All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
CollisionVisualizationRenderable.h
1 // Copyright eeGeo Ltd (2012-2023), All Rights Reserved
2 
3 #pragma once
4 
5 
6 #include "RenderableBase.h"
7 #include "Types.h"
8 #include "Collision.h"
9 #include "CollisionVisualization.h"
10 #include "Rendering.h"
11 #include "SingleSphere.h"
12 
13 #include <array>
14 #include <string>
15 
16 namespace Eegeo
17 {
18  namespace CollisionVisualization
19  {
21  {
22  public:
24  Rendering::LayerIds::Values layerId,
25  const dv3& ecefPosition,
26  const Rendering::Materials::IMaterial& material,
27  const Rendering::VertexLayouts::VertexBinding& vertexBinding,
28  const Eegeo::Geometry::SingleSphere& boundingSphere,
29  const Eegeo::v4& initialColor,
30  bool depthTest,
31  bool depthWrite,
32  bool depthBias,
33  bool alphaBlend);
34 
36 
37  virtual m44 CalcModelViewProjection(const dv3& ecefCameraPosition, const m44& viewProjection, const float environmentFlatteningScale) const;
38 
39  virtual void Render(Rendering::GLState& glState) const;
40 
41  virtual void OnMaterialChanged(const Rendering::Materials::IMaterial* pMaterial, Eegeo::Rendering::VertexLayouts::VertexBindingPool& vertexBindingPool);
42 
43  virtual const v4& GetColor() const { return m_color; }
44  virtual const std::vector<std::array<v4, 2>>& GetHeightClipPlanes() const { return m_heightClipPlanes; }
45  virtual bool IsDepthTest() const { return m_depthTest; }
46  virtual bool IsDepthWrite() const { return m_depthWrite; }
47  virtual bool IsDepthBias() const { return m_depthBias; }
48  virtual bool IsAlphaBlend() const { return m_alphaBlend; }
49 
50  virtual const std::array<v4, 2>& GetCurrentHeightClipPlanePair() const;
51 
52  virtual void SetColor(const v4& color) { m_color = color; }
53  virtual void SetHeightClipPlanes(const std::vector<std::array<v4, 2>>& heightClipPlanes) { m_heightClipPlanes = heightClipPlanes; }
54  virtual void SetDepthTest(bool enabled) { m_depthTest = enabled; }
55  virtual void SetDepthWrite(bool enabled) { m_depthWrite = enabled; }
56  virtual void SetDepthBias(bool enabled) { m_depthBias = enabled; }
57  virtual void SetAlphaBlend(bool enabled) { m_alphaBlend = enabled; }
58 
59  virtual Eegeo::Geometry::SingleSphere GetBoundingSphere() const { return m_boundingSphere; }
60 
61  private:
62  Rendering::Mesh* m_pMesh;
63  const Eegeo::Geometry::SingleSphere m_boundingSphere;
64  v4 m_color;
65  std::vector<std::array<v4, 2>> m_heightClipPlanes;
66  bool m_depthTest;
67  bool m_depthWrite;
68  bool m_depthBias;
69  bool m_alphaBlend;
70 
71  mutable std::vector<std::array<v4, 2>>::const_iterator m_currentHeightClipPlanePair;
72  };
73  }
74 }