All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Mesh.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Rendering.h"
7 #include "IdTypes.h"
8 #include "VAOCache.h"
9 #include <string>
10 
11 namespace Eegeo
12 {
13  namespace Rendering
14  {
20  class Mesh : protected Eegeo::NonCopyable
21  {
22  public:
23  Mesh(
24  const VertexLayouts::VertexLayout& vertexLayout,
25  Rendering::GlBufferPool& glBufferPool,
26  const void* pVertexData,
27  size_t vertexDataSize,
28  const void* pIndexData,
29  size_t indexDataSize,
30  u32 numOfIndices,
31  const std::string& meshId
32  );
33 
34  ~Mesh();
35 
36  const VertexLayouts::VertexLayout& GetVertexLayout() const { return m_vertexLayout; }
37 
38  u32 GetNumOfIndices() const { return m_numOfIndices; }
39  TVertexBufferId GetVertexBuffer() const { return m_glVertexBuffer; }
40  TIndexBufferId GetIndexBuffer() const { return m_glIndexBuffer; }
41 
42  void BindVertexBuffers(const VertexLayouts::VertexBinding* pVertexBinding, Rendering::GLState& glState);
43 
44  void UnbindVertexBuffers(Rendering::GLState& glState);
45  void UnbindVertexBuffers(const VertexLayouts::VertexBinding* pVertexBinding, Rendering::GLState& glState);
46 
47 
48  const std::string& GetMeshId() const { return m_meshId; }
49 
50 
51  protected:
52  const VertexLayouts::VertexLayout& m_vertexLayout;
53  Rendering::GlBufferPool& m_glBufferPool;
54  TVertexBufferId m_glVertexBuffer;
55  TIndexBufferId m_glIndexBuffer;
56  const std::string m_meshId;
57 
58  u32 m_numOfIndices;
59 
60 #if defined(EEGEO_IOS) || defined(EEGEO_OSX)
61  VAOCache m_vaoCache;
62 #endif
63  };
64  }
65 }