eng::GraphMaker Class Reference

Facade to help make a Graph. More...

#include <eng_graph_maker.hh>

List of all members.

Public Member Functions

 GraphMaker (void)
 ~GraphMaker ()
SharedPtr< GraphCommit (void)
SharedPtr< PartitionGetPartition (void)
void SelectPartition (SharedPtr< Partition > partition)
SharedPtr< PartitionMakeChildPartition (SharedPtr< Partition > parentPartition, const string &name)
SharedPtr< PartitionMakeSiblingPartition (SharedPtr< Partition > prevSiblingPartition, const string &name)
ModesNode::Ptr AttachNode (const ModesNode::Value &nodeValue, const NodePredecessors &nodePredecessors)
MaterialNode::Ptr AttachNode (const MaterialNode::Value &nodeValue, const NodePredecessors &nodePredecessors)
TextureNode::Ptr AttachNode (const TextureNode::Value &nodeValue, const NodePredecessors &nodePredecessors)
ColorsNode::Ptr AttachNode (const ColorsNode::Value &nodeValue, const NodePredecessors &nodePredecessors)
PolygonNode::Ptr AttachNode (const PolygonNode::Value &nodeValue, const NodePredecessors &nodePredecessors)
PolygonNode_Tex::Ptr AttachNode (const PolygonNode_Tex::Value &nodeValue, const NodePredecessors &nodePredecessors)
void SetConstantNormals (SharedPtr< NormalVertexs > polygonNormals, SharedPtr< NormalVertexs > vertexNormals)

Private Member Functions

template<typename POLYGON_NODE>
POLYGON_NODE::Ptr AttachPolygonNode2 (const typename POLYGON_NODE::Value &nodeValue, const NodePredecessors &nodePredecessors)
template<typename POLYGON_NODE, typename POLYGON_NODE_TRI_COLOR1, typename POLYGON_NODE_QUAD_COLOR1, typename POLYGON_NODE_TRI_COLOR3, typename POLYGON_NODE_QUAD_COLOR4>
POLYGON_NODE::Ptr AttachPolygonNode (const typename POLYGON_NODE::Value &nodeValue, const NodePredecessors &nodePredecessors)

Private Attributes

shptr< GraphmGraph
shptr< PartitionmPartition

Classes

class  NodePredecessors
 Specifies the nodes that a new node should be placed underneath. More...
class  Partition
 Defines a subtree of a Graph being made (opaque to clients). More...


Detailed Description

Facade to help make a Graph.

///
/// Overview:
/// GraphMaker is a facade over Graph to help build an optimized Graph.
/// It provides methods to allocate, find, and optimize the order of Nodes.
/// When a client is finished making a Graph, it should call GraphMaker::Commit().
/// An instance of GraphMaker is one-shot: it cannot be reused to make more Graphs.
///
/// 3D models often have polygons with the same attributes.
/// In those cases, in terms of a graph, similar polygons need to be placed
/// under the same set of "predecessor" nodes.
/// GraphMaker provides the method GraphMaker::Assign()  to specify a set of predecessors.
/// GraphMaker determines the optimal order, and automatically allocates
/// and attaches any predecessors if necessary.  GraphMaker and NodePredecessors
/// form a Facade to insulate clients from knowing the optimal order of nodes.
/// Clients can expect a new node to be underneath one of the predecessors
/// but without knowing exactly which one.
///
/// GraphMaker tolerates clients that specify predecessor nodes in any order.
///
/// SelectPartition() can be thought of as a cursor or current position.
/// It tells GraphMaker which partition of a Graph to affect.
///
/// Usage notes:
/// ------------
/// - Client should use GraphMaker interface to manipulate Nodes.
///   Client shouldn't circumvent GraphMaker.
///   GraphMaker needs to track changes to Nodes.
///
/// Examples:
/// ---------
///
/// GraphMaker graphMaker;
/// ModesNode::Value modesValue = modes;
/// ColorsNode::Value colorsValue = colors;
/// GraphMaker::NodePredecessors nodePredecessors;
/// nodePredecessors.Assign( modesValue );
/// nodePredecessors.Assign( colorsValue );
/// graphMaker.AttachNode( polygonValue, nodePredecessors );
/// shptr<Graph> graph = graphMaker.Commit();  // get completed Graph
///
/// Implementation notes:
/// GraphMaker creates a new Graph and hides it to prevent the client
/// circumventing GraphMaker and directly attaching nodes to Graph.
/// The reason is that GraphMaker needs to intercept and cache nodes
/// to speed retrieval of predecessors.
/// 

