All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TextShader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Shader.h"
6 #include "IdTypes.h"
7 #include "Graphics.h"
8 #include "Rendering.h"
9 #include "VectorMath.h"
10 #include <string>
11 
12 namespace Eegeo
13 {
14  namespace Rendering
15  {
16  namespace Shaders
17  {
18  class TextShader : public Shader
19  {
20  public:
21  static TextShader* Create(const TShaderId shaderId);
22 
23  static TextShader* CreateWithOutline(const TShaderId shaderId);
24 
25  const GLuint GetDiffuseSamplerId() const;
26 
27  void SetMVP(const m44& mvp) const;
28 
29  void SetScale(const v3& scale) const;
30 
31  void SetForegroundColour(const v4& rgba);
32 
33  void SetShadowColour(const v4& rgba);
34 
35  void SetOutlineColour(const v4& rgba);
36 
37  void SetThresholds(const bool outlinedText);
38 
39  void Use(Rendering::GLState& glState) const;
40 
41  private:
42  GLuint m_modelViewProjectionUniformLocation;
43  GLuint m_scaleUniformLocation;
44  GLuint m_foregroundColourUniformLocation;
45  GLuint m_shadowColourUniformLocation;
46  GLuint m_outlineColourUniformLocation;
47  GLuint m_diffuseTextureSampleUniformLocation;
48  GLuint m_thresholdsUniformLocation;
49 
50  const bool m_hasOutlineColourUniform;
51 
52  TextShader(const TShaderId shaderId, const std::string& vertexCode, const std::string& fragmentCode, bool hasOutlineColourUniform);
53  };
54  }
55  }
56 }
57