eng::VisitorDraw Class Reference

Visitor that draws a Graph. More...

#include <eng_graph_draw.hh>

Inheritance diagram for eng::VisitorDraw:

eng::Visitor

List of all members.

Public Member Functions

 VisitorDraw (Graph &graph, SharedPtr< Object > object)
 ~VisitorDraw (void)
void Visit (TransformNode &node)
void Visit (VertexsNode &node)
void Visit (NormalsNode &node)
void Visit (ModesNode &node)
void Visit (MaterialNode &node)
void Visit (TextureNode &node)
void Visit (ColorsNode &node)
void Visit (PolygonNode &node)
void Visit (PolygonNode_TriColor1 &node)
void Visit (PolygonNode_TriColor3 &node)
void Visit (PolygonNode_QuadColor1 &node)
void Visit (PolygonNode_QuadColor4 &node)
void Visit (PolygonNode_Tex &node)
void Visit (PolygonNode_TexTriColor1 &node)
void Visit (PolygonNode_TexTriColor3 &node)
void Visit (PolygonNode_TexQuadColor1 &node)
void Visit (PolygonNode_TexQuadColor4 &node)
void Visit (SpecialNode &node)
void Visit (PopMatrixNode &node)
 Pop matrixs.
void Begin (GraphTraversal::Ptr traversal)
void End (void)
 Visitor::End() is called after traversal ended.

Private Types

enum  ePolygonType { ePolygonType_NONE, ePolygonType_TRIANGLES, ePolygonType_QUADS }

Private Member Functions

void ComputeEyeMatrix (void)
void ComputeNormals (NormalsNode &normalsNode)
void DRAW_POLYGON_NODE_CHECKS (PolygonNode &node)
void DRAW_POLYGON_NODE_TEX_CHECKS (PolygonNode_Tex &node)
void BeginTriangle (void)
void BeginQuad (void)
void EndTriangle (void)
void EndQuad (void)
void EndDrawing (void)

Private Attributes

SharedPtr< ObjectmObject
GraphTraversal::Ptr mTraversal
 represents the act of traversing a Graph
Matrix mMatrix
 every visit to TransformNode multiplies this matrix
Matrix mMatrixEye
 maps to eye space (outputs eye vertexs)
const Matrix mMatrixView
 the Engine's view/eye matrix
Stack< Matrix > mMatrixStack
SharedPtrNull< const
LocalVertexs > 
mLocalVertexs
EyeVertexs mEyeVertexs
 results of transforming local vertexs (VertexsNode)
shptr0< NormalVertexs > mPolygonNormals
 ptr to NormalsNode member, normal vectors on polygons
shptr0< NormalVertexs > mVertexNormals
 ptr to NormalsNode member, normal vector on vertexs
ModesNode::Modes mModes
 current graphic Modes
bool mLighting
 whether to use lighting
shptr< Texture > mTexture
 texture object (ignored if mTexturing is false)
bool mRestoreTextureMatrix
 if texture matrix needs to be reloaded with identity
fp mSavedTextureMatrix [16]
ColorsNode::Colors mColors
 flyweight array
ePolygonType mPolygonType
 which type of polygon to draw
bool mDone
 VisitorDraw is one-shot.

Classes

class  PopMatrixNode
 SpecialNode to pop matrix (counterpart of TransformNode). More...


Detailed Description

Visitor that draws a Graph.

Member Enumeration Documentation

enum eng::VisitorDraw::ePolygonType [private]

Enumerator:
ePolygonType_NONE 
ePolygonType_TRIANGLES 
ePolygonType_QUADS 


Constructor & Destructor Documentation

eng::VisitorDraw::VisitorDraw ( Graph graph,
SharedPtr< Object object 
)

eng::VisitorDraw::~VisitorDraw ( void   ) 


Member Function Documentation

void eng::VisitorDraw::Visit ( TransformNode node  )  [virtual]

Visit TransformNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( VertexsNode node  )  [virtual]

Visit VertexsNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( NormalsNode node  )  [virtual]

Visit NormalsNode. See "Normal Vectors" in implementation.html

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( ModesNode node  )  [virtual]

Transform normal vectors. Really rotates them (normal vectors should not be translated out of normal space).

Precondition:
Normal vectors were computed. Visit ModesNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( MaterialNode node  )  [virtual]

Visit MaterialNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( TextureNode node  )  [virtual]

Visit TextureNode. This either enables and binds a texture, or it disables texturing. Untextured polygons are to be placed underneath a disabled/invalid TextureNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( ColorsNode node  )  [virtual]

Visit ColorsNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode node  )  [virtual]

Visit PolygonNode.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TriColor1 node  )  [virtual]

Visit PolygonNode_TriColor1.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TriColor3 node  )  [virtual]

Visit PolygonNode_TriColor3.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_QuadColor1 node  )  [virtual]

Visit PolygonNode_QuadColor1.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_QuadColor4 node  )  [virtual]

