53#ifndef ACG_BASE_NODE_HH
54#define ACG_BASE_NODE_HH
60#include "../Math/VectorT.hh"
61#include "../GL/GLState.hh"
62#include "../Config/ACGDefines.hh"
63#include "PickTarget.hh"
72#include <ACG/Scenegraph/DrawModes.hh>
73#include <ACG/GL/RenderObject.hh>
92#define ACG_CLASSNAME(_className) \
93 virtual const std::string& className() const override { \
94 static std::string cname( #_className ); return cname; \
126 void delete_subtree();
179 enter(_state, _drawMode);
240 leave(_state, _drawMode);
275 void setDirty (
bool _dirty =
true) { dirty_ = _dirty; }
322 children_.push_back(_node);
332 if (_pos == childrenEnd())
return;
334 children_.erase(_pos);
348 ChildIter i=std::find(children_.begin(),children_.end(),_node);
357 if ( name() == _name )
361 cIt != childrenEnd(); ++cIt )
405 void hide() { set_status(HideNode); }
407 void show() { set_status(Active); }
411 bool hidden() {
return status_ != Active; }
415 std::string
name()
const {
return name_; }
417 void name(
const std::string& _name) { name_ = _name; }
423 unsigned int id()
const {
return id_; }
516 void multipassStatusSetActive(
const unsigned int _i,
bool _active);
526 bool multipassStatusActive(
const unsigned int _i)
const;
560 void multipassNodeSetActive(
const unsigned int _i ,
bool _active);
570 bool multipassNodeActive(
const unsigned int _i)
const;
602 void setRenderObjectShaders(
const std::string& _vertexShaderFile,
const std::string& _geometryShaderFile,
const std::string& _fragmentShaderFile,
bool _relativePaths =
true,
DrawModes::DrawModePrimitive _primitiveType = DrawModes::PRIMITIVE_POLYGON);
624 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);
654 void setRenderObjectTexture(
int _samplerSlot, GLuint _texId, GLenum _texType = GL_TEXTURE_2D);
ACG::SceneGraph::BaseNode BaseNode
Base Node.
Interface for modifying render objects.
ChildIter childrenBegin()
Returns: begin-iterator of children.
std::vector< BaseNode * >::reverse_iterator ChildRIter
allows to reverse iterate over children
bool hidden()
Is node not visible (status != Active)?
bool isDirty() const
Check if node should be redrawn.
BaseNode * parent_
pointer to parent node
bool dirty_
Flag indicating that the node has to be redrawn.
ChildIter childrenEnd()
Returns: end-iterator of children.
RenderObjectModifier * renderModifier_
render-object modifier
unsigned int traverseMode_
traverse mode
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
size_t nChildren() const
number of children
unsigned int traverseMode() const
Return how the node should be traversed.
MultipassBitMask multipassStatus_
void operator=(const BaseNode &)
Assignment operator. Disabled.
ConstChildRIter childrenRBegin() const
Same but const.
void enablePicking(bool _enable)
void drawMode(DrawModes::DrawMode _drawMode)
RenderObjectModifier * getRenderObjectModifier()
Get render-object modifier.
void setMultipassStatus(const MultipassBitMask _passStatus)
Set multipass settings for the nodes status functions.
std::vector< BaseNode * >::const_reverse_iterator ConstChildRIter
allows to reverse iterate over children
TraverseMode
Node traverse types.
std::vector< BaseNode * >::const_iterator ConstChildIter
allows to iterate over children
ConstChildRIter childrenREnd() const
Same but const.
unsigned int MultipassBitMask
Multipass pass bit mask type.
void name(const std::string &_name)
rename a node
static unsigned int last_id_used__
used to provide unique IDs to nodes
void hide()
Hide Node: set status to HideNode.
MultipassBitMask multipassNode_
const GLSL::UniformPool * uniformPool_
user provided uniform pool for shader constants
virtual void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
Deferred draw call with shader based renderer.
ConstChildIter childrenBegin() const
Same but cont.
BaseNode * parent()
Get the nodes parent node.
MultipassBitMask multipassNode() const
Get the current multipass settings for the node.
ChildRIter childrenREnd()
Returns: reverse end-iterator of children.
ConstChildIter childrenEnd() const
Same but const.
std::vector< BaseNode * >::iterator ChildIter
allows to iterate over children
virtual void enter(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
PASSES
This enum should be used to enable rendering of a node in different.
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
std::string name_
name of node
unsigned int id_
ID of node.
virtual void boundingBox(Vec3d &, Vec3d &)
void setDirty(bool _dirty=true)
mark node for redrawn
DrawModes::DrawMode drawMode_
private draw mode
ChildRIter childrenRBegin()
Returns: reverse begin-iterator of children.
MultipassBitMask multipassStatus() const
Get the current multipass settings for the nodes status functions.
StatusMode status() const
Get node's status.
void set_status(StatusMode _s)
Set the status of this node.
void setMultipassNode(const MultipassBitMask _passNode)
Set multipass settings for the node.
std::map< int, RenderObject::Texture > textureSettings_
texture settings for shader based rendering
virtual const std::string & className() const =0
Return class name (implemented by the ACG_CLASSNAME macro)
virtual void leave(GLState &, const DrawModes::DrawMode &)
virtual DrawModes::DrawMode availableDrawModes() const
std::map< DrawModes::DrawModePrimitive, ShaderSet > shaderSettings_
shader settings for primitive modes
std::string name() const
Returns: name of node (needs not be unique)
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
virtual void leave(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
void setRenderObjectUniformPool(const GLSL::UniformPool *_pool)
Set uniforms for shader based rendering.
void remove(ChildIter _pos)
BaseNode * find(const std::string &_name)
const GLSL::UniformPool * getRenderObjectUniformPool()
Get uniforms for shader based rendering.
virtual void pick(GLState &, PickTarget)
std::vector< BaseNode * > children_
list of children
const BaseNode * parent() const
Get the nodes parent node.
void show()
Show node: set status to Active.
StatusMode status_
node status()
BaseNode(const BaseNode &)
Copy constructor. Disabled.
virtual void draw(GLState &, const DrawModes::DrawMode &)
Draw this node using the draw modes _drawMode.
virtual void enter(GLState &, const DrawModes::DrawMode &)
void setRenderObjectModifier(RenderObjectModifier *_modifier)
Set modifier for render objects.
virtual void mouseEvent(GLState &, QMouseEvent *)
Handle mouse event (some interaction, e.g. modeling)
bool visible()
Is node visible (status == Active)?
ChildIter find(BaseNode *_node)
DrawModePrimitive
Primitive mode of a mesh.
PickTarget
What target to use for picking.
Namespace providing different geometric functions concerning angles.
Interface class between scenegraph and renderer.
std::string tes_
tess-eval
bool relativePaths_
rel or abs path
std::string vs_
vertex shader
std::string tcs_
tess-control