RAMSES Documentation  27.0.130
Information for RAMSES users and developers
Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
ramses::Camera Class Reference

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>

Inheritance diagram for ramses::Camera:
[legend]
Collaboration diagram for ramses::Camera:
[legend]

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...
 
- Public Member Functions inherited from ramses::Node
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...
 
NodegetChild (uint32_t index)
 Gets child node at provided index. More...
 
const NodegetChild (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...
 
NodegetParent ()
 Gets parent Node of this Node. More...
 
const NodegetParent () 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...
 
- Public Member Functions inherited from ramses::SceneObject
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...
 
- Public Member Functions inherited from ramses::RamsesObject
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...
 
- Public Member Functions inherited from ramses::StatusObject
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...
 
StatusObjectoperator= (const StatusObject &other)=delete
 Deleted copy assignment. More...
 

Public Attributes

class CameraNodeImpl & impl
 
- Public Attributes inherited from ramses::Node
class NodeImpl & impl
 
- Public Attributes inherited from ramses::SceneObject
class SceneObjectImpl & impl
 
- Public Attributes inherited from ramses::ClientObject
class ClientObjectImpl & impl
 
- Public Attributes inherited from ramses::RamsesObject
class RamsesObjectImpl & impl
 
- Public Attributes inherited from ramses::StatusObject
class StatusObjectImpl & impl
 

Protected Member Functions

 Camera (CameraNodeImpl &pimpl)
 Constructor for Camera. More...
 
virtual ~Camera ()
 
- Protected Member Functions inherited from ramses::Node
 Node (NodeImpl &pimpl)
 Constructor for Node. More...
 
virtual ~Node ()
 Destructor of the Node. More...
 
- Protected Member Functions inherited from ramses::SceneObject
 SceneObject (SceneObjectImpl &pimpl)
 Constructor for SceneObject. More...
 
virtual ~SceneObject ()
 Destructor of the SceneObject. More...
 
- Protected Member Functions inherited from ramses::ClientObject
 ClientObject (ClientObjectImpl &pimpl)
 Constructor for ClientObject. More...
 
virtual ~ClientObject ()
 Destructor of the ClientObject. More...
 
- Protected Member Functions inherited from ramses::RamsesObject
 RamsesObject (RamsesObjectImpl &pimpl)
 Constructor for RamsesObject. More...
 
virtual ~RamsesObject ()
 Destructor of the RamsesObject. More...
 
- Protected Member Functions inherited from ramses::StatusObject
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Camera()

ramses::Camera::Camera ( CameraNodeImpl &  pimpl)
explicitprotected

Constructor for Camera.

Parameters
[in]pimplInternal data for implementation specifics of Camera (sink - instance becomes owner)

◆ ~Camera()

virtual ramses::Camera::~Camera ( )
protectedvirtual

Protected trivial destructor to avoid deleting by user

Member Function Documentation

◆ bindFrustumPlanes()

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.

Parameters
[in]frustumPlanesDataData 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]nearFarPlanesDataData object with 2 floats that will be used as source for frustum planes values. The (x, y) floats represent (near, far) frustum planes.
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

◆ bindViewportOffset()

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.

Parameters
[in]offsetDataData object with 2 integers that will be used as source for viewport offset values
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().
Examples
ramses-example-local-scene-referencing/src/main.cpp, and ramses-example-local-viewport-link/src/main.cpp.

◆ bindViewportSize()

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.

Parameters
[in]sizeDataData object with 2 integers that will be used as source for viewport size values
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().
Examples
ramses-example-local-scene-referencing/src/main.cpp, and ramses-example-local-viewport-link/src/main.cpp.

◆ getBottomPlane()

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.

Returns
the bottom plane of the Camera

◆ getFarPlane()

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.

Returns
the far plane of the Camera

◆ getLeftPlane()

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.

Returns
the left plane of the Camera

◆ getNearPlane()

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.

Returns
the near plane of the Camera

◆ getProjectionMatrix()

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.

Parameters
[out]projectionMatrixWill be filled with the projection matrix 4x4 column-major
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

◆ getRightPlane()

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.

Returns
the right plane of the Camera

◆ getTopPlane()

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.

Returns
the top plane of the Camera

◆ getViewportHeight()

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.

Returns
viewport height in pixels

◆ getViewportWidth()

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.

Returns
viewport width in pixels

◆ getViewportX()

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.

Returns
horizontal offset of the viewport in pixels

◆ getViewportY()

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.

Returns
vertical offset of the viewport in pixels

◆ isFrustumPlanesBound()

bool ramses::Camera::isFrustumPlanesBound ( ) const

