blob: 075bfd48d1129858bb64ce841c8feb564a9fea8f (
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
|
// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import Qt3D.Core 2.0
import Qt3D.Render 2.0
import Qt3D.Extras 2.0
Entity {
id: root
property double angle: 0
property double radius: 10
property var mesh
property alias color: material.diffuse
property vector3d center: Qt.vector3d(0, 0, 0)
components: [
Transform {
id: tr
matrix: {
var ra = 0// (root.angle) * Math.PI / 180
var m = Qt.matrix4x4()
m.rotate(root.angle, Qt.vector3d(0, 1, 0))
m.translate(Qt.vector3d(root.center.x + root.radius * Math.sin(ra), root.center.y, root.center.z - root.radius * Math.cos(ra)))
return m
}
}
]
Entity {
PhongMaterial {
id: material
}
components: [ material, mesh ]
}
}
|