All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ColorMaterial.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "IMaterial.h"
7 #include "Rendering.h"
8 #include "ColorShader.h"
9 #include "Lighting.h"
10 #include "VectorMathDecl.h"
11 #include <string>
12 
13 namespace Eegeo
14 {
15  namespace Rendering
16  {
17  namespace Materials
18  {
19  class ColorMaterial : protected Eegeo::NonCopyable, public IMaterial
20  {
21  public:
22  ColorMaterial(const TMaterialId materialId,
23  const std::string& name,
24  Shaders::ColorShader& shader,
25  const v4& initialColor
26  );
27 
28  const TMaterialId GetId() const { return m_id; }
29  const Shader& GetShader() const { return m_shader; }
30  const std::string& GetName() const { return m_name; }
31 
32  void SetState(Rendering::GLState& glState) const;
33 
34  void SetStatePerRenderable(const Rendering::RenderableBase* renderableBase, Rendering::GLState& glState) const;
35 
36  void SetColor(const v4& color) { m_color = color; }
37  const v4& GetColor() const { return m_color; }
38 
39  protected:
40  const TMaterialId m_id;
41  const std::string m_name;
42  Shaders::ColorShader& m_shader;
43  v4 m_color;
44  };
45  }
46  }
47 }