diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/backend/managers.cpp | 6 | ||||
-rw-r--r-- | src/render/backend/managers_p.h | 1 | ||||
-rw-r--r-- | src/render/framegraph/qclearbuffers.cpp | 2 | ||||
-rw-r--r-- | src/render/frontend/qcamera.cpp | 103 | ||||
-rw-r--r-- | src/render/geometry/joint.cpp | 1 | ||||
-rw-r--r-- | src/render/raycasting/qray3d.cpp | 8 |
6 files changed, 101 insertions, 20 deletions
diff --git a/src/render/backend/managers.cpp b/src/render/backend/managers.cpp index 26fd68600..aa7dbb741 100644 --- a/src/render/backend/managers.cpp +++ b/src/render/backend/managers.cpp @@ -110,6 +110,12 @@ void JointManager::addDirtyJoint(Qt3DCore::QNodeId jointId) m_dirtyJoints.push_back(jointHandle); } +void JointManager::removeDirtyJoint(Qt3DCore::QNodeId jointId) +{ + const HJoint jointHandle = lookupHandle(jointId); + m_dirtyJoints.removeAll(jointHandle); +} + QVector<HJoint> JointManager::dirtyJoints() { return std::move(m_dirtyJoints); diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index 89b02b86f..759c16f64 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -443,6 +443,7 @@ class JointManager : public Qt3DCore::QResourceManager< { public: void addDirtyJoint(Qt3DCore::QNodeId jointId); + void removeDirtyJoint(Qt3DCore::QNodeId jointId); QVector<HJoint> dirtyJoints(); private: diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp index 67773a6b7..4cc4c98b6 100644 --- a/src/render/framegraph/qclearbuffers.cpp +++ b/src/render/framegraph/qclearbuffers.cpp @@ -220,7 +220,7 @@ void QClearBuffers::setClearStencilValue(int clearStencilValue) ColorBuffer flag is set, all color buffers will be cleared. */ /*! - \qmlproperty RenderTargetOutput Qt3D.Render::ClearBuffers::colorbuffer + \qmlproperty RenderTargetOutput Qt3D.Render::ClearBuffers::colorBuffer Specifies a specific color buffer to clear. If set to NULL (default), and ColorBuffer flag is set, all color buffers will be cleared. */ diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp index 274b555f6..29703878d 100644 --- a/src/render/frontend/qcamera.cpp +++ b/src/render/frontend/qcamera.cpp @@ -254,11 +254,14 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! * \qmlproperty enumeration Qt3D.Render::Camera::projectionType * - * Holds the type of the camera projection. + * Holds the type of the camera projection. The default value is + * CameraLens.PerspectiveProjection. * * \list - * \li CameraLens.OrthographicProjection - * \li CameraLens.PerspectiveProjection + * \li CameraLens.OrthographicProjection - Parallel lines appear parallel. Objects appear + * the same size regardless of distance. + * \li CameraLens.PerspectiveProjection - Parallel lines appear to meet in the distance. + * Objects appear to shrink the farther they are from the camera. * \li CameraLens.FrustumProjection * \li CameraLens.CustomProjection * \endlist @@ -267,17 +270,28 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! * \qmlproperty real Qt3D.Render::Camera::nearPlane - * Holds the current camera near plane of the camera. + * Holds the current camera near plane of the camera. Objects that + * are closer to the camera than the nearPlane will not be rendered. */ /*! * \qmlproperty real Qt3D.Render::Camera::farPlane - * Holds the current camera far plane of the camera. + * Holds the current camera far plane of the camera. Objects that + * are farther from the camera than the farPlane will not be rendered. */ /*! * \qmlproperty real Qt3D.Render::Camera::fieldOfView - * Holds the current field of view of the camera in degrees. + * Holds the current vertical field of view of the camera in degrees. + * + * Along with \l aspectRatio, this property determines how much of + * the scene is visible to the camera. In that respect you might + * think of it as analogous to choosing a wide angle (wide horizontal + * field of view) or telephoto (narrow horizontal field of view) lens, + * depending on how much of a scene you want to capture. + * + * fieldOfView is only relevant when \l projectionType is + * CameraLens.PerspectiveProjection. */ /*! @@ -288,21 +302,33 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! *\qmlproperty real Qt3D.Render::Camera::left * Holds the current left of the camera. + * + * This property is only relevant when \l projectionType is + * CameraLens.OrthographicProjection. */ /*! * \qmlproperty real Qt3D.Render::Camera::right * Holds the current right of the camera. + * + * This property is only relevant when \l projectionType is + * CameraLens.OrthographicProjection. */ /*! * \qmlproperty real Qt3D.Render::Camera::bottom * Holds the current bottom of the camera. + * + * This property is only relevant when \l projectionType is + * CameraLens.OrthographicProjection. */ /*! * \qmlproperty real Qt3D.Render::Camera::top * Holds the current top of the camera. + * + * This property is only relevant when \l projectionType is + * CameraLens.OrthographicProjection. */ /*! @@ -321,19 +347,29 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) * \qmlproperty vector3d Qt3D.Render::Camera::upVector * Holds the current up vector of the camera in coordinates relative to * the parent entity. + * + * The up vector indicates which direction the top of the camera is + * facing. Think of taking a picture: after positioning yourself + * and pointing the camera at your target, you might rotate the camera + * left or right, giving you a portrait or landscape (or angled!) + * shot. upVector allows you to control this type of movement. */ /*! * \qmlproperty vector3d Qt3D.Render::Camera::viewCenter * Holds the current view center of the camera in coordinates relative to * the parent entity. - * \readonly + * + * Intuitively, the viewCenter is the location the camera is pointing at. */ /*! * \qmlproperty vector3d Qt3D.Render::Camera::viewVector * Holds the camera's view vector in coordinates relative to * the parent entity. + * + * This vector decribes the displacement from the camera (\l position) + * to its target (\l viewCenter). * \readonly */ @@ -348,30 +384,44 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! * \property QCamera::projectionType * - * Holds the type of the camera projection. + * Holds the type of the camera projection. The default value is + * QCameraLens::PerspectiveProjection. * * \list - * \li CameraLens.OrthographicProjection - * \li CameraLens.PerspectiveProjection - * \li CameraLens.FrustumProjection - * \li CameraLens.CustomProjection + * \li QCameraLens::OrthographicProjection - Parallel lines appear parallel. Objects appear + * the same size regardless of distance. + * \li QCameraLens::PerspectiveProjection - Parallel lines appear to meet in the distance. + * Objects appear to shrink the farther they are from the camera. + * \li QCameraLens::FrustumProjection + * \li QCameraLens::CustomProjection * \endlist * \sa Qt3DRender::QCameraLens::ProjectionType */ /*! * \property QCamera::nearPlane - * Holds the current camera near plane. + * Holds the current camera near plane. Objects that are closer to the + * camera than the nearPlane will not be rendered. */ /*! * \property QCamera::farPlane - * Holds the current camera far plane. + * Holds the current camera far plane. Objects that are farther from the + * camera than the farPlane will not be rendered. */ /*! * \property QCamera::fieldOfView - * Holds the current field of view in degrees. + * Holds the current vertical field of view in degrees. + * + * Along with \l aspectRatio, this property determines how much of + * the scene is visible to the camera. In that respect you might + * think of it as analogous to choosing a wide angle (wide horizontal + * field of view) or telephoto (narrow horizontal field of view) lens + * depending on how much of a scene you want to capture. + * + * fieldOfView is only relevant when \l projectionType is + * QCameraLens::PerspectiveProjection. */ /*! @@ -382,21 +432,33 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! *\property QCamera::left * Holds the current left of the camera. + * + * This property is only relevant when \l projectionType is + * QCameraLens::OrthographicProjection. */ /*! * \property QCamera::right * Holds the current right of the camera. + * + * This property is only relevant when \l projectionType is + * QCameraLens::OrthographicProjection. */ /*! * \property QCamera::bottom * Holds the current bottom of the camera. + * + * This property is only relevant when \l projectionType is + * QCameraLens::OrthographicProjection. */ /*! * \property QCamera::top * Holds the current top of the camera. + * + * This property is only relevant when \l projectionType is + * QCameraLens::OrthographicProjection. */ /*! @@ -419,18 +481,29 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) * \property QCamera::upVector * Holds the camera's up vector in coordinates relative to * the parent entity. + * + * The up vector indicates which direction the top of the camera is + * facing. Think of taking a picture: after positioning yourself + * and pointing the camera at your target, you might rotate the camera + * left or right, giving you a portrait or landscape (or angled!) + * shot. upVector allows you to control this type of movement. */ /*! * \property QCamera::viewCenter * Holds the camera's view center in coordinates relative to * the parent entity. + * + * Intuitively, the viewCenter is the location the camera is pointing at. */ /*! * \property QCamera::viewVector * Holds the camera's view vector in coordinates relative to * the parent entity. + * + * This vector decribes the displacement from the camera (\l position) + * to its target (\l viewCenter). */ /*! diff --git a/src/render/geometry/joint.cpp b/src/render/geometry/joint.cpp index 9c53b8ef8..c770564f9 100644 --- a/src/render/geometry/joint.cpp +++ b/src/render/geometry/joint.cpp @@ -153,6 +153,7 @@ Qt3DCore::QBackendNode *JointFunctor::get(Qt3DCore::QNodeId id) const void JointFunctor::destroy(Qt3DCore::QNodeId id) const { + m_jointManager->removeDirtyJoint(id); m_jointManager->releaseResource(id); } diff --git a/src/render/raycasting/qray3d.cpp b/src/render/raycasting/qray3d.cpp index d8ad25b50..18dd9a40a 100644 --- a/src/render/raycasting/qray3d.cpp +++ b/src/render/raycasting/qray3d.cpp @@ -101,7 +101,7 @@ QRay3D::QRay3D() */ QRay3D::QRay3D(const Vector3D &origin, const Vector3D &direction, float distance) : m_origin(origin) - , m_direction(direction) + , m_direction(direction.normalized()) , m_distance(distance) {} @@ -157,7 +157,7 @@ void QRay3D::setDirection(const Vector3D &value) if (value.isNull()) return; - m_direction = value; + m_direction = value.normalized(); } float QRay3D::distance() const @@ -178,14 +178,14 @@ Vector3D QRay3D::point(float t) const QRay3D &QRay3D::transform(const Matrix4x4 &matrix) { m_origin = matrix * m_origin; - m_direction = matrix.mapVector(m_direction); + m_direction = matrix.mapVector(m_direction).normalized(); return *this; } QRay3D QRay3D::transformed(const Matrix4x4 &matrix) const { - return QRay3D(matrix * m_origin, matrix.mapVector(m_direction)); + return QRay3D(matrix * m_origin, matrix.mapVector(m_direction).normalized()); } bool QRay3D::operator==(const QRay3D &other) const |