Developer Documentation
ACG::SceneGraph::BaseNode Class Referenceabstract

#include <ACG/Scenegraph/BaseNode.hh>

Inheritance diagram for ACG::SceneGraph::BaseNode:
ACG::SceneGraph::ArrayResourceManagerNodeT< T > ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve > ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType > ACG::SceneGraph::CameraNode ACG::SceneGraph::CartesianClippingNode ACG::SceneGraph::ClippingNode ACG::SceneGraph::CoordinateSystemNode ACG::SceneGraph::CoordsysNode ACG::SceneGraph::GlutPrimitiveNode ACG::SceneGraph::LightNode ACG::SceneGraph::LightSourceNode ACG::SceneGraph::MaterialNode ACG::SceneGraph::MeshNodeBase ACG::SceneGraph::OBJNode ACG::SceneGraph::OSDTransformNode ACG::SceneGraph::PointNode ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection > ACG::SceneGraph::PolyLineNodeT< PolyLine > ACG::SceneGraph::PrincipalAxisNode ACG::SceneGraph::PtrResourceManagerNodeT< T > ACG::SceneGraph::QtWidgetNode ACG::SceneGraph::QuadNode ACG::SceneGraph::SeparatorNode ACG::SceneGraph::ShaderNode ACG::SceneGraph::SkeletonNodeT< SkeletonType > ACG::SceneGraph::SliceNode ACG::SceneGraph::SplatCloudNode ACG::SceneGraph::StatusViewNodeT< MeshT > ACG::SceneGraph::StencilRefNode ACG::SceneGraph::TextNode ACG::SceneGraph::Texture3DNode ACG::SceneGraph::TextureNode ACG::SceneGraph::TransformNode ACG::SceneGraph::TriangleNode ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT > ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT > ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT > PlaneNode ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT > ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT > ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT > ACG::SceneGraph::SkeletonNodeT< SkeletonT > ACG::SceneGraph::StatusViewNodeT< PolyMesh > ACG::SceneGraph::StatusViewNodeT< TriMesh > ACG::SceneGraph::VolumeMeshNodeT< MeshT >

Classes

struct  ShaderSet
 

Public Types

enum  StatusMode { Active = 0x1, HideNode = 0x2, HideChildren = 0x4, HideSubtree = 0x8 }
 Status modi. More...
 
enum  TraverseMode { NodeFirst = 0x1, ChildrenFirst = 0x2, SecondPass = 0x4 }
 Node traverse types. More...
 
typedef std::vector< BaseNode * >::const_iterator ConstChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::iterator ChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::const_reverse_iterator ConstChildRIter
 allows to reverse iterate over children
 
typedef std::vector< BaseNode * >::reverse_iterator ChildRIter
 allows to reverse iterate over children
 

Public Member Functions

 BaseNode (BaseNode *_parent=0, std::string _name="<unknown>")
 Default constructor.
 
 BaseNode (BaseNode *_parent, BaseNode *_child, std::string _name="<unknown>")
 Put this node between _parent and _child.
 
virtual ~BaseNode ()
 Destructor.
 
void delete_subtree ()
 Delete the whole subtree of this node. More...
 
virtual const std::string & className () const =0
 Return class name (implemented by the ACG_CLASSNAME macro)
 
virtual DrawModes::DrawMode availableDrawModes () const
 
virtual void boundingBox (Vec3d &, Vec3d &)
 
virtual void enter (GLState &, const DrawModes::DrawMode &)
 
