V-ART
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
VART::SceneNode Class Referenceabstract

Base class for objects that compose a scene graph. More...

#include <scenenode.h>

Inheritance diagram for VART::SceneNode:
VART::MemoryObj VART::GraphicObj VART::Light VART::Transform VART::Cone VART::Curve VART::Cylinder VART::Dot VART::MeshObject VART::PolyLine VART::RefSystem VART::Sphere VART::PointLight VART::SpotLight VART::Joint

Public Types

enum  TypeID {
  NONE, GRAPHIC_OBJ, BOX, CONE,
  CURVE, BEZIER, CYLINDER, IMAGE,
  IMAGE_2D, VOLUME, MESH_OBJECT, SPHERE,
  JOINT, BIAXIAL_JOINT, CONDYLAR_JOINT, ELLIPSOID_JOINT,
  SADDLE_JOINT, PLANE_JOINT, POLYAXIAL_JOINT, UNIAXIAL_JOINT,
  HINGE_JOINT, PIVOT_JOINT, TRANSFORM
}
 

Public Member Functions

 SceneNode ()
 Creates an uninitialized scene node. More...
 
 SceneNode (SceneNode &node)
 
virtual ~SceneNode ()
 
SceneNodeoperator= (const SceneNode &node)
 
virtual SceneNodeCopy ()=0
 
virtual SceneNodeRecursiveCopy ()
 
const std::string & GetDescription () const
 Returns a copy of the object's description. More...
 
void SetDescription (const std::string &desc)
 Changes the object's description. More...
 
void AddChild (SceneNode &child)
 Add a child at the end of child list. More...
 
bool DetachChild (SceneNode *childPtr)
 Removes a child from the child list. More...
 
virtual bool DrawOGL () const
 Recursive drawing using OpenGL commands. More...
 
virtual void DrawForPicking () const =0
 Draws and object, setting pick info. More...
 
virtual TypeID GetID () const
 Returns type identification of the node. More...
 
void AutoDeleteChildren () const
 Deletes (dealocate memory) recursively all children marked as 'autoDelete'. More...
 
SceneNodeFindChildByName (const std::string &name) const
 Recusively searches its children for a given name. More...
 
std::list< SceneNode * > GetChilds ()
 
bool FindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Search target among children. More...
 
bool FindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Search target among children. More...
 
int GetNodeTypeList (TypeID type, std::list< SceneNode * > &nodeList)
 Find all the nodes of with typeID 'type'. More...
 
virtual void TraverseDepthFirst (SNOperator *operatorPtr) const
 Process all children in depth-first order. More...
 
virtual void TraverseBreadthFirst (SNOperator *operatorPtr) const
 Process all children in breadth-first order. More...
 
virtual void LocateDepthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (depth first) More...
 
virtual void LocateBreadthFirst (SNLocator *locatorPtr) const
 Seaches for a particular scene node (breadth first) More...
 
virtual void XmlPrintOn (std::ostream &os, unsigned int indent) const
 Recursively outputs XML representation of the scene node. More...
 
- Public Member Functions inherited from VART::MemoryObj
 MemoryObj ()
 Default constructor. More...
 
 MemoryObj (const VART::MemoryObj &obj)
 Copy constructor. More...
 

Static Public Attributes

static bool recursivePrinting = true
 

Protected Member Functions

virtual bool DrawInstanceOGL () const
 Non-recursive drawing - should be overriden by every derived class. More...
 
