aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
diff options
context:
space:
mode:
authoraavit <qt_aavit@ovi.com>2012-09-07 13:29:53 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-09-27 12:08:39 +0200
commit4fc4e7ed89c3085ae98c57dd80e6cd8cc61f6ee2 (patch)
tree0426f330789a67db260e5995172f0ba7ec9e8c59 /tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
parenta49154a75005403185e3813d441fb3e1931af2a2 (diff)
Added lancelot-based scenegraph rendering regression test
Change-Id: I6718d00ba96dc9c96dac82de4ded9228f6bfb990 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml')
-rw-r--r--tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml104
1 files changed, 104 insertions, 0 deletions
diff --git a/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
new file mode 100644
index 0000000000..47687918e0
--- /dev/null
+++ b/tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
@@ -0,0 +1,104 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: topLevel
+ width: 320
+ height: 480
+ ShaderEffectSource {
+ id: front
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "cornflowerblue"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Front"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ ShaderEffectSource {
+ id: back
+ visible: false
+ smooth: true
+ sourceItem: Rectangle {
+ width: 256
+ height: 64
+ color: "firebrick"
+ radius: 8
+ Text {
+ anchors.centerIn: parent
+ text: "Back"
+ font.pixelSize: 48
+ color: "white"
+ }
+ }
+ }
+ Column {
+ anchors.fill: parent
+ Repeater {
+ model: ListModel {
+ ListElement {
+ foo: "No culling"
+ bar: ShaderEffect.NoCulling
+ turned: false
+ }
+ ListElement {
+ foo: "Back-face culling"
+ bar: ShaderEffect.BackFaceCulling
+ turned: false
+ }
+ ListElement {
+ foo: "Front-face culling"
+ bar: ShaderEffect.FrontFaceCulling
+ turned: false
+ }
+ }
+
+ Item{
+ id: item_0000
+ width: 320
+ height: 120
+ ShaderEffect {
+ anchors.right: parent.right
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.margins: 10
+ width: 200
+ height: 100
+ culling: model.bar
+ property variant frontSource: front
+ property variant backSource: back
+ fragmentShader: "
+ varying highp vec2 qt_TexCoord0;
+ uniform sampler2D frontSource;
+ uniform sampler2D backSource;
+ uniform lowp float qt_Opacity;
+ void main() {
+ gl_FragColor = gl_FrontFacing
+ ? texture2D(frontSource, qt_TexCoord0)
+ : texture2D(backSource, qt_TexCoord0);
+ }"
+ transform: Rotation {
+ origin.x: 200
+ origin.y: 180 - 120 * index
+ axis { x: 0; y: 1; z: 0 }
+ angle: (turned == true) ? 180 : 0
+
+ }
+ }
+ Text {
+ font.pointSize: 10
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.margins: 5
+ text: foo
+ }
+ }
+ }
+ }
+}
+