RobWorkProject
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
DrawableNode Class Referenceabstract

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

#include <DrawableNode.hpp>

Inherits SceneNode.

Inherited by DrawableGeometryNode, DrawableNodeClone, and Drawable.

Classes

struct  RenderInfo
 Information for rendering. More...
 

Public Types

enum  DrawableTypeMask {
  Physical =1, Virtual =2, DrawableObject =4, CollisionObject =8,
  User1 =1024, User2 =2048, User3 =4096, User4 =8096,
  ALL =0xFFFFFFFF
}
 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::common::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::common::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

virtual ~DrawableNode ()
 Destructor.
 
virtual void draw (const DrawableNode::RenderInfo &info=RenderInfo()) const =0
 draws the object.
 
virtual void setHighlighted (bool b)=0
 enables or disables highlighting of the drawable class More...
 
virtual bool isHighlighted () const =0
 Returns whether the DrawableNode is highlighted. More...
 
virtual void setDrawType (DrawType drawType)=0
 Sets the DrawType. More...
 
virtual void setTransparency (float alpha)=0
 Sets up the color alpha value. More...
 
virtual float getTransparency ()=0
 Gets the color alpha value. More...
 
bool isTransparent ()
 Check if node is transparent. More...
 
virtual void setScale (float scale)=0
 Specifies the scale of the object. More...
 
virtual float getScale () const =0
 gets the scale of the object More...
 
virtual void setVisible (bool enable)=0
 enable or disable this drawable. When disabled the drawable will not render anything.
 
virtual bool isVisible ()=0
 checks if this drawable is enabled
 
virtual const rw::math::Transform3DgetTransform () const =0
 gets the transformation of the drawable object More...
 
virtual void setTransform (const rw::math::Transform3D<> &t3d)=0
 Sets the transformation of the drawable object. More...
 
virtual void setMask (unsigned int mask)=0
 the group(s) that this drawable belong to More...
 
virtual unsigned int getMask () const =0
 Get the DrawableTypeMask for the node. 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 Member Functions

 DrawableNode (const std::string &name)
 constructor
 
- Protected Member Functions inherited from SceneNode
 SceneNode (const std::string &name, int type)
 Construct new scene node. More...
 

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.
 

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 rendered. Hence objects that are virtual should be set to virtual.

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

drawable->draw(DrawableNode::Physical | DrawableNode::User1);

Member Enumeration Documentation

◆ DrawableTypeMask

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

Enumerator
Virtual 

A physical object in the scene.

DrawableObject 

A virtual object, e.g. lines showing camera view angle.

CollisionObject 

An object that is "just" a drawable.

User1 

An object that is also a CollisionObject.

User2 

User defined group 1...

User2

User3 

User3.

User4 

User4.

◆ DrawType

enum DrawType

when calling render on the draw mode or type can be specified.

Enumerator
WIRE 

Render in solid.

OUTLINE 

Render in wireframe.

Render both solid and wireframe

Member Function Documentation

◆ asDrawableNode()

DrawableNode* asDrawableNode ( )
inlinevirtual

Get a pointer to a DrawableNode, if this is a DrawableNode.

Returns
a pointer, or NULL if the SceneNode is not of correct type.

Reimplemented from SceneNode.

◆ getMask()

virtual unsigned int getMask ( ) const
pure virtual

Get the DrawableTypeMask for the node.

Returns
the type mask.

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ getScale()

virtual float getScale ( ) const
pure virtual

gets the scale of the object

Returns
scale [in] the scale

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ getTransform()

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

gets the transformation of the drawable object

Returns
transform of the drawable object

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ getTransparency()

virtual float getTransparency ( )
pure virtual

Gets the color alpha value.

Returns
alpha value in the interval $ [0.0;1.0] $

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ isHighlighted()

virtual bool isHighlighted ( ) const
pure virtual

Returns whether the DrawableNode is highlighted.

Returns
true/false

Implemented in Drawable, DrawableGeometry, and DrawableNodeClone.

◆ isTransparent()

bool isTransparent ( )
inline

Check if node is transparent.

Returns
true if transparent, false otherwise.

◆ setDrawType()

virtual void setDrawType ( DrawType  drawType)
pure virtual

Sets the DrawType.

Parameters
drawType[in] the DrawType to be used

Implemented in Drawable, DrawableGeometry, and DrawableNodeClone.

◆ setHighlighted()

virtual void setHighlighted ( bool  b)
pure virtual

enables or disables highlighting of the drawable class

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

Implemented in Drawable, DrawableGeometry, and DrawableNodeClone.

◆ setMask()

virtual void setMask ( unsigned int  mask)
pure virtual

the group(s) that this drawable belong to

Parameters
mask[in] drawable mask

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ setScale()

virtual void setScale ( float  scale)
pure virtual

Specifies the scale of the object.

Parameters
scale[in] the scale

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ setTransform()

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

Sets the transformation of the drawable object.

Parameters
t3d[in] transform of drawable object

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.

◆ setTransparency()

virtual void setTransparency ( float  alpha)
pure virtual

Sets up the color alpha value.

Parameters
alpha[in] $ 0.0 $ corresponds to fully transparent and $1.0$ to completely solid.

Implemented in Drawable, DrawableNodeClone, and DrawableGeometry.


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