1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGORTHOGRAPHICCAMERA_H
5#define QSSGORTHOGRAPHICCAMERA_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3D/private/qquick3dcamera_p.h>
19
20QT_BEGIN_NAMESPACE
21
22struct QSSGRenderCamera;
23class Q_QUICK3D_EXPORT QQuick3DOrthographicCamera : public QQuick3DCamera
24{
25 Q_OBJECT
26 Q_PROPERTY(float clipNear READ clipNear WRITE setClipNear NOTIFY clipNearChanged)
27 Q_PROPERTY(float clipFar READ clipFar WRITE setClipFar NOTIFY clipFarChanged)
28 Q_PROPERTY(float horizontalMagnification READ horizontalMagnification WRITE setHorizontalMagnification NOTIFY horizontalMagnificationChanged)
29 Q_PROPERTY(float verticalMagnification READ verticalMagnification WRITE setVerticalMagnification NOTIFY verticalMagnificationChanged)
30
31 QML_NAMED_ELEMENT(OrthographicCamera)
32
33public:
34 explicit QQuick3DOrthographicCamera(QQuick3DNode *parent = nullptr);
35
36 float clipNear() const;
37 float clipFar() const;
38 float horizontalMagnification() const;
39 float verticalMagnification() const;
40
41public Q_SLOTS:
42 void setClipNear(float clipNear);
43 void setClipFar(float clipFar);
44 void setHorizontalMagnification(float horizontalMagnification);
45 void setVerticalMagnification(float horizontalMagnification);
46
47Q_SIGNALS:
48 void clipNearChanged();
49 void clipFarChanged();
50 void horizontalMagnificationChanged();
51 void verticalMagnificationChanged();
52
53protected:
54 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
55
56private:
57 float m_clipNear = 10.0f;
58 float m_clipFar = 10000.0f;
59 float m_horizontalMagnification = 1.0f;
60 float m_verticalMagnification = 1.0f;
61};
62
63QT_END_NAMESPACE
64
65#endif // QSSGORTHOGRAPHICCAMERA_H
66

source code of qtquick3d/src/quick3d/qquick3dorthographiccamera_p.h