Developer Documentation
ACG::SceneGraph::SkeletonNodeT< SkeletonType > Class Template Reference

#include <AC>

Inheritance diagram for ACG::SceneGraph::SkeletonNodeT< SkeletonType >:
ACG::SceneGraph::ACG::SceneGraph::BaseNode

Public Types

typedef SkeletonType::Point Point
 
typedef JointT< typename SkeletonType::Point > Joint
 
typedef SkeletonType::Pose Pose
 
typedef SkeletonType::Matrix Matrix
 
- Public Types inherited from ACG::SceneGraph::ACG::SceneGraph::BaseNode
enum  StatusMode { Active = 0x1, HideNode = 0x2, HideChildren = 0x4, HideSubtree = 0x8 }
 Status modi. More...
 
enum  TraverseMode { NodeFirst = 0x1, ChildrenFirst = 0x2, SecondPass = 0x4 }
 Node traverse types. More...
 
typedef std::vector< BaseNode * >::const_iterator ConstChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::iterator ChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::const_reverse_iterator ConstChildRIter
 allows to reverse iterate over children
 
typedef std::vector< BaseNode * >::reverse_iterator ChildRIter
 allows to reverse iterate over children
 
enum  PASSES {
  NOPASS = 0, ALLPASSES = 1 << 0, PASS_1 = 1 << 1, PASS_2 = 1 << 2,
  PASS_3 = 1 << 3, PASS_4 = 1 << 4, PASS_5 = 1 << 5, PASS_6 = 1 << 6,
  PASS_7 = 1 << 7, PASS_8 = 1 << 8
}
 This enum should be used to enable rendering of a node in different.
 
typedef unsigned int MultipassBitMask
 Multipass pass bit mask type.
 

Public Member Functions

 ACG_CLASSNAME (SkeletonNodeT)
 
 SkeletonNodeT (SkeletonType &_skeleton, BaseNode *_parent=0, std::string _name="<SkeletonNode>")
 Constructor. More...
 
 ~SkeletonNodeT ()
 Destructor. More...
 
SkeletonType & skeleton ()
 Returns a pointer to the skeleton. More...
 
DrawModes::DrawMode availableDrawModes () const override
 Returns available draw modes. More...
 
void boundingBox (Vec3d &_bbMin, Vec3d &_bbMax) override
 Returns the bounding box of this node. More...
 
void draw (GLState &_state, const DrawModes::DrawMode &_drawMode) override
 Renders the nodes contents using the given render state and draw mode. More...
 
void pick (GLState &_state, PickTarget _target) override
 Renders the node in picking mode, restricted to the node components given by _target. More...
 
void getRenderObjects (IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat) override
 Adds renderobjects to renderer for flexible shader pipeline. More...
 
void setActivePose (const AnimationHandle &_hAni)
 Set the pose which should be rendered. More...
 
AnimationHandle activePose ()
 Get the pose that is used for rendering. More...
 
void showCoordFrames (bool _bVisible=true)
 Toggle visibility of coordinate frames for all joints. More...
 
bool coordFramesVisible ()
 
double frameSize ()
 returns the size of the rendered coordinate system
 
- Public Member Functions inherited from ACG::SceneGraph::ACG::SceneGraph::BaseNode
 BaseNode (BaseNode *_parent=0, std::string _name="<unknown>")
 Default constructor.
 
 BaseNode (BaseNode *_parent, BaseNode *_child, std::string _name="<unknown>")
 Put this node between _parent and _child.
 
virtual ~BaseNode ()
 Destructor.
 
void delete_subtree ()
 Delete the whole subtree of this node. More...
 
virtual const std::string & className () const =0
 Return class name (implemented by the ACG_CLASSNAME macro)
 
virtual void enter (GLState &, const DrawModes::DrawMode &)
 
