![]() |
RAMSES Documentation
27.0.130
Information for RAMSES users and developers
|
The PerspectiveCamera is a local camera which defines a perspective view into the scene. More...
#include <PerspectiveCamera.h>
Public Member Functions | |
status_t | setFrustum (float fov, float aspectRatio, float nearPlane, float farPlane) |
An alternative method (see ramses::Camera::setFrustum) to set the perspective view frustum of the camera by providing opening angle and aspect ratio. More... | |
float | getVerticalFieldOfView () const |
Gets the vertical field of view opening angle in degrees. More... | |
float | getAspectRatio () const |
Gets the aspect ratio between camera frustum width and height (set via setFrustum, not viewport). More... | |
status_t | setFrustum (float leftPlane, float rightPlane, float bottomPlane, float topPlane, float nearPlane, float farPlane) |
Sets camera frustum planes of the Camera. More... | |
![]() | |
status_t | setFrustum (float leftPlane, float rightPlane, float bottomPlane, float topPlane, float nearPlane, float farPlane) |
Sets camera frustum planes of the Camera. More... | |
status_t | setViewport (int32_t x, int32_t y, uint32_t width, uint32_t height) |
Sets the viewport to be used when rendering with this camera. More... | |
int32_t | getViewportX () const |
Returns the horizontal offset of the viewport in pixels relative to lower left corner of destination render buffer. More... | |
int32_t | getViewportY () const |
Returns the vertical offset of the viewport in pixels relative to lower left corner of destination render buffer. More... | |
uint32_t | getViewportWidth () const |
Returns the viewport width in pixels. More... | |
uint32_t | getViewportHeight () const |
Returns the viewport height in pixels. More... | |
float | getLeftPlane () const |
Returns the left plane of the camera frustum. More... | |
float | getRightPlane () const |
Returns the right plane of the camera frustum. More... | |
float | getBottomPlane () const |
Returns the bottom plane of the camera frustum. More... | |
float | getTopPlane () const |
Returns the top plane of the camera frustum. More... | |
float | getNearPlane () const |
Returns the near plane of the camera frustum. More... | |
float | getFarPlane () const |
Returns the far plane of the camera frustum. More... | |
status_t | getProjectionMatrix (float(&projectionMatrix)[16]) const |
Gets projection matrix based on camera parameters. Projection matrix can only be retrieved after all parameters were set and are valid. More... | |
status_t | bindViewportOffset (const DataVector2i &offsetData) |
Binds a ramses::DataObject to be used as source for viewport offset values. More... | |
status_t | bindViewportSize (const DataVector2i &sizeData) |
Binds a ramses::DataObject to be used as source for viewport size values. More... | |
status_t | bindFrustumPlanes (const DataVector4f &frustumPlanesData, const DataVector2f &nearFarPlanesData) |
Binds ramses::DataObject to be used as source for frustum planes values. More... | |
status_t | unbindViewportOffset () |
Unbinds any bound ramses::DataObject from viewport offset (see bindViewportOffset). Does nothing if no ramses::DataObject bound. More... | |
status_t | unbindViewportSize () |
Unbinds any bound ramses::DataObject from viewport size (see bindViewportSize). Does nothing if no ramses::DataObject bound. More... | |
status_t | unbindFrustumPlanes () |
Unbinds any bound ramses::DataObject from frustum planes (see bindFrustumPlanes). Does nothing if no ramses::DataObject bound. More... | |
bool | isViewportOffsetBound () const |
Checks if there is a ramses::DataObject bound to viewport offset (see bindViewportOffset). More... | |
bool | isViewportSizeBound () const |
Checks if there is a ramses::DataObject bound to viewport size (see bindViewportSize). More... | |
bool | isFrustumPlanesBound () const |
Checks if there is a ramses::DataObject bound to viewport size (see bindFrustumPlanes). More... | |
![]() | |
bool | hasChild () const |
Returns if node has at least one child Node. More... | |
uint32_t | getChildCount () const |
Gets the number of child Nodes of this node. More... | |
Node * | getChild (uint32_t index) |
Gets child node at provided index. More... | |
const Node * | getChild (uint32_t index) const |
Gets child node at provided index. More... | |
status_t | addChild (Node &node) |
Adds child Node to this node. More... | |
status_t | removeChild (Node &node) |
Removes a child Node from this node. More... | |
status_t | removeAllChildren () |
Removes all child Nodes from this node. More... | |
bool | hasParent () const |
Returns if Node has a parent Node. More... | |
Node * | getParent () |
Gets parent Node of this Node. More... | |
const Node * | getParent () const |
Gets parent Node of this Node. More... | |
status_t | setParent (Node &node) |
Sets parent Node for this node. More... | |
status_t | removeParent () |
Removes the parent Node from this Node. More... | |
status_t | getModelMatrix (float(&modelMatrix)[16]) const |
Gets model (world in scene space) matrix computed from the scene graph. Performance note: this call will cause computation of a transformation chain, however the result is cached therefore subsequent calls will have little to none performance overhead as long as topology or transformation in the chain does not change. More... | |
status_t | getInverseModelMatrix (float(&inverseModelMatrix)[16]) const |
Gets inverse model (world in scene space) matrix computed from the scene graph. Performance note: this call will cause computation of a transformation chain, however the result is cached therefore subsequent calls will have little to none performance overhead as long as topology or transformation in the chain does not change. More... | |
status_t | rotate (float x, float y, float z) |
Rotates in all three directions with the given values without affecting the currently set rotation convention. More... | |
status_t | setRotation (float x, float y, float z) |
Sets the absolute rotation in all three directions for left-handed rotation using Euler ZYX rotation convention. If this function is used to set, then only ramses::Node::getRotation(float&,float&,float&)const can be used to get node rotation, which implicitly uses left-handed Euler ZYX rotation convention. More... | |
status_t | setRotation (float x, float y, float z, ERotationConvention rotationConvention) |
Sets the absolute rotation in all three directions for right-handed rotation using the chosen Euler angles rotation convention. If this function is used to set, then only ramses::Node::getRotation(float&,float&,float&,ERotationConvention&)const can be used to get node rotation. More... | |
status_t | getRotation (float &x, float &y, float &z) const |
Retrieves the absolute rotation for left-handed rotation using Euler ZYX rotation convention. More... | |
status_t | getRotation (float &x, float &y, float &z, ERotationConvention &rotationConvention) const |
Retrieves the absolute rotation for right-handed rotation in all three directions and the used Euler angles rotation convention. This function can be used only if ramses::Node::setRotation(float,float,float,ERotationConvention) is used to set node rotation. More... | |
status_t | translate (float x, float y, float z) |
Translates in all three directions with the given values. More... | |
status_t | setTranslation (float x, float y, float z) |
Sets the absolute translation the absolute values. More... | |
status_t | getTranslation (float &x, float &y, float &z) const |
Retrieves the current absolute translation. More... | |
status_t | scale (float x, float y, float z) |
Scales in all three directions with the given values. More... | |
status_t | setScaling (float x, float y, float z) |
Sets the absolute scale in all three dimensions. More... | |
status_t | getScaling (float &x, float &y, float &z) const |
Retrieves the current absolute scale in all three dimensions. More... | |
status_t | setVisibility (EVisibilityMode mode) |
Sets the visibility of the Node. Visibility of a node determines if a renderable is rendered or not and if its resources are loaded. See EVisibilityMode for more details. Those attributes are propagated down to the node's children recursively. A node can only be rendered, if none of its parents are Invisible or Off, the node's resources are only loaded if none of its parents are Off. More... | |
EVisibilityMode | getVisibility () const |
Gets the visibility property of the Node. This is just the visibility state of this node object, NOT the hierarchically accumulated visibility of its parents. More... | |
![]() | |
sceneObjectId_t | getSceneObjectId () const |
Returns scene object id which is automatically assigned at creation time of object and is unique within scope of one scene. More... | |
sceneId_t | getSceneId () const |
Returns sceneid to which this object belongs to. More... | |
![]() | |
const char * | getName () const |
Returns the name of the object. More... | |
status_t | setName (const char *name) |
Changes the name of the object. More... | |
ERamsesObjectType | getType () const |
Gets type of the object. More... | |
bool | isOfType (ERamsesObjectType type) const |
Checks if the object is of given type. More... | |
![]() | |
status_t | validate () const |
Generates verbose validation of the object. More... | |
const char * | getValidationReport (EValidationSeverity minSeverity=EValidationSeverity_Info) const |
Provides verbose report in human readable form generated by validate. More... | |
const char * | getStatusMessage (status_t status) const |
Get the string description for a status provided by a RAMSES API function. More... | |
StatusObject (const StatusObject &other)=delete | |
Deleted copy constructor. More... | |
StatusObject & | operator= (const StatusObject &other)=delete |
Deleted copy assignment. More... | |
Protected Member Functions | |
PerspectiveCamera (CameraNodeImpl &pimpl) | |
Constructor for PerspectiveCamera. More... | |
virtual | ~PerspectiveCamera () |
![]() | |
Camera (CameraNodeImpl &pimpl) | |
Constructor for Camera. More... | |
virtual | ~Camera () |
![]() | |
Node (NodeImpl &pimpl) | |
Constructor for Node. More... | |
virtual | ~Node () |
Destructor of the Node. More... | |
![]() | |
SceneObject (SceneObjectImpl &pimpl) | |
Constructor for SceneObject. More... | |
virtual | ~SceneObject () |
Destructor of the SceneObject. More... | |
![]() | |
ClientObject (ClientObjectImpl &pimpl) | |
Constructor for ClientObject. More... | |
virtual | ~ClientObject () |
Destructor of the ClientObject. More... | |
![]() | |
RamsesObject (RamsesObjectImpl &pimpl) | |
Constructor for RamsesObject. More... | |
virtual | ~RamsesObject () |
Destructor of the RamsesObject. More... | |
![]() | |
StatusObject (StatusObjectImpl &pimpl) | |
Constructor for StatusObject. More... | |
virtual | ~StatusObject () |
Destructor of the StatusObject. More... | |
Friends | |
class | SceneImpl |
Scene is the factory for creating PerspectiveCamera instances. More... | |
Additional Inherited Members | |
![]() | |
class CameraNodeImpl & | impl |
![]() | |
class NodeImpl & | impl |
![]() | |
class SceneObjectImpl & | impl |
![]() | |
class ClientObjectImpl & | impl |
![]() | |
class RamsesObjectImpl & | impl |
![]() | |
class StatusObjectImpl & | impl |
The PerspectiveCamera is a local camera which defines a perspective view into the scene.
A valid camera for rendering must have viewport and frustum set. Frustum planes can be set using ramses::Camera::setFrustum or ramses::PerspectiveCamera::setFrustum, depending if input is concrete frustum planes or field of view and aspect ratio.
|
explicitprotected |
Constructor for PerspectiveCamera.
[in] | pimpl | Internal data for implementation specifics of PerspectiveCamera (sink - instance becomes owner) |
|
protectedvirtual |
Protected trivial destructor to avoid deleting by user
float ramses::PerspectiveCamera::getAspectRatio | ( | ) | const |
Gets the aspect ratio between camera frustum width and height (set via setFrustum, not viewport).
If frustum planes data is bound (ramses::Camera::bindFrustumPlanes) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setFrustum.
float ramses::PerspectiveCamera::getVerticalFieldOfView | ( | ) | const |
Gets the vertical field of view opening angle in degrees.
If frustum planes data is bound (ramses::Camera::bindFrustumPlanes) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setFrustum.
status_t ramses::PerspectiveCamera::setFrustum | ( | float | fov, |
float | aspectRatio, | ||
float | nearPlane, | ||
float | farPlane | ||
) |
An alternative method (see ramses::Camera::setFrustum) to set the perspective view frustum of the camera by providing opening angle and aspect ratio.
When using this method the field of view and aspect ratio are internally converted to six frustum planes, therefore this is just a convenience wrapper for ramses::Camera::setFrustum.
Important note: if frustum planes data is bound (see ramses::Camera::bindFrustumPlanes) the values set here will not be effective until unbound again, bound values are always overridden by values from bound data object. Bound values can only be modified via the ramses::DataObject bound to them. See ramses::RamsesUtils::SetPerspectiveCameraFrustumToDataObjects providing way to conveniently set perspective frustum on data objects also with basic validity checking.
[in] | fov | The vertical field of view to be set, must be > 0. This is the full vertical opening angle in degrees. |
[in] | aspectRatio | Ratio between frustum width and height, must be > 0. This value is generally independent from the viewport width and height but typically matches the viewport aspect ratio. |
[in] | nearPlane | Near plane of the camera frustum, must be > 0. |
[in] | farPlane | Far plane of the camera frustum, must be > nearPlane. |
status_t ramses::Camera::setFrustum |
Sets camera frustum planes of the Camera.
It is mandatory to set frustum planes using either this method or ramses::PerspectiveCamera::setFrustum in order to have a valid camera for rendering.
In order to set valid frustum, all these must be true: leftPlane < rightPlane & bottomPlane < topPlane & 0 < nearPlane < farPlane.
Important note: if frustum planes data is bound (see bindFrustumPlanes) the values set here will not be effective until unbound again, bound values are always overridden by values from bound data object. Bound values can only be modified via the ramses::DataObject bound to them.
[in] | leftPlane | Left plane of the camera frustum. Left opening angle if camera is perspective. |
[in] | rightPlane | Right plane of the camera frustum. Right opening angle if camera is perspective. |
[in] | bottomPlane | Bottom plane of the camera frustum. Bottom opening angle if camera is perspective. |
[in] | topPlane | Top plane of the camera frustum. Top opening angle if camera is perspective. |
[in] | nearPlane | Near plane of the camera frustum. |
[in] | farPlane | Far plane of the camera frustum. |
|
friend |
Scene is the factory for creating PerspectiveCamera instances.