All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
MeshRenderable.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "RenderableBase.h"
6 #include "LayerIds.h"
7 #include "VectorMathDecl.h"
8 #include "Rendering.h"
9 #include "VertexBindingPool.h"
10 #include "Mesh.h"
11 #include "IMaterial.h"
12 #include "Shader.h"
13 
14 namespace Eegeo
15 {
16  namespace Rendering
17  {
18  namespace Renderables
19  {
21  {
22  public:
24  LayerIds::Values layerId,
25  Eegeo::dv3 ecefPosition,
26  Materials::IMaterial* material,
27  Rendering::Mesh* pMesh,
28  const Rendering::VertexLayouts::VertexBinding& vertexBinding
29  );
30 
31  virtual ~MeshRenderable();
32 
33  virtual void OnMaterialChanged(const Rendering::Materials::IMaterial* pMaterial, Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
34 
35  virtual void Render(Rendering::GLState& glState) const;
36 
37  Rendering::Mesh& GetMesh() { return *m_pMesh; }
38 
39  const Rendering::Mesh& GetMesh() const { return *m_pMesh; }
40 
41  protected:
42 
43  void UpdateVertexBinding(Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool)
44  {
45  SetVertexBinding(vertexBindingPool.GetVertexBinding(GetMesh().GetVertexLayout(), GetMaterial()->GetShader().GetVertexAttributes()));
46  }
47 
48  Mesh* m_pMesh;
49  };
50  }
51  }
52 }