All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ModelRenderable.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "RenderableBase.h"
6 #include "Rendering.h"
7 #include "VectorMath.h"
8 
9 namespace Eegeo
10 {
11  namespace Rendering
12  {
13  namespace Renderables
14  {
16  {
17  public:
18  ModelRenderable(LayerIds::Values layerId,
19  Materials::ModelMaterial& material,
20  Mesh* pMesh,
21  const VertexLayouts::VertexBinding& vertexBinding,
22  Eegeo::dv3 ecefPosition);
23 
24  ~ModelRenderable();
25 
26  virtual void UpdateMVP(const Rendering::RenderContext& renderContext, float environmentFlatteningScale);
27 
28  void SetWorldMat(const m44& worldMat);
29  void SetUsesAlpha(bool usesAlpha);
30 
31  const m44& GetInverseWorldMatrix() const;
32  const v3& GetCameraRelativeModelOrigin() const;
33  const VertexLayouts::VertexBinding& GetVertexBinding() const;
34 
35  const float GetAlpha() const { return m_alpha; }
36  void SetAlpha(float alpha);
37  void SetMaterial(const Materials::IMaterial* pMaterial, VertexLayouts::VertexBindingPool& vertexBindingPool);
38  void SetMesh(Mesh* pMesh);
39  void OnMaterialChanged(const Rendering::Materials::IMaterial* pMaterial, Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
40 
41  void Render(Rendering::GLState& glState) const;
42 
43  protected:
44 
45  void UpdateVertexBinding(Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
46 
47  float m_alpha;
48  v3 m_cameraRelativeModelOrigin;
49  m44 m_worldMat;
50  m44 m_inverseWorldMat;
51 
52  Mesh* m_pMesh;
53  };
54  }
55  }
56 }