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>
89 namespace SceneGraph {
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;
251 void setDirty (
bool _dirty =
true) { dirty_ = _dirty; }
298 children_.push_back(_node);
306 void remove(ChildIter _pos)
308 if (_pos == childrenEnd())
return;
310 children_.erase(_pos);
324 ChildIter i=std::find(children_.begin(),children_.end(),_node);
333 if ( name() == _name )
337 cIt != childrenEnd(); ++cIt )
381 void hide() { set_status(HideNode); }
383 void show() { set_status(Active); }
387 bool hidden() {
return status_ != Active; }
391 std::string
name()
const {
return name_; }
393 void name(
const std::string& _name) { name_ = _name; }
399 unsigned int id()
const {
return id_; }
492 void multipassStatusSetActive(
const unsigned int _i,
bool _active);
502 bool multipassStatusActive(
const unsigned int _i)
const;
536 void multipassNodeSetActive(
const unsigned int _i ,
bool _active);
546 bool multipassNodeActive(
const unsigned int _i)
const;
578 void setRenderObjectShaders(
const std::string& _vertexShaderFile,
const std::string& _geometryShaderFile,
const std::string& _fragmentShaderFile,
bool _relativePaths =
true,
DrawModes::DrawModePrimitive _primitiveType = DrawModes::PRIMITIVE_POLYGON);
600 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);
630 void setRenderObjectTexture(
int _samplerSlot, GLuint _texId, GLenum _texType = GL_TEXTURE_2D);
762 #endif // ACG_BASE_NODE_HH defined
Pick spline curve or surface (picks u or u,v coords respectively)
ConstChildIter childrenEnd() const
Same but const.
std::map< int, RenderObject::Texture > textureSettings_
texture settings for shader based rendering
BaseNode * parent_
pointer to parent node
Namespace providing different geometric functions concerning angles.
void push_back(BaseNode *_node)
Insert _node at the end of the list of children.
bool visible()
Is node visible (status == Active)?
PickTarget
What target to use for picking.
const GLSL::UniformPool * getRenderObjectUniformPool()
Get uniforms for shader based rendering.
void drawMode(DrawModes::DrawMode _drawMode)
std::map< DrawModes::DrawModePrimitive, ShaderSet > shaderSettings_
shader settings for primitive modes
BaseNode * find(const std::string &_name)
size_t nChildren() const
number of children
virtual void draw(GLState &, const DrawModes::DrawMode &)
Draw this node using the draw modes _drawMode.
picks faces (should be implemented for all nodes)
virtual void pick(GLState &, PickTarget)
pick any of the prior targets (should be implemented for all nodes)
bool relativePaths_
rel or abs path
bool isDirty() const
Check if node should be redrawn.
Interface class between scenegraph and renderer.
unsigned int MultipassBitMask
Multipass pass bit mask type.
void name(const std::string &_name)
rename a node
void setTraverseMode(unsigned int _mode)
Set traverse mode for node.
ChildRIter childrenRBegin()
Returns: reverse begin-iterator of children.
TraverseMode
Node traverse types.
StatusMode status_
node status()
PASSES
This enum should be used to enable rendering of a node in different.
ChildIter childrenBegin()
Returns: begin-iterator of children.
void setMultipassStatus(const MultipassBitMask _passStatus)
Set multipass settings for the nodes status functions.
virtual void enter(GLState &, const DrawModes::DrawMode &)
RenderObjectModifier * renderModifier_
render-object modifier
ConstChildIter childrenBegin() const
Same but cont.
std::string vs_
vertex shader
virtual void getRenderObjects(IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
Deferred draw call with shader based renderer.
bool dirty_
Flag indicating that the node has to be redrawn.
void show()
Show node: set status to Active.
picks verices (may not be implemented for all nodes)
DrawModePrimitive
Primitive mode of a mesh.
unsigned int traverseMode_
traverse mode
ConstChildRIter childrenREnd() const
Same but const.
picks edges (may not be implemented for all nodes)
picks only visible front verices (may not be implemented for all nodes)
ConstChildRIter childrenRBegin() const
Same but const.
DrawModes::DrawMode drawMode_
private draw mode
std::list< BaseNode * >::iterator ChildIter
allows to iterate over children
bool hidden()
Is node not visible (status != Active)?
const BaseNode * parent() const
Get the nodes parent 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
std::string name() const
Returns: name of node (needs not be unique)
RenderObjectModifier * getRenderObjectModifier()
Get render-object modifier.
std::list< BaseNode * > children_
list of children
DrawModes::DrawMode drawMode() const
Return the own draw modes of this node.
ChildRIter childrenREnd()
Returns: reverse end-iterator of children.
MultipassBitMask multipassStatus_
virtual DrawModes::DrawMode availableDrawModes() const
StatusMode status() const
Get node's status.
std::list< BaseNode * >::const_iterator ConstChildIter
allows to iterate over children
virtual void boundingBox(Vec3d &, Vec3d &)
std::string name_
name of node
void hide()
Hide Node: set status to HideNode.
void setDirty(bool _dirty=true)
mark node for redrawn
ACG::SceneGraph::BaseNode BaseNode
Base Node.
picks faces (may not be implemented for all nodes)
MultipassBitMask multipassNode_
void enablePicking(bool _enable)
unsigned int id_
ID of node.
void set_status(StatusMode _s)
Set the status of this node.
std::string tes_
tess-eval
void setRenderObjectModifier(RenderObjectModifier *_modifier)
Set modifier for render objects.
BaseNode * parent()
Get the nodes parent node.
std::string tcs_
tess-control
Interface for modifying render objects.
std::list< BaseNode * >::const_reverse_iterator ConstChildRIter
allows to reverse iterate over children
virtual void mouseEvent(GLState &, QMouseEvent *)
Handle mouse event (some interaction, e.g. modeling)
void setMultipassNode(const MultipassBitMask _passNode)
Set multipass settings for the node.
MultipassBitMask multipassNode() const
Get the current multipass settings for the node.
picks only visible front edges (may not be implemented for all nodes)
MultipassBitMask multipassStatus() const
Get the current multipass settings for the nodes status functions.
void setRenderObjectUniformPool(const GLSL::UniformPool *_pool)
Set uniforms for shader based rendering.
ChildIter childrenEnd()
Returns: end-iterator of children.
DrawMode NONE
not a valid draw mode
unsigned int traverseMode() const
Return how the node should be traversed.
ChildIter find(BaseNode *_node)
std::list< BaseNode * >::reverse_iterator ChildRIter
allows to reverse iterate over children
virtual void leave(GLState &, const DrawModes::DrawMode &)