Debian Codegraph @

tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml

raw
1 import QtQuick 2.0
2
3 Rectangle {
4 id: topLevel
5 width: 320
6 height: 480
7 ShaderEffectSource {
8 id: front
9 visible: false
10 smooth: true
11 sourceItem: Rectangle {
12 width: 256
13 height: 64
14 color: "cornflowerblue"
15 radius: 8
16 Text {
17 anchors.centerIn: parent
18 text: "Front"
19 font.pixelSize: 48
20 color: "white"
21 }
22 }
23 }
24 ShaderEffectSource {
25 id: back
26 visible: false
27 smooth: true
28 sourceItem: Rectangle {
29 width: 256
30 height: 64
31 color: "firebrick"
32 radius: 8
33 Text {
34 anchors.centerIn: parent
35 text: "Back"
36 font.pixelSize: 48
37 color: "white"
38 }
39 }
40 }
41 Column {
42 anchors.fill: parent
43 Repeater {
44 model: ListModel {
45 ListElement {
46 foo: "No culling"
47 bar: ShaderEffect.NoCulling
48 turned: false
49 }
50 ListElement {
51 foo: "Back-face culling"
52 bar: ShaderEffect.BackFaceCulling
53 turned: false
54 }
55 ListElement {
56 foo: "Front-face culling"
57 bar: ShaderEffect.FrontFaceCulling
58 turned: false
59 }
60 }
61
62 Item{
63 id: item_0000
64 width: 320
65 height: 120
66 ShaderEffect {
67 anchors.right: parent.right
68 anchors.verticalCenter: parent.verticalCenter
69 anchors.margins: 10
70 width: 200
71 height: 100
72 cullMode: model.bar
73 property variant frontSource: front
74 property variant backSource: back
75 fragmentShader: "qrc:shaders/culling.frag"
76 transform: Rotation {
77 origin.x: 200
78 origin.y: 180 - 120 * index
79 axis { x: 0; y: 1; z: 0 }
80 angle: (turned == true) ? 180 : 0
81
82 }
83 }
84 Text {
85 font.pointSize: 10
86 anchors.verticalCenter: parent.verticalCenter
87 anchors.left: parent.left
88 anchors.margins: 5
89 text: foo
90 }
91 }
92 }
93 }
94 }
95