2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2020-02-25 14:37:45 +02:00
|
|
|
|
|
|
|
|
import QtQuick 2.0
|
|
|
|
|
import QtQuick3D 1.15
|
|
|
|
|
import CameraGeometry 1.0
|
|
|
|
|
|
|
|
|
|
Model {
|
|
|
|
|
id: cameraFrustum
|
|
|
|
|
|
|
|
|
|
property alias geometryName: cameraGeometry.name // Name must be unique for each geometry
|
|
|
|
|
property alias viewPortRect: cameraGeometry.viewPortRect
|
|
|
|
|
property Node targetNode: null
|
|
|
|
|
property Node scene: null
|
|
|
|
|
property bool selected: false
|
|
|
|
|
|
|
|
|
|
function updateGeometry()
|
|
|
|
|
{
|
|
|
|
|
cameraGeometry.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
position: targetNode ? targetNode.scenePosition : Qt.vector3d(0, 0, 0)
|
|
|
|
|
rotation: targetNode ? targetNode.sceneRotation : Qt.quaternion(1, 0, 0, 0)
|
|
|
|
|
|
|
|
|
|
geometry: cameraGeometry
|
|
|
|
|
materials: [
|
|
|
|
|
DefaultMaterial {
|
|
|
|
|
id: defaultMaterial
|
2020-08-04 10:19:24 +03:00
|
|
|
diffuseColor: cameraFrustum.selected ? "#FF0000" : "#555555"
|
2020-02-25 14:37:45 +02:00
|
|
|
lighting: DefaultMaterial.NoLighting
|
2020-03-10 15:57:41 +02:00
|
|
|
cullMode: Material.NoCulling
|
2020-02-25 14:37:45 +02:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
CameraGeometry {
|
|
|
|
|
id: cameraGeometry
|
|
|
|
|
camera: cameraFrustum.scene && cameraFrustum.targetNode ? cameraFrustum.targetNode : null
|
|
|
|
|
}
|
|
|
|
|
}
|