QCameraLens Class

class Qt3DRender::QCameraLens

Qt3DRender::QCameraLens specifies the projection matrix that will be used to define a Camera for a 3D scene. More...

Header: #include <Qt3DRender/QCameraLens>
qmake: QT += 3drender
Since: Qt 5.5
Instantiated By: CameraLens
Inherits: Qt3DCore::QComponent

This class was introduced in Qt 5.5.

Public Types

enum ProjectionType { OrthographicProjection, PerspectiveProjection, FrustumProjection, CustomProjection }

Public Functions

QCameraLens(Qt3DCore::QNode *parent = nullptr)
void setAspectRatio(float aspectRatio)
void setBottom(float bottom)
void setExposure(float exposure)
void setFarPlane(float farPlane)
void setFieldOfView(float fieldOfView)
void setFrustumProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane)
void setLeft(float left)
void setNearPlane(float nearPlane)
void setOrthographicProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane)
void setPerspectiveProjection(float fieldOfView, float aspectRatio, float nearPlane, float farPlane)
void setProjectionMatrix(const QMatrix4x4 &projectionMatrix)
void setProjectionType(Qt3DRender::QCameraLens::ProjectionType projectionType)
void setRight(float right)
void setTop(float top)

Detailed Description

Member Type Documentation

enum QCameraLens::ProjectionType

Specifies which parameters of Qt3DRender::QCameraLens are used to compute the projection matrix.

ConstantValueDescription
Qt3DRender::QCameraLens::OrthographicProjection0Orthogonal projection
Qt3DRender::QCameraLens::PerspectiveProjection1Perspective projection
Qt3DRender::QCameraLens::FrustumProjection2Frustum projection
Qt3DRender::QCameraLens::CustomProjection3Custom user-defined projection

Member Function Documentation

QCameraLens::QCameraLens(Qt3DCore::QNode *parent = nullptr)

Constructs a QCameraLens with given parent

void QCameraLens::setAspectRatio(float aspectRatio)

Sets the projection's aspect ratio to aspectRatio. This triggers a projection matrix update.

Note: this has no effect if the projection type is not Qt3DRender::QCameraLens::PerspectiveProjection.

void QCameraLens::setBottom(float bottom)

Sets the projection's bottom window coordinate to bottom. This triggers a projection matrix update.

Note: this has no effect if the projection type is Qt3DRender::QCameraLens::PerspectiveProjection.

void QCameraLens::setExposure(float exposure)

Sets the camera lens' exposure

void QCameraLens::setFarPlane(float farPlane)

Sets the projection's far plane to farPlane. This triggers a projection matrix update.

void QCameraLens::setFieldOfView(float fieldOfView)

Sets the projection's field of view to fieldOfView degrees. This triggers a projection matrix update.

Note: this has no effect if the projection type is not Qt3DRender::QCameraLens::PerspectiveProjection.

void QCameraLens::setFrustumProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane)

Defines an orthographic projection based on left, right, bottom, top, nearPlane, farPlane.

void QCameraLens::setLeft(float left)

Sets the projection's lower left window coordinate to left. This triggers a projection matrix update.

Note: this has no effect if the projection type is Qt3DRender::QCameraLens::PerspectiveProjection.

void QCameraLens::setNearPlane(float nearPlane)

Sets the projection's near plane to nearPlane. This triggers a projection matrix update.

void QCameraLens::setOrthographicProjection(float left, float right, float bottom, float top, float nearPlane, float farPlane)

Defines an orthographic projection based on left, right, bottom, top, nearPlane, farPlane.

void QCameraLens::setPerspectiveProjection(float fieldOfView, float aspectRatio, float nearPlane, float farPlane)

Defines a perspective projection based on fieldOfView, aspectRatio, nearPlane, farPlane.

void QCameraLens::setProjectionMatrix(const QMatrix4x4 &projectionMatrix)

Sets the project matrix to projectionMatrix.

Note: This will set the projection type to Qt3DRender::QCameraLens::CustomProjection and thus ignore all other camera parameters that might have been specified.

void QCameraLens::setProjectionType(Qt3DRender::QCameraLens::ProjectionType projectionType)

Sets the lens' projection type projectionType.

Note: Qt3DRender::QCameraLens::Frustum and Qt3DRender::QCameraLens::PerspectiveProjection are two different ways of specifying the same projection.

void QCameraLens::setRight(float right)

Sets the projection's upper right window coordinate to right. This triggers a projection matrix update.

Note: this has no effect if the projection type is Qt3DRender::QCameraLens::PerspectiveProjection.

void QCameraLens::setTop(float top)

Sets the projection's top window coordinate to top. This triggers a projection matrix update.

Note: this has no effect if the projection type is Qt3DRender::QCameraLens::PerspectiveProjection.