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 StatusMode status() const
Get node's status.
ChildIter childrenEnd()
Returns: end-iterator of children.
virtual void enter(GLState &, const DrawModes::DrawMode &)
unsigned int MultipassBitMask
Multipass pass bit mask type.
void enablePicking(bool _enable)
MultipassBitMask multipassStatus() const
Get the current multipass settings for the nodes status functions.
std::vector< BaseNode * >::iterator ChildIter
allows to iterate over children
virtual DrawModes::DrawMode availableDrawModes() const
ConstChildRIter childrenRBegin() const
Same but const.
virtual void draw(GLState &, const DrawModes::DrawMode &)
Draw this node using the draw modes _drawMode.
picks only visible front edges (may not be implemented for all nodes)
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
BaseNode * parent()
Get the nodes parent node.
MultipassBitMask multipassStatus_
StatusMode status_
node status()
MultipassBitMask multipassNode() const
Get the current multipass settings for the node.
virtual void pick(GLState &, PickTarget)
std::string name() const
Returns: name of node (needs not be unique)
RenderObjectModifier * renderModifier_
render-object modifier
Interface for modifying render objects.
void setRenderObjectUniformPool(const GLSL::UniformPool *_pool)
Set uniforms for shader based rendering.
void setRenderObjectModifier(RenderObjectModifier *_modifier)
Set modifier for render objects.
ChildIter find(BaseNode *_node)
virtual void enter(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
PASSES
This enum should be used to enable rendering of a node in different.
BaseNode * parent_
pointer to parent node
void set_status(StatusMode _s)
Set the status of this node.
PickTarget
What target to use for picking.
std::string name_
name of node
const GLSL::UniformPool * uniformPool_
user provided uniform pool for shader constants
size_t nChildren() const
number of children
bool hidden()
Is node not visible (status != Active)?
bool relativePaths_
rel or abs path
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.
ConstChildRIter childrenREnd() const
Same but const.
std::vector< BaseNode * >::const_iterator ConstChildIter
allows to iterate over children
void name(const std::string &_name)
rename a node
std::vector< BaseNode * > children_
list of children
virtual void mouseEvent(GLState &, QMouseEvent *)
Handle mouse event (some interaction, e.g. modeling)
void hide()
Hide Node: set status to HideNode.
std::string tes_
tess-eval
void setMultipassStatus(const MultipassBitMask _passStatus)
Set multipass settings for the nodes status functions.
ChildIter childrenBegin()
Returns: begin-iterator of children.
unsigned int id_
ID of node.
unsigned int traverseMode_
traverse mode
ChildRIter childrenRBegin()
Returns: reverse begin-iterator of children.
bool dirty_
Flag indicating that the node has to be redrawn.
virtual void leave(GLState &, const DrawModes::DrawMode &)
TraverseMode
Node traverse types.
DrawModePrimitive
Primitive mode of a mesh.
Namespace providing different geometric functions concerning angles.
RenderObjectModifier * getRenderObjectModifier()
Get render-object modifier.
picks verices (may not be implemented for all nodes)
Pick spline curve or surface (picks u or u,v coords respectively)
DrawMode NONE
not a valid draw mode
picks only visible front verices (may not be implemented for all nodes)
void show()
Show node: set status to Active.
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
const BaseNode * parent() const
Get the nodes parent node.
picks edges (may not be implemented for all nodes)
const GLSL::UniformPool * getRenderObjectUniformPool()
Get uniforms for shader based rendering.
bool isDirty() const
Check if node should be redrawn.
virtual void leave(IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
std::vector< BaseNode * >::reverse_iterator ChildRIter
allows to reverse iterate over children
void setDirty(bool _dirty=true)
mark node for redrawn
MultipassBitMask multipassNode_
std::vector< BaseNode * >::const_reverse_iterator ConstChildRIter
allows to reverse iterate over children
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
void setMultipassNode(const MultipassBitMask _passNode)
Set multipass settings for the node.
BaseNode * find(const std::string &_name)
picks faces (may not be implemented for all nodes)
static unsigned int last_id_used__
used to provide unique IDs to nodes
bool visible()
Is node visible (status == Active)?
void drawMode(DrawModes::DrawMode _drawMode)
pick any of the prior targets (should be implemented for all nodes)
std::map< DrawModes::DrawModePrimitive, ShaderSet > shaderSettings_
shader settings for primitive modes
DrawModes::DrawMode drawMode_
private draw mode
Interface class between scenegraph and renderer.
unsigned int traverseMode() const
Return how the node should be traversed.
virtual void boundingBox(Vec3d &, Vec3d &)
ChildRIter childrenREnd()
Returns: reverse end-iterator of children.
ConstChildIter childrenEnd() const
Same but const.
picks faces (should be implemented for all nodes)
std::string vs_
vertex shader
std::map< int, RenderObject::Texture > textureSettings_
texture settings for shader based rendering
ACG::SceneGraph::BaseNode BaseNode
Base Node.
std::string tcs_
tess-control