aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick3d/xr_shared/PickRay.qml
blob: 1556554a03302bc00ff6cf58f983e0e12d96d2ef (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
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick3D

Node {
    id: pointer

    property real beamThickness: 0.3
    property color beamColor: "#eeeeee"
    property color beamHitColor: "#bbddcc"
    property color beamPressedHitColor: "#bbccdd"
    property color beamPressedMissColor: "#ddbbbb"
    property bool pressed: false
    property bool hit: false

    property real length: 150

    Model {
        readonly property real thickness: pointer.beamThickness / 100
        eulerRotation.x: -90
        scale: Qt.vector3d(thickness, pickRay.length/100, thickness)
        source: "#Cone"
        materials: PrincipledMaterial {
            baseColor: pointer.hit ?
                           (pointer.pressed ? pointer.beamPressedHitColor : pointer.beamHitColor) :
                           (pointer.pressed ? pointer.beamPressedMissColor : pointer.beamColor)
            lighting: PrincipledMaterial.NoLighting
        }
        opacity: 0.8
    }
}