Node graph: Occlusion node

Change-Id: Ic71475be3512c88fb224acd3d84bef66ae78a73d
Reviewed-by: spyro-adb <adb@spyro-soft.com>
This commit is contained in:
Andrzej Biniek
2024-12-26 22:08:08 +01:00
committed by spyro-adb
parent f0a3f3bf2f
commit 9651a7ca70
5 changed files with 93 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ Item {
case "Metalness":
n = graphView.graph.insertNode(Nodes.Components.metalness);
break;
case "Occlusion":
n = graphView.graph.insertNode(Nodes.Components.occlusion);
break;
case "BaseColor":
n = graphView.graph.insertNode(Nodes.Components.baseColor);
break;

View File

@@ -43,6 +43,14 @@ StudioControls.Menu {
}
}
StudioControls.MenuItem {
text: qsTr("Occlusion")
onTriggered: () => {
internal.createNode(Nodes.Components.occlusion);
}
}
StudioControls.MenuItem {
text: qsTr("Roughness")

View File

@@ -37,6 +37,10 @@ QtObject {
Roughness {
}
}
readonly property Component occlusion: Component {
Occlusion {
}
}
readonly property Component texture: Component {
Texture {
}

View File

@@ -77,6 +77,23 @@ Base {
});
}
},
{
id: "principledmaterial_in_occlusion",
alias: "",
name: "Occlusion",
type: "nge::Occlusion",
binding: values => {
root.value.occlussion = Qt.binding(() => {
return values.occlusion;
});
root.value.occlusionChannel = Qt.binding(() => {
return values.channel;
});
root.value.occlusionMap = Qt.binding(() => {
return values.map;
});
}
},
]
property var pout: []
}

View File

@@ -0,0 +1,61 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Layouts
import QtQuick3D as QtQuick3D
Base {
id: root
readonly property QtObject reset: QtObject {
property int channel
property QtQuick3D.Texture map
property real occlusion
}
readonly property QtObject value: QtObject {
property int channel
property QtQuick3D.Texture map
property real occlusion
}
Layout.preferredHeight: 150
Layout.preferredWidth: 150
type: "Occlusion"
portsMetaData: QtObject {
property var pin: [
{
id: "occlusion",
alias: "occlusion",
name: "Occlusion",
type: "real"
},
{
id: "occlusion_in_occlusionChannel",
alias: "channel",
name: "Channel",
type: "QQuick3DMaterial::TextureChannelMapping"
},
{
id: "occlusion_in_occlusionMap ",
alias: "map",
name: "Map",
type: "Texture"
},
]
property var pout: [
{
id: "occlusion_out",
alias: "",
name: "OUT",
type: "nge::Occlusion"
},
]
}
Component.onCompleted: {
node.label = "Occlusion";
}
}