All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DebugShader.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "Rendering.h"
7 #include <string>
8 
9 namespace Eegeo
10 {
11  namespace DebugRendering
12  {
13  struct Shader {
14  int m_positionSlot;
15  int m_colorSlot;
16  int m_uvSlot;
17  int m_projectionUniform;
18  int m_viewUniform;
19  int m_modelUniform;
20  int m_textureUniform;
21  u32 m_programHandle;
22  };
23 
24  class DebugShader : protected Eegeo::NonCopyable
25  {
26  public:
27  // IH: Dependency on GLState in construction. These objects should only be constructed
28  // during the app's Draw() phase
30  ~DebugShader();
31 
32  Shader* GetDiffuseTexturedShader() { return m_pDiffuseTexturedShader; }
33  Shader* GetDiffuseColourShader() { return m_pDiffuseColourShader; }
34 
35  private:
36 
37  Shader* m_pDiffuseTexturedShader;
38  Shader* m_pDiffuseColourShader;
39 
40  void CompileShaders(Eegeo::Rendering::GLState& glState);
41  Shader* CompileSingleShader(std::string &vertexProgram, std::string &fragmentProgram, Eegeo::Rendering::GLState& glState);
42  void DestroyShaders();
43  std::string VertexShader();
44  std::string TexturedFragmentShader();
45  std::string ColourFragmentShader();
46  };
47  }
48 }