00001 #ifndef _MESH_H_ 00002 #define _MESH_H_ 00003 00004 #include "IGS_MeshBase.h" 00005 #include "math/vector4.h" 00006 #include <vector> 00007 00008 class IGS_Mesh; 00009 00010 //============================================================================= 00011 class MeshIndexes 00012 { 00013 public: 00014 int vertexNum; 00015 }; 00016 //============================================================================= 00017 class MeshEdge //this is used to store the silhouette edges 00018 { 00019 public: 00020 int v0; 00021 int v1; 00022 00023 MeshEdge(); 00024 bool operator==( const MeshEdge& right ) const; 00025 void ClearSilhouetteInfo() const; 00026 bool IsSilhouette() const; 00027 void MarkFrontFacing() const; 00028 void MarkBackFacing() const; 00029 00030 protected: 00031 mutable bool mRenderedForward; 00032 mutable bool mRenderedReverse; 00033 mutable int mTimesRendered; 00034 }; 00035 //============================================================================= 00036 class IGS_Mesh : 00037 public IGS_MeshBase 00038 { 00039 public: 00040 IGS_Mesh(); 00041 00042 int AddEdge( const int v0, const int v1 ); 00043 int AddFacet( const MeshFacet& facet ); 00044 void ClearSilhouetteEdges() const; 00045 void GetBoundingBox( double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax ) const; 00046 virtual void Prepare( const IGS_Controller& controller ); 00047 virtual void Render( const IGS_Controller& controller ) const; 00048 00049 std::vector< MeshEdge > edges; //used only for silhouettes 00050 std::vector< MeshFacet > facets; 00051 protected: 00052 Vector4 ComputeNormalForFacet( const int facetNum ) const; 00053 }; 00054 //============================================================================= 00055 #endif