Constructor & Destructor Documentation

eng::GraphMaker::GraphMaker ( void   ) 

Construct a Graph then attach an initial Partition to it. The initial Partition consists of a set of default Nodes.

eng::GraphMaker::~GraphMaker ( void   ) 


Member Function Documentation

SharedPtr< Graph > eng::GraphMaker::Commit ( void   ) 

Commit Graph.

SharedPtr< GraphMaker::Partition > eng::GraphMaker::GetPartition ( void   ) 

Get current partition.

void eng::GraphMaker::SelectPartition ( SharedPtr< Partition partition  ) 

SharedPtr<Partition> eng::GraphMaker::MakeChildPartition ( SharedPtr< Partition parentPartition,
const string &  name 
)

SharedPtr<Partition> eng::GraphMaker::MakeSiblingPartition ( SharedPtr< Partition prevSiblingPartition,
const string &  name 
)

PolygonNode_Tex::Ptr eng::GraphMaker::AttachNode ( const ModesNode::Value nodeValue,
const NodePredecessors nodePredecessors 
)

Attach a ModesNode.

Attach a MaterialNode as a descendant of a set of predecessors.

Attach a TextureNode as a descendant of a set of predecessors.

Attach a ColorsNode as a descendant of a set of predecessors.

Attach a PolygonNode as a descendant of a set of predecessors. Applies to all non-textured variants of PolygonNode.

Attach a PolygonNode_Tex as a descendant of a set of predecessors. Applies to all variants of PolygonNode_Tex.

MaterialNode::Ptr eng::GraphMaker::AttachNode ( const MaterialNode::Value nodeValue,
const NodePredecessors nodePredecessors 
)

TextureNode::Ptr eng::GraphMaker::AttachNode ( const TextureNode::Value nodeValue,
const NodePredecessors nodePredecessors 
)

ColorsNode::Ptr eng::GraphMaker::AttachNode ( const ColorsNode::Value nodeValue,
const NodePredecessors nodePredecessors 
)

PolygonNode::Ptr eng::GraphMaker::AttachNode ( const PolygonNode::Value nodeValue,
const NodePredecessors nodePredecessors 
)

PolygonNode_Tex::Ptr eng::GraphMaker::AttachNode ( const PolygonNode_Tex::Value nodeValue,
const NodePredecessors nodePredecessors 
)

void eng::GraphMaker::SetConstantNormals ( SharedPtr< NormalVertexs >  polygonNormals,
SharedPtr< NormalVertexs >  vertexNormals 
)

template<typename POLYGON_NODE>
POLYGON_NODE::Ptr eng::GraphMaker::AttachPolygonNode2 ( const typename POLYGON_NODE::Value &  nodeValue,
const NodePredecessors nodePredecessors 
) [inline, private]

Template functions to attach an optimal species of PolygonNode.

template<typename POLYGON_NODE, typename POLYGON_NODE_TRI_COLOR1, typename POLYGON_NODE_QUAD_COLOR1, typename POLYGON_NODE_TRI_COLOR3, typename POLYGON_NODE_QUAD_COLOR4>
POLYGON_NODE::Ptr eng::GraphMaker::AttachPolygonNode ( const typename POLYGON_NODE::Value &  nodeValue,
const NodePredecessors nodePredecessors 
) [inline, private]


Member Data Documentation

shptr<Graph> eng::GraphMaker::mGraph [private]

shptr<Partition> eng::GraphMaker::mPartition [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