GPU-Accelerated Coverage  0.1.0
Compute coverage tours for known environment with articulated objects on GPU
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
gpu_coverage::Node Class Reference

Scene graph node, corresponding to Assimp's aiNode. More...

#include <Node.h>

Public Types

typedef std::vector< Node * > Children
 
typedef std::vector< Mesh * > Meshes
 
typedef std::vector< AbstractCamera * > Cameras
 
typedef std::vector< Light * > Lights
 
typedef std::vector< Channel * > Channels
 

Public Member Functions

 Node (const aiNode *const node, const aiScene *scene, const std::vector< Mesh * > &meshes, Node *const parent=NULL)
 Constructor for creating a node from an Assimp aiNode. More...
 
 Node (const std::string &name, Node *const parent)
 Constructor for manually creating a child node. More...
 
virtual ~Node ()
 Destructor.
 
void setFrame ()
 Set the current frame of the animation. More...
 
void render (const std::vector< glm::mat4 > &view, const LocationsMVP *const locationsMVP, const LocationsMaterial *const locationsMaterial, const bool hasTesselationShader) const
 Renders the scene using the current shaders. More...
 
void toDot (FILE *dot)
 Write Graphviz Dot node representing this node to file for debugging. More...
 
const Children & getChildren () const
 Returns a vector of all direct children. More...
 
const Meshes & getMeshes () const
 Returns a vector of all meshes associated with this node. More...
 
size_t getId () const
 Returns the unique ID of this node. More...
 
const std::string & getName () const
 Returns the name of this node for logging. More...
 
const NodegetParent () const
 Returns the parent node. More...
 
const glm::mat4 & getLocalTransform () const
 Returns the local transform of the node relative to the parent node. More...
 
const glm::mat4 & getWorldTransform () const
 Returns the transform of the node in world coordinates. More...
 
void setLocalTransform (const glm::mat4 &localTransform)
 Sets the local transform of the node relative to the parent node. More...
 
void addCamera (AbstractCamera *const camera)
 Adds a camera to this node. More...
 
void addLight (Light *const light)
 Adds a light source to this node. More...
 
void addAnimationChannel (Channel *const channel)
 Adds an animation channel to this node. More...
 
bool isVisible () const
 Returns true if the node is visible. More...
 
void setVisible (bool visible)
 Sets the visibility of this node. More...
 
const Cameras & getCameras () const
 Returns the cameras associated with this node. More...
 
const Lights & getLights () const
 Returns the light sources associated with this node. More...
 
const Channels & getChannels () const
 Returns the animation channels influencing this node. More...
 

Protected Member Functions

void setFrameRecursive (bool needsUpdate)
 Updates the current frame number recursively in all child frames. More...
 
void updateWorldTransform ()
 Recomputes the world transform after the local transform has changed. More...
 

Protected Attributes

const size_t id
 Unique ID, see getId().
 
const std::string name
 Name of this node for logging, see getName().
 
Children children
 Direct children of this node.
 
std::vector< bool > allocatedChild
 Bit map indicating which children this node has allocated and is in charge of deleting later.
 
Meshes meshes
 Meshes associated with this node.
 
Cameras cameras
 Cameras associated with this node.
 
Lights lights
 Light sources associated with this node.
 
Channels channels
 Animation channels influencing this node.
 
Node *const parent
 Parent node.
 
glm::mat4 worldTransform
 Current world transform, see getWorldTransform().
 
glm::mat4 localTransform
 Current world transform, see getLocalTransform().
 
bool visible
 True if node is visible while rendering, see setVisible() and isVisible().
 

Friends

class Scene
 

Detailed Description

Scene graph node, corresponding to Assimp's aiNode.

Constructor & Destructor Documentation

gpu_coverage::Node::Node ( const aiNode *const  node,
const aiScene *  scene,
const std::vector< Mesh * > &  meshes,
Node *const  parent = NULL 
)

Constructor for creating a node from an Assimp aiNode.

Parameters
nodeThe Assimp aiNode for creating this node.
sceneThe scene containing this node.
meshesAll meshes loaded beforehand.
parentThe parent node (NULL if this node is the root node).
gpu_coverage::Node::Node ( const std::string &  name,
Node *const  parent 
)