bool RecursiveFindPathTo (SceneNode *targetPtr, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 
bool RecursiveFindPathTo (const std::string &targetName, SGPath *resultPtr) const
 Recursive auxiliar method for FindPathTo. More...
 

Protected Attributes

std::list< SceneNode * > childList
 Child list. More...
 
std::string description
 Textual identification. More...
 

Additional Inherited Members

- Public Attributes inherited from VART::MemoryObj
bool autoDelete
 

Detailed Description

Base class for objects that compose a scene graph.

A SceneNode is something directly related to the rendering engine such as shapes (GraphicObj), transformations (Transform) and lights (Light). Several nodes together create an environment (Scene) that is draw every rendering cicle. SceneNodes have childs to allow creating a hierarchy of objects. This class should be considered abstract.

Definition at line 25 of file scenenode.h.

Member Enumeration Documentation

Enumerator
NONE 
GRAPHIC_OBJ 
BOX 
CONE 
CURVE 
BEZIER 
CYLINDER 
IMAGE 
IMAGE_2D 
VOLUME 
MESH_OBJECT 
SPHERE 
JOINT 
BIAXIAL_JOINT 
CONDYLAR_JOINT 
ELLIPSOID_JOINT 
SADDLE_JOINT 
PLANE_JOINT 
POLYAXIAL_JOINT 
UNIAXIAL_JOINT 
HINGE_JOINT 
PIVOT_JOINT 
TRANSFORM 

Definition at line 28 of file scenenode.h.

Constructor & Destructor Documentation

VART::SceneNode::SceneNode ( )

Creates an uninitialized scene node.

Definition at line 18 of file scenenode.cpp.

VART::SceneNode::SceneNode ( VART::SceneNode node)

Definition at line 41 of file scenenode.cpp.

References childList, and description.

VART::SceneNode::~SceneNode ( )
virtual

Definition at line 36 of file scenenode.cpp.

Member Function Documentation

void VART::SceneNode::AddChild ( VART::SceneNode child)

Add a child at the end of child list.

Definition at line 54 of file scenenode.cpp.

Referenced by VART::XmlScene::LoadSceneNode(), and RecursiveCopy().

void VART::SceneNode::AutoDeleteChildren ( ) const

Deletes (dealocate memory) recursively all children marked as 'autoDelete'.

Definition at line 85 of file scenenode.cpp.

virtual SceneNode* VART::SceneNode::Copy ( )
pure virtual
bool VART::SceneNode::DetachChild ( SceneNode childPtr)

Removes a child from the child list.

Returns
False if given child pointer was not found.

The child node is not destroyed, it is simply removed from the child list. Removes the first ocurrence of given scene node.

Definition at line 59 of file scenenode.cpp.

virtual void VART::SceneNode::DrawForPicking ( ) const
pure virtual

Draws and object, setting pick info.

This method should be called in selection mode in order to identify objects that are selected by the mouse (see Scene::Pick).

Implemented in VART::Transform, VART::GraphicObj, and VART::Light.

virtual bool VART::SceneNode::DrawInstanceOGL ( ) const
inlineprotectedvirtual

Non-recursive drawing - should be overriden by every derived class.

Reimplemented in VART::MeshObject, VART::Dot, and VART::Sphere.

Definition at line 151 of file scenenode.h.

bool VART::SceneNode::DrawOGL ( ) const
virtual

Recursive drawing using OpenGL commands.

Returns
false if V-ART is was not compiled with OpenGL support

Reimplemented in VART::Transform, and VART::PolyLine.

Definition at line 76 of file scenenode.cpp.

Referenced by VART::PointLight::DrawOGL().

VART::SceneNode * VART::SceneNode::FindChildByName ( const std::string &  name) const

Recusively searches its children for a given name.

Deprecated:
Please use a SNLocator.

Definition at line 96 of file scenenode.cpp.

References FindChildByName().

Referenced by VART::Action::Copy(), FindChildByName(), and VART::Scene::GetObjectRec().

bool VART::SceneNode::FindPathTo ( SceneNode targetPtr,
SGPath resultPtr 
) const

Search target among children.

Parameters
targetPtr[in] Node to search for.
resultPtr[out] Where to store the computed path.
Returns
True if a path is found. False otherwise.
Deprecated:
Please use LocateDepthFirst.

Performs a depth-first search and returns the first path to target node. If found, the computed path will not include the initial scene node (the one that was asked to find a path) but it will include the target scene node.

Definition at line 119 of file scenenode.cpp.

References VART::SGPath::Clear().

bool VART::SceneNode::FindPathTo ( const std::string &  targetName,
SGPath resultPtr 
) const

Search target among children.

Parameters
targetName[in] Node to search for.
resultPtr[out] Where to store the computed path.
Returns
True if a path is found. False otherwise.
Deprecated:
Please use LocateDepthFirst.

Performs a depth-first search and returns the first path to target node. If found, the computed path will not include the initial scene node (the one that was asked to find a path) but it will include the target scene node.

list< VART::SceneNode * > VART::SceneNode::GetChilds ( )

Returns the list of children.

Deprecated:
Incorrect name. Exposes a private attribute. Returns a list by copy. Please use TraverseDepthFirst or TraverseBreadthFirst.

Definition at line 112 of file scenenode.cpp.

const std::string& VART::SceneNode::GetDescription ( ) const
inline

Returns a copy of the object's description.

Definition at line 50 of file scenenode.h.

References description.

Referenced by VART::XmlScene::LoadMeshFromFile(), VART::OffsetModifier::Modify(), and VART::DescriptionLocator::OperateOn().

virtual TypeID VART::SceneNode::GetID ( ) const
inlinevirtual

Returns type identification of the node.

Reimplemented in VART::Transform, and VART::MeshObject.

Definition at line 76 of file scenenode.h.

References NONE.

Referenced by VART::XmlPrinter::OperateOn().

int VART::SceneNode::GetNodeTypeList ( TypeID  type,
std::list< SceneNode * > &  nodeList 
)

Find all the nodes of with typeID 'type'.

Deprecated:
Does not obey parameter convention. Please use TraverseDepthFirst (or TraverseBreadthFirst) with a Collector.
Returns
total Number of Nodes. 'nodeList' stores nodes.

Definition at line 242 of file scenenode.cpp.

void VART::SceneNode::LocateBreadthFirst ( SNLocator locatorPtr) const
virtual

Seaches for a particular scene node (breadth first)

Applies a locator to self and all of its children. Does not builds a path to target node, since the breadth search is not recursive.

Definition at line 226 of file scenenode.cpp.

References childList, VART::SNLocator::NotFinished(), and VART::SNLocator::OperateOn().

Referenced by VART::XmlJointAction::CreateJointMover().

void VART::SceneNode::LocateDepthFirst ( SNLocator locatorPtr) const
virtual

Seaches for a particular scene node (depth first)

Recursively applies a locator, building a path (see SGPath) to it when it signals completion. The resulting path does not include the initial scene node.

Definition at line 206 of file scenenode.cpp.

References VART::SNLocator::AddNodeToPath(), VART::SNLocator::Finished(), VART::SNLocator::NotFinished(), and VART::SNLocator::OperateOn().

VART::SceneNode & VART::SceneNode::operator= ( const SceneNode node)
VART::SceneNode * VART::SceneNode::RecursiveCopy ( )
virtual

Returns a copy of an SceneNode, and of all of its children, recursively.

Deprecated:
Returns a pointer to memory allocated by the framework.

Definition at line 23 of file scenenode.cpp.

References AddChild(), and childList.

bool VART::SceneNode::RecursiveFindPathTo ( SceneNode targetPtr,
SGPath resultPtr 
) const
protected

Recursive auxiliar method for FindPathTo.

Definition at line 134 of file scenenode.cpp.

References VART::SGPath::PushFront().

bool VART::SceneNode::RecursiveFindPathTo ( const std::string &  targetName,
SGPath resultPtr 
) const
protected

Recursive auxiliar method for FindPathTo.

void VART::SceneNode::SetDescription ( const std::string &  desc)
inline

Changes the object's description.

Definition at line 53 of file scenenode.h.

References description.

Referenced by VART::XmlScene::LoadSceneNode(), and VART::MeshObject::ReadFromOBJ().

void VART::SceneNode::TraverseBreadthFirst ( SNOperator operatorPtr) const
virtual

Process all children in breadth-first order.

Parameters
operatorPtr[in,out] A scene node operator.

Applies a scene node operator to all children in breadth-first order.

Definition at line 188 of file scenenode.cpp.

References childList, and VART::SNOperator::OperateOn().

void VART::SceneNode::TraverseDepthFirst ( SNOperator operatorPtr) const
virtual

Process all children in depth-first order.

Parameters
operatorPtr[in,out] A scene node operator.

Applies a scene node operator to all children in depth-first order.

Definition at line 175 of file scenenode.cpp.

References VART::SNOperator::OperateOn().

void VART::SceneNode::XmlPrintOn ( std::ostream &  os,
unsigned int  indent 
) const
virtual

Recursively outputs XML representation of the scene node.

Reimplemented in VART::Joint.

Definition at line 281 of file scenenode.cpp.

Member Data Documentation

std::list<SceneNode*> VART::SceneNode::childList
protected

Child list.

Definition at line 160 of file scenenode.h.

Referenced by LocateBreadthFirst(), operator=(), RecursiveCopy(), SceneNode(), and TraverseBreadthFirst().

std::string VART::SceneNode::description
protected

Textual identification.

Definition at line 162 of file scenenode.h.

Referenced by GetDescription(), VART::Light::Light(), VART::operator<<(), VART::Light::operator=(), operator=(), SceneNode(), and SetDescription().

bool VART::SceneNode::recursivePrinting = true
static

Definition at line 147 of file scenenode.h.


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