RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Attributes | List of all members
Drawable Class Reference

Abstract base class for all drawable classes. More...

#include <Drawable.hpp>

Inherits DrawableNode.

Public Types

typedef rw::core::Ptr< DrawablePtr
 smart pointer type to this class
 
- Public Types inherited from DrawableNode
enum  DrawableTypeMask {
  Physical = 1 , Virtual = 2 , DrawableObject = 4 , CollisionObject = 8 ,
  User1 = 1024 , User2 = 2048 , User3 = 4096 , User4 = 8096 ,
  ALL = 0x7FFFFFFF
}
 draw mask is used to filter which drawables to exclude from rendering. More...
 
enum  DrawType { SOLID , WIRE , OUTLINE }
 when calling render on the draw mode or type can be specified. More...
 
typedef rw::core::Ptr< DrawableNodePtr
 smart pointer type to this class
 
- Public Types inherited from SceneNode
enum  AddPolicy { Front , Back }
 Policy for adding parent nodes. More...
 
enum  NodeType { GroupType = 0 , CameraType , DrawableType , UserBeginType = 1024 }
 Node types. More...
 
typedef rw::core::Ptr< SceneNodePtr
 Smart pointer type for SceneNode.
 
typedef std::list< SceneNode::PtrNodeList
 Type for the list of nodes.
 
typedef const std::list< SceneNode::PtrNodeListConst
 Type for a const list of nodes.
 

Public Member Functions

 Drawable (const std::string &name, unsigned int dmask=Physical)
 draw mask is used to filter which drawables to exclude from rendering. More...
 
 Drawable (rw::core::Ptr< rw::graphics::Render > render, const std::string &name="", unsigned int dmask=DrawableObject)
 Constructer for Drawable. More...
 
virtual ~Drawable ()
 Virtual destructor.
 
virtual void draw (const rw::graphics::DrawableNode::RenderInfo &info=RenderInfo()) const
 draws the object.
 
void setHighlighted (bool b)
 enables or disables highlighting of the drawable class More...
 
bool isHighlighted () const
 Returns whether the Drawable is highlighted. More...
 
void setDrawType (rw::graphics::DrawableNode::DrawType drawType)
 Sets the DrawType. More...
 
void setTransparency (float alpha)
 Sets up the color alpha value. More...
 
float getTransparency ()
 Gets the color alpha value. More...
 
void setScale (float scale)
 Specifies the scale of the object. More...
 
float getScale () const
 gets the scale of the object More...
 
void setVisible (bool enable)
 enable or disable this drawable. When disabled the drawable will not render anything.
 
bool isVisible ()
 checks if this drawable is enabled
 
const rw::math::Transform3DgetTransform () const
 gets the transformation of the drawable object More...
 
void setTransform (const rw::math::Transform3D<> &t3d)
 Sets the transformation of the drawable object. More...
 
void setMask (unsigned int mask)
 the group(s) that this drawable belong to More...
 
unsigned int getMask () const
 Get the rendering groups that this drawable belongs to. More...
 
std::vector< rw::core::Ptr< rw::graphics::Render > > getRenders () const
 Get this drawables Render object.
 
void addRender (rw::core::Ptr< rw::graphics::Render > render)
 Add a render to this drawable. More...
 
- Public Member Functions inherited from DrawableNode
virtual ~DrawableNode ()
 Destructor.
 
bool isTransparent ()
 Check if node is transparent. More...
 
DrawableNodeasDrawableNode ()
 Get a pointer to a DrawableNode, if this is a DrawableNode. More...
 
- Public Member Functions inherited from SceneNode
virtual ~SceneNode ()
 Destructor.
 
void addParent (SceneNode::Ptr node, AddPolicy policy=Back)
 Add a parent node. More...
 
bool hasParent (SceneNode::Ptr parent)
 Check if the given node is a parent node. More...
 
void removeParent (SceneNode::Ptr node)
 erases the parent from the parent list. More...
 
virtual GroupNodeasGroupNode ()
 Get a pointer to a GroupNode, if this is a GroupNode. More...
 
virtual SceneCameraasCameraNode ()
 Get a pointer to a CameraNode, if this is a CameraNode. More...
 
int getType ()
 Get the NodeType. More...
 
const std::string & getName ()
 Get the name of the node. More...
 
void setName (const std::string &name)
 Set the name of this node. More...
 

Protected Attributes

std::vector< rw::core::Ptr< rw::graphics::Render > > _renders
 constructor More...
 
rw::graphics::DrawableNode::DrawType _drawType
 drawType specified how the Drawable should be visualized
 
float _alpha
 alpha represents the color alpha value for which, \( 0.0 \) corresponds to fully transparent and \(1.0\) to completely solid. Default is \(1.0\).
 
bool _highlighted
 highlighted specifies whether the drawable should be highlighted. Default is false
 
float _scale
 The scale of the object.
 
