aboutsummaryrefslogtreecommitdiffstats
path: root/tests/baseline/data/textures/envmap2.qml
blob: e390e71aedfb8f552a8d8507f5161b035b245b8d (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
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick3D

Item {
    width: 800
    height: 600

    Item {
        id: quickScene
        visible: false
        width: 1024
        height: 1024
        Image {
            source: "../shared/maps/00455_OpenfootageNET_field_low_resized.png"
            anchors.fill: parent
        }
        Text {
            text: "Background"
            font.pointSize: 36
            anchors.horizontalCenter: parent.horizontalCenter
            color: "red"
            y: 200
        }
    }

    View3D {
        anchors.fill: parent
        PerspectiveCamera {
            id: camera
            // Positioned in a way so the "Background" text on top of the
            // background image is reflected on the top face of the cube.
            z: 450
        }
        DirectionalLight {
        }
        Model {
            source: "../shared/models/InvertedSphere.mesh"
            scale: Qt.vector3d(4000, 4000, 4000)
            eulerRotation.y: 90
            materials: PrincipledMaterial {
                lighting: PrincipledMaterial.NoLighting
                baseColorMap: Texture {
                    flipU: true
                    sourceItem: quickScene
                }
            }
        }
        Model {
            source: "#Cube"
            scale: Qt.vector3d(3, 3, 3)
            eulerRotation: Qt.vector3d(30, 30, 0)
            materials: PrincipledMaterial {
                specularReflectionMap: Texture {
                    sourceItem: quickScene
                    mappingMode: Texture.Environment
                }
            }
        }
    }
}