| 1 |
// Copyright (C) 2015 Paul Lemire |
| 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 Layer layer |
| 11 |
property Material visualMaterial; |
| 12 |
property real rotateAngle: 0.0 |
| 13 |
property vector3d rotateAxis: Qt.vector3d(1.0, 0.0, 0.0) |
| 14 |
property vector3d center; |
| 15 |
property vector3d normal; |
| 16 |
readonly property vector4d equation: Qt.vector4d(normal.x, |
| 17 |
normal.y, |
| 18 |
normal.z, |
| 19 |
-(normal.x * center.x + |
| 20 |
normal.y * center.y + |
| 21 |
normal.z * center.z)) |
| 22 |
|
| 23 |
PlaneMesh { |
| 24 |
id: mesh |
| 25 |
width: 20.0 |
| 26 |
height: 20.0 |
| 27 |
meshResolution: Qt.size(2, 2) |
| 28 |
} |
| 29 |
|
| 30 |
Transform { |
| 31 |
id: transform |
| 32 |
translation: root.center |
| 33 |
rotation: fromAxisAndAngle(root.rotateAxis, root.rotateAngle) |
| 34 |
} |
| 35 |
|
| 36 |
components: [visualMaterial, mesh, transform, layer] |
| 37 |
} |
| 38 |
|