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