| 1 |
// Copyright (C) 2017 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 |
property double angle: 0 |
| 11 |
property double radius: 10 |
| 12 |
property var mesh |
| 13 |
property alias color: material.diffuse |
| 14 |
property vector3d center: Qt.vector3d(0, 0, 0) |
| 15 |
|
| 16 |
components: [ |
| 17 |
Transform { |
| 18 |
id: tr |
| 19 |
matrix: { |
| 20 |
var ra = 0// (root.angle) * Math.PI / 180 |
| 21 |
var m = Qt.matrix4x4() |
| 22 |
m.rotate(root.angle, Qt.vector3d(0, 1, 0)) |
| 23 |
m.translate(Qt.vector3d(root.center.x + root.radius * Math.sin(ra), root.center.y, root.center.z - root.radius * Math.cos(ra))) |
| 24 |
return m |
| 25 |
} |
| 26 |
} |
| 27 |
] |
| 28 |
|
| 29 |
Entity { |
| 30 |
PhongMaterial { |
| 31 |
id: material |
| 32 |
} |
| 33 |
components: [ material, mesh ] |
| 34 |
} |
| 35 |
} |