59 #ifndef ACG_BASE_NODE_HH
60 #define ACG_BASE_NODE_HH
66 #include "../Math/VectorT.hh"
67 #include "../GL/GLState.hh"
68 #include "../Config/ACGDefines.hh"
72 #include <QMouseEvent>
79 #include <ACG/Scenegraph/DrawModes.hh>
80 #include <ACG/GL/RenderObject.hh>
123 #define ACG_CLASSNAME(_className) \
124 virtual const std::string& className() const { \
125 static std::string cname( #_className ); return cname; \
157 void delete_subtree();
163 virtual const std::string& className()
const = 0;
210 enter(_state, _drawMode);
271 leave(_state, _drawMode);
306 void setDirty (
bool _dirty =
true) { dirty_ = _dirty; }
353 children_.push_back(_node);
361 void remove(ChildIter _pos)
363 if (_pos == childrenEnd())
return;
365 children_.erase(_pos);
379 ChildIter i=std::find(children_.begin(),children_.end(),_node);
388 if ( name() == _name )
392 cIt != childrenEnd(); ++cIt )
436 void hide() { set_status(HideNode); }
438 void show() { set_status(Active); }
442 bool hidden() {
return status_ != Active; }
446 std::string
name()
const {
return name_; }
448 void name(
const std::string& _name) { name_ = _name; }
454 unsigned int id()
const {
return id_; }
547 void multipassStatusSetActive(
const unsigned int _i,
bool _active);
557 bool multipassStatusActive(
const unsigned int _i)
const;
591 void multipassNodeSetActive(
const unsigned int _i ,
bool _active);
601 bool multipassNodeActive(
const unsigned int _i)
const;
633 void setRenderObjectShaders(
const std::string& _vertexShaderFile,
const std::string& _geometryShaderFile,
const std::string& _fragmentShaderFile,
bool _relativePaths =
true,
DrawModes::DrawModePrimitive _primitiveType = DrawModes::PRIMITIVE_POLYGON);
655 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);
685 void setRenderObjectTexture(
int _samplerSlot, GLuint _texId, GLenum _texType = GL_TEXTURE_2D);
817 #endif // ACG_BASE_NODE_HH defined
picks only visible front verices (may not be implemented for all nodes)
ConstChildRIter childrenREnd() const
Same but const.
MultipassBitMask multipassNode() const
Get the current multipass settings for the node.
bool visible()
Is node visible (status == Active)?
DrawModes::DrawMode drawMode_
private draw mode
picks faces (may not be implemented for all nodes)
MultipassBitMask multipassStatus() const
Get the current multipass settings for the nodes status functions.
void show()
Show node: set status to Active.
std::string vs_
vertex shader
virtual void draw(GLState &, const DrawModes::DrawMode &)
Draw this node using the draw modes _drawMode.
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
ConstChildIter childrenEnd() const
Same but const.
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
std::vector< BaseNode * >::reverse_iterator ChildRIter
allows to reverse iterate over children
BaseNode * parent()
Get the nodes parent node.
picks edges (may not be implemented for all nodes)
ChildIter childrenEnd()
Returns: end-iterator of children.
PASSES
This enum should be used to enable rendering of a node in different.
std::string tes_
tess-eval
Namespace providing different geometric functions concerning angles.
void name(const std::string &_name)
rename a node
size_t nChildren() const
number of children
std::string name() const
Returns: name of node (needs not be unique)
virtual void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
Deferred draw call with shader based renderer.
void setRenderObjectUniformPool(const GLSL::UniformPool *_pool)
Set uniforms for shader based rendering.
std::string tcs_
tess-control
const BaseNode * parent() const
Get the nodes parent node.
Pick spline curve or surface (picks u or u,v coords respectively)
ChildIter find(BaseNode *_node)
pick any of the prior targets (should be implemented for all nodes)
ChildRIter childrenRBegin()
Returns: reverse begin-iterator of children.
TraverseMode
Node traverse types.
std::map< int, RenderObject::Texture > textureSettings_
texture settings for shader based rendering
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
MultipassBitMask multipassStatus_
virtual void enter(GLState &, const DrawModes::DrawMode &)
RenderObjectModifier * renderModifier_
render-object modifier
std::vector< BaseNode * >::iterator ChildIter
allows to iterate over children
void enablePicking(bool _enable)
std::string name_
name of node
const GLSL::UniformPool * getRenderObjectUniformPool()
Get uniforms for shader based rendering.
std::map< DrawModes::DrawModePrimitive, ShaderSet > shaderSettings_
shader settings for primitive modes
StatusMode status_
node status()
RenderObjectModifier * getRenderObjectModifier()
Get render-object modifier.
ChildRIter childrenREnd()
Returns: reverse end-iterator of children.
virtual DrawModes::DrawMode availableDrawModes() const
void setMultipassNode(const MultipassBitMask _passNode)
Set multipass settings for the node.
ConstChildRIter childrenRBegin() const
Same but const.
MultipassBitMask multipassNode_
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
picks faces (should be implemented for all nodes)
bool dirty_
Flag indicating that the node has to be redrawn.
Interface for modifying render objects.
ACG::SceneGraph::BaseNode BaseNode
Base Node.
static unsigned int last_id_used__
used to provide unique IDs to nodes
const GLSL::UniformPool * uniformPool_
user provided uniform pool for shader constants
ConstChildIter childrenBegin() const
Same but cont.
picks only visible front edges (may not be implemented for all nodes)
std::vector< BaseNode * >::const_iterator ConstChildIter
allows to iterate over children
std::vector< BaseNode * > children_
list of children
void setRenderObjectModifier(RenderObjectModifier *_modifier)
Set modifier for render objects.
unsigned int traverseMode_
traverse mode
virtual void mouseEvent(GLState &, QMouseEvent *)
Handle mouse event (some interaction, e.g. modeling)
DrawModePrimitive
Primitive mode of a mesh.
unsigned int id_
ID of node.
virtual void enter(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
virtual void leave(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
void setDirty(bool _dirty=true)
mark node for redrawn
BaseNode * find(const std::string &_name)
bool hidden()
Is node not visible (status != Active)?
PickTarget
What target to use for picking.
StatusMode status() const
Get node's status.
bool relativePaths_
rel or abs path
Interface class between scenegraph and renderer.
DrawMode NONE
not a valid draw mode
unsigned int MultipassBitMask
Multipass pass bit mask type.
virtual void pick(GLState &, PickTarget)
unsigned int traverseMode() const
Return how the node should be traversed.
ChildIter childrenBegin()
Returns: begin-iterator of children.
bool isDirty() const
Check if node should be redrawn.
BaseNode * parent_
pointer to parent node
virtual void leave(GLState &, const DrawModes::DrawMode &)
virtual void boundingBox(Vec3d &, Vec3d &)
void hide()
Hide Node: set status to HideNode.
picks verices (may not be implemented for all nodes)
void set_status(StatusMode _s)
Set the status of this node.
void drawMode(DrawModes::DrawMode _drawMode)