- class QCamera#
The
QCamera
class defines a view point through which the scene will be rendered. More…Synopsis#
Properties#
Methods#
def
__init__()
def
aspectRatio()
def
bottom()
def
exposure()
def
farPlane()
def
fieldOfView()
def
left()
def
lens()
def
nearPlane()
def
pan()
def
panRotation()
def
position()
def
projectionType()
def
right()
def
roll()
def
rollRotation()
def
rotate()
def
rotation()
def
tilt()
def
tiltRotation()
def
top()
def
transform()
def
translate()
def
translateWorld()
def
upVector()
def
viewCenter()
def
viewMatrix()
def
viewVector()
Slots#
def
setAspectRatio()
def
setBottom()
def
setExposure()
def
setFarPlane()
def
setFieldOfView()
def
setLeft()
def
setNearPlane()
def
setPosition()
def
setRight()
def
setTop()
def
setUpVector()
def
setViewCenter()
def
viewAll()
def
viewEntity()
def
viewSphere()
Signals#
def
bottomChanged()
def
leftChanged()
def
rightChanged()
def
topChanged()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
- class CameraTranslationOption#
This enum specifies how camera view center is translated
Constant
Description
Qt3DRender.QCamera.TranslateViewCenter
Translate the view center causing the view direction to remain the same
Qt3DRender.QCamera.DontTranslateViewCenter
Don’t translate the view center causing the view direction to change
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property aspectRatioᅟ: float#
Holds the current aspect ratio.
- Access functions:
- property bottomᅟ: float#
Holds the current bottom of the camera.
This property is only relevant when
projectionType
isOrthographicProjection
.- Access functions:
Signal
bottomChanged()
- property exposureᅟ: float#
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.
- Access functions:
- property farPlaneᅟ: float#
Holds the current camera far plane. Objects that are farther from the camera than the farPlane will not be rendered.
- Access functions:
- property fieldOfViewᅟ: float#
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
isPerspectiveProjection
.- Access functions:
- property leftᅟ: float#
Holds the current left of the camera.
This property is only relevant when
projectionType
isOrthographicProjection
.- Access functions:
Signal
leftChanged()
- property lensᅟ: QCameraLens#
Holds the
QCameraLens
component of the camera.- Access functions:
- property nearPlaneᅟ: float#
Holds the current camera near plane. Objects that are closer to the camera than the nearPlane will not be rendered.
- Access functions:
Holds the camera’s position in coordinates relative to the parent entity.
- Access functions:
- property projectionMatrixᅟ: QMatrix4x4#
Holds the current projection matrix of the camera.
- Access functions:
- property projectionTypeᅟ: Qt3DRender.QCameraLens.ProjectionType#
Holds the type of the camera projection. The default value is
PerspectiveProjection
.OrthographicProjection
- Parallel lines appear parallel. Objects appear the same size regardless of distance.PerspectiveProjection
- Parallel lines appear to meet in the distance. Objects appear to shrink the farther they are from the camera.FrustumProjection
CustomProjection
See also
ProjectionType
- Access functions:
- property rightᅟ: float#
Holds the current right of the camera.
This property is only relevant when
projectionType
isOrthographicProjection
.- Access functions:
Signal
rightChanged()
- property topᅟ: float#
Holds the current top of the camera.
This property is only relevant when
projectionType
isOrthographicProjection
.- Access functions:
Signal
topChanged()
- property transformᅟ: QTransform#
Holds the
QTransform
component of the camera.- Access functions:
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.
- Access functions:
Holds the camera’s view center in coordinates relative to the parent entity.
Intuitively, the viewCenter is the location the camera is pointing at.
- Access functions:
- property viewMatrixᅟ: QMatrix4x4#
Holds the camera’s view matrix in coordinates relative to the parent entity.
- Access functions:
Signal
viewMatrixChanged()
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
).- Access functions:
Signal
viewVectorChanged()
- __init__([parent=None])#
- Parameters:
parent –
QNode
Creates a new
QCamera
instance with the specifiedparent
.- aspectRatio()#
- Return type:
float
See also
setAspectRatio()
Getter of property
aspectRatioᅟ
.- aspectRatioChanged(aspectRatio)#
- Parameters:
aspectRatio – float
Notification signal of property
aspectRatioᅟ
.- bottom()#
- Return type:
float
See also
setBottom()
Getter of property
bottomᅟ
.- bottomChanged(bottom)#
- Parameters:
bottom – float
Notification signal of property
bottomᅟ
.- exposure()#
- Return type:
float
See also
setExposure()
Getter of property
exposureᅟ
.- exposureChanged(exposure)#
- Parameters:
exposure – float
Notification signal of property
exposureᅟ
.- farPlane()#
- Return type:
float
See also
setFarPlane()
Getter of property
farPlaneᅟ
.- farPlaneChanged(farPlane)#
- Parameters:
farPlane – float
Notification signal of property
farPlaneᅟ
.- fieldOfView()#
- Return type:
float
See also
setFieldOfView()
Getter of property
fieldOfViewᅟ
.- fieldOfViewChanged(fieldOfView)#
- Parameters:
fieldOfView – float
Notification signal of property
fieldOfViewᅟ
.- left()#
- Return type:
float
See also
setLeft()
Getter of property
leftᅟ
.- leftChanged(left)#
- Parameters:
left – float
Notification signal of property
leftᅟ
.- lens()#
- Return type:
QCameraLens
Returns the current lens.
Getter of property
lensᅟ
.- nearPlane()#
- Return type:
float
See also
setNearPlane()
Getter of property
nearPlaneᅟ
.- nearPlaneChanged(nearPlane)#
- Parameters:
nearPlane – float
Notification signal of property
nearPlaneᅟ
.- pan(angle)#
- Parameters:
angle – float
Adjusts the pan angle of the camera by
angle
in degrees.- pan(angle, axis)
- Parameters:
angle – float
axis –
QVector3D
Adjusts the pan angle of the camera by
angle
in degrees on a chosenaxis
.- panAboutViewCenter(angle)#
- Parameters:
angle – float
Adjusts the camera pan about view center by
angle
in degrees.- panAboutViewCenter(angle, axis)
- Parameters:
angle – float
axis –
QVector3D
Adjusts the camera pan about view center by
angle
in degrees onaxis
.- panRotation(angle)#
- Parameters:
angle – float
- Return type:
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.Getter of property
positionᅟ
.Notification signal of property
positionᅟ
.- projectionMatrix()#
- Return type:
See also
setProjectionMatrix()
Getter of property
projectionMatrixᅟ
.- projectionMatrixChanged(projectionMatrix)#
- Parameters:
projectionMatrix –
QMatrix4x4
Notification signal of property
projectionMatrixᅟ
.- projectionType()#
- Return type:
ProjectionType
See also
setProjectionType()
Getter of property
projectionTypeᅟ
.- projectionTypeChanged(projectionType)#
- Parameters:
projectionType –
ProjectionType
Notification signal of property
projectionTypeᅟ
.- right()#
- Return type:
float
See also
setRight()
Getter of property
rightᅟ
.- rightChanged(right)#
- Parameters:
right – float
Notification signal of property
rightᅟ
.- roll(angle)#
- Parameters:
angle – float
Adjusts the camera roll by
angle
in degrees.- rollAboutViewCenter(angle)#
- Parameters:
angle – float
Adjusts the camera roll about view center by
angle
in degrees.- rollRotation(angle)#
- Parameters:
angle – float
- Return type:
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.- rotate(q)#
- Parameters:
q –
QQuaternion
Rotates the camera with the use of a Quaternion in
q
.- rotateAboutViewCenter(q)#
- Parameters:
q –
QQuaternion
Rotates the camera about the view center with the use of a Quaternion in
q
.Returns the calculated rotation in relation to the
angle
in degrees and chosenaxis
taken in.- setAspectRatio(aspectRatio)#
- Parameters:
aspectRatio – float
Sets the camera’s aspect ratio to
aspectRatio
.See also
aspectRatio()
Setter of property
aspectRatioᅟ
.- setBottom(bottom)#
- Parameters:
bottom – float
Sets the bottom of the camera to
bottom
.See also
bottom()
Setter of property
bottomᅟ
.- setExposure(exposure)#
- Parameters:
exposure – float
Sets the camera’s exposure to
exposure
.See also
exposure()
Setter of property
exposureᅟ
.- setFarPlane(farPlane)#
- Parameters:
farPlane – float
Sets the camera’s far plane to
farPlane
See also
farPlane()
Setter of property
farPlaneᅟ
.- setFieldOfView(fieldOfView)#
- Parameters:
fieldOfView – float
Sets the camera’s field of view to
fieldOfView
in degrees.See also
fieldOfView()
Setter of property
fieldOfViewᅟ
.- setLeft(left)#
- Parameters:
left – float
Sets the left of the camera to
left
.See also
left()
Setter of property
leftᅟ
.- setNearPlane(nearPlane)#
- Parameters:
nearPlane – float
Sets the camera’s near plane to
nearPlane
.See also
nearPlane()
Setter of property
nearPlaneᅟ
.Sets the camera’s position in 3D space to
position
.See also
position()
Setter of property
positionᅟ
.- setProjectionMatrix(projectionMatrix)#
- Parameters:
projectionMatrix –
QMatrix4x4
Sets the camera’s projection matrix to
projectionMatrix
.See also
projectionMatrix()
Setter of property
projectionMatrixᅟ
.- setProjectionType(type)#
- Parameters:
type –
ProjectionType
Sets the camera’s projection type to
type
.See also
projectionType()
Setter of property
projectionTypeᅟ
.- setRight(right)#
- Parameters:
right – float
Sets the right of the camera to
right
.See also
right()
Setter of property
rightᅟ
.- setTop(top)#
- Parameters:
top – float
Sets the top of the camera to
top
.See also
top()
Setter of property
topᅟ
.Sets the camera’s up vector to
upVector
.See also
upVector()
Setter of property
upVectorᅟ
.Sets the camera’s view center to
viewCenter
.See also
viewCenter()
Setter of property
viewCenterᅟ
.- tilt(angle)#
- Parameters:
angle – float
Adjusts the tilt angle of the camera by
angle
in degrees.- tiltAboutViewCenter(angle)#
- Parameters:
angle – float
Adjusts the camera tilt about view center by
angle
in degrees.- tiltRotation(angle)#
- Parameters:
angle – float
- Return type:
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.- top()#
- Return type:
float
See also
setTop()
Getter of property
topᅟ
.- topChanged(top)#
- Parameters:
top – float
Notification signal of property
topᅟ
.- transform()#
- Return type:
QTransform
Returns the camera’s position via transform.
Getter of property
transformᅟ
.- translate(vLocal[, option=Qt3DRender.QCamera.CameraTranslationOption.TranslateViewCenter])#
- Parameters:
vLocal –
QVector3D
option –
CameraTranslationOption
Translates the camera’s position and its view vector by
vLocal
in local coordinates. Theoption
allows for toggling whether the view center should be translated.- translateWorld(vWorld[, option=Qt3DRender.QCamera.CameraTranslationOption.TranslateViewCenter])#
- Parameters:
vWorld –
QVector3D
option –
CameraTranslationOption
Translates the camera’s position and its view vector by
vWorld
in world coordinates. Theoption
allows for toggling whether the view center should be translated.Getter of property
upVectorᅟ
.Notification signal of property
upVectorᅟ
.- 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.Note
Only works if the lens is in perspective or orthographic projection mode.
See also
Getter of property
viewCenterᅟ
.Notification signal of property
viewCenterᅟ
.- viewEntity(entity)#
- Parameters:
entity –
QEntity
Rotates and moves the camera so that it’s
viewCenter
is the center of theentity
's bounding volume and the entire entity fits in the view port.Note
Only works if the lens is in perspective or orthographic projection mode.
See also
- viewMatrix()#
- Return type:
Getter of property
viewMatrixᅟ
.- viewMatrixChanged()#
Notification signal of property
viewMatrixᅟ
.Rotates and moves the camera so that it’s
viewCenter
iscenter
and a sphere ofradius
fits in the view port.Note
Only works if the lens is in perspective or orthographic projection mode.
See also
Getter of property
viewVectorᅟ
.Notification signal of property
viewVectorᅟ
.