The QCamera class defines a view point through which the scene will be rendered. 更多...
头: | #include <Qt3DRender/QCamera> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender) |
qmake: | QT += 3drender |
实例化: | Camera |
继承: | Qt3DCore::QEntity |
enum | CameraTranslationOption { TranslateViewCenter, DontTranslateViewCenter } |
|
|
QCamera (Qt3DCore::QNode * parent = nullptr) | |
float | aspectRatio () const |
float | bottom () const |
float | exposure () const |
float | farPlane () const |
float | fieldOfView () const |
float | left () const |
Qt3DRender::QCameraLens * | lens () const |
float | nearPlane () const |
void | pan (float angle ) |
void | pan (float angle , const QVector3D & axis ) |
void | panAboutViewCenter (float angle ) |
void | panAboutViewCenter (float angle , const QVector3D & axis ) |
QQuaternion | panRotation (float angle ) const |
QVector3D | position () const |
QMatrix4x4 | projectionMatrix () const |
QCameraLens::ProjectionType | projectionType () const |
float | right () const |
void | roll (float angle ) |
void | rollAboutViewCenter (float angle ) |
QQuaternion | rollRotation (float angle ) const |
void | rotate (const QQuaternion & q ) |
void | rotateAboutViewCenter (const QQuaternion & q ) |
QQuaternion | rotation (float angle , const QVector3D & axis ) const |
void | tilt (float angle ) |
void | tiltAboutViewCenter (float angle ) |
QQuaternion | tiltRotation (float angle ) const |
float | top () const |
Qt3DCore::QTransform * | transform () const |
void | translate (const QVector3D & vLocal , Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter) |
void | translateWorld (const QVector3D & vWorld , Qt3DRender::QCamera::CameraTranslationOption option = TranslateViewCenter) |
QVector3D | upVector () const |
QVector3D | viewCenter () const |
QVector3D | viewVector () const |
void | setAspectRatio (float aspectRatio ) |
void | setBottom (float bottom ) |
void | setExposure (float exposure ) |
void | setFarPlane (float farPlane ) |
void | setFieldOfView (float fieldOfView ) |
void | setLeft (float left ) |
void | setNearPlane (float nearPlane ) |
void | setPosition (const QVector3D & position ) |
void | setProjectionMatrix (const QMatrix4x4 & projectionMatrix ) |
void | setProjectionType (QCameraLens::ProjectionType type ) |
void | setRight (float right ) |
void | setTop (float top ) |
void | setUpVector (const QVector3D & upVector ) |
void | setViewCenter (const QVector3D & viewCenter ) |
void | viewAll () |
void | viewEntity (Qt3DCore::QEntity * entity ) |
void | viewSphere (const QVector3D & center , float radius ) |
void | aspectRatioChanged (float aspectRatio ) |
void | bottomChanged (float bottom ) |
void | exposureChanged (float exposure ) |
void | farPlaneChanged (float farPlane ) |
void | fieldOfViewChanged (float fieldOfView ) |
void | leftChanged (float left ) |
void | nearPlaneChanged (float nearPlane ) |
void | positionChanged (const QVector3D & position ) |
void | projectionMatrixChanged (const QMatrix4x4 & projectionMatrix ) |
void | projectionTypeChanged (QCameraLens::ProjectionType projectionType ) |
void | rightChanged (float right ) |
void | topChanged (float top ) |
void | upVectorChanged (const QVector3D & upVector ) |
void | viewCenterChanged (const QVector3D & viewCenter ) |
void | viewVectorChanged (const QVector3D & viewVector ) |
This enum specifies how camera view center is translated
常量 | 值 | 描述 |
---|---|---|
Qt3DRender::QCamera::TranslateViewCenter
|
0
|
Translate the view center causing the view direction to remain the same |
Qt3DRender::QCamera::DontTranslateViewCenter
|
1
|
Don't translate the view center causing the view direction to change |
Holds the current aspect ratio.
访问函数:
float | aspectRatio () const |
void | setAspectRatio (float aspectRatio ) |
通知程序信号:
void | aspectRatioChanged (float aspectRatio ) |
Holds the current bottom of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection .
访问函数:
float | bottom () const |
void | setBottom (float bottom ) |
通知程序信号:
void | bottomChanged (float bottom ) |
Holds the current exposure of the camera.
The default value is 0.0.
The MetalRoughMaterial in Qt 3D Extras is currently the only provided material that makes use of camera exposure. Negative values will cause the material to be darker, and positive values will cause it to be lighter.
Custom materials may choose to interpret the value differently.
访问函数:
float | exposure () const |
void | setExposure (float exposure ) |
通知程序信号:
void | exposureChanged (float exposure ) |
Holds the current camera far plane. Objects that are farther from the camera than the farPlane will not be rendered.
访问函数:
float | farPlane () const |
void | setFarPlane (float farPlane ) |
通知程序信号:
void | farPlaneChanged (float farPlane ) |
Holds the current vertical field of view in degrees.
Along with 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 projectionType is QCameraLens::PerspectiveProjection .
访问函数:
float | fieldOfView () const |
void | setFieldOfView (float fieldOfView ) |
通知程序信号:
void | fieldOfViewChanged (float fieldOfView ) |
Holds the current left of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection .
访问函数:
float | left () const |
void | setLeft (float left ) |
通知程序信号:
void | leftChanged (float left ) |
[read-only]
lens
:
Qt3DRender::QCameraLens
* const
保持 Qt3DRender::QCameraLens component of the camera.
访问函数:
Qt3DRender::QCameraLens * | lens () const |
Holds the current camera near plane. Objects that are closer to the camera than the nearPlane will not be rendered.
访问函数:
float | nearPlane () const |
void | setNearPlane (float nearPlane ) |
通知程序信号:
void | nearPlaneChanged (float nearPlane ) |
Holds the camera's position in coordinates relative to the parent entity.
访问函数:
QVector3D | 位置 () const |
void | setPosition (const QVector3D & position ) |
通知程序信号:
void | positionChanged (const QVector3D & position ) |
Holds the current projection matrix of the camera.
访问函数:
QMatrix4x4 | projectionMatrix () const |
void | setProjectionMatrix (const QMatrix4x4 & projectionMatrix ) |
通知程序信号:
void | projectionMatrixChanged (const QMatrix4x4 & projectionMatrix ) |
Holds the type of the camera projection. The default value is QCameraLens::PerspectiveProjection .
访问函数:
QCameraLens::ProjectionType | projectionType () const |
void | setProjectionType (QCameraLens::ProjectionType type ) |
通知程序信号:
void | projectionTypeChanged (QCameraLens::ProjectionType projectionType ) |
另请参阅 Qt3DRender::QCameraLens::ProjectionType .
Holds the current right of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection .
访问函数:
float | right () const |
void | setRight (float right ) |
通知程序信号:
void | rightChanged (float right ) |
Holds the current top of the camera.
This property is only relevant when projectionType is QCameraLens::OrthographicProjection .
访问函数:
float | top () const |
void | setTop (float top ) |
通知程序信号:
void | topChanged (float top ) |
[read-only]
transform
:
Qt3DCore::QTransform
* const
保持 Qt3DCore::QTransform component of the camera.
访问函数:
Qt3DCore::QTransform * | transform () const |
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.
访问函数:
QVector3D | upVector () const |
void | setUpVector (const QVector3D & upVector ) |
通知程序信号:
void | upVectorChanged (const QVector3D & upVector ) |
Holds the camera's view center in coordinates relative to the parent entity.
Intuitively, the viewCenter is the location the camera is pointing at.
访问函数:
QVector3D | viewCenter () const |
void | setViewCenter (const QVector3D & viewCenter ) |
通知程序信号:
void | viewCenterChanged (const QVector3D & viewCenter ) |
[read-only]
viewVector
: const
QVector3D
Holds the camera's view vector in coordinates relative to the parent entity.
This vector decribes the displacement from the camera ( position ) to its target ( viewCenter ).
访问函数:
QVector3D | viewVector () const |
通知程序信号:
void | viewVectorChanged (const QVector3D & viewVector ) |
[explicit]
QCamera::
QCamera
(
Qt3DCore::QNode
*
parent
= nullptr)
Creates a new QCamera instance with the specified parent .
Returns the current lens.
注意: Getter function for property lens.
[invokable]
void
QCamera::
pan
(
float
angle
)
Adjusts the pan angle of the camera by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
pan
(
float
angle
, const
QVector3D
&
axis
)
Adjusts the pan angle of the camera by angle in degrees on a chosen axis .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
panAboutViewCenter
(
float
angle
)
Adjusts the camera pan about view center by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
panAboutViewCenter
(
float
angle
, const
QVector3D
&
axis
)
Adjusts the camera pan about view center by angle in degrees on axis .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
QQuaternion
QCamera::
panRotation
(
float
angle
) const
Returns the calculated pan rotation in relation to the angle in degrees taken in to adjust the camera's pan or left/right rotation on the Y axis.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
roll
(
float
angle
)
Adjusts the camera roll by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
rollAboutViewCenter
(
float
angle
)
Adjusts the camera roll about view center by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
QQuaternion
QCamera::
rollRotation
(
float
angle
) const
Returns the calculated roll rotation in relation to the angle in degrees taken in to adjust the camera's roll or lean left/right rotation on the Z axis.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
rotate
(const
QQuaternion
&
q
)
Rotates the camera with the use of a Quaternion in q .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
rotateAboutViewCenter
(const
QQuaternion
&
q
)
Rotates the camera about the view center with the use of a Quaternion in q .
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
QQuaternion
QCamera::
rotation
(
float
angle
, const
QVector3D
&
axis
) const
Returns the calculated rotation in relation to the angle in degrees and chosen axis taken in.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[slot]
void
QCamera::
setAspectRatio
(
float
aspectRatio
)
Sets the camera's aspect ratio to aspectRatio .
注意: setter 函数对于特性 aspectRatio .
另请参阅 aspectRatio ().
[slot]
void
QCamera::
setBottom
(
float
bottom
)
Sets the bottom of the camera to bottom .
注意: setter 函数对于特性 bottom .
另请参阅 bottom ().
[slot]
void
QCamera::
setExposure
(
float
exposure
)
Sets the camera's exposure to exposure .
注意: setter 函数对于特性 exposure .
另请参阅 exposure ().
[slot]
void
QCamera::
setFarPlane
(
float
farPlane
)
Sets the camera's far plane to farPlane
注意: setter 函数对于特性 farPlane .
另请参阅 farPlane ().
[slot]
void
QCamera::
setFieldOfView
(
float
fieldOfView
)
Sets the camera's field of view to fieldOfView in degrees.
注意: setter 函数对于特性 fieldOfView .
另请参阅 fieldOfView ().
[slot]
void
QCamera::
setLeft
(
float
left
)
Sets the left of the camera to left .
注意: setter 函数对于特性 left .
另请参阅 left ().
[slot]
void
QCamera::
setNearPlane
(
float
nearPlane
)
Sets the camera's near plane to nearPlane .
注意: setter 函数对于特性 nearPlane .
另请参阅 nearPlane ().
[slot]
void
QCamera::
setPosition
(const
QVector3D
&
position
)
Sets the camera's position in 3D space to position .
注意: setter 函数对于特性 position .
另请参阅 position ().
[slot]
void
QCamera::
setProjectionMatrix
(const
QMatrix4x4
&
projectionMatrix
)
Sets the camera's projection matrix to projectionMatrix .
注意: setter 函数对于特性 projectionMatrix .
另请参阅 projectionMatrix ().
[slot]
void
QCamera::
setProjectionType
(
QCameraLens::ProjectionType
type
)
Sets the camera's projection type to type .
注意: setter 函数对于特性 projectionType .
另请参阅 projectionType ().
[slot]
void
QCamera::
setRight
(
float
right
)
Sets the right of the camera to right .
注意: setter 函数对于特性 right .
另请参阅 right ().
[slot]
void
QCamera::
setTop
(
float
top
)
Sets the top of the camera to top .
注意: setter 函数对于特性 top .
另请参阅 top ().
[slot]
void
QCamera::
setUpVector
(const
QVector3D
&
upVector
)
Sets the camera's up vector to upVector .
注意: setter 函数对于特性 upVector .
另请参阅 upVector ().
[slot]
void
QCamera::
setViewCenter
(const
QVector3D
&
viewCenter
)
Sets the camera's view center to viewCenter .
注意: setter 函数对于特性 viewCenter .
另请参阅 viewCenter ().
[invokable]
void
QCamera::
tilt
(
float
angle
)
Adjusts the tilt angle of the camera by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
tiltAboutViewCenter
(
float
angle
)
Adjusts the camera tilt about view center by angle in degrees.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
QQuaternion
QCamera::
tiltRotation
(
float
angle
) const
Returns the calculated tilt rotation in relation to the angle in degrees taken in to adjust the camera's tilt or up/down rotation on the X axis.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
Returns the camera's position via transform.
注意: Getter function for property transform.
[invokable]
void
QCamera::
translate
(const
QVector3D
&
vLocal
,
Qt3DRender::QCamera::CameraTranslationOption
option
= TranslateViewCenter)
Translates the camera's position and its view vector by vLocal in local coordinates. The option allows for toggling whether the view center should be translated.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[invokable]
void
QCamera::
translateWorld
(const
QVector3D
&
vWorld
,
Qt3DRender::QCamera::CameraTranslationOption
option
= TranslateViewCenter)
Translates the camera's position and its view vector by vWorld in world coordinates. The option allows for toggling whether the view center should be translated.
注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .
[slot]
void
QCamera::
viewAll
()
Rotates and moves the camera so that it's viewCenter is the center of the scene's bounding volume and the entire scene fits in the view port.
注意: Only works if the lens is in perspective or orthographic projection mode.
另请参阅 Qt3D.Render::Camera::projectionType .
[slot]
void
QCamera::
viewEntity
(
Qt3DCore::QEntity
*
entity
)
Rotates and moves the camera so that it's viewCenter is the center of the entity 's bounding volume and the entire entity fits in the view port.
注意: Only works if the lens is in perspective or orthographic projection mode.
另请参阅 Camera.projectionType .
[slot]
void
QCamera::
viewSphere
(const
QVector3D
&
center
,
float
radius
)
Rotates and moves the camera so that it's viewCenter is center and a sphere of radius fits in the view port.
注意: Only works if the lens is in perspective or orthographic projection mode.