aboutsummaryrefslogtreecommitdiffstats
path: root/tests/baseline/scenegrabber_xr/testscenes/customsimpletexture.qml
blob: 10cc42b7b4c8ab2a94c7206e70dfd3634ae5c579 (plain)
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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick3D
import QtQuick

Node {
    id: root
    property vector3d qmlxr_originPosition: Qt.vector3d(0, 0, 600)
    property SceneEnvironment qmlxr_environment: SceneEnvironment {
        backgroundMode: SceneEnvironment.Color
        clearColor: "#444845"
    }
    property real time: 10
    property real amplitude: 4
    DirectionalLight {
        position: Qt.vector3d(-500, 500, -100)
        color: Qt.rgba(0.2, 0.2, 0.2, 1.0)
        ambientColor: Qt.rgba(0.1, 0.1, 0.1, 1.0)
    }
    // texture disabled (result should be black)
    Model {
        source: "#Sphere"
        scale: Qt.vector3d(2, 2, 2)
        x: -200
        materials: [
            CustomMaterial {
                property alias time: root.time
                property alias amplitude: root.amplitude
                vertexShader: "customsimpletexture.vert"
                fragmentShader: "customsimpletexture.frag"
                property TextureInput tex1: TextureInput {
                    enabled: false
                }
            }
        ]
    }
    // texture enabled but no actual Texture is given (should survive with
    // dummy texture, result is expected to be black)
    Model {
        source: "#Sphere"
        scale: Qt.vector3d(2, 2, 2)
        materials: [
            CustomMaterial {
                property alias time: root.time
                property alias amplitude: root.amplitude
                vertexShader: "customsimpletexture.vert"
                fragmentShader: "customsimpletexture.frag"
                property TextureInput tex1: TextureInput {
                    enabled: true
                }
            }
        ]
    }
    Model {
        source: "#Sphere"
        scale: Qt.vector3d(2, 2, 2)
        x: 200
        materials: [
            CustomMaterial {
                property alias time: root.time
                property alias amplitude: root.amplitude
                vertexShader: "customsimpletexture.vert"
                fragmentShader: "customsimpletexture.frag"
                property TextureInput tex1: TextureInput {
                    enabled: true
                    texture: Texture {
                        source: "maps/oulu_2.jpeg"
                    }
                }
            }
        ]
    }
    // sample two textures
    Model {
        source: "#Cube"
        scale: Qt.vector3d(1.5, 1.5, 1.5)
        y: -200
        materials: [
            CustomMaterial {
                property real time: 0
                property real amplitude: 0
                vertexShader: "customsimpletexture.vert"
                fragmentShader: "customsimpletexture2.frag"
                property TextureInput tex1: TextureInput {
                    enabled: true
                    texture: Texture {
                        source: "maps/oulu_2.jpeg"
                    }
                }
                property TextureInput tex2: TextureInput {
                    enabled: true
                    texture: Texture {
                        source: "maps/rgba.png"
                    }
                }
            }
        ]
    }
    // not so simple after all: combine SCREEN_TEXTURE with another texture
    Model {
        source: "#Rectangle"
        scale: Qt.vector3d(1.5, 1.5, 1.5)
        y: 200
        materials: [
            CustomMaterial {
                property real time: 0
                property real amplitude: 0
                vertexShader: "customsimpletexture.vert"
                fragmentShader: "customsimpletexturescreen.frag"
                property TextureInput tex1: TextureInput {
                    enabled: true
                    texture: Texture {
                        source: "maps/oulu_2.jpeg"
                    }
                }
            }
        ]
    }
}