1/****************************************************************************
2**
3** Copyright (C) 2019 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of Qt Quick 3D.
7**
8** $QT_BEGIN_LICENSE:GPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 or (at your option) any later version
20** approved by the KDE Free Qt Foundation. The licenses are as published by
21** the Free Software Foundation and appearing in the file LICENSE.GPL3
22** included in the packaging of this file. Please review the following
23** information to ensure the GNU General Public License requirements will
24** be met: https://www.gnu.org/licenses/gpl-3.0.html.
25**
26** $QT_END_LICENSE$
27**
28****************************************************************************/
29import QtQuick 2.15
30import HelperWidgets 2.0
31import QtQuick.Layouts 1.12
32
33Column {
34    width: parent.width
35
36    Section {
37        caption: qsTr("Default Material")
38        width: parent.width
39        SectionLayout {
40            Label {
41                text: qsTr("Lighting")
42                tooltip: qsTr("Defines which lighting method is used when generating this material.")
43            }
44            ComboBox {
45                scope: "DefaultMaterial"
46                model: ["NoLighting", "FragmentLighting"]
47                backendValue: backendValues.lighting
48                Layout.fillWidth: true
49            }
50            Label {
51                text: qsTr("Blend Mode")
52                tooltip: qsTr("Determines how the colors of the model rendered blend with those behind it.")
53            }
54            ComboBox {
55                scope: "DefaultMaterial"
56                model: ["SourceOver", "Screen", "Multiply", "Overlay", "ColorBurn", "ColorDodge"]
57                backendValue: backendValues.blendMode
58                Layout.fillWidth: true
59            }
60            Label {
61                text: qsTr("Enable Vertex Colors")
62                tooltip: qsTr("Enables the use of vertex colors from the mesh.")
63            }
64            SecondColumnLayout {
65                CheckBox {
66                    text: backendValues.vertexColorsEnabled.valueToString
67                    backendValue: backendValues.vertexColorsEnabled
68                    Layout.fillWidth: true
69                }
70            }
71        }
72    }
73
74    Section {
75        caption: qsTr("Diffuse")
76        width: parent.width
77        Column {
78            width: parent.width
79            ColorEditor {
80                caption: qsTr("Diffuse Color")
81                backendValue: backendValues.diffuseColor
82                supportGradient: false
83                Layout.fillWidth: true
84            }
85            SectionLayout {
86                Label {
87                    text: qsTr("Diffuse Map")
88                    tooltip: qsTr("Defines a texture to apply to the material.")
89                }
90                SecondColumnLayout {
91                    IdComboBox {
92                        typeFilter: "QtQuick3D.Texture"
93                        Layout.fillWidth: true
94                        backendValue: backendValues.diffuseMap
95                    }
96                }
97            }
98        }
99    }
100
101    Section {
102        caption: qsTr("Emissive")
103        width: parent.width
104        Column {
105            width: parent.width
106            ColorEditor {
107                caption: qsTr("Emissive Color")
108                backendValue: backendValues.emissiveColor
109                supportGradient: false
110                Layout.fillWidth: true
111            }
112            SectionLayout {
113                Label {
114                    text: qsTr("Emissive Factor")
115                    tooltip: qsTr("Determines the amount of self-illumination from the material (will not light other objects).")
116                }
117                SecondColumnLayout {
118                    SpinBox {
119                        maximumValue: 1
120                        minimumValue: 0
121                        decimals: 2
122                        stepSize: 0.1
123                        backendValue: backendValues.emissiveFactor
124                        Layout.fillWidth: true
125                    }
126                }
127                Label {
128                    text: qsTr("Emissive Map")
129                    tooltip: qsTr("Sets a texture to be used to set the emissive factor for different parts of the material.")
130                }
131                SecondColumnLayout {
132                    IdComboBox {
133                        typeFilter: "QtQuick3D.Texture"
134                        Layout.fillWidth: true
135                        backendValue: backendValues.emissiveMap
136                    }
137                }
138            }
139        }
140    }
141
142    Section {
143        caption: qsTr("Specular")
144        width: parent.width
145        Column {
146            width: parent.width
147            ColorEditor {
148                caption: qsTr("Specular Tint")
149                backendValue: backendValues.specularTint
150                supportGradient: false
151                Layout.fillWidth: true
152            }
153
154            SectionLayout {
155                Label {
156                    text: qsTr("Specular Amount")
157                    tooltip: qsTr("Controls the strength of specularity (highlights and reflections).")
158                }
159                SecondColumnLayout {
160                    SpinBox {
161                        maximumValue: 1
162                        minimumValue: 0
163                        decimals: 2
164                        stepSize: 0.1
165                        backendValue: backendValues.specularAmount
166                        Layout.fillWidth: true
167                    }
168                }
169                Label {
170                    text: qsTr("Specular Map")
171                    tooltip: qsTr("Defines a RGB texture to modulate the amount and the color of specularity across the surface of the material.")
172                }
173                SecondColumnLayout {
174                    IdComboBox {
175                        typeFilter: "QtQuick3D.Texture"
176                        Layout.fillWidth: true
177                        backendValue: backendValues.specularMap
178                    }
179                }
180                Label {
181                    text: qsTr("Specular Model")
182                    tooltip: qsTr("Determines which functions are used to calculate specular highlights for lights in the scene.")
183                }
184                ComboBox {
185                    scope: "DefaultMaterial"
186                    model: ["Default", "KGGX", "KWard"]
187                    backendValue: backendValues.specularModel
188                    Layout.fillWidth: true
189                }
190                Label {
191                    text: qsTr("Reflection Map")
192                    tooltip: qsTr("Sets a texture used for specular highlights on the material.")
193                }
194                SecondColumnLayout {
195                    IdComboBox {
196                        typeFilter: "QtQuick3D.Texture"
197                        Layout.fillWidth: true
198                        backendValue: backendValues.specularReflectionMap
199                    }
200                }
201                Label {
202                    text: qsTr("Index of Refraction")
203                    tooltip: qsTr("Controls what angles of reflections are affected by the Fresnel power.")
204                }
205                SecondColumnLayout {
206                    SpinBox {
207                        maximumValue: 3
208                        minimumValue: 1
209                        decimals: 2
210                        stepSize: 0.1
211                        backendValue: backendValues.indexOfRefraction
212                        Layout.fillWidth: true
213                    }
214                }
215                Label {
216                    text: qsTr("Fresnel Power")
217                    tooltip: qsTr("Decreases head-on reflections (looking directly at the surface) while maintaining reflections seen at grazing angles.")
218                }
219                SecondColumnLayout {
220                    SpinBox {
221                        maximumValue: 9999999
222                        minimumValue: -9999999
223                        realDragRange: 5000
224                        decimals: 2
225                        backendValue: backendValues.fresnelPower
226                        Layout.fillWidth: true
227                    }
228                }
229                Label {
230                    text: qsTr("Specular Roughness")
231                    tooltip: qsTr("Controls the size of the specular highlight generated from lights and the clarity of reflections in general.")
232                }
233                SecondColumnLayout {
234                    SpinBox {
235                        maximumValue: 1
236                        minimumValue: 0.001
237                        decimals: 3
238                        backendValue: backendValues.specularRoughness
239                        Layout.fillWidth: true
240                    }
241                }
242                Label {
243                    text: qsTr("Roughness Map")
244                    tooltip: qsTr("Defines a texture to control the specular roughness of the material.")
245                }
246                SecondColumnLayout {
247                    IdComboBox {
248                        typeFilter: "QtQuick3D.Texture"
249                        Layout.fillWidth: true
250                        backendValue: backendValues.roughnessMap
251                    }
252                }
253            }
254        }
255    }
256
257    Section {
258        caption: qsTr("Opacity")
259        width: parent.width
260        SectionLayout {
261            Label {
262                text: qsTr("Opacity")
263                tooltip: qsTr("Sets the visibility of the geometry for this material.")
264            }
265            SecondColumnLayout {
266                SpinBox {
267                    maximumValue: 1
268                    minimumValue: 0
269                    decimals: 2
270                    stepSize: 0.1
271                    backendValue: backendValues.opacity
272                    Layout.fillWidth: true
273                }
274            }
275            Label {
276                text: qsTr("Opacity Map")
277                tooltip: qsTr("Defines a texture used to control the opacity differently for different parts of the material.")
278            }
279            SecondColumnLayout {
280                IdComboBox {
281                    typeFilter: "QtQuick3D.Texture"
282                    Layout.fillWidth: true
283                    backendValue: backendValues.opacityMap
284                }
285            }
286        }
287    }
288
289    Section {
290        caption: qsTr("Bump/Normal")
291        width: parent.width
292        SectionLayout {
293            Label {
294                text: qsTr("Bump Amount")
295                tooltip: qsTr("Controls the amount of simulated displacement for the bump map or normal map.")
296            }
297            SecondColumnLayout {
298                SpinBox {
299                    maximumValue: 1
300                    minimumValue: 0
301                    decimals: 2
302                    stepSize: 0.1
303                    backendValue: backendValues.bumpAmount
304                    Layout.fillWidth: true
305                }
306            }
307            Label {
308                text: qsTr("Bump Map")
309                tooltip: qsTr("Defines a grayscale texture to simulate fine geometry displacement across the surface of the material.")
310            }
311            SecondColumnLayout {
312                IdComboBox {
313                    id: bumpMapComboBox
314                    typeFilter: "QtQuick3D.Texture"
315                    Layout.fillWidth: true
316                    backendValue: backendValues.bumpMap
317
318                    Connections {
319                        target: normalMapComboBox.backendValue
320                        onExpressionChanged: {
321                            if (normalMapComboBox.backendValue.expression !== "")
322                                bumpMapComboBox.backendValue.resetValue()
323                        }
324                    }
325                }
326            }
327            Label {
328                text: qsTr("Normal Map")
329                tooltip: qsTr("Defines a RGB image used to simulate fine geometry displacement across the surface of the material.")
330            }
331            SecondColumnLayout {
332                IdComboBox {
333                    id: normalMapComboBox
334                    typeFilter: "QtQuick3D.Texture"
335                    Layout.fillWidth: true
336                    backendValue: backendValues.normalMap
337
338                    Connections {
339                        target: bumpMapComboBox.backendValue
340                        onExpressionChanged: {
341                            if (bumpMapComboBox.backendValue.expression !== "")
342                                normalMapComboBox.backendValue.resetValue()
343                        }
344                    }
345                }
346            }
347        }
348    }
349
350    Section {
351        caption: qsTr("Translucency")
352        width: parent.width
353        SectionLayout {
354            Label {
355                text: qsTr("Translucency Falloff")
356                tooltip: qsTr("Defines the amount of falloff for the translucency based on the angle of the normals of the object to the light source.")
357            }
358            SecondColumnLayout {
359                SpinBox {
360                    maximumValue: 999999
361                    minimumValue: -999999
362                    realDragRange: 5000
363                    decimals: 2
364                    backendValue: backendValues.translucentFalloff
365                    Layout.fillWidth: true
366                }
367            }
368            Label {
369                text: qsTr("Diffuse Light Wrap")
370                tooltip: qsTr("Determines the amount of light wrap for the translucency map.")
371            }
372            SecondColumnLayout {
373                SpinBox {
374                    maximumValue: 1
375                    minimumValue: 0
376                    decimals: 2
377                    stepSize: 0.1
378                    backendValue: backendValues.diffuseLightWrap
379                    Layout.fillWidth: true
380                }
381            }
382            Label {
383                text: qsTr("Translucency Map")
384                tooltip: qsTr("Defines a grayscale texture controlling how much light can pass through the material from behind.")
385            }
386            SecondColumnLayout {
387                IdComboBox {
388                    typeFilter: "QtQuick3D.Texture"
389                    Layout.fillWidth: true
390                    backendValue: backendValues.translucencyMap
391                }
392            }
393        }
394    }
395}
396