virtual void enter (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void draw (GLState &, const DrawModes::DrawMode &)
 Draw this node using the draw modes _drawMode. More...
 
virtual void getRenderObjects (IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
 Deferred draw call with shader based renderer. More...
 
virtual void leave (GLState &, const DrawModes::DrawMode &)
 
virtual void leave (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void enterPick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
virtual void pick (GLState &, PickTarget)
 
virtual void leavePick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
void enablePicking (bool _enable)
 
bool pickingEnabled ()
 
virtual void mouseEvent (GLState &, QMouseEvent *)
 Handle mouse event (some interaction, e.g. modeling)
 
void setDirty (bool _dirty=true)
 mark node for redrawn
 
bool isDirty () const
 Check if node should be redrawn.
 
ChildIter childrenBegin ()
 Returns: begin-iterator of children.
 
ConstChildIter childrenBegin () const
 Same but cont.
 
ChildIter childrenEnd ()
 Returns: end-iterator of children.
 
ConstChildIter childrenEnd () const
 Same but const.
 
ChildRIter childrenRBegin ()
 Returns: reverse begin-iterator of children.
 
ConstChildRIter childrenRBegin () const
 Same but const.
 
ChildRIter childrenREnd ()
 Returns: reverse end-iterator of children.
 
ConstChildRIter childrenREnd () const
 Same but const.
 
void push_back (BaseNode *_node)
 Insert _node at the end of the list of children.
 
void remove (ChildIter _pos)
 
size_t nChildren () const
 number of children
 
ChildIter find (BaseNode *_node)
 
BaseNodefind (const std::string &_name)
 
BaseNodeparent ()
 Get the nodes parent node.
 
const BaseNodeparent () const
 Get the nodes parent node.
 
void set_parent (BaseNode *_parent)
 Set the parent of this node. More...
 
StatusMode status () const
 Get node's status.
 
void set_status (StatusMode _s)
 Set the status of this node.
 
void hide ()
 Hide Node: set status to HideNode.
 
void show ()
 Show node: set status to Active.
 
bool visible ()
 Is node visible (status == Active)?
 
bool hidden ()
 Is node not visible (status != Active)?
 
std::string name () const
 Returns: name of node (needs not be unique)
 
void name (const std::string &_name)
 rename a node
 
unsigned int id () const
 
DrawModes::DrawMode drawMode () const
 Return the own draw modes of this node.
 
void drawMode (DrawModes::DrawMode _drawMode)
 
unsigned int traverseMode () const
 Return how the node should be traversed.
 
void setTraverseMode (unsigned int _mode)
 Set traverse mode for node.
 

Private Member Functions

 BaseNode (const BaseNode &)
 Copy constructor. Disabled.
 
void operator= (const BaseNode &)
 Assignment operator. Disabled.
 

Private Attributes

BaseNodeparent_
 pointer to parent node
 
std::string name_
 name of node
 
StatusMode status_
 node status()
 
std::vector< BaseNode * > children_
 list of children
 
unsigned int id_
 ID of node.
 
DrawModes::DrawMode drawMode_
 private draw mode
 
bool pickingEnabled_
 
bool dirty_
 Flag indicating that the node has to be redrawn.
 
unsigned int traverseMode_
 traverse mode
 
std::map< DrawModes::DrawModePrimitive, ShaderSetshaderSettings_
 shader settings for primitive modes
 
std::map< int, RenderObject::TexturetextureSettings_
 texture settings for shader based rendering
 
const GLSL::UniformPooluniformPool_
 user provided uniform pool for shader constants
 
RenderObjectModifierrenderModifier_
 render-object modifier
 

Static Private Attributes

static unsigned int last_id_used__ = 0
 used to provide unique IDs to nodes
 

Render pass controls

The render pass controls are only used during multipass traversal. There are two types of multipass controls. One type controls if the enter and leave functions of the nodes are used (RenderStatusPass) or if the actual draw function is called (RenderDrawPass). The bitmasks define if the functions are called by the traverse_multipass operation. The bitmask are initialized to run in the first path.

enum  PASSES {
  NOPASS = 0, ALLPASSES = 1 << 0, PASS_1 = 1 << 1, PASS_2 = 1 << 2,
  PASS_3 = 1 << 3, PASS_4 = 1 << 4, PASS_5 = 1 << 5, PASS_6 = 1 << 6,
  PASS_7 = 1 << 7, PASS_8 = 1 << 8
}
 This enum should be used to enable rendering of a node in different.
 
typedef unsigned int MultipassBitMask
 Multipass pass bit mask type.
 
MultipassBitMask multipassStatus () const
 Get the current multipass settings for the nodes status functions. More...
 
void setMultipassStatus (const MultipassBitMask _passStatus)
 Set multipass settings for the nodes status functions. More...
 
void multipassStatusSetActive (const unsigned int _i, bool _active)
 Set multipass status to traverse in a specific pass. More...
 
bool multipassStatusActive (const unsigned int _i) const
 Get multipass status to traverse in a specific pass. More...
 
MultipassBitMask multipassNode () const
 Get the current multipass settings for the node. More...
 
void setMultipassNode (const MultipassBitMask _passNode)
 Set multipass settings for the node. More...
 
void multipassNodeSetActive (const unsigned int _i, bool _active)
 Set Node status to traverse in a specific pass. More...
 
bool multipassNodeActive (const unsigned int _i) const
 Get Node status to traverse in a specific pass. More...
 

RenderObject controls

The render pass controls are only used during shader-based rendering with render-objects. It is possible to provide shader and state settings that are copied to render-objects. These functions do not affect the fixed-function pipeline implementation of the scenegraph (enter() draw() leave()).

MultipassBitMask multipassStatus_
 
MultipassBitMask multipassNode_
 
void setRenderObjectShaders (const std::string &_vertexShaderFile, const std::string &_geometryShaderFile, const std::string &_fragmentShaderFile, bool _relativePaths=true, DrawModes::DrawModePrimitive _primitiveType=DrawModes::PRIMITIVE_POLYGON)
 Set custom shaders. More...
 
void setRenderObjectShaders (const std::string &_vertexShaderFile, const std::string &_tessControlShaderFile, const std::string &_tessEvalShaderFile, const std::string &_geometryShaderFile, const std::string &_fragmentShaderFile, bool _relativePaths=true, DrawModes::DrawModePrimitive _primitiveType=DrawModes::PRIMITIVE_POLYGON)
 Set custom shaders. More...
 
void setRenderObjectUniformPool (const GLSL::UniformPool *_pool)
 Set uniforms for shader based rendering. More...
 
const GLSL::UniformPoolgetRenderObjectUniformPool ()
 Get uniforms for shader based rendering. More...
 
void setRenderObjectTexture (int _samplerSlot, GLuint _texId, GLenum _texType=GL_TEXTURE_2D)
 Set textures for shader based rendering. More...
 
void setRenderObjectModifier (RenderObjectModifier *_modifier)
 Set modifier for render objects. More...
 
RenderObjectModifiergetRenderObjectModifier ()
 Get render-object modifier. More...
 
void applyRenderObjectSettings (DrawModes::DrawModePrimitive _primitive, RenderObject *_obj) const
 Set shaders, textures and uniforms as provided by user to a render-object. More...
 

Detailed Description

This is the base for all scenegraph nodes. All virtual functions should be reimplemented when inheriting from this class.

Definition at line 104 of file BaseNode.hh.

Member Enumeration Documentation

◆ StatusMode

Status modi.

Enumerator
Active 

Draw node & children.

HideNode 

Hide this node, but draw children.

HideChildren 

Draw this node, but hide children.

HideSubtree 

Hide this node and its children.

Definition at line 389 of file BaseNode.hh.

◆ TraverseMode

Node traverse types.

Enumerator
NodeFirst 

Execute action on node first and then on its children.

ChildrenFirst 

Execute action the children first and then on this node.

SecondPass 

Draw node in second pass.

Definition at line 438 of file BaseNode.hh.

Member Function Documentation

◆ applyRenderObjectSettings()

void ACG::SceneGraph::BaseNode::applyRenderObjectSettings ( DrawModes::DrawModePrimitive  _primitive,
RenderObject _obj 
) const

Set shaders, textures and uniforms as provided by user to a render-object.

A derived node can use this convenience function to copy shader, uniform and texture settings to a render-object.

Parameters
_primitivethe primitive type of the render-object
_objthe render-object [in/out]

Definition at line 301 of file BaseNode.cc.

◆ availableDrawModes()

virtual DrawModes::DrawMode ACG::SceneGraph::BaseNode::availableDrawModes ( ) const
inlinevirtual

Return a list of available draw modes for this node: should be OR'ed from the items of the enum DrawModeIDs.

Reimplemented in ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::MeshNodeT< PolyMesh >, ACG::SceneGraph::MeshNodeT< TriMesh >, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::PrincipalAxisNode, ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve >, ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT >, ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType >, ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT >, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::TextNode, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT >, ACG::SceneGraph::VolumeMeshNodeT< MeshT >, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT >, ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT >, ACG::SceneGraph::GridNode, ACG::SceneGraph::CameraNode, ACG::SceneGraph::SkeletonNodeT< SkeletonType >, ACG::SceneGraph::SkeletonNodeT< SkeletonT >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::CoordinateSystemNode, ACG::SceneGraph::QtWidgetNode, ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT >, ACG::SceneGraph::ArrowNode, ACG::SceneGraph::BoundingBoxNode, ACG::SceneGraph::SliceNode, PlaneNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::QuadNode, and ACG::SceneGraph::BoxesNode.

Definition at line 136 of file BaseNode.hh.

◆ boundingBox()

virtual void ACG::SceneGraph::BaseNode::boundingBox ( Vec3d ,
Vec3d  
)
inlinevirtual

Compute the bounding box of this node and update the values _bbMin and _bbMax accordingly. Do not initialize _bbMin and _bbMax since they may already store values of previous nodes' bounding box computation.

Reimplemented in ACG::SceneGraph::LightNode, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::PrincipalAxisNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::MeshNodeT< PolyMesh >, ACG::SceneGraph::MeshNodeT< TriMesh >, ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve >, ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT >, ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType >, ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT >, ACG::SceneGraph::LineNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::TextNode, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT >, ACG::SceneGraph::VolumeMeshNodeT< MeshT >, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT >, ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT >, ACG::SceneGraph::GridNode, ACG::SceneGraph::CameraNode, ACG::SceneGraph::SkeletonNodeT< SkeletonType >, ACG::SceneGraph::SkeletonNodeT< SkeletonT >, ACG::SceneGraph::OBJNode, ACG::SceneGraph::CoordinateSystemNode, ACG::SceneGraph::QtWidgetNode, ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT >, ACG::SceneGraph::ArrowNode, ACG::SceneGraph::SliceNode, PlaneNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::QuadNode, and ACG::SceneGraph::BoxesNode.

Definition at line 143 of file BaseNode.hh.

◆ delete_subtree()

void ACG::SceneGraph::BaseNode::delete_subtree ( )

Delete the whole subtree of this node.

This function will remove the whole subtree below this node. All children in this nodes bubtree will be automatically removed from the tree and their destructor is called. The node itself will be removed from the list of its parents children. Afterwards it will also call its own destructor.

Definition at line 170 of file BaseNode.cc.

◆ draw()

virtual void ACG::SceneGraph::BaseNode::draw ( GLState ,
const DrawModes::DrawMode  
)
inlinevirtual

Draw this node using the draw modes _drawMode.

This function is called when the scenegraph is traversed by the classical draw routines.

In this call the node should draw it's content via OpenGL.

Note
Keep in mind, that you should use the currently active state and don't change it (at least reset it the original values you got). Otherwise nodes that are drawn after this node might get an inconsistent state.

Reimplemented in ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::MeshNodeT< PolyMesh >, ACG::SceneGraph::MeshNodeT< TriMesh >, ACG::SceneGraph::LightNode, ACG::SceneGraph::ArrowNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::PrincipalAxisNode, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve >, ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT >, ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType >, ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT >, ACG::SceneGraph::TrackballNode, ACG::SceneGraph::ManipulatorNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::TextNode, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT >, ACG::SceneGraph::VolumeMeshNodeT< MeshT >, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT >, ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT >, ACG::SceneGraph::GridNode, ACG::SceneGraph::CameraNode, ACG::SceneGraph::OBJNode, ACG::SceneGraph::CoordinateSystemNode, ACG::SceneGraph::SkeletonNodeT< SkeletonType >, ACG::SceneGraph::SkeletonNodeT< SkeletonT >, ACG::SceneGraph::CoordFrameNode, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT >, PlaneNode, ACG::SceneGraph::SliceNode, ACG::SceneGraph::BoundingBoxNode, ACG::SceneGraph::TriangleNode, ACG::SceneGraph::QuadNode, ACG::SceneGraph::StatusViewNodeT< MeshT >, ACG::SceneGraph::StatusViewNodeT< PolyMesh >, and ACG::SceneGraph::StatusViewNodeT< TriMesh >.

Definition at line 192 of file BaseNode.hh.

◆ drawMode()

void ACG::SceneGraph::BaseNode::drawMode ( DrawModes::DrawMode  _drawMode)
inline

Set this node's own draw mode. It will be used for drawing instead of the the global draw mode.

Definition at line 433 of file BaseNode.hh.

◆ enablePicking()

void ACG::SceneGraph::BaseNode::enablePicking ( bool  _enable)
inline

Enable or Disable picking for this node ( default: enabled )

Definition at line 265 of file BaseNode.hh.

◆ enter() [1/2]

virtual void ACG::SceneGraph::BaseNode::enter ( GLState ,
const DrawModes::DrawMode  
)
inlinevirtual

This function is called when traversing the scene graph and arriving at this node. It can be used to store GL states that will be changed in order to restore then in the leave() function.

There are two overloads of the enter() function, one with IRenderer* parameter, the other one without. As long the overload with IRenderer* parameter is not being overridden, all renderers will make use of the overload without the IRenderer* parameter. If the overload with IRenderer* parameter is being overridden, only legacy renderers will use the version without the additional parameter and new renderers implementing the IRenderer interface will use the version with the additional parameter.

See also
MaterialNode

Reimplemented in ACG::SceneGraph::MaterialNode, ACG::SceneGraph::LightNode, ACG::SceneGraph::TextureNode, ACG::SceneGraph::LightSourceNode, ACG::SceneGraph::ClippingNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::TextNode, ACG::SceneGraph::TransformNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::StencilRefNode, ACG::SceneGraph::OSDTransformNode, ACG::SceneGraph::CartesianClippingNode, ACG::SceneGraph::Texture3DNode, ACG::SceneGraph::StatusViewNodeT< MeshT >, ACG::SceneGraph::StatusViewNodeT< PolyMesh >, and ACG::SceneGraph::StatusViewNodeT< TriMesh >.

Definition at line 160 of file BaseNode.hh.

◆ enter() [2/2]

virtual void ACG::SceneGraph::BaseNode::enter ( IRenderer ,
GLState _state,
const DrawModes::DrawMode _drawMode 
)
inlinevirtual

This function is called when traversing the scene graph and arriving at this node. It can be used to store GL states that will be changed in order to restore then in the leave() function.

If you do not need the IRenderer* argument in your override of this function, simply use the override without the additional parameter.

There are two overloads of the enter() function, one with IRenderer* parameter, the other one without. As long the overload with IRenderer* parameter is not being overridden, all renderers will make use of the overload without the IRenderer* parameter. If the overload with IRenderer* parameter is being overridden, only legacy renderers will use the version without the additional parameter and new renderers implementing the IRenderer interface will use the version with the additional parameter.

Reimplemented in ACG::SceneGraph::ClippingNode.

Definition at line 178 of file BaseNode.hh.

◆ enterPick()

void ACG::SceneGraph::BaseNode::enterPick ( GLState _state,
PickTarget  _target,
const DrawModes::DrawMode _drawMode 
)
virtual

This function is called when traversing the scene graph during picking and arriving at this node. It can be used to store GL states that will be changed in order to restore then in the leavePick() function. Its default implementation will call the enter() function.

Reimplemented in ACG::SceneGraph::MaterialNode, ACG::SceneGraph::TextureNode, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::StencilRefNode, and ACG::SceneGraph::OSDTransformNode.

Definition at line 180 of file BaseNode.cc.

◆ find() [1/2]

ChildIter ACG::SceneGraph::BaseNode::find ( BaseNode _node)
inline

Find a specific node in the list of children.
This method is designed to convert a node pointer to an iterator that may be used e.g. for insert()'ing a new node at a distinct position.
Returns childrenEnd() if no appropriate node is found.

Definition at line 346 of file BaseNode.hh.

◆ find() [2/2]

BaseNode* ACG::SceneGraph::BaseNode::find ( const std::string &  _name)
inline

Find a node of a given name

Definition at line 355 of file BaseNode.hh.

◆ getRenderObjectModifier()

RenderObjectModifier* ACG::SceneGraph::BaseNode::getRenderObjectModifier ( )
inline

Get render-object modifier.

Definition at line 670 of file BaseNode.hh.

◆ getRenderObjects()

virtual void ACG::SceneGraph::BaseNode::getRenderObjects ( IRenderer _renderer,
GLState _state,
const DrawModes::DrawMode _drawMode,
const Material _mat 
)
inlinevirtual

Deferred draw call with shader based renderer.

The renderer calls this function to collect the geometry that should be rendered from the nodes.

Add any renderable geometry to the renderer via _renderer->addRenderObject()

The material is fetched from the last active material node and may be used to setup Renderobjects, but may as well be ignored.

Note
You should not draw anything yourself in this function.
Parameters
_rendererThe renderer which will be used. Add your geometry into this class
_stateThe current GL State when this object is called
_drawModeThe active draw mode
_matCurrent material

Reimplemented in ACG::SceneGraph::LightNode, ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::MeshNodeT< PolyMesh >, ACG::SceneGraph::MeshNodeT< TriMesh >, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::PrincipalAxisNode, ACG::SceneGraph::ArrowNode, ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve >, ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT >, ACG::SceneGraph::LineNode, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType >, ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT >, ACG::SceneGraph::TextNode, PlaneNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT >, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::VolumeMeshNodeT< MeshT >, ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT >, ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT >, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::PointNode, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT >, ACG::SceneGraph::CameraNode, ACG::SceneGraph::QtWidgetNode, ACG::SceneGraph::SkeletonNodeT< SkeletonType >, ACG::SceneGraph::SkeletonNodeT< SkeletonT >, ACG::SceneGraph::BoundingBoxNode, ACG::SceneGraph::StatusViewNodeT< MeshT >, ACG::SceneGraph::StatusViewNodeT< PolyMesh >, ACG::SceneGraph::StatusViewNodeT< TriMesh >, and ACG::SceneGraph::BoxesNode.

Definition at line 210 of file BaseNode.hh.

◆ getRenderObjectUniformPool()

const GLSL::UniformPool* ACG::SceneGraph::BaseNode::getRenderObjectUniformPool ( )
inline

Get uniforms for shader based rendering.

Definition at line 641 of file BaseNode.hh.

◆ id()

unsigned int ACG::SceneGraph::BaseNode::id ( ) const
inline

Get unique ID of node. IDs are always positive and may be used e.g. for picking.

Definition at line 423 of file BaseNode.hh.

◆ leave() [1/2]

virtual void ACG::SceneGraph::BaseNode::leave ( GLState ,
const DrawModes::DrawMode  
)
inlinevirtual

The leave function is used to restore GL states the have been changed. This function must restore the status before enter()!

There are two overloads of the leave() function, one with IRenderer* parameter, the other one without. As long the overload with IRenderer* parameter is not being overridden, all renderers will make use of the overload without the IRenderer* parameter. If the overload with IRenderer* parameter is being overridden, only legacy renderers will use the version without the additional parameter and new renderers implementing the IRenderer interface will use the version with the additional parameter.

Reimplemented in ACG::SceneGraph::MaterialNode, ACG::SceneGraph::LightNode, ACG::SceneGraph::TextureNode, ACG::SceneGraph::LightSourceNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::ClippingNode, ACG::SceneGraph::TextNode, ACG::SceneGraph::TransformNode, ACG::SceneGraph::ShaderNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::StencilRefNode, ACG::SceneGraph::OSDTransformNode, ACG::SceneGraph::CartesianClippingNode, ACG::SceneGraph::Texture3DNode, ACG::SceneGraph::StatusViewNodeT< MeshT >, ACG::SceneGraph::StatusViewNodeT< PolyMesh >, and ACG::SceneGraph::StatusViewNodeT< TriMesh >.

Definition at line 223 of file BaseNode.hh.

◆ leave() [2/2]

virtual void ACG::SceneGraph::BaseNode::leave ( IRenderer ,
GLState _state,
const DrawModes::DrawMode _drawMode 
)
inlinevirtual

The leave function is used to restore GL states the have been changed. This function must restore the status before enter()!

If you do not need the IRenderer* argument in your override of this function, simply use the override without the additional parameter.

There are two overloads of the leave() function, one with IRenderer* parameter, the other one without. As long the overload with IRenderer* parameter is not being overridden, all renderers will make use of the overload without the IRenderer* parameter. If the overload with IRenderer* parameter is being overridden, only legacy renderers will use the version without the additional parameter and new renderers implementing the IRenderer interface will use the version with the additional parameter.

Reimplemented in ACG::SceneGraph::ClippingNode.

Definition at line 239 of file BaseNode.hh.

◆ leavePick()

void ACG::SceneGraph::BaseNode::leavePick ( GLState _state,
PickTarget  _target,
const DrawModes::DrawMode _drawMode 
)
virtual

The leavePick function is used to restore GL states the have been changed. This function must restore the status before enterPick() ! Its default implementation will call the leave() function.

Reimplemented in ACG::SceneGraph::MaterialNode, ACG::SceneGraph::TextureNode, ACG::SceneGraph::EnvMapNode, ACG::SceneGraph::StencilRefNode, ACG::SceneGraph::ShaderNode, and ACG::SceneGraph::OSDTransformNode.

Definition at line 188 of file BaseNode.cc.

◆ multipassNode()

MultipassBitMask ACG::SceneGraph::BaseNode::multipassNode ( ) const
inline

Get the current multipass settings for the node.

Get a bitmask defining in which traverse path an action is applied to the node. (1-indexed) Use the PASSES enum above to control multipass rendering!

Returns
Bitmask defining in which traverse passes an action is applied to the node.

Definition at line 537 of file BaseNode.hh.

◆ multipassNodeActive()

bool ACG::SceneGraph::BaseNode::multipassNodeActive ( const unsigned int  _i) const

Get Node status to traverse in a specific pass.

Check multipass setting for the node if an action will be applied in the given pass. Use the PASSES enum above to control multipass rendering!

Parameters
_iCheck this pass if an action will be applied to the node.

Definition at line 248 of file BaseNode.cc.

◆ multipassNodeSetActive()

void ACG::SceneGraph::BaseNode::multipassNodeSetActive ( const unsigned int  _i,
bool  _active 
)

Set Node status to traverse in a specific pass.

Change multipass setting for the node. An action will be applied to this node in the given pass. Use the PASSES enum above to control multipass rendering!

Parameters
_iPass in which the node should be rendered
_activeEnable or disable node in this pass?

Definition at line 228 of file BaseNode.cc.

◆ multipassStatus()

MultipassBitMask ACG::SceneGraph::BaseNode::multipassStatus ( ) const
inline

Get the current multipass settings for the nodes status functions.

Get a bitmask defining in which traverse pass the enter and leave nodes are used. Use the PASSES enum above to control multipass rendering!

Returns
Bitmask defining in which traverse pass the enter and leave nodes are used

Definition at line 493 of file BaseNode.hh.

◆ multipassStatusActive()

bool ACG::SceneGraph::BaseNode::multipassStatusActive ( const unsigned int  _i) const

Get multipass status to traverse in a specific pass.

Check multipass setting for the nodes status functions if they should be called in the given render pass. Use the PASSES enum above to control multipass rendering!

Parameters
_iCheck this pass if the nodes enter/leave functions are active

Definition at line 215 of file BaseNode.cc.

◆ multipassStatusSetActive()

void ACG::SceneGraph::BaseNode::multipassStatusSetActive ( const unsigned int  _i,
bool  _active 
)

Set multipass status to traverse in a specific pass.

Change multipass setting for the nodes status functions. The node will call its enter and leave functions in the given pass if its set active. Use the PASSES enum above to control multipass rendering!

Parameters
_iPass in which the node should be rendered
_activeActivate or deactivate in this pass?

Definition at line 195 of file BaseNode.cc.

◆ pick()

virtual void ACG::SceneGraph::BaseNode::pick ( GLState ,
PickTarget   
)
inlinevirtual

Draw the node using the GL picking name stack. The node's ID will already be on the name stack, so only names identifying e.g. faces should be used ( by pick_set_name() ).

Reimplemented in ACG::SceneGraph::MeshNodeT< Mesh >, ACG::SceneGraph::MeshNodeT< MeshT >, ACG::SceneGraph::MeshNodeT< PolyMesh >, ACG::SceneGraph::MeshNodeT< TriMesh >, ACG::SceneGraph::LightNode, ACG::SceneGraph::PrincipalAxisNode, ACG::SceneGraph::GlutPrimitiveNode, ACG::SceneGraph::TranslationManipulatorNode, ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve >, ACG::SceneGraph::BSplineCurveNodeT< ACG::BSplineCurveT >, ACG::SceneGraph::BSplineSurfaceNodeT< BSplineSurfaceType >, ACG::SceneGraph::BSplineSurfaceNodeT< ACG::BSplineSurfaceT >, ACG::SceneGraph::ManipulatorNode, ACG::SceneGraph::LineNode, ACG::SceneGraph::CoordsysNode, ACG::SceneGraph::VolumeMeshNodeT< VolumeMeshT >, ACG::SceneGraph::VolumeMeshNodeT< MeshT >, ACG::SceneGraph::SplatCloudNode, ACG::SceneGraph::PolyLineNodeT< PolyLine >, ACG::SceneGraph::PolyLineNodeT< typename ACG::PolyLineT >, ACG::SceneGraph::PolyLineNodeT< ACG::PolyLineT >, ACG::SceneGraph::CameraNode, ACG::SceneGraph::GridNode, ACG::SceneGraph::OBJNode, ACG::SceneGraph::CoordinateSystemNode, ACG::SceneGraph::SkeletonNodeT< SkeletonType >, ACG::SceneGraph::SkeletonNodeT< SkeletonT >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollection >, ACG::SceneGraph::PolyLineCollectionNodeT< PolyLineCollectionT >, ACG::SceneGraph::SliceNode, PlaneNode, ACG::SceneGraph::TriangleNode, and ACG::SceneGraph::QuadNode.

Definition at line 254 of file BaseNode.hh.

◆ pickingEnabled()

bool ACG::SceneGraph::BaseNode::pickingEnabled ( )
inline

Check if picking is enabled for this node

Definition at line 269 of file BaseNode.hh.

◆ remove()

void ACG::SceneGraph::BaseNode::remove ( ChildIter  _pos)
inline

Remove child node at position _pos. This _pos must be reachable from childrenBegin().
This method has no effect if called with childrenEnd() as parameter.

Definition at line 330 of file BaseNode.hh.

◆ set_parent()

void ACG::SceneGraph::BaseNode::set_parent ( BaseNode _parent)

Set the parent of this node.

This function will remove this node from its original parents children, if the parent exists. And will add it to the new parents children.

Definition at line 146 of file BaseNode.cc.

◆ setMultipassNode()

void ACG::SceneGraph::BaseNode::setMultipassNode ( const MultipassBitMask  _passNode)
inline

Set multipass settings for the node.

Set a bitmask defining in which traverse path an action is applied to the node. (1-indexed) Set to ALLPASSES if you want to render in all passes. Use the PASSES enum above to control multipass rendering!

Parameters
_passNodeBitmask defining in which traverse passes an action is applied to the node.

Definition at line 549 of file BaseNode.hh.

◆ setMultipassStatus()

void ACG::SceneGraph::BaseNode::setMultipassStatus ( const MultipassBitMask  _passStatus)
inline

Set multipass settings for the nodes status functions.

Set a bitmask defining in which traverse pass the enter and leave nodes are used. Use the PASSES enum above to control multipass rendering!

Set to ALLPASSES if you want to render in all passes

Parameters
_passStatusBitmask defining in which traverse pass the enter and leave nodes are used

Definition at line 505 of file BaseNode.hh.

◆ setRenderObjectModifier()

void ACG::SceneGraph::BaseNode::setRenderObjectModifier ( RenderObjectModifier _modifier)
inline

Set modifier for render objects.

Render-objects can be modified, if the implementation of a node supports this. The currently active modifier should be applied directly before adding an object to the renderer.

Parameters
_modifierpointer to address of modifier, address must be valid whenever the node creates render-objects

Definition at line 665 of file BaseNode.hh.

◆ setRenderObjectShaders() [1/2]

void ACG::SceneGraph::BaseNode::setRenderObjectShaders ( const std::string &  _vertexShaderFile,
const std::string &  _geometryShaderFile,
const std::string &  _fragmentShaderFile,
bool  _relativePaths = true,
DrawModes::DrawModePrimitive  _primitiveType = DrawModes::PRIMITIVE_POLYGON 
)

Set custom shaders.

Assigns a set of shaders to a primitive type of a node. For instance, it is possible to render faces with a different shaders than lines. Default shaders are used instead if no other shaders are provided. Note: the derived node has to actually make use of shaders provided here

Example: set shaders in OpenFlipper/Shaders/MyWireShaders for rendering the line parts of a node: node->setRenderobjectShaders("MyWireShaders/v.glsl", "MyWireShaders/g.glsl", "MyWireShaders/f.glsl", true, ACG::SceneGraph::DrawModes::PRIMITIVE_WIREFRAME);

Parameters
_vertexShaderFilefilename of vertex shader template compatible with ACG::ShaderGenerator
_geometryShaderFilefilename of geometry shader template compatible with ACG::ShaderGenerator
_fragmentShaderFilefilename of fragment shader template compatible with ACG::ShaderGenerator
_relativePathsfilenames are relative or absolute
_primitiveTypeassign shaders to rendering this type of primitive of the polyline

Definition at line 261 of file BaseNode.cc.

◆ setRenderObjectShaders() [2/2]

void ACG::SceneGraph::BaseNode::setRenderObjectShaders ( const std::string &  _vertexShaderFile,
const std::string &  _tessControlShaderFile,
const std::string &  _tessEvalShaderFile,
const std::string &  _geometryShaderFile,
const std::string &  _fragmentShaderFile,
bool  _relativePaths = true,
DrawModes::DrawModePrimitive  _primitiveType = DrawModes::PRIMITIVE_POLYGON 
)

Set custom shaders.

Assigns a set of shaders to a primitive type of a node. For instance, it is possible to render faces with a different shaders than lines. Default shaders are used instead if no other shaders are provided. Note: the derived node has to actually make use of shaders provided here

Example: set shaders in OpenFlipper/Shaders/MyWireShaders for rendering the line parts of a node: node->setRenderObjectShaders("MyWireShaders/v.glsl", "MyWireShaders/g.glsl", "MyWireShaders/f.glsl", true, ACG::SceneGraph::DrawModes::PRIMITIVE_WIREFRAME);

Parameters
_vertexShaderFilefilename of vertex shader template compatible with ACG::ShaderGenerator
_tessControlShaderFilefilename of tessellation-control shader template compatible with ACG::ShaderGenerator
_tessEvalShaderFilefilename of tessellation-eval shader template compatible with ACG::ShaderGenerator
_geometryShaderFilefilename of geometry shader template compatible with ACG::ShaderGenerator
_fragmentShaderFilefilename of fragment shader template compatible with ACG::ShaderGenerator
_relativePathsfilenames are relative or absolute
_primitiveTypeassign shaders to rendering this type of primitive of the polyline

Definition at line 274 of file BaseNode.cc.

◆ setRenderObjectTexture()

void ACG::SceneGraph::BaseNode::setRenderObjectTexture ( int  _samplerSlot,
GLuint  _texId,
GLenum  _texType = GL_TEXTURE_2D 
)

Set textures for shader based rendering.

Assign textures to sampler slots. Note: Fixed-function drawing ignores these textures. Also, it is still necessary to set the according sampler index in a UniformPool to access this texture in a shader.

Parameters
_samplerSlotsampler slot to bind the texture to, zero-based index
_texIdgl texture id
_texTypegl texture type ie. GL_TEXTURE_1D, ..

Definition at line 289 of file BaseNode.cc.

◆ setRenderObjectUniformPool()

void ACG::SceneGraph::BaseNode::setRenderObjectUniformPool ( const GLSL::UniformPool _pool)
inline

Set uniforms for shader based rendering.

Uniforms are copied from a pool when rendering with shader-based render-objects. The specified pool has to be a valid memory address whenever the objects are rendered. It does not make a copy of the pool.

Parameters
_poolpointer to address of a uniform pool

Definition at line 636 of file BaseNode.hh.

Member Data Documentation

◆ multipassNode_

MultipassBitMask ACG::SceneGraph::BaseNode::multipassNode_
private

multi pass bit mask (1-indexed) Defines in which multipass runs an action should be applied to the node. (Only applies during multipass traversal!)

Definition at line 696 of file BaseNode.hh.

◆ multipassStatus_

MultipassBitMask ACG::SceneGraph::BaseNode::multipassStatus_
private

multi pass bit mask (1-indexed) Defines in which multipass runs the enter and leave functions should be called. (Only applies during multipass traversal!)

Definition at line 690 of file BaseNode.hh.

◆ pickingEnabled_

bool ACG::SceneGraph::BaseNode::pickingEnabled_
private

Flag indicating if picking should be done for this object This flag has to be checked by your node if you implement picking

Definition at line 733 of file BaseNode.hh.


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