![]() |
RAMSES Documentation
27.0.130
Information for RAMSES users and developers
|
The Camera base class is part of a scene and defines a view into the scene defined by the client application. It is also a Node with transformation. More...
#include <Camera.h>
Public Member Functions | |
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... | |
Public Attributes | |
class CameraNodeImpl & | impl |
![]() | |
class NodeImpl & | impl |
![]() | |
class SceneObjectImpl & | impl |
![]() | |
class ClientObjectImpl & | impl |
![]() | |
class RamsesObjectImpl & | impl |
![]() | |
class StatusObjectImpl & | impl |
Protected Member Functions | |
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 Camera instances. More... | |
The Camera base class is part of a scene and defines a view into the scene defined by the client application. It is also a Node with transformation.
A valid camera for rendering must have viewport and frustum set.
|
explicitprotected |
|
protectedvirtual |
Protected trivial destructor to avoid deleting by user
status_t ramses::Camera::bindFrustumPlanes | ( | const DataVector4f & | frustumPlanesData, |
const DataVector2f & | nearFarPlanesData | ||
) |
Binds ramses::DataObject to be used as source for frustum planes values.
In addition to setFrustum (alternatively ramses::PerspectiveCamera::setFrustum), which sets frustum planes directly, a ramses::DataVector4f can be bound to provide values for left, right, bottom, top planes and a ramses::DataVector2f for near and far planes. When a ramses::DataObject is bound the values from it override those set using setFrustum, see ramses::DataObject for possible use cases. See ramses::RamsesUtils::SetPerspectiveCameraFrustumToDataObjects providing way to conveniently set perspective frustum on data objects also with basic validity checking.
[in] | frustumPlanesData | Data object with 4 floats that will be used as source for frustum planes values. The (x, y, z, w) floats represent (left, right, bottom, top) frustum planes. |
[in] | nearFarPlanesData | Data object with 2 floats that will be used as source for frustum planes values. The (x, y) floats represent (near, far) frustum planes. |
status_t ramses::Camera::bindViewportOffset | ( | const DataVector2i & | offsetData | ) |
Binds a ramses::DataObject to be used as source for viewport offset values.
In addition to setViewport, which sets viewport parameters directly, a ramses::DataVector2i can be bound to viewport offset and size. When a ramses::DataObject is bound the values from it override those set using setViewport, see ramses::DataObject for possible use cases.
[in] | offsetData | Data object with 2 integers that will be used as source for viewport offset values |
status_t ramses::Camera::bindViewportSize | ( | const DataVector2i & | sizeData | ) |
Binds a ramses::DataObject to be used as source for viewport size values.
In addition to setViewport, which sets viewport parameters directly, a ramses::DataVector2i can be bound to viewport offset and size. When a ramses::DataObject is bound the values from it override those set using setViewport, see ramses::DataObject for possible use cases.
[in] | sizeData | Data object with 2 integers that will be used as source for viewport size values |
float ramses::Camera::getBottomPlane | ( | ) | const |
Returns the bottom plane of the camera frustum.
If frustum planes data is bound (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::Camera::getFarPlane | ( | ) | const |
Returns the far plane of the camera frustum.
If frustum planes data is bound (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::Camera::getLeftPlane | ( | ) | const |
Returns the left plane of the camera frustum.
If frustum planes data is bound (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::Camera::getNearPlane | ( | ) | const |
Returns the near plane of the camera frustum.
If frustum planes data is bound (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::Camera::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.
[out] | projectionMatrix | Will be filled with the projection matrix 4x4 column-major |
float ramses::Camera::getRightPlane | ( | ) | const |
Returns the right plane of the camera frustum.
If frustum planes data is bound (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::Camera::getTopPlane | ( | ) | const |
Returns the top plane of the camera frustum.
If frustum planes data is bound (bindFrustumPlanes) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setFrustum.
uint32_t ramses::Camera::getViewportHeight | ( | ) | const |
Returns the viewport height in pixels.
If viewport data is bound (bindViewportSize) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setViewport.
uint32_t ramses::Camera::getViewportWidth | ( | ) | const |
Returns the viewport width in pixels.
If viewport data is bound (bindViewportSize) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setViewport.
int32_t ramses::Camera::getViewportX | ( | ) | const |
Returns the horizontal offset of the viewport in pixels relative to lower left corner of destination render buffer.
If viewport data is bound (bindViewportOffset) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setViewport.
int32_t ramses::Camera::getViewportY | ( | ) | const |
Returns the vertical offset of the viewport in pixels relative to lower left corner of destination render buffer.
If viewport data is bound (bindViewportOffset) the value returned here represents the effective value used, i.e. the one from bound ramses::DataObject, not the one set via setViewport.
bool ramses::Camera::isFrustumPlanesBound | ( | ) | const |
Checks if there is a ramses::DataObject bound to viewport size (see bindFrustumPlanes).
bool ramses::Camera::isViewportOffsetBound | ( | ) | const |
Checks if there is a ramses::DataObject bound to viewport offset (see bindViewportOffset).
bool ramses::Camera::isViewportSizeBound | ( | ) | const |
Checks if there is a ramses::DataObject bound to viewport size (see bindViewportSize).
status_t ramses::Camera::setFrustum | ( | float | leftPlane, |
float | rightPlane, | ||
float | bottomPlane, | ||
float | topPlane, | ||
float | nearPlane, | ||
float | farPlane | ||
) |
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. |
status_t ramses::Camera::setViewport | ( | int32_t | x, |
int32_t | y, | ||
uint32_t | width, | ||
uint32_t | height | ||
) |
Sets the viewport to be used when rendering with this camera.
The viewport size does not have to match the size of the destination render buffer (ramses::RenderTarget or display's framebuffer). However when the size matches, the projected camera frustum will fill destination buffer fully. The viewport is aligned with the lower left corner of the destination render buffer.
Important note: if viewport data is bound (see bindViewportOffset or bindViewportSize) the value 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.
The viewport position (x
and y
) are relative offsets to the destination render buffer's lower left pixel. The viewport size (width
and height
) must be positive numbers in the range [1, 32768].
[in] | x | horizontal offset of the viewport rectangle in pixels (zero = leftmost pixel) |
[in] | y | vertical offset of the viewport rectangle in pixels (zero = bottommost pixel) |
[in] | width | horizontal size of the viewport rectangle in pixels (min 1, max 32768) |
[in] | height | vertical size of the viewport rectangle in pixels (min 1, max 32768) |
status_t ramses::Camera::unbindFrustumPlanes | ( | ) |
Unbinds any bound ramses::DataObject from frustum planes (see bindFrustumPlanes). Does nothing if no ramses::DataObject bound.
status_t ramses::Camera::unbindViewportOffset | ( | ) |
Unbinds any bound ramses::DataObject from viewport offset (see bindViewportOffset). Does nothing if no ramses::DataObject bound.
status_t ramses::Camera::unbindViewportSize | ( | ) |
Unbinds any bound ramses::DataObject from viewport size (see bindViewportSize). Does nothing if no ramses::DataObject bound.
class CameraNodeImpl& ramses::Camera::impl |
Stores internal data for implementation specifics of Camera.