Checks if there is a ramses::DataObject bound to viewport size (see bindFrustumPlanes).

Returns
True if there is any ramses::DataObject bound, false otherwise.

◆ isViewportOffsetBound()

bool ramses::Camera::isViewportOffsetBound ( ) const

Checks if there is a ramses::DataObject bound to viewport offset (see bindViewportOffset).

Returns
True if there is any ramses::DataObject bound, false otherwise.

◆ isViewportSizeBound()

bool ramses::Camera::isViewportSizeBound ( ) const

Checks if there is a ramses::DataObject bound to viewport size (see bindViewportSize).

Returns
True if there is any ramses::DataObject bound, false otherwise.

◆ setFrustum()

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.

Parameters
[in]leftPlaneLeft plane of the camera frustum. Left opening angle if camera is perspective.
[in]rightPlaneRight plane of the camera frustum. Right opening angle if camera is perspective.
[in]bottomPlaneBottom plane of the camera frustum. Bottom opening angle if camera is perspective.
[in]topPlaneTop plane of the camera frustum. Top opening angle if camera is perspective.
[in]nearPlaneNear plane of the camera frustum.
[in]farPlaneFar plane of the camera frustum.
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().
Examples
ramses-example-basic-renderpasses/src/main.cpp, ramses-example-local-client-dcsm/src/main.cpp, ramses-example-local-dma-offscreenbuffer/src/main.cpp, ramses-example-local-offscreenbuffer/src/main.cpp, ramses-example-local-pick-handling/src/main.cpp, ramses-example-text-basic/src/main.cpp, and ramses-example-text-languages/src/main.cpp.

◆ setViewport()

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].

Parameters
[in]xhorizontal offset of the viewport rectangle in pixels (zero = leftmost pixel)
[in]yvertical offset of the viewport rectangle in pixels (zero = bottommost pixel)
[in]widthhorizontal size of the viewport rectangle in pixels (min 1, max 32768)
[in]heightvertical size of the viewport rectangle in pixels (min 1, max 32768)
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().
Examples
ramses-example-basic-animation-realtime/src/main.cpp, ramses-example-basic-animation/src/main.cpp, ramses-example-basic-blending/src/main.cpp, ramses-example-basic-compositing/src/main.cpp, ramses-example-basic-effect-from-glsl/src/main.cpp, ramses-example-basic-file-loading/src/main.cpp, ramses-example-basic-geometry/src/main.cpp, ramses-example-basic-rendergroups/src/main.cpp, ramses-example-basic-renderpasses/src/main.cpp, ramses-example-basic-rendertarget/src/main.cpp, ramses-example-basic-scenegraph/src/main.cpp, ramses-example-basic-texturing/src/main.cpp, ramses-example-data-buffers-texture/src/main.cpp, ramses-example-data-buffers-vertices/src/main.cpp, ramses-example-geometry-instancing/src/main.cpp, ramses-example-interleaved-vertex-buffers/src/main.cpp, ramses-example-local-client-dcsm/src/main.cpp, ramses-example-local-client/src/main.cpp, ramses-example-local-datalink/src/main.cpp, ramses-example-local-displays/src/main.cpp, ramses-example-local-dma-offscreenbuffer/src/main.cpp, ramses-example-local-geometry-shaders/src/main.cpp, ramses-example-local-offscreenbuffer/src/main.cpp, ramses-example-local-pick-handling/src/main.cpp, ramses-example-renderonce/src/main.cpp, ramses-example-text-basic/src/main.cpp, and ramses-example-text-languages/src/main.cpp.

◆ unbindFrustumPlanes()

status_t ramses::Camera::unbindFrustumPlanes ( )

Unbinds any bound ramses::DataObject from frustum planes (see bindFrustumPlanes). Does nothing if no ramses::DataObject bound.

Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

◆ unbindViewportOffset()

status_t ramses::Camera::unbindViewportOffset ( )

Unbinds any bound ramses::DataObject from viewport offset (see bindViewportOffset). Does nothing if no ramses::DataObject bound.

Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

◆ unbindViewportSize()

status_t ramses::Camera::unbindViewportSize ( )

Unbinds any bound ramses::DataObject from viewport size (see bindViewportSize). Does nothing if no ramses::DataObject bound.

Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

Friends And Related Function Documentation

◆ SceneImpl

friend class SceneImpl
friend

Scene is the factory for creating Camera instances.

Member Data Documentation

◆ impl

class CameraNodeImpl& ramses::Camera::impl

Stores internal data for implementation specifics of Camera.


The documentation for this class was generated from the following file: