File: picking.qml

package info (click to toggle)
qt6-quick3d 6.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 143,588 kB
  • sloc: cpp: 395,989; ansic: 41,469; xml: 288; sh: 242; makefile: 32
file content (82 lines) | stat: -rw-r--r-- 2,015 bytes parent folder | download | duplicates (3)
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
import QtQuick
import QtQuick3D

View3D {
    id: view
    objectName: "view"
    anchors.fill: parent
    environment: SceneEnvironment {
        backgroundMode: SceneEnvironment.Color
        clearColor: "black"
    }
    OrthographicCamera { z: 600 }
    DirectionalLight { }
    Model {
        id: model1
        objectName: "model1"
        source: "#Cube"
        pickable: true
        materials: PrincipledMaterial {
            baseColor: "red"
        }
    }
    Model {
        id: model2
        objectName: "model2"
        source: "#Cube"
        pickable: true
        position: Qt.vector3d(50.0, 50.0, -50.0)
        materials: PrincipledMaterial {
            baseColor: "green"
        }
    }
    Node {
        objectName: "item2dNode"
        z: 200
        Rectangle {
            id: item2d
            objectName: "item2d"
            anchors.centerIn: parent
            width: 150
            height: 150
            border.width: 2
            border.color: "#ffffff"
            color: "#808080"
            opacity: 0.5
            // Not enabled, so by default picking goes through
            enabled: false
            Text {
                anchors.centerIn: parent
                font.pixelSize: 20
                text: "Rectangle"
            }
        }
    }
    InstanceList {
        id: instanceList
        instances: [
            InstanceListEntry {
                position: Qt.vector3d(-200, 0, 200)
                color: "magenta"
            },
            InstanceListEntry {
                position: Qt.vector3d(-25, 75, -100)
                color: "blue"
            },
            InstanceListEntry {
                position: Qt.vector3d(200, 0, 0)
                color: "orange"
            }
        ]
    }
    Model {
        id: instancedModel
        objectName: "instancedModel"
        source: "#Cube"
        pickable: true
        instancing: instanceList
        materials: PrincipledMaterial {
            baseColor: "white"
        }
    }
}