V-ART
|
Base class for objects that compose a scene graph. More...
#include <scenenode.h>
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 () |
SceneNode & | operator= (const SceneNode &node) |
virtual SceneNode * | Copy ()=0 |
virtual SceneNode * | RecursiveCopy () |
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... | |
SceneNode * | FindChildByName (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 |
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.
Definition at line 28 of file scenenode.h.
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.
|
virtual |
Definition at line 36 of file scenenode.cpp.
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.
|
pure virtual |
Returns a copy of an SceneNode. Every derived class must reimplement this method, to avoid errors with VART::SceneNode::RecursiveCopy.
Implemented in VART::Joint, VART::PolyLine, VART::MeshObject, VART::Transform, VART::Cone, VART::Cylinder, VART::Light, VART::Dot, VART::UniaxialJoint, VART::Sphere, VART::PolyaxialJoint, VART::BiaxialJoint, and VART::RefSystem.
bool VART::SceneNode::DetachChild | ( | SceneNode * | childPtr | ) |
Removes a child from the child list.
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.
|
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.
|
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.
|
virtual |
Recursive drawing using OpenGL commands.
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.
Definition at line 96 of file scenenode.cpp.
References FindChildByName().
Referenced by VART::Action::Copy(), FindChildByName(), and VART::Scene::GetObjectRec().
Search target among children.
targetPtr | [in] Node to search for. |
resultPtr | [out] Where to store the computed path. |
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.
targetName | [in] Node to search for. |
resultPtr | [out] Where to store the computed path. |
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.
Definition at line 112 of file scenenode.cpp.
|
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().
|
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().
Find all the nodes of with typeID 'type'.
Definition at line 242 of file scenenode.cpp.
|
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().
|
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 | ) |
Definition at line 47 of file scenenode.cpp.
References childList, and description.
Referenced by VART::Sphere::operator=(), VART::Dot::operator=(), VART::Cone::operator=(), and VART::Cylinder::operator=().
|
virtual |
Returns a copy of an SceneNode, and of all of its children, recursively.
Definition at line 23 of file scenenode.cpp.
References AddChild(), and childList.
|
protected |
Recursive auxiliar method for FindPathTo.
Definition at line 134 of file scenenode.cpp.
References VART::SGPath::PushFront().
|
protected |
Recursive auxiliar method for FindPathTo.
|
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().
|
virtual |
Process all children in breadth-first order.
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().
|
virtual |
Process all children in depth-first order.
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().
|
virtual |
Recursively outputs XML representation of the scene node.
Reimplemented in VART::Joint.
Definition at line 281 of file scenenode.cpp.
|
protected |
Child list.
Definition at line 160 of file scenenode.h.
Referenced by LocateBreadthFirst(), operator=(), RecursiveCopy(), SceneNode(), and TraverseBreadthFirst().
|
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().
|
static |
Definition at line 147 of file scenenode.h.