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