00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef OXYGEN_TRIMESH
00023 #define OXYGEN_TRIMESH
00024
00025 #include "indexbuffer.h"
00026 #include <list>
00027 #include <boost/shared_array.hpp>
00028 #include <boost/shared_ptr.hpp>
00029 #include <string>
00030
00031 namespace oxygen
00032 {
00033
00044 class TriMesh
00045 {
00046 public:
00047 struct Face
00048 {
00049 public:
00050 boost::shared_ptr<IndexBuffer> indeces;
00051 std::string material;
00052
00053 public:
00054 Face(boost::shared_ptr<IndexBuffer> i, std::string m)
00055 : indeces(i), material(m) {};
00056 };
00057
00058 typedef std::list<Face> TFaces;
00059
00060 public:
00061 TriMesh();
00062 ~TriMesh();
00063
00065 void SetPos(boost::shared_array<float> pos, int vertexCount);
00066
00068 const boost::shared_array<float> GetPos() const;
00069
00071 int GetVertexCount() const;
00072
00074 void SetTexCoords(boost::shared_array<float> texCoords);
00075
00077 const boost::shared_array<float> GetTexCoords() const;
00078
00080 void SetNormals(boost::shared_array<float> normal);
00081
00083 const boost::shared_array<float> GetNormals() const;
00084
00087 void AddFace(boost::shared_ptr<IndexBuffer> indeces,
00088 const std::string& material = "default");
00089
00092 void AddFace(const Face& face);
00093
00095 const TFaces& GetFaces() const;
00096
00098 const std::string& GetName() const;
00099
00101 void SetName(const std::string& name);
00102
00103 protected:
00105 std::string mName;
00106
00108 int mVertexCount;
00109
00111 boost::shared_array<float> mPos;
00112
00114 boost::shared_array<float> mTexCoords;
00115
00117 boost::shared_array<float> mNormal;
00118
00120 TFaces mFaces;
00121 };
00122
00123 }
00124
00125 #endif // OXYGEN_TRIMESH