bool _enable
 True if drawable is enabled/visible, false otherwise.
 
rw::math::Transform3D _t3d
 The transformation that is applied to the drawable object.
 

Additional Inherited Members

- Static Public Member Functions inherited from SceneNode
static void removeParent (SceneNode::Ptr node, SceneNode::Ptr parent)
 Remove a parent node. More...
 
- Public Attributes inherited from SceneNode
std::string _name
 The name of the node.
 
std::list< SceneNode::Ptr_parentNodes
 The list of parent nodes.
 
int _type
 The NodeType.
 
- Protected Member Functions inherited from DrawableNode
 DrawableNode (const std::string &name)
 constructor
 
- Protected Member Functions inherited from SceneNode
 SceneNode (const std::string &name, int type)
 Construct new scene node. More...
 

Detailed Description

Abstract base class for all drawable classes.

Classes that are able to draw them self, may inherit from this class.

The drawable class use a draw mask to distinguish between different groups to draw. E.g. when taking snapshots with a simulated camera virtual objects such as the red laser vector or the lines showing the camera view angle is should not be renered. Hence objects that are virtual should be set to virtual.

A call to draw enabling Physical and User1 defined objects look like:

drawable->draw(Drawable::Physical | Drawable::User1);
@ User1
An object that is also a CollisionObject.
Definition: DrawableNode.hpp:74

Constructor & Destructor Documentation

◆ Drawable() [1/2]

Drawable ( const std::string &  name,
unsigned int  dmask = Physical 
)

draw mask is used to filter which drawables to exclude from rendering.

typedef enum{Physical=1, //! A physical object in the scene Virtual=2, //! A virtual object, e.g. lines showing camera view angle DrawableObject=4,//! An object that is "just" a drawable CollisionObject=8, //! An object that is also a CollisionObject User1=1024, //! User defined group 1... User2=2048,//!< User2 User3=4096,//!< User3 User4=8096, //!< User4 ALL=0xFFFFFFFF } DrawableTypeMask;

Constructer for Drawable

Parameters
name[in] Name of drawable
dmask[in] Type of the Drawable. Default value is Physical

◆ Drawable() [2/2]

Drawable ( rw::core::Ptr< rw::graphics::Render render,
const std::string &  name = "",
unsigned int  dmask = DrawableObject 
)

Constructer for Drawable.

Parameters
render[in] Render to be used by the drawable
name[in] Name of drawable
dmask[in] Type of the Drawable. Default value is Physical

Member Function Documentation

◆ addRender()

void addRender ( rw::core::Ptr< rw::graphics::Render render)
inline

Add a render to this drawable.

Parameters
render[in] the render.

◆ getMask()

unsigned int getMask ( ) const
inlinevirtual

Get the rendering groups that this drawable belongs to.

Returns
the drawable type mask (see DrawableNode::DrawableTypeMask).

Implements DrawableNode.

◆ getScale()

float getScale ( ) const
virtual

gets the scale of the object

Returns
scale [in] the scale

Implements DrawableNode.

◆ getTransform()

const rw::math::Transform3D& getTransform ( ) const
virtual

gets the transformation of the drawable object

Returns
transform of the drawable object

Implements DrawableNode.

◆ getTransparency()

float getTransparency ( )
virtual

Gets the color alpha value.

Returns
alpha value in the interval \( [0.0;1.0] \)

Implements DrawableNode.

◆ isHighlighted()

bool isHighlighted ( ) const
virtual

Returns whether the Drawable is highlighted.

Returns
true/false

Implements DrawableNode.

◆ setDrawType()

void setDrawType ( rw::graphics::DrawableNode::DrawType  drawType)
virtual

Sets the DrawType.

Parameters
drawType[in] the DrawType to be used

Implements DrawableNode.

◆ setHighlighted()

void setHighlighted ( bool  b)
virtual

enables or disables highlighting of the drawable class

Parameters
b[in] a if true highlight is enabled if false disabled

Implements DrawableNode.

◆ setMask()

void setMask ( unsigned int  mask)
inlinevirtual

the group(s) that this drawable belong to

Parameters
mask[in] drawable mask

Implements DrawableNode.

◆ setScale()

void setScale ( float  scale)
virtual

Specifies the scale of the object.

Parameters
scale[in] the scale

Implements DrawableNode.

◆ setTransform()

void setTransform ( const rw::math::Transform3D<> &  t3d)
virtual

Sets the transformation of the drawable object.

Parameters
t3d[in] transform of drawable object

Implements DrawableNode.

◆ setTransparency()

void setTransparency ( float  alpha)
virtual

Sets up the color alpha value.

Parameters
alpha[in] \( 0.0 \) corresponds to fully transparent and \(1.0\) to completely solid.

Implements DrawableNode.

Member Data Documentation

◆ _renders

std::vector<rw::core::Ptr<rw::graphics::Render> > _renders
protected

constructor

The renderer that is used to render and draw the drawable


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