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

import QtQuick
import QtQuick3D

Rectangle {
    width: 400
    height: 400
    color: "black"

    View3D {
        anchors.fill: parent

        PerspectiveCamera {
            id: cam
            position: Qt.vector3d(50, 50, 150)
        }

        DirectionalLight {
            rotation: Quaternion.fromEulerAngles(-30, -70, 0)
            ambientColor: Qt.rgba(0.8, 0.8, 0.8, 1.0);
        }

        environment: SceneEnvironment {
            probeExposure: 7.5
        }

        Texture {
            id: lightprobe_texture
            source: "maps/OpenfootageNET_Gerlos-512.hdr"
            mappingMode: Texture.LightProbe
            tilingModeHorizontal: Texture.ClampToEdge
        }

        Model {
            id: no_ibl
            position: Qt.vector3d(0, 100, -100)
            source: "#Sphere"
            materials: [
                PrincipledMaterial {
                    baseColor: "#ffd777"
                    metalness: 0.7
                    roughness: 0.3
                    specularAmount: 0.2
                    specularTint: 0.0
                    opacity: 1.0
                    lighting: DefaultMaterial.FragmentLighting
                }
            ]
        }

        Model {
            id: local_lightprobe
            position: Qt.vector3d(100, 100, -100)
            source: "#Sphere"
            materials: [
                PrincipledMaterial {
                    baseColor: "#e7e7f7"
                    metalness: 1.0
                    roughness: 0.3
                    specularAmount: 0.2
                    specularTint: 0.0
                    opacity: 1.0
                    lighting: DefaultMaterial.FragmentLighting

                    lightProbe: lightprobe_texture
                }
            ]
        }

        Model {
            id: specular_reflection_map
            position: Qt.vector3d(100, 0, -100)
            source: "#Sphere"
            materials: [
                DefaultMaterial {
                    diffuseColor: "red"
                    lighting: DefaultMaterial.FragmentLighting

                    specularReflectionMap: lightprobe_texture
                }
            ]
        }
    }
}