All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
InteriorsMaterialBase.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Interiors.h"
6 #include "IMaterial.h"
7 #include "PackedDiffuseMaterial.h"
8 #include "IdTypes.h"
9 #include "Rendering.h"
10 #include "Lighting.h"
11 #include "ICallback.h"
12 #include "InteriorsStencilMirrorType.h"
13 #include "InteriorsRenderableLayer.h"
14 
15 #include <string>
16 
17 namespace Eegeo
18 {
19  namespace Resources
20  {
21  namespace Interiors
22  {
24  {
25  public:
26 
27  const static u32 MirrorStencilRef = 0x08;
28 
30  const Rendering::TMaterialId materialId,
31  const std::string& name,
32  const Lighting::GlobalLighting& lighting,
33  IInteriorsMaterialAssignmentObserver& materialAssignmentObserver,
34  bool useAlternativeAmbient,
35  bool isTranslucent,
36  const v4& diffuseColor,
37  InteriorsRenderableLayer::Type renderableLayer
38  );
39 
40  virtual ~InteriorsMaterialBase();
41 
42  virtual const Rendering::TMaterialId GetId() const { return m_id; }
43 
44  virtual const std::string& GetName() const { return m_name; }
45 
46  virtual const Lighting::GlobalLighting& GetLighting() const { return m_lighting; }
47 
48  virtual bool IsUsingAlternativeAmbient() const { return m_useAlternativeAmbient; }
49 
50  virtual bool IsTranslucent() const { return m_isTranslucent; }
51 
52  virtual v4 GetDiffuseColor() const { return m_diffuseColor; }
53 
54  virtual InteriorsRenderableLayer::Type GetRenderableLayer() const { return m_renderableLayer; }
55 
56  virtual void OnAssignedToRenderable(Rendering::Renderables::InteriorRenderable& renderable);
57 
58  virtual void SetState(Rendering::GLState& glState) const;
59 
60  virtual v4 GetModulatedDiffuseColor(const v4& renderableColor) const;
61 
62  virtual void SetStatePerInstanceRenderable(int instanceIndex, const Rendering::Renderables::InstancedInteriorFloorRenderable& instancedRenderable, Rendering::GLState& glState) const {};
63 
64  protected:
65 
66  virtual void SetTranslucencyState(const Rendering::Renderables::InteriorRenderable& interiorFloorRenderable, Rendering::GLState& glState) const;
67 
68  private:
69  const Rendering::TMaterialId m_id;
70  const std::string m_name;
71  const Lighting::GlobalLighting& m_lighting;
73  IInteriorsMaterialAssignmentObserver& m_materialAssignmentObserver;
74 
75  const bool m_useAlternativeAmbient;
76  const bool m_isTranslucent;
77  const v4 m_diffuseColor;
78  const InteriorsRenderableLayer::Type m_renderableLayer;
79  };
80  }
81  }
82 }