Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquick3dcamera_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGCAMERA_H
7#define QSSGCAMERA_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtQuick3D/private/qquick3dnode_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QSSGRenderCamera;
25class Q_QUICK3D_EXPORT QQuick3DCamera : public QQuick3DNode
26{
27 Q_OBJECT
28 Q_PROPERTY(bool frustumCullingEnabled READ frustumCullingEnabled WRITE setFrustumCullingEnabled NOTIFY frustumCullingEnabledChanged)
29 Q_PROPERTY(QQuick3DNode *lookAtNode READ lookAtNode WRITE setLookAtNode NOTIFY lookAtNodeChanged REVISION(6, 4))
30 Q_PROPERTY(float levelOfDetailBias READ levelOfDetailBias WRITE setLevelOfDetailBias NOTIFY levelOfDetailBiasChanged REVISION(6, 5))
31 QML_NAMED_ELEMENT(Camera)
32 QML_UNCREATABLE("Camera is Abstract")
33public:
34 Q_INVOKABLE QVector3D mapToViewport(const QVector3D &scenePos) const;
35 Q_INVOKABLE QVector3D mapFromViewport(const QVector3D &viewportPos) const;
36 QVector3D mapToViewport(const QVector3D &scenePos,
37 qreal width,
38 qreal height);
39 QVector3D mapFromViewport(const QVector3D &viewportPos,
40 qreal width,
41 qreal height);
42
43 Q_INVOKABLE void lookAt(const QVector3D &scenePos);
44 Q_INVOKABLE void lookAt(QQuick3DNode *node);
45
46 // It will be used only after the scene was drawn.
47 // It means that the spatialNode of this camera already was created.
48 void updateGlobalVariables(const QRectF &inViewport);
49
50 bool frustumCullingEnabled() const;
51 QQuick3DNode *lookAtNode() const;
52 Q_REVISION(6, 5) float levelOfDetailBias() const;
53
54public Q_SLOTS:
55 void setFrustumCullingEnabled(bool frustumCullingEnabled);
56 void setLookAtNode(QQuick3DNode *node);
57 Q_REVISION(6, 5) void setLevelOfDetailBias(float newLevelOFDetailBias);
58
59Q_SIGNALS:
60 void frustumCullingEnabledChanged();
61 Q_REVISION(6, 4) void lookAtNodeChanged();
62 Q_REVISION(6, 5) void levelOfDetailBiasChanged();
63
64protected:
65 explicit QQuick3DCamera(QQuick3DNodePrivate &dd, QQuick3DNode *parent = nullptr);
66
67 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
68
69private Q_SLOTS:
70 void updateLookAt();
71
72private:
73 bool m_frustumCullingEnabled = false;
74 QQuick3DNode *m_lookAtNode = nullptr;
75 float m_levelOfDetailBias = 1.0f;
76};
77
78QT_END_NAMESPACE
79
80#endif // QSSGCAMERA_H
Combined button and popup list for selecting options.