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::PickableObject Class Reference

PickableObject provides a way to specify a 'pickable' area. More...

#include <PickableObject.h>

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

Public Member Functions

const ArrayBuffergetGeometryBuffer () const
 Get the geometry buffer assigned to this PickableObject. More...
 
const CameragetCamera () const
 Get the camera currently set to the PickableObject. More...
 
status_t setCamera (const Camera &camera)
 Set the camera to be used to unproject geometry. More...
 
pickableObjectId_t getPickableObjectId () const
 Get the currently set PickableObject's user ID. More...
 
status_t setPickableObjectId (pickableObjectId_t id)
 Set PickableObject's user ID. More...
 
status_t setEnabled (bool enabled)
 Enable/Disable PickableObject. More...
 
bool isEnabled () const
 Get the enabled state of the PickableObject. 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 PickableObjectImpl & 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

 PickableObject (PickableObjectImpl &pimpl)
 Constructor for PickableObject. More...
 
virtual ~PickableObject () override
 Destructor of the PickableObject. More...
 
- 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 PickableObject instances. More...
 

Detailed Description

PickableObject provides a way to specify a 'pickable' area.

The purpose of the PickableObject is to enable user to add 'pickable' components to a scene. When this area is picked (see ramses::RamsesRenderer API) a message is sent to RamsesClient with list of picked objects, these can be dispatched and handled using ramses::IRendererEventHandler::objectsPicked. Geometry specifies a triangle list (see ramses::Scene::createPickableObject for geometry requirements). PickableObject is a ramses::Node and as such can be placed in scene transformation topology, transformations will then be applied accordingly to the geometry when calculating picking. Geometry is defined in 3D coordinates but does not have to be volumetric, in fact when combined with the right camera it can represent a screen space area. In order to create a valid PickableObject it is mandatory to set a Camera. This is needed for the intersection algorithm to determine whether it was picked, the camera is needed to unproject the rasterized triangles. Typically the camera will be same as the one used to render the actual renderable but in some cases it makes sense to have different camera for rendering and picking.

Usage example: we have a Ramses scene with a 3D car made of multiple MeshNodes within a transformation node topology, we want to make the car pickable: 1) Precompute a simplified geometry representation of the car (e.g. a bounding box) so that it can be represented as a single geometry with minimum amount of triangles (reduce overhead of intersection computation). 2) Create a PickableObject with the simplified geometry. 3) Set the PickableObject's parent node to be the 3D car's root node. This way the pickable geometry will always be transformed together with the car. 4) Assign the camera used to render the car to our PickableObject - the pickable geometry was computed from the car's geometry and therefore should use same camera for both rendering and picking.

Examples
ramses-example-local-pick-handling/src/main.cpp.

Constructor & Destructor Documentation

◆ PickableObject()

ramses::PickableObject::PickableObject ( PickableObjectImpl &  pimpl)
explicitprotected

Constructor for PickableObject.

Parameters
pimplInternal data for implementation specifics of PickableObject (sink - instance becomes owner)

◆ ~PickableObject()

virtual ramses::PickableObject::~PickableObject ( )
overrideprotectedvirtual

Destructor of the PickableObject.

Member Function Documentation

◆ getCamera()

const Camera* ramses::PickableObject::getCamera ( ) const

Get the camera currently set to the PickableObject.

Returns
The PickableObject's camera, nullptr if no camera assigned.

◆ getGeometryBuffer()

const ArrayBuffer& ramses::PickableObject::getGeometryBuffer ( ) const

Get the geometry buffer assigned to this PickableObject.

Returns
The geometry buffer.

◆ getPickableObjectId()

pickableObjectId_t ramses::PickableObject::getPickableObjectId ( ) const

Get the currently set PickableObject's user ID.

Returns
The PickableObject's user ID

◆ isEnabled()

bool ramses::PickableObject::isEnabled ( ) const

Get the enabled state of the PickableObject.

Returns
Indicates if the PickableObject is enabled

◆ setCamera()

status_t ramses::PickableObject::setCamera ( const Camera camera)

Set the camera to be used to unproject geometry.

Camera has to be valid (see ramses::PerspectiveCamera or ramses::OrthographicCamera) in order to be assigned to a PickableObject. See ramses::PickableObject for more details.

Parameters
[in]cameraCamera to be used to unproject geometry.
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().
Examples
ramses-example-local-pick-handling/src/main.cpp.

◆ setEnabled()

status_t ramses::PickableObject::setEnabled ( bool  enabled)

Enable/Disable PickableObject.

If a PickableObject is disabled it cannot be picked. PickableObject is enabled when created.

Parameters
[in]enabledThe enable flag which indicates if the PickableObject is enabled
Returns
StatusOK for success, otherwise the returned status can be used to resolve error message using getStatusMessage().

◆ setPickableObjectId()

status_t ramses::PickableObject::setPickableObjectId ( pickableObjectId_t  id)

Set PickableObject's user ID.

Parameters
[in]idUser ID assigned to PickableObject, it will be used in callback ramses::IRendererEventHandler::objectsPicked when this PickableObject is picked.
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 PickableObject instances.

Member Data Documentation

◆ impl

class PickableObjectImpl& ramses::PickableObject::impl

Stores internal data for implementation specifics of PickableObject.


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