Visit PolygonNode_QuadColor4.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_Tex node  )  [virtual]

Visit PolygonNode_Tex.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TexTriColor1 node  )  [virtual]

Visit PolygonNode_TexTriColor1.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TexTriColor3 node  )  [virtual]

Visit PolygonNode_TexTriColor3.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TexQuadColor1 node  )  [virtual]

Visit PolygonNode_TexQuadColor1.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PolygonNode_TexQuadColor4 node  )  [virtual]

Visit PolygonNode_TexQuadColor4.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( SpecialNode node  )  [inline, virtual]

Reimplemented from eng::Visitor.

void eng::VisitorDraw::Visit ( PopMatrixNode node  ) 

Pop matrixs.

void eng::VisitorDraw::Begin ( GraphTraversal::Ptr  traversal  ) 

void eng::VisitorDraw::End ( void   )  [virtual]

Visitor::End() is called after traversal ended.

Reimplemented from eng::Visitor.

void eng::VisitorDraw::ComputeEyeMatrix ( void   )  [private]

This formula combines local:world and world:eye transformations using matrix multiplication.

It is based on the two steps needed to transform a local vertex to eye space:

transform local --> world : rotation, translation transform world --> eye : translation, rotation

Local vertexs are first rotated around their origin, then translated to world space. World vertexs, conversely, are first translated to eye space, then rotated around the eye's origin.

----------------------------------------------------------------------------- [ x ] * [ Xx Xy Xz Tx ] = [ x2 ] * [ 1 0 0 Tx ] = [ x3 ] * [ Xx Xy Xz 0 ] [ y ] [ Yx Yy Yz Ty ] [ y2 ] [ 0 1 0 Ty ] [ y3 ] [ Yx Yy Yz 0 ] [ z ] [ Zx Zy Zz Tz ] [ z2 ] [ 0 0 1 Tz ] [ z3 ] [ Zx Zy Zz 0 ] [ 1 ] [ 0 0 0 1 ] [ 1 ] [ 0 0 0 1 ] [ 1 ] [ 0 0 0 1 ] t1 t3 -----------------------------------------------------------------------------

Implicit args: mMatrix multiplied matrix mMatrixView modelview matrix Output: mMatrixEye local:eye matrix suitable for vertex transformation

void eng::VisitorDraw::ComputeNormals ( NormalsNode normalsNode  )  [private]

Compute normal vectors. Resulting normal vectors will remain in normal space. ComputeNormals() precedes TransformNormals().

void eng::VisitorDraw::DRAW_POLYGON_NODE_CHECKS ( PolygonNode node  )  [private]

Debug.

void eng::VisitorDraw::DRAW_POLYGON_NODE_TEX_CHECKS ( PolygonNode_Tex node  )  [private]

void eng::VisitorDraw::BeginTriangle ( void   )  [inline, private]

void eng::VisitorDraw::BeginQuad ( void   )  [inline, private]

void eng::VisitorDraw::EndTriangle ( void   )  [inline, private]

void eng::VisitorDraw::EndQuad ( void   )  [inline, private]

void eng::VisitorDraw::EndDrawing ( void   )  [inline, private]


Member Data Documentation

SharedPtr<Object> eng::VisitorDraw::mObject [private]

GraphTraversal::Ptr eng::VisitorDraw::mTraversal [private]

represents the act of traversing a Graph

Matrix eng::VisitorDraw::mMatrix [private]

every visit to TransformNode multiplies this matrix

Matrix eng::VisitorDraw::mMatrixEye [private]

maps to eye space (outputs eye vertexs)

const Matrix eng::VisitorDraw::mMatrixView [private]

the Engine's view/eye matrix

Stack<Matrix> eng::VisitorDraw::mMatrixStack [private]

SharedPtrNull<const LocalVertexs> eng::VisitorDraw::mLocalVertexs [private]

EyeVertexs eng::VisitorDraw::mEyeVertexs [private]

results of transforming local vertexs (VertexsNode)

shptr0<NormalVertexs> eng::VisitorDraw::mPolygonNormals [private]

ptr to NormalsNode member, normal vectors on polygons

shptr0<NormalVertexs> eng::VisitorDraw::mVertexNormals [private]

ptr to NormalsNode member, normal vector on vertexs

ModesNode::Modes eng::VisitorDraw::mModes [private]

current graphic Modes

bool eng::VisitorDraw::mLighting [private]

whether to use lighting

shptr<Texture> eng::VisitorDraw::mTexture [private]

texture object (ignored if mTexturing is false)

bool eng::VisitorDraw::mRestoreTextureMatrix [private]

if texture matrix needs to be reloaded with identity

fp eng::VisitorDraw::mSavedTextureMatrix[16] [private]

ColorsNode::Colors eng::VisitorDraw::mColors [private]

flyweight array

ePolygonType eng::VisitorDraw::mPolygonType [private]

which type of polygon to draw

bool eng::VisitorDraw::mDone [private]

VisitorDraw is one-shot.


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:21 2007