Constructor for manually creating a child node.

Parameters
nameName of the child node.
parentParent node.

Member Function Documentation

void gpu_coverage::Node::addAnimationChannel ( Channel *const  channel)

Adds an animation channel to this node.

Parameters
camera
void gpu_coverage::Node::addCamera ( AbstractCamera *const  camera)

Adds a camera to this node.

Parameters
camera
void gpu_coverage::Node::addLight ( Light *const  light)

Adds a light source to this node.

Parameters
camera
const Cameras& gpu_coverage::Node::getCameras ( ) const
inline

Returns the cameras associated with this node.

Returns
Vector of cameras.
const Channels& gpu_coverage::Node::getChannels ( ) const
inline

Returns the animation channels influencing this node.

Returns
Vector of animation channels.
const Children& gpu_coverage::Node::getChildren ( ) const
inline

Returns a vector of all direct children.

Returns
Children of this node.
size_t gpu_coverage::Node::getId ( ) const
inline

Returns the unique ID of this node.

Returns
ID.
const Lights& gpu_coverage::Node::getLights ( ) const
inline

Returns the light sources associated with this node.

Returns
Vector of light sources.
const glm::mat4& gpu_coverage::Node::getLocalTransform ( ) const
inline

Returns the local transform of the node relative to the parent node.

Returns
Local transform.
const Meshes& gpu_coverage::Node::getMeshes ( ) const
inline

Returns a vector of all meshes associated with this node.

Returns
Children of this node.
const std::string& gpu_coverage::Node::getName ( ) const
inline

Returns the name of this node for logging.

Returns
Name of this node.

If available, the name included in the input file read by Assimp is used.

const Node* gpu_coverage::Node::getParent ( ) const
inline

Returns the parent node.

Returns
Parent node.
const glm::mat4& gpu_coverage::Node::getWorldTransform ( ) const
inline

Returns the transform of the node in world coordinates.

Returns
World transform.
bool gpu_coverage::Node::isVisible ( ) const
inline

Returns true if the node is visible.

Parameters
Trueif node is visible.
void gpu_coverage::Node::render ( const std::vector< glm::mat4 > &  view,
const LocationsMVP *const  locationsMVP,
const LocationsMaterial *const  locationsMaterial,
const bool  hasTesselationShader 
) const

Renders the scene using the current shaders.

Parameters
viewView matrix (or matrices) as set by AbstractCamera::setViewProjection().
locationsMVPLocation of the shader variables for model, view, and projection matrices.
locationsMaterialLocation of the shader variables for material and light variables.
hasTesselationShaderTrue if the current shader has a tesselation stage.
void gpu_coverage::Node::setFrame ( )

Set the current frame of the animation.

Parameters
[in]frameFrame number of the animation.

This method passes the new frame number to all animation Channels and recomputes the local transforms of all tree nodes recursively.

void gpu_coverage::Node::setFrameRecursive ( bool  needsUpdate)
protected

Updates the current frame number recursively in all child frames.

Parameters
needsUpdateTrue if the local transform needs to be updated.

needsUpdate is true if the local transform of this node or one of its ancestors in the tree has changed due to an animation channel. In this case, the world transform of all children will also have to be recomputed.

void gpu_coverage::Node::setLocalTransform ( const glm::mat4 &  localTransform)
inline

Sets the local transform of the node relative to the parent node.

Parameters
localTransformThe local transform.

This method also updates the node's world transform, but does not update the transformations of the children.

void gpu_coverage::Node::setVisible ( bool  visible)
inline

Sets the visibility of this node.

Parameters
visibleTrue if node is visible.

Children of invisible nodes will not be rendered.

void gpu_coverage::Node::toDot ( FILE *  dot)

Write Graphviz Dot node representing this node to file for debugging.

Parameters
[in]dotOutput Dot file.
void gpu_coverage::Node::updateWorldTransform ( )
protected

Recomputes the world transform after the local transform has changed.

setLocalTransform() triggers this method.


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