Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Mesh.h
Go to the documentation of this file.
1 
2 #ifndef GLSDK_MESH_MESH_H
3 #define GLSDK_MESH_MESH_H
4 
10 #include <memory>
11 #include <vector>
12 #include <map>
13 #include <string>
14 #include <boost/noncopyable.hpp>
15 
16 namespace glmesh
17 {
20 
22  typedef std::map<std::string, GLuint> MeshVariantMap;
23 
24  struct RenderCmdListData;
25 
40  {
41  public:
43  RenderCmdList();
46 
47  RenderCmdList(class RenderCmdList &anOther);
48  RenderCmdList& operator=(class RenderCmdList &anOther);
49 
57  void DrawArrays(GLenum primitive, GLint startIndex, GLsizei vertexCount);
58 
76  void DrawElements(GLenum primitive, GLsizei vertexCount, GLenum dataType, GLintptr byteOffset,
77  GLint baseVertex = 0);
78 
80  void PrimitiveRestartIndex();
81 
93  void PrimitiveRestartIndex(GLuint index);
94 
95  private:
96  std::auto_ptr<RenderCmdListData> m_pData;
97 
98  friend class Mesh;
99  };
100 
101 
102  struct MeshData;
103 
133  class Mesh : public boost::noncopyable
134  {
135  public:
155  Mesh(const std::vector<GLuint> &bufferObjects, GLuint mainVao, const RenderCmdList &renderCmds,
156  const MeshVariantMap &variants = MeshVariantMap());
157 
159  ~Mesh();
160 
162  void Render() const;
163 
166  void Render(const std::string &variantName) const;
167 
169  bool DoesMainExist() const;
170 
173  bool DoesVariantExist(const std::string &variantName) const;
174 
175  private:
176  std::auto_ptr<MeshData> m_pData;
177 
178  Mesh(const Mesh&);
179  Mesh &operator=(const Mesh&);
180 
181  void RenderWithCurrVao() const;
182  };
183 
185 }
186 
187 
188 
189 #endif //GLSDK_MESH_MESH_H