/[usata]/usata2/src/gfx/mesh.hpp
ViewVC logotype

Diff of /usata2/src/gfx/mesh.hpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by Descender, Tue Jan 4 16:05:03 2005 UTC revision 1.2 by Descender, Sun Jan 9 09:58:55 2005 UTC
# Line 14  Line 14 
14  #ifndef USATA_GFX_MESH_HPP  #ifndef USATA_GFX_MESH_HPP
15  #define USATA_GFX_MESH_HPP  #define USATA_GFX_MESH_HPP
16    
17    #include <iostream>
18    #include <vector>
19    #include <string>
20    #include <map>
21    #include <boost/tuple/tuple.hpp>
22  #include "math/vector.hpp"  #include "math/vector.hpp"
23    
24  namespace usata  namespace usata
25  {  {
26      namespace gfx      namespace gfx
27      {      {
28          class TriangleMesh                  struct Vertex
29          {                  {
30          public:                          math::Vector4d position;
31                            math::Vector4d texture;
32              struct Vertex                          math::Vector4d normal;
33              {                  };
34                  math::Vector4d position;  
35                  math::Vector4d texture;                  class Triangle
36                  math::Vector4d normal;                  {
37              };                  public:
38                            Vertex *vertices[3];
39              struct Face                          math::Vector4d plane;
40              {                  };
41                  int vertices[3];  
42                  math::Vector4d normal;                  typedef boost::tuple<Vertex *, Vertex *>     EdgePair;
43              }                  typedef boost::tuple<Triangle *, Triangle *> TrianglePair;
44    
45              TriangleMesh();                  class TriangleMeshImpl;
46              ~TriangleMesh();  
47                                class TriangleMesh
48                    {
49          private:                  public:
50                            typedef std::vector<Vertex>   VertexList;
51              std::vector<Vertex> m_vertices;                          typedef std::vector<Triangle> TriangleList;
52              std::vector<Face>   m_faces;                          typedef std::map<EdgePair, TrianglePair> EdgeTable;
53          };  
54                            TriangleMesh();
55                            ~TriangleMesh();
56    
57                            void
58                            clear();
59    
60                            void
61                            add_vertex(const Vertex& vertex);
62    
63                            void
64                            add_triangle(int v0, int v1, int v2);
65    
66                            void
67                            draw();
68    
69                            void
70                            load(const std::string& filename);
71    
72                    private:
73    
74                            VertexList   m_vertices;
75                            TriangleList m_triangles;
76                            EdgeTable    m_edges;
77    
78                            void
79                            compute_edge_table();
80                    };
81    
82      } // namespace gfx      } // namespace gfx
83    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26