virtual void enter (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void draw (GLState &, const DrawModes::DrawMode &)
 Draw this node using the draw modes _drawMode. More...
 
virtual void getRenderObjects (IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat)
 Deferred draw call with shader based renderer. More...
 
virtual void leave (GLState &, const DrawModes::DrawMode &)
 
virtual void leave (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void enterPick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
virtual void pick (GLState &, PickTarget)
 
virtual void leavePick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
void enablePicking (bool _enable)
 
bool pickingEnabled ()
 
virtual void mouseEvent (GLState &, QMouseEvent *)
 Handle mouse event (some interaction, e.g. modeling)
 
void setDirty (bool _dirty=true)
 mark node for redrawn
 
bool isDirty () const
 Check if node should be redrawn.
 
ChildIter childrenBegin ()
 Returns: begin-iterator of children.
 
ConstChildIter childrenBegin () const
 Same but cont.
 
ChildIter childrenEnd ()
 Returns: end-iterator of children.
 
ConstChildIter childrenEnd () const
 Same but const.
 
ChildRIter childrenRBegin ()
 Returns: reverse begin-iterator of children.
 
ConstChildRIter childrenRBegin () const
 Same but const.
 
ChildRIter childrenREnd ()
 Returns: reverse end-iterator of children.
 
ConstChildRIter childrenREnd () const
 Same but const.
 
void push_back (BaseNode *_node)
 Insert _node at the end of the list of children.
 
void remove (ChildIter _pos)
 
size_t nChildren () const
 number of children
 
ChildIter find (BaseNode *_node)
 
BaseNodefind (const std::string &_name)
 
BaseNodeparent ()
 Get the nodes parent node.
 
const BaseNodeparent () const
 Get the nodes parent node.
 
void set_parent (BaseNode *_parent)
 Set the parent of this node. More...
 
StatusMode status () const
 Get node's status.
 
void set_status (StatusMode _s)
 Set the status of this node.
 
void hide ()
 Hide Node: set status to HideNode.
 
void show ()
 Show node: set status to Active.
 
bool visible ()
 Is node visible (status == Active)?
 
bool hidden ()
 Is node not visible (status != Active)?
 
std::string name () const
 Returns: name of node (needs not be unique)
 
void name (const std::string &_name)
 rename a node
 
unsigned int id () const
 
DrawModes::DrawMode drawMode () const
 Return the own draw modes of this node.
 
void drawMode (DrawModes::DrawMode _drawMode)
 
unsigned int traverseMode () const
 Return how the node should be traversed.
 
void setTraverseMode (unsigned int _mode)
 Set traverse mode for node.
 
MultipassBitMask multipassStatus () const
 Get the current multipass settings for the nodes status functions. More...
 
void setMultipassStatus (const MultipassBitMask _passStatus)
 Set multipass settings for the nodes status functions. More...
 
void multipassStatusSetActive (const unsigned int _i, bool _active)
 Set multipass status to traverse in a specific pass. More...
 
bool multipassStatusActive (const unsigned int _i) const
 Get multipass status to traverse in a specific pass. More...
 
MultipassBitMask multipassNode () const
 Get the current multipass settings for the node. More...
 
void setMultipassNode (const MultipassBitMask _passNode)
 Set multipass settings for the node. More...
 
void multipassNodeSetActive (const unsigned int _i, bool _active)
 Set Node status to traverse in a specific pass. More...
 
bool multipassNodeActive (const unsigned int _i) const
 Get Node status to traverse in a specific pass. More...
 
void setRenderObjectShaders (const std::string &_vertexShaderFile, const std::string &_geometryShaderFile, const std::string &_fragmentShaderFile, bool _relativePaths=true, DrawModes::DrawModePrimitive _primitiveType=DrawModes::PRIMITIVE_POLYGON)
 Set custom shaders. More...
 
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)
 Set custom shaders. More...
 
void setRenderObjectUniformPool (const GLSL::UniformPool *_pool)
 Set uniforms for shader based rendering. More...
 
const GLSL::UniformPoolgetRenderObjectUniformPool ()
 Get uniforms for shader based rendering. More...
 
void setRenderObjectTexture (int _samplerSlot, GLuint _texId, GLenum _texType=GL_TEXTURE_2D)
 Set textures for shader based rendering. More...
 
void setRenderObjectModifier (RenderObjectModifier *_modifier)
 Set modifier for render objects. More...
 
RenderObjectModifiergetRenderObjectModifier ()
 Get render-object modifier. More...
 
void applyRenderObjectSettings (DrawModes::DrawModePrimitive _primitive, RenderObject *_obj) const
 Set shaders, textures and uniforms as provided by user to a render-object. More...
 

Private Member Functions

void pick_vertices (GLState &_state)
 Pick method for vertices. More...
 
void pick_edges (GLState &_state)
 Pick method for edges. More...
 
void draw_bone (GLState &_state, DrawModes::DrawMode _drawMode, const Point &_parent, const Point &_axis)
 Helper function to draw the bones. More...
 
void addBoneToRenderer (IRenderer *_renderer, RenderObject &_base, const Point &_parent, const Point &_axis)
 Helper function to create a renderobject for bones. More...
 
void computeConeMatrices (const GLMatrixf &_modelView, const Point &_parent, const Point &_axis, GLMatrixf *_outCone0, GLMatrixf *_outCone1)
 Helper function to compute modelview matrices for the two cones composing a bone.
 
void NormalizeCoordinateFrame (Matrix &_mat)
 Normalizes a coordinate frame defined by the given matrix. More...
 
void getJointColor (const Vec4f &_baseColor, Vec4f &_result)
 get a joint color suitable to the baseColor More...
 
void HSVtoRGB (const Vec4f &_HSV, Vec4f &_RGB)
 Convert HSV color to RGB. More...
 
void RGBtoHSV (const Vec4f &_RGB, Vec4f &_HSV)
 Convert RGB color to HSV. More...
 
double unprojectPointSize (double _pointSize, const Vec3d &_point, GLState &_state)
 Simulate glPointSize(12) with a sphere. More...
 

Private Attributes

bool bCoordFramesVisible_
 Coordinate frames are visible if this is true, not visible if false.
 
SkeletonType & skeleton_
 The skeleton nodes skeleton.
 
AnimationHandle hAni_
 The active pose, this one is going to be rendered.
 
double fFrameSize_
 size for the coord-frame
 
int slices_
 
int stacks_
 
ACG::GLSpheresphere_
 
ACG::GLConecone_
 
ACG::GLCylindercylinder_
 
GeometryBuffer pointInstanceData_
 per instance data of joint spheres
 
VertexDeclaration pointInstanceDecl_
 
GeometryBuffer boneInstanceData_
 per instance data of bones
 
VertexDeclaration boneInstanceDecl_
 

Detailed Description

template<class SkeletonType>
class ACG::SceneGraph::SkeletonNodeT< SkeletonType >

/.../SkeletonNodeT.hh>

Brief Description.

A more elaborate description follows.

Definition at line 77 of file SkeletonNodeT.hh.

Constructor & Destructor Documentation

◆ SkeletonNodeT()

template<class SkeletonType>
ACG::SceneGraph::SkeletonNodeT< SkeletonType >::SkeletonNodeT ( SkeletonType &  _skeleton,
BaseNode _parent = 0,
std::string  _name = "<SkeletonNode>" 
)

Constructor.

Definition at line 75 of file SkeletonNodeT_impl.hh.

◆ ~SkeletonNodeT()

template<class SkeletonType >
ACG::SceneGraph::SkeletonNodeT< SkeletonType >::~SkeletonNodeT ( )

Destructor.

Definition at line 98 of file SkeletonNodeT_impl.hh.

Member Function Documentation

◆ activePose()

template<class SkeletonType >
AnimationHandle ACG::SceneGraph::SkeletonNodeT< SkeletonType >::activePose ( )

Get the pose that is used for rendering.

Returns the active pose set with SkeletonNodeT::setActivePose.

Definition at line 720 of file SkeletonNodeT_impl.hh.

◆ addBoneToRenderer()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::addBoneToRenderer ( IRenderer _renderer,
RenderObject _base,
const Point &  _parent,
const Point &  _axis 
)
private

Helper function to create a renderobject for bones.

Definition at line 629 of file SkeletonNodeT_impl.hh.

◆ availableDrawModes()

template<class SkeletonType >
DrawModes::DrawMode ACG::SceneGraph::SkeletonNodeT< SkeletonType >::availableDrawModes ( ) const
overridevirtual

Returns available draw modes.

Reimplemented from ACG::SceneGraph::ACG::SceneGraph::BaseNode.

Definition at line 153 of file SkeletonNodeT_impl.hh.

◆ boundingBox()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::boundingBox ( Vec3d _bbMin,
Vec3d _bbMax 
)
overridevirtual

Returns the bounding box of this node.

Reimplemented from ACG::SceneGraph::ACG::SceneGraph::BaseNode.

Definition at line 129 of file SkeletonNodeT_impl.hh.

◆ draw()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::draw ( GLState _state,
const DrawModes::DrawMode _drawMode 
)
override

Renders the nodes contents using the given render state and draw mode.

Definition at line 314 of file SkeletonNodeT_impl.hh.

◆ draw_bone()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::draw_bone ( GLState _state,
DrawModes::DrawMode  _drawMode,
const Point &  _parent,
const Point &  _axis 
)
private

Helper function to draw the bones.

Definition at line 601 of file SkeletonNodeT_impl.hh.

◆ getJointColor()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::getJointColor ( const Vec4f _baseColor,
Vec4f _result 
)
private

get a joint color suitable to the baseColor

get suitable color for the joint

Definition at line 491 of file SkeletonNodeT_impl.hh.

◆ getRenderObjects()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::getRenderObjects ( IRenderer _renderer,
GLState _state,
const DrawModes::DrawMode _drawMode,
const Material _mat 
)
override

Adds renderobjects to renderer for flexible shader pipeline.

Generates renderobjects instead of direct draw calls for better rendering management.

Definition at line 776 of file SkeletonNodeT_impl.hh.

◆ HSVtoRGB()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::HSVtoRGB ( const Vec4f _HSV,
Vec4f _RGB 
)
private

Convert HSV color to RGB.

Converts the color from HSV color space to RGB.

H is in range [0, 360], S and V in [0, 1].

Parameters
[in]_HSVAn array of 3 GLfloats, holding H, S and V
[out]_RGBAn array of 3 GLfloats, holding R, G and B

Definition at line 201 of file SkeletonNodeT_impl.hh.

◆ NormalizeCoordinateFrame()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::NormalizeCoordinateFrame ( Matrix &  _mat)
private

Normalizes a coordinate frame defined by the given matrix.

Definition at line 176 of file SkeletonNodeT_impl.hh.

◆ pick()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::pick ( GLState _state,
PickTarget  _target 
)
override

Renders the node in picking mode, restricted to the node components given by _target.

Definition at line 512 of file SkeletonNodeT_impl.hh.

◆ pick_edges()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::pick_edges ( GLState _state)
private

Pick method for edges.

Definition at line 570 of file SkeletonNodeT_impl.hh.

◆ pick_vertices()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::pick_vertices ( GLState _state)
private

Pick method for vertices.

Definition at line 546 of file SkeletonNodeT_impl.hh.

◆ RGBtoHSV()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::RGBtoHSV ( const Vec4f _RGB,
Vec4f _HSV 
)
private

Convert RGB color to HSV.

Converts a color from RGB color space to HSV.

Red, green and blue are in the range [0, 1].

Parameters
[out]_RGBAn array of 3 GLfloats, holding R, G and B
[in]_HSVAn array of 3 GLfloats, holding H, S and V

Definition at line 262 of file SkeletonNodeT_impl.hh.

◆ setActivePose()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::setActivePose ( const AnimationHandle _hAni)

Set the pose which should be rendered.

Selects the active pose.

The active pose is the pose that is drawn to the viewport. If the animation handle is invalid (-1), the default pose will be drawn.

Warning
Do not call this method directly, call SkeletonObject::setActivePose instead. The object has to be notified, in order to properly update the text node positions.
Parameters
_hAniA handle to an animation, or an invalid handle for the default pose.

Definition at line 708 of file SkeletonNodeT_impl.hh.

◆ showCoordFrames()

template<class SkeletonType >
void ACG::SceneGraph::SkeletonNodeT< SkeletonType >::showCoordFrames ( bool  _bVisible = true)

Toggle visibility of coordinate frames for all joints.

Definition at line 732 of file SkeletonNodeT_impl.hh.

◆ skeleton()

template<class SkeletonType >
SkeletonType & ACG::SceneGraph::SkeletonNodeT< SkeletonType >::skeleton ( )

Returns a pointer to the skeleton.

Definition at line 117 of file SkeletonNodeT_impl.hh.

◆ unprojectPointSize()

template<class SkeletonType >
double ACG::SceneGraph::SkeletonNodeT< SkeletonType >::unprojectPointSize ( double  _pointSize,
const Vec3d _point,
GLState _state 
)
private

Simulate glPointSize(12) with a sphere.

Compute the radius of a sphere simulating glPointSize after projection.

Definition at line 749 of file SkeletonNodeT_impl.hh.


The documentation for this class was generated from the following files: