All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SceneModelRenderable.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 "LayerIds.h"
8 #include "VectorMath.h"
9 
10 namespace Eegeo
11 {
12  namespace Rendering
13  {
14  namespace Renderables
15  {
17  {
18  public:
19  SceneModelRenderable(LayerIds::Values layerId,
21  const VertexLayouts::VertexBinding& vertexBinding,
22  Eegeo::dv3 ecefPosition);
24 
26 
27  virtual void UpdateMVP(const Rendering::RenderContext& renderContext, float environmentFlatteningScale);
28 
29  SceneModels::SceneModelMaterialResource& GetMaterialResource() const;
30  void SetMaterialResource(SceneModels::SceneModelMaterialResource& materialResource, VertexLayouts::VertexBindingPool& vertexBindingPool);
31 
32  void SetWorldMat(const m44& worldMat);
33  void SetUsesAlpha(bool usesAlpha);
34  const float GetAlpha() const { return m_alpha; }
35  void SetAlpha(float alpha);
36 
37  const m44& GetInverseWorldMatrix() const;
38  const v3& GetCameraRelativeModelOrigin() const;
39  const VertexLayouts::VertexBinding& GetVertexBinding() const;
40 
41  virtual void SetMaterial(const Rendering::Materials::IMaterial* pMaterial, Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
42  virtual void OnMaterialChanged(const Rendering::Materials::IMaterial* pMaterial, Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
43 
44  virtual SceneModelRenderable* Clone() = 0;
45 
46  protected:
47 
48  virtual void UpdateVertexBinding(Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool) = 0;
49 
50  float m_alpha;
51  v3 m_cameraRelativeModelOrigin;
52  m44 m_worldMat;
53  m44 m_inverseWorldMat;
54 
55  SceneModels::SceneModelMaterialResource* m_pMaterialResource;
56  };
57 
58 
59 
60  }
61  }
62 }