1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
// Copyright (C) 2021 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.Controls
import QtQuick.Layouts
import QtQuick3D
import QtQuick3D.MaterialEditor
Pane {
id: root
required property MaterialAdapter targetMaterial
ColumnLayout {
RowLayout {
Label {
text: qsTr("Source Blend")
Layout.fillWidth: true
}
ComboBox {
id: sourceBlendComboBox
textRole: "text"
valueRole: "value"
implicitContentWidthPolicy: ComboBox.WidestText
onActivated: root.targetMaterial.sourceBlend = currentValue
Component.onCompleted: currentIndex = indexOfValue(root.targetMaterial.sourceBlend)
model: [
{ value: CustomMaterial.NoBlend, text: qsTr("No Blend") },
{ value: CustomMaterial.Zero, text: qsTr("Zero") },
{ value: CustomMaterial.One, text: qsTr("One") },
{ value: CustomMaterial.SrcColor, text: qsTr("Source Color") },
{ value: CustomMaterial.OneMinusSrcColor, text: qsTr("1 - Source Color") },
{ value: CustomMaterial.DstColor, text: qsTr("Destination Color") },
{ value: CustomMaterial.OneMinusDstColor, text: qsTr("1 - Destination Color") },
{ value: CustomMaterial.SrcAlpha, text: qsTr("Source Alpha") },
{ value: CustomMaterial.OneMinusSrcAlpha, text: qsTr("1 - Source Alpha") },
{ value: CustomMaterial.DstAlpha, text: qsTr("Destination Alpha") },
{ value: CustomMaterial.OneMinusDstAlpha, text: qsTr("1 - Destination Alpha") },
{ value: CustomMaterial.ConstantColor, text: qsTr("Constant Color") },
{ value: CustomMaterial.OneMinusConstantColor, text: qsTr("1 - Constant Color") },
{ value: CustomMaterial.ConstantAlpha, text: qsTr("Constant Alpha") },
{ value: CustomMaterial.OneMinusConstantAlpha, text: qsTr("1 - Constant Alpha") },
{ value: CustomMaterial.SrcAlphaSaturate, text: qsTr("Source Alpha Saturate") }
]
}
}
RowLayout {
Label {
text: qsTr("Destination Blend")
Layout.fillWidth: true
}
ComboBox {
id: destinationBlendComboBox
textRole: "text"
valueRole: "value"
implicitContentWidthPolicy: ComboBox.WidestText
onActivated: root.targetMaterial.destinationBlend = currentValue
Component.onCompleted: currentIndex = indexOfValue(root.targetMaterial.destinationBlend)
model: [
{ value: CustomMaterial.NoBlend, text: qsTr("No Blend") },
{ value: CustomMaterial.Zero, text: qsTr("Zero") },
{ value: CustomMaterial.One, text: qsTr("One") },
{ value: CustomMaterial.SrcColor, text: qsTr("Source Color") },
{ value: CustomMaterial.OneMinusSrcColor, text: qsTr("1 - Source Color") },
{ value: CustomMaterial.DstColor, text: qsTr("Destination Color") },
{ value: CustomMaterial.OneMinusDstColor, text: qsTr("1 - Destination Color") },
{ value: CustomMaterial.SrcAlpha, text: qsTr("Source Alpha") },
{ value: CustomMaterial.OneMinusSrcAlpha, text: qsTr("1 - Source Alpha") },
{ value: CustomMaterial.DstAlpha, text: qsTr("Destination Alpha") },
{ value: CustomMaterial.OneMinusDstAlpha, text: qsTr("1 - Destination Alpha") },
{ value: CustomMaterial.ConstantColor, text: qsTr("Constant Color") },
{ value: CustomMaterial.OneMinusConstantColor, text: qsTr("1 - Constant Color") },
{ value: CustomMaterial.ConstantAlpha, text: qsTr("Constant Alpha") },
{ value: CustomMaterial.OneMinusConstantAlpha, text: qsTr("1 - Constant Alpha") },
{ value: CustomMaterial.SrcAlphaSaturate, text: qsTr("Source Alpha Saturate") }
]
}
}
RowLayout {
Label {
text: qsTr("Cull Mode")
Layout.fillWidth: true
}
ComboBox {
id: cullModeComboBox
textRole: "text"
valueRole: "value"
implicitContentWidthPolicy: ComboBox.WidestText
onActivated: root.targetMaterial.cullMode = currentValue
Component.onCompleted: currentIndex = indexOfValue(root.targetMaterial.cullMode)
model: [
{ value: CustomMaterial.BackFaceCulling, text: qsTr("Back Face Culling") },
{ value: CustomMaterial.FrontFaceCulling, text: qsTr("Front Face Culling") },
{ value: CustomMaterial.NoCulling, text: qsTr("No Culling") }
]
}
}
RowLayout {
Label {
text: qsTr("Depth Draw Mode")
Layout.fillWidth: true
}
ComboBox {
id: depthDrawModeComboBox
textRole: "text"
valueRole: "value"
implicitContentWidthPolicy: ComboBox.WidestText
onActivated: root.targetMaterial.depthDrawMode = currentValue
Component.onCompleted: currentIndex = indexOfValue(root.targetMaterial.depthDrawMode)
model: [
{ value: CustomMaterial.OpaqueOnlyDepthDraw, text: qsTr("Opaque Only") },
{ value: CustomMaterial.AlwaysDepthDraw, text: qsTr("Always") },
{ value: CustomMaterial.NeverDepthDraw, text: qsTr("Never") },
{ value: CustomMaterial.OpaquePrePassDepthDraw, text: qsTr("Opaque Pre-pass") }
]
}
}
RowLayout {
Label {
text: qsTr("Shading Mode")
Layout.fillWidth: true
}
ComboBox {
id: shadingModeComboBox
textRole: "text"
valueRole: "value"
implicitContentWidthPolicy: ComboBox.WidestText
onActivated: root.targetMaterial.shadingMode = currentValue
Component.onCompleted: currentIndex = indexOfValue(root.targetMaterial.shadingMode)
model: [
{ value: CustomMaterial.Shaded, text: qsTr("Shaded") },
{ value: CustomMaterial.Unshaded, text: qsTr("Unshaded") }
]
}
}
}
}
|