eng::Node Class Reference

Base Node class. More...

#include <eng_node.hh>

Inheritance diagram for eng::Node:

eng::ColorsNode eng::LodNode eng::MaterialNode eng::ModesNode eng::NormalsNode eng::PartitionNode eng::PolygonNode eng::SpecialNode eng::TextureNode eng::TransformNode eng::VertexsNode

List of all members.

Public Types

typedef
SharedPtrNull< Node
Ptr

Public Member Functions

 Node (void)
 Node (const Node &src)
virtual ~Node ()
virtual const
Node::Value
GetValue (void) const =0
Node::Ptr GetParent (void) const
void AttachSibling (Node::Ptr sibling)
virtual void AttachChild (Node::Ptr child)
void Detach (const bool keepChildren=false)
virtual void DetachChild (Node::Ptr child)

Protected Types

enum  TypeId {
  ID_LOD_NODE, ID_PARTITION_NODE, ID_TRANSFORM_NODE, ID_VERTEXS_NODE,
  ID_NORMALS_NODE, ID_MODES_NODE, ID_MATERIAL_NODE, ID_TEXTURE_NODE,
  ID_COLORS_NODE, ID_POLYGON_NODE, ID_SPECIAL_NODE
}
typedef uint Idx
 index to Graph's node clones or Node::mChildren[]

Protected Member Functions

virtual TypeId GetTypeId (void) const =0
virtual Node::Ptr Clone (void) const =0
bool IfDetached (void) const
bool IfChildren (void) const
SortedNodesGetChildren (void)
Node::Ptr GetFirstChild (void) const
Node::Ptr GetLastChild (void) const
Node::Ptr GetPrevSibling (void) const
Node::Ptr GetNextSibling (void) const
void SetParent (Node::Ptr parent)
virtual void Accept (Visitor &visitor)=0
virtual void Departure (void)
 a Visitor's action done after node and its children were visited
virtual bool IfDeparture (void) const
 True if this is a special "departure" Node.

Protected Attributes

CLASS_CONST Idx INVALID_IDX = 0xb00bb00b
 also indicates if node isn't a clone
CLASS_CONST uint VCNT = 4
 maximum vertexs per polygon (triangles or quads)
Node::Ptr mParent
 parent node
SortedNodes mChildren
 sorted children, SortedNodes is a Flyweight
Node::Idx mSiblingIdx
 the index of this node in the parent's mChildren array

Private Attributes

Node::Idx mCloneIdx
 NodeClones manages this.
CLASS_VAR long msInstanceCnt

Friends

class Value
class NodeClones
class Graph
class GraphMaker
class GraphImporter
bool operator< (const Node &node1, const Node &node2)
 
Returns:
True if node1 has less net priority than node2.

bool operator== (const Node &node1, const Node &node2)
 
Returns:
True if two nodes have equal priority.

bool operator!= (const Node &node1, const Node &node2)
 
Returns:
True if two nodes have different priority.

void CheckNode (const Node *node, bool nullOk)

Classes

class  SortableNode
 Encapsulates a Node::Ptr for sorting Nodes according to priority. More...
class  SortedNodes
 Flyweight container of Nodes sorted by priority (holds children/siblings). More...
class  Value
 A Node's Value is dual-purpose: it's a Node's state and its key. More...


Detailed Description

Base Node class.

See design.html and implementation.html.

