File: VertexColorPane.qml

package info (click to toggle)
qt6-quick3d 6.8.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 140,860 kB
  • sloc: cpp: 380,464; ansic: 36,078; xml: 252; sh: 241; makefile: 29
file content (128 lines) | stat: -rw-r--r-- 4,489 bytes parent folder | download | duplicates (2)
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
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick3D

// qmllint disable missing-property
// Disabling missing-property because the targetMaterial property
// will either be a PrincipaledMaterial or SpecularGlossyMaterial
// but the shared properties are not part of the common base class
ScrollView {
    id: rootView
    required property Material targetMaterial
    property bool specularGlossyMode: false

    ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
    width: availableWidth

    ColumnLayout {
        width: rootView.availableWidth
        MarkdownLabel {
            text: `# Vertex Color
You can control the usage of the mesh vertex colors here.`
        }

        RowLayout {
            Label {
                text: "Enabled use the vertex color as base color for materials"
            }

            Switch {
                checked: targetMaterial.vertexColorsEnabled
                onCheckedChanged: {
                    targetMaterial.vertexColorsEnabled = checked
                }
            }

        }

        MarkdownLabel {
            text: `# Vertex Color as Mask
You can defines the vertex color channels used as the specifies mask.`
        }
        RowLayout {
            Label {
                text: "Enabled use the vertex color as mask for materials"
            }
            Switch {
                id: vertexColorMaskSwitch
                checked: targetMaterial.vertexColorsMaskEnabled
                onCheckedChanged: {
                    targetMaterial.vertexColorsMaskEnabled = checked
                }
            }
        }

        MarkdownLabel {
            enabled: vertexColorMaskSwitch.checked
            text: `## Vertex Color Red Channel Mask Flags
You can add flags to the vertex color red channel mask to get used as the specifies mask.`
        }

        VertexColorMaskFlagsControl {
            enabled: vertexColorMaskSwitch.checked
            specularGlossyMode: rootView.specularGlossyMode
            onSpecularGlossyMaterialMaskChanged: {
                targetMaterial.vertexColorRedMask = specularGlossyMaterialMask
            }
            onPrincipledMaterialMaskChanged: {
                targetMaterial.vertexColorRedMask = principledMaterialMask
            }
        }

        MarkdownLabel {
            enabled: vertexColorMaskSwitch.checked
            text: `## Vertex Color Green Channel Mask Flags
You can add flags to the vertex color green channel mask to get used as the specifies mask.`
        }

        VertexColorMaskFlagsControl {
            enabled: vertexColorMaskSwitch.checked
            specularGlossyMode: rootView.specularGlossyMode
            onSpecularGlossyMaterialMaskChanged: {
                targetMaterial.vertexColorGreenMask = specularGlossyMaterialMask
            }
            onPrincipledMaterialMaskChanged: {
                targetMaterial.vertexColorGreenMask = principledMaterialMask
            }
        }

        MarkdownLabel {
            enabled: vertexColorMaskSwitch.checked
            text: `## Vertex Color Blue Channel Mask Flags
You can add flags to the vertex color blue channel mask to get used as the specifies mask.`
        }

        VertexColorMaskFlagsControl {
            enabled: vertexColorMaskSwitch.checked
            specularGlossyMode: rootView.specularGlossyMode
            onSpecularGlossyMaterialMaskChanged: {
                targetMaterial.vertexColorBlueMask = specularGlossyMaterialMask
            }
            onPrincipledMaterialMaskChanged: {
                targetMaterial.vertexColorBlueMask = principledMaterialMask
            }
        }

        MarkdownLabel {
            enabled: vertexColorMaskSwitch.checked
            text: `## Vertex Color Alpha Channel Mask Flags
You can add flags to the vertex color alpha channel mask to get used as the specifies mask.`
        }

        VertexColorMaskFlagsControl {
            enabled: vertexColorMaskSwitch.checked
            specularGlossyMode: rootView.specularGlossyMode
            onSpecularGlossyMaterialMaskChanged: {
                targetMaterial.vertexColorAlphaMask = specularGlossyMaterialMask
            }
            onPrincipledMaterialMaskChanged: {
                targetMaterial.vertexColorAlphaMask = principledMaterialMask
            }
        }
    }
}
// qmllint enable missing-property