| 1 |
// Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import Qt3D.Core 2.0 |
| 5 |
import Qt3D.Render 2.0 |
| 6 |
import Qt3D.Extras 2.0 |
| 7 |
|
| 8 |
Entity { |
| 9 |
id: root |
| 10 |
signal pressed(var event) |
| 11 |
signal clicked(var event) |
| 12 |
signal released(var event) |
| 13 |
signal entered() |
| 14 |
signal exited() |
| 15 |
|
| 16 |
property Layer layer |
| 17 |
property real x: 0 |
| 18 |
property real y: 0 |
| 19 |
property real z: 0 |
| 20 |
property alias scale: transform.scale |
| 21 |
property alias hoverEnabled: objectPicker.hoverEnabled |
| 22 |
property alias diffuseColor: material.diffuse |
| 23 |
property alias ambientColor: material.ambient |
| 24 |
property alias pickingEnabled: objectPicker.enabled |
| 25 |
readonly property bool containsMouse: objectPicker.containsMouse |
| 26 |
readonly property bool isPressed: objectPicker.pressed |
| 27 |
|
| 28 |
property GeometryRenderer mesh; |
| 29 |
|
| 30 |
ObjectPicker { |
| 31 |
id: objectPicker |
| 32 |
onClicked: root.clicked(pick) |
| 33 |
onPressed: root.pressed(pick) |
| 34 |
onReleased: root.released(pick) |
| 35 |
onEntered: root.entered() |
| 36 |
onExited: root.exited(); |
| 37 |
} |
| 38 |
|
| 39 |
PhongMaterial { id: material } |
| 40 |
|
| 41 |
Transform { |
| 42 |
id: transform |
| 43 |
translation: Qt.vector3d(x, y, z) |
| 44 |
} |
| 45 |
|
| 46 |
components: [mesh, material, transform, objectPicker, layer] |
| 47 |
} |
| 48 |
|