Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquick3dperspectivecamera.cpp
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
5
6#include <QtQuick3DRuntimeRender/private/qssgrendercamera_p.h>
7
8#include <QtMath>
9#include <QtQuick3DUtils/private/qssgutils_p.h>
10
11#include "qquick3dutils_p.h"
12
13#include "qquick3dnode_p_p.h"
14
16
58
65
77{
78 return m_clipNear;
79}
80
92{
93 return m_clipFar;
94}
95
127{
128 return m_fieldOfView;
129}
130
135
137{
138 if (qFuzzyCompare(m_clipNear, clipNear))
139 return;
140
141 m_clipNear = clipNear;
143 update();
144}
145
147{
148 if (qFuzzyCompare(m_clipFar, clipFar))
149 return;
150
151 m_clipFar = clipFar;
153 update();
154}
155
157{
158 if (qFuzzyCompare(m_fieldOfView, fieldOfView))
159 return;
160
161 m_fieldOfView = fieldOfView;
163 update();
164}
165
167 fieldOfViewOrientation)
168{
169 if (m_fieldOfViewOrientation == fieldOfViewOrientation)
170 return;
171
172 m_fieldOfViewOrientation = fieldOfViewOrientation;
174 update();
175}
176
178{
180 if (camera) {
181 const bool changed = ((int(qUpdateIfNeeded(camera->clipNear, m_clipNear))
182 | int(qUpdateIfNeeded(camera->clipFar, m_clipFar))
183 | int(qUpdateIfNeeded(camera->fov, qDegreesToRadians(m_fieldOfView)))
184 | int(qUpdateIfNeeded(camera->fovHorizontal, m_fieldOfViewOrientation == QQuick3DPerspectiveCamera::FieldOfViewOrientation::Horizontal))) != 0);
185 if (changed)
187 }
188
189 return camera;
190}
191
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
QQuick3DPerspectiveCamera(QQuick3DNode *parent=nullptr)
FieldOfViewOrientation fieldOfViewOrientation
void setFieldOfViewOrientation(QQuick3DPerspectiveCamera::FieldOfViewOrientation fieldOfViewOrientation)
QSSGRenderGraphObject * updateSpatialNode(QSSGRenderGraphObject *node) override
QCamera * camera
Definition camera.cpp:19
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
constexpr float qDegreesToRadians(float degrees)
Definition qmath.h:260
QT_BEGIN_NAMESPACE bool qUpdateIfNeeded(T &orig, T updated)
#define emit
Definition moc.h:23