00001 #include "IGS_MeshBase.h" 00002 00003 //============================================================================= 00004 // Constructor 00005 // 00006 // Description: Constructor 00007 //============================================================================= 00008 IGS_MeshBase::IGS_MeshBase() 00009 { 00010 //does nothing on purpose 00011 } 00012 00013 //============================================================================= 00014 // Copy Constructor 00015 // 00016 // Description: Copy COnstructor 00017 //============================================================================= 00018 IGS_MeshBase::IGS_MeshBase( const IGS_MeshBase& right ) 00019 : 00020 m_Normals( right.m_Normals ), 00021 m_Vertexes( right.m_Vertexes ) 00022 { 00023 } 00024 00025 //============================================================================= 00026 // Destructor - 00027 // 00028 // Description: Destructor - virtual 00029 //============================================================================= 00030 IGS_MeshBase::~IGS_MeshBase() 00031 { 00032 m_Normals.clear(); 00033 m_Vertexes.clear(); 00034 } 00035 00036 00037 //============================================================================= 00038 // AddVertex 00039 // 00040 // Description: adds a vertex to the list of points 00041 //============================================================================= 00042 int IGS_MeshBase::AddNormal( const Vector4& normal ) 00043 { 00044 m_Normals.push_back( normal ); 00045 return m_Normals.size() - 1; 00046 } 00047 00048 //============================================================================= 00049 // AddVertexCoordinates 00050 // 00051 // Description: adds a vector with the vertex coordinates to the mesh 00052 //============================================================================= 00053 int IGS_MeshBase::AddVertexCoordinates( const Vector4& vector ) 00054 { 00055 assert( vector.Magnitude() < 1000.0 ); //vertexes this big are usually errors 00056 m_Vertexes.push_back( vector ); 00057 return m_Vertexes.size(); 00058 } 00059 00060 //============================================================================= 00061 // GetNormal 00062 // 00063 // Description: returns the normal at index i 00064 //============================================================================= 00065 const Vector4& IGS_MeshBase::GetNormal( const int i ) const 00066 { 00067 return this->m_Normals[ i ]; 00068 } 00069 00070 //============================================================================= 00071 // GetNumVertexes 00072 // 00073 // Description: returns the number of vertexes in this mesh 00074 //============================================================================= 00075 const int IGS_MeshBase::GetNumVertexes() const 00076 { 00077 return this->m_Vertexes.size(); 00078 } 00079 00080 //============================================================================= 00081 // GetVertex 00082 // 00083 // Description: gets a constant reference to a particular vertex 00084 //============================================================================= 00085 const Vector4& IGS_MeshBase::GetVertex( const int i ) const 00086 { 00087 return this->m_Vertexes[ i ]; 00088 }