tgModel.h
Go to the documentation of this file.
00001 
00009 #ifndef TG_MODEL
00010 #define TG_MODEL
00011 
00012 #include <stdio.h>
00013 #include <vector>
00014 
00015 #include <blort/TomGine/tgMathlib.h>
00016 
00017 namespace TomGine{
00018 
00019 struct tgVertex{
00020         vec3 pos;                               
00021         vec3 normal;                    
00022         vec2 texCoord;                  
00023 };
00024 struct tgFace{
00025         std::vector<int> v;             
00026         vec3 normal;                    
00027 };
00028 struct tgLine{
00029         vec3 start;
00030         vec3 end;
00031 };
00032 struct tgRay{
00033         vec3 start;
00034         vec3 dir;
00035 };
00036 // struct LineLoop{
00037 //      std::vector<vec3> points;
00038 // };
00039 
00040 struct BoundingSphere{
00041         vec3 center;
00042         float radius;
00043 };
00044 
00048 class tgModel{  
00049 public:
00050         std::vector<tgVertex>   m_vertices;                             
00051         std::vector<tgFace>             m_faces;                                
00052         std::vector<tgLine>             m_lines;                                
00053         std::vector<vec3>               m_points;                               
00054         BoundingSphere                  m_bs;                                   
00055         
00056         // functions for access to member data
00057         void            add(tgVertex v){ m_vertices.push_back(v); }
00058         void            add(tgFace f){ m_faces.push_back(f); }
00059         tgVertex                getVertex(unsigned int i){ if(i<m_vertices.size()) return m_vertices[i]; else return tgVertex();}
00060         tgFace          getFace(unsigned int i){ if(i<m_faces.size()) return m_faces[i]; else return tgFace();}
00061         unsigned        getVertexSize(){ return m_vertices.size(); }
00062         unsigned        getFaceSize(){ return m_faces.size(); }
00063         
00065         virtual void DrawFaces() const;
00066         
00068         virtual void DrawLines(const vec3 &color=vec3(1,0,0)) const;
00069         
00071         virtual void DrawPoints(const vec3 &color=vec3(1,0,0)) const;
00072         
00074         virtual void DrawNormals(float normal_length) const;
00075         
00077         virtual void ComputeNormals();
00078         
00080         virtual void ComputeFaceNormals();
00081         
00083         virtual void ComputeBoundingSphere();
00084         
00086         virtual void Clear();
00087         
00089         virtual void Print() const;
00090         
00091 };
00092 
00093 } // namespace TomGine
00094 
00095 #endif


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12