eng_graph_debug.hh

Go to the documentation of this file.
00001 /*
00008  * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
00009  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
00010  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
00011  *****************************************************************************/
00012 
00013 #if DEBUG
00014 #if ! DOXYGEN
00015 #ifndef ENG_GRAPH_DEBUG_HH
00016 #define ENG_GRAPH_DEBUG_HH 1
00017 
00018 namespace eng {
00019 
00026 class VisitorCheck : public Visitor
00027 {
00028 public:
00029     VisitorCheck( Graph& graph );
00030     ~VisitorCheck( void );
00031 
00032     // Regular nodes:
00033     void    Visit( LodNode& node );
00034     void    Visit( PartitionNode& node );
00035     void    Visit( TransformNode& node );
00036     void    Visit( VertexsNode& node );
00037     void    Visit( NormalsNode& node );
00038     void    Visit( ModesNode& node );
00039     void    Visit( MaterialNode& node );
00040     void    Visit( TextureNode& node );
00041     void    Visit( ColorsNode& node );
00042     void    Visit( PolygonNode& node );
00043     // Visitor's default PolygonNode variants call Visit(PolygonNode&).
00044     void    Visit( PolygonNode_Tex& node );
00045     void    Visit( PolygonNode_TexTriColor1& node );
00046     void    Visit( PolygonNode_TexTriColor3& node );
00047     void    Visit( PolygonNode_TexQuadColor1& node );
00048     void    Visit( PolygonNode_TexQuadColor4& node );
00049 
00050     // Special nodes (need to cast base Visitor to derived Visitor):
00051     void    Visit( SpecialNode& node );
00052 
00053             operator bool() const { return mContinue; }  
00054     void    Begin( GraphTraversal::Ptr traversal );
00055     void    End( void );
00056 
00057 // Specific methods:
00058 
00059     // Some tests construct degenerate Graphs but do checking themselves,
00060     // so VisitorCheck otherwise would interfere with those tests.
00061     CLASS_METHOD void   Enable( bool f = true ) { msEnabled = f; }
00062     CLASS_METHOD void   EnableStrictChecking( bool f = true ) { msStrict = f; }
00063     CLASS_METHOD void   DisableTextureChecking( void ) { msDisableTextureChecking = true; }
00064     bool                IfError( void ) { return mError; }
00065 
00066 // Subroutines of Visit().
00067 private:
00068     enum eChild { eChild_REQUIRED, eChild_OPTIONAL };
00069     void            CheckInteriorNode( Node& node, eChild child );
00070     void            CheckLeafNode( Node& node );
00071     void            CheckPolygonNode( PolygonNode& node );
00072 
00073     struct NodeCounts
00074     {
00075         NodeCounts( void );
00076         uint    mLodNode;
00077         uint    mPartitionNode;
00078         uint    mTransformNode;
00079         uint    mVertexsNode;
00080         uint    mNormalsNode;
00081         uint    mModesNode;
00082         uint    mMaterialNode;
00083         uint    mTextureNode;
00084         uint    mColorsNode;
00085         uint    mPolygonNode;
00086     };
00087 
00088 // Data members:
00089 private:
00090     CLASS_VAR bool          msEnabled;          
00091     CLASS_VAR bool          msStrict;           
00092     CLASS_VAR bool          msDisableTextureChecking;
00093     GraphTraversal::Ptr     mTraversal;         
00094     bool                    mContinue;          
00095     bool                    mError;
00096     NodeCounts              mNodeCounts;
00097     uint                    mVertexsCnt;        
00098     bool                    mTexturing;
00099 };
00100 
00104 class VisitorPrint : public Visitor
00105 {
00106 public:
00107     VisitorPrint( Graph& graph ) :Visitor(graph) { }
00108     void    Visit( Node& node );
00109     void    Visit( LodNode& node );
00110     void    Visit( PartitionNode& node );
00111     void    Visit( TransformNode& node );
00112     void    Visit( VertexsNode& node );
00113     void    Visit( NormalsNode& node );
00114     void    Visit( ModesNode& node );
00115     void    Visit( MaterialNode& node );
00116     void    Visit( TextureNode& node );
00117     void    Visit( ColorsNode& node );
00118     void    Visit( PolygonNode& node );
00119     void    Visit( PolygonNode_TriColor1& node );
00120     void    Visit( PolygonNode_TriColor3& node );
00121     void    Visit( PolygonNode_QuadColor1& node );
00122     void    Visit( PolygonNode_QuadColor4& node );
00123     void    Visit( PolygonNode_Tex& node );
00124     void    Visit( PolygonNode_TexTriColor1& node );
00125     void    Visit( PolygonNode_TexTriColor3& node );
00126     void    Visit( PolygonNode_TexQuadColor1& node );
00127     void    Visit( PolygonNode_TexQuadColor4& node );
00128     void    Visit( SpecialNode& node );
00129 };
00130 
00131 } // namespace eng
00132 
00133 #endif // ENG_GRAPH_DEBUG_HH
00134 #endif // ! DOXYGEN
00135 #endif // DEBUG
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:08 2007