Debian Codegraph @

tests/manual/clip-planes-qml/ClippingPlanes.qml

raw
1 // Copyright (C) 2015 Paul Lemire
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 2.4 as QQ2
5 import Qt3D.Core 2.0
6 import Qt3D.Render 2.0
7 import Qt3D.Extras 2.0
8
9 Entity {
10 id: root
11 property Layer capsLayer
12 property Layer visualizationLayer
13
14 property ShaderData sectionData: ShaderData {
15 property int sectionsCount: 3
16 property ShaderDataArray sections: ShaderDataArray {
17 ShaderData {
18 property vector4d equation: clipPlane0.equation
19 property vector3d center: clipPlane0.center
20 }
21 ShaderData {
22 property vector4d equation: clipPlane1.equation
23 property vector3d center: clipPlane1.center
24 }
25 ShaderData {
26 property vector4d equation: clipPlane2.equation
27 property vector3d center: clipPlane2.center
28 }
29 }
30 }
31
32 Entity {
33 property Material cappingMaterial: Material {
34 effect: CappingMaterialEffect {
35 sectionsData: root.sectionData
36 }
37 }
38
39 property GeometryRenderer mesh: PlaneMesh {
40 width: 20.0
41 height: 20.0
42 meshResolution: Qt.size(2, 2)
43 }
44
45 components: [cappingMaterial, mesh, root.capsLayer]
46 }
47
48 PlaneVisualizationMaterial {
49 id: clipPlanesMaterial
50 alpha: 0.5
51 }
52
53 // XZ
54 ClipPlaneEntity {
55 id: clipPlane0
56 layer: root.visualizationLayer
57 visualMaterial: clipPlanesMaterial
58 center: Qt.vector3d(0, -10, 0)
59 normal: Qt.vector3d(0, -1.0, 0)
60 }
61 // XY
62 ClipPlaneEntity {
63 id: clipPlane1
64 layer: root.visualizationLayer
65 visualMaterial: clipPlanesMaterial
66 center: Qt.vector3d(0, 0, 10)
67 normal: Qt.vector3d(0, 0, -1.0)
68 rotateAxis: Qt.vector3d(1.0, 0.0, 0.0)
69 rotateAngle: 90
70 }
71
72 // YZ
73 ClipPlaneEntity {
74 id: clipPlane2
75 layer: root.visualizationLayer
76 visualMaterial: clipPlanesMaterial
77 center: Qt.vector3d(-10, 0, 0)
78 normal: Qt.vector3d(1.0, 0, 0)
79 rotateAxis: Qt.vector3d(0.0, 0.0, 1.0)
80 rotateAngle: -90
81 }
82
83 QQ2.SequentialAnimation {
84 running: true
85 loops: QQ2.Animation.Infinite
86 QQ2.NumberAnimation {
87 target: clipPlane0
88 property: "center.y"
89 from: 10
90 to: 0
91 duration: 2000
92 easing.type: QQ2.Easing.InOutQuart
93 }
94
95 QQ2.NumberAnimation {
96 target: clipPlane1
97 property: "center.z"
98 from: 10
99 to: 0
100 duration: 2000
101 easing.type: QQ2.Easing.InOutQuart
102 }
103 QQ2.NumberAnimation {
104 target: clipPlane2
105 property: "center.x"
106 from: -10
107 to: 0
108 duration: 4000
109 easing.type: QQ2.Easing.InOutQuart
110 }
111 QQ2.NumberAnimation {
112 target: clipPlane1
113 property: "center.z"
114 from: 0
115 to: 10
116 duration: 4000
117 easing.type: QQ2.Easing.InOutQuint
118 }
119 QQ2.NumberAnimation {
120 target: clipPlane0
121 property: "center.y"
122 from: 0
123 to: 10
124 duration: 2000
125 easing.type: QQ2.Easing.InOutQuint
126 }
127 QQ2.NumberAnimation {
128 target: clipPlane2
129 property: "center.x"
130 from: 0
131 to: -10
132 duration: 2000
133 easing.type: QQ2.Easing.InOutQuint
134 }
135 }
136 }