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

import QtQuick3D
import QtQuick

Rectangle {
    id: directionallight
    width: 800
    height: 480
    color: Qt.rgba(0, 0, 0, 1)

    View3D {
        id: view
        anchors.fill: parent
        camera: camera1

        DirectionalLight {
            castsShadow: true
            shadowFactor: 25
            eulerRotation: Qt.vector3d(-60, -20, 0)
        }

	// The ground must have shadows from the cube, the cylinder, and the big sphere above the cube.
	// The ground must not show shadowing from the smaller sphere in the center.
	// The cube must not show shadowing from from the big sphere.

        Model {
            id: ground
            source: "#Cube"
            scale: Qt.vector3d(10, 0.01, 10)
            materials: DefaultMaterial {
                diffuseColor: Qt.rgba(1.0, 1.0, 0.0, 1.0)
            }
            castsShadows: false
        }

        Model {
            source: "#Sphere"
            y: 50
            materials: DefaultMaterial {
            }
            castsShadows: false // no shadow should be visible on the ground for this
        }

        Model {
            source: "#Cylinder"
            y: 200
            x: -250
            scale: Qt.vector3d(1, 5, 1)
            materials: DefaultMaterial {
            }
        }

        Model {
            source: "#Sphere"
            x: -250
            y: 200 // above the cube
            z: 250
            materials: DefaultMaterial {
            }
        }

        Model {
            source: "#Cube"
            x: -250
            z: 250
            y: 50
            materials: DefaultMaterial {
            }
            receivesShadows: false // the sphere above would shadow it otherwise
        }

        PerspectiveCamera {
            id: camera1
            z: 600
            y: 300
            clipFar: 1000
            eulerRotation: Qt.vector3d(-20, 0, 0)
        }
    }
}