Departure nodes: A Visitor can push a special "departure" node on the traversal stack to do an action after traversal has visited it AND all of its children. Pushing can be done by calling GraphTraversal::Push() when Visitor::Visit() is called. These special nodes exist on the traversal stack (aren't linked in the Graph). For example, when TextureNode is visited, it enables texturing, but when traversal passes away from it, texturing should be disabled.


Member Typedef Documentation

typedef SharedPtrNull<Node> eng::Node::Ptr

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, and eng::SpecialNode.

typedef uint eng::Node::Idx [protected]

index to Graph's node clones or Node::mChildren[]


Member Enumeration Documentation

enum eng::Node::TypeId [protected]

Enumerator:
ID_LOD_NODE 
ID_PARTITION_NODE 
ID_TRANSFORM_NODE 
ID_VERTEXS_NODE 
ID_NORMALS_NODE 
ID_MODES_NODE 
ID_MATERIAL_NODE 
ID_TEXTURE_NODE 
ID_COLORS_NODE 
ID_POLYGON_NODE 
ID_SPECIAL_NODE 


Constructor & Destructor Documentation

eng::Node::Node ( void   ) 

Construct free-standing Node not yet attached to any Graph.

eng::Node::Node ( const Node src  ) 

Copy ctor.

eng::Node::~Node (  )  [virtual]

dtor.


Member Function Documentation

virtual TypeId eng::Node::GetTypeId ( void   )  const [protected, pure virtual]

Implemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, and eng::SpecialNode.

virtual Node::Ptr eng::Node::Clone ( void   )  const [protected, pure virtual]

Implemented in eng::VisitorDraw::PopMatrixNode, eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, eng::PolygonNode_TexQuadColor4, and eng::SpecialNode.

bool eng::Node::IfDetached ( void   )  const [protected]

Returns:
True if node is detached.

bool eng::Node::IfChildren ( void   )  const [protected]

Returns:
True if a node has any children.

virtual const Node::Value& eng::Node::GetValue ( void   )  const [pure virtual]

Implemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_Tex, and eng::SpecialNode.

Node::Ptr eng::Node::GetParent ( void   )  const

Get parent link. Parent could be NULL_NODE.

Node::SortedNodes & eng::Node::GetChildren ( void   )  [protected]

Get children.

Node::Ptr eng::Node::GetFirstChild ( void   )  const [inline, protected]

Node::Ptr eng::Node::GetLastChild ( void   )  const [protected]

Infreq.

Node::Ptr eng::Node::GetPrevSibling ( void   )  const [protected]

Returns:
Previous sibling. Infreq.

Node::Ptr eng::Node::GetNextSibling ( void   )  const [inline, protected]

void eng::Node::SetParent ( Node::Ptr  parent  )  [protected]

Set parent link. Allows parent=NULL_NODE for detaching a node.

void eng::Node::AttachSibling ( Node::Ptr  sibling  ) 

Attach a sibling according to 2nd-order priority (horizontal/homogeneous).

Precondition:
This node has a parent.

void eng::Node::AttachChild ( Node::Ptr  child  )  [virtual]

Insert a new node in sorted container of siblings.

Precondition:
Child's 1st-order priority must be exactly one level below the parent.
The levels/rows of a Graph are ordered vertically (heterogeneous ordering). For example, a TransformNode's child must be a NormalsNode.

Reimplemented in eng::LodNode.

void eng::Node::Detach ( const bool  keepChildren = false  ) 

Detach this node from parent/siblings/children.

Parameters:
keepChildren Pass true to let detached node keep its children attached. This arg is useful to detach a subtree.

void eng::Node::DetachChild ( Node::Ptr  child  )  [virtual]

Detach child from this parent.

Reimplemented in eng::LodNode.

virtual void eng::Node::Accept ( Visitor visitor  )  [protected, pure virtual]

Implemented in eng::VisitorDraw::PopMatrixNode, eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, eng::PolygonNode_TexQuadColor4, and eng::SpecialNode.

virtual void eng::Node::Departure ( void   )  [inline, protected, virtual]

a Visitor's action done after node and its children were visited

virtual bool eng::Node::IfDeparture ( void   )  const [inline, protected, virtual]

True if this is a special "departure" Node.


Friends And Related Function Documentation

friend class Value [friend]

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, and eng::PolygonNode_TexQuadColor4.

friend class NodeClones [friend]

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, and eng::PolygonNode_TexQuadColor4.

friend class Graph [friend]

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, and eng::PolygonNode_TexQuadColor4.

friend class GraphMaker [friend]

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, and eng::PolygonNode_TexQuadColor4.

friend class GraphImporter [friend]

Reimplemented in eng::LodNode, eng::PartitionNode, eng::TransformNode, eng::VertexsNode, eng::NormalsNode, eng::ModesNode, eng::MaterialNode, eng::TextureNode, eng::ColorsNode, eng::PolygonNode, eng::PolygonNode_TriColor1, eng::PolygonNode_TriColor3, eng::PolygonNode_QuadColor1, eng::PolygonNode_QuadColor4, eng::PolygonNode_Tex, eng::PolygonNode_TexTriColor1, eng::PolygonNode_TexTriColor3, eng::PolygonNode_TexQuadColor1, and eng::PolygonNode_TexQuadColor4.

bool operator< ( const Node node1,
const Node node2 
) [friend]

Returns:
True if node1 has less net priority than node2.

bool operator== ( const Node node1,
const Node node2 
) [friend]

Returns:
True if two nodes have equal priority.

bool operator!= ( const Node node1,
const Node node2 
) [friend]

Returns:
True if two nodes have different priority.

void CheckNode ( const Node node,
bool  nullOk 
) [friend]

Basic check for an individual Node. CHECK_NODE*() macros expand to CheckNode() with appropriate args.


Member Data Documentation

CLASS_CONST Idx eng::Node::INVALID_IDX = 0xb00bb00b [protected]

also indicates if node isn't a clone

CLASS_CONST uint eng::Node::VCNT = 4 [protected]

maximum vertexs per polygon (triangles or quads)

Node::Ptr eng::Node::mParent [protected]

parent node

SortedNodes eng::Node::mChildren [protected]

sorted children, SortedNodes is a Flyweight

Node::Idx eng::Node::mSiblingIdx [protected]

the index of this node in the parent's mChildren array

Node::Idx eng::Node::mCloneIdx [private]

NodeClones manages this.

long eng::Node::msInstanceCnt [private]


The documentation for this class was generated from the following files: Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:22 2007