Package org.robwork.sdurw_graphics
Class DrawableNode
- java.lang.Object
-
- org.robwork.sdurw_graphics.SceneNode
-
- org.robwork.sdurw_graphics.DrawableNode
-
- Direct Known Subclasses:
DrawableGeometryNode
,DrawableNodeClone
public class DrawableNode extends SceneNode
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);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DrawableNode.DrawableTypeMask
draw mask is used to filter which drawables to exclude from rendering.static class
DrawableNode.DrawType
when calling render on the draw mode or type
can be specified.static class
DrawableNode.RenderInfo
Information for rendering.-
Nested classes/interfaces inherited from class org.robwork.sdurw_graphics.SceneNode
SceneNode.AddPolicy, SceneNode.NodeType
-
-
Constructor Summary
Constructors Constructor Description DrawableNode(long cPtr, boolean cMemoryOwn)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DrawableNode
asDrawableNode()
Get a pointer to a DrawableNode, if this is a DrawableNode.void
delete()
void
draw()
draws the object.void
draw(DrawableNode.RenderInfo info)
draws the object.static long
getCPtr(DrawableNode obj)
long
getMask()
Get the DrawableTypeMask for the node.float
getScale()
gets the scale of the objectTransform3D
getTransform()
gets the transformation of the drawable objectfloat
getTransparency()
Gets the color alpha value.boolean
isHighlighted()
Returns whether the DrawableNode is highlighted
boolean
isTransparent()
Check if node is transparent.boolean
isVisible()
checks if this drawable is enabledvoid
setDrawType(DrawableNode.DrawType drawType)
Sets the DrawType
void
setHighlighted(boolean b)
enables or disables highlighting of the drawable class
void
setMask(long mask)
the group(s) that this drawable belong tovoid
setScale(float scale)
Specifies the scale of the objectvoid
setTransform(Transform3D t3d)
Sets the transformation of the drawable objectvoid
setTransparency(float alpha)
Sets up the color alpha value.
void
setVisible(boolean enable)
enable or disable this drawable.-
Methods inherited from class org.robwork.sdurw_graphics.SceneNode
addParent, addParent, asCameraNode, asGroupNode, get_name, get_parentNodes, get_type, getCPtr, getName, getType, hasParent, removeParent, removeParent, set_name, set_parentNodes, set_type, setName
-
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(DrawableNode obj)
-
draw
public void draw(DrawableNode.RenderInfo info)
draws the object.
-
draw
public void draw()
draws the object.
-
setHighlighted
public void setHighlighted(boolean b)
enables or disables highlighting of the drawable class
- Parameters:
b
- [in] a if true highlight is enabled if false disabled
-
isHighlighted
public boolean isHighlighted()
Returns whether the DrawableNode is highlighted
- Returns:
- true/false
-
setDrawType
public void setDrawType(DrawableNode.DrawType drawType)
Sets the DrawType
- Parameters:
drawType
- [in] the DrawType to be used
-
setTransparency
public void setTransparency(float alpha)
Sets up the color alpha value.
- Parameters:
alpha
- [in] 0.0 corresponds to fully transparent and
1.0 to completely solid.
-
getTransparency
public float getTransparency()
Gets the color alpha value.- Returns:
- alpha value in the interval [0.0;1.0]
-
isTransparent
public boolean isTransparent()
Check if node is transparent.- Returns:
- true if transparent, false otherwise.
-
setScale
public void setScale(float scale)
Specifies the scale of the object- Parameters:
scale
- [in] the scale
-
getScale
public float getScale()
gets the scale of the object- Returns:
- scale [in] the scale
-
setVisible
public void setVisible(boolean enable)
enable or disable this drawable. When disabled the drawable
will not render anything.
-
isVisible
public boolean isVisible()
checks if this drawable is enabled
-
getTransform
public Transform3D getTransform()
gets the transformation of the drawable object- Returns:
- transform of the drawable object
-
setTransform
public void setTransform(Transform3D t3d)
Sets the transformation of the drawable object- Parameters:
t3d
- [in] transform of drawable object
-
setMask
public void setMask(long mask)
the group(s) that this drawable belong to- Parameters:
mask
- [in] drawable mask
-
getMask
public long getMask()
Get the DrawableTypeMask for the node.- Returns:
- the type mask.
-
asDrawableNode
public DrawableNode asDrawableNode()
Description copied from class:SceneNode
Get a pointer to a DrawableNode, if this is a DrawableNode.- Overrides:
asDrawableNode
in classSceneNode
- Returns:
- a pointer, or NULL if the SceneNode is not of correct type.
-
-