HatchitGraphics
ht_glmaterial.h
1 
25 #pragma once
26 
27 #include <ht_material.h>
28 #include <ht_glvertshader.h>
29 #include <ht_glfragshader.h>
30 #include <ht_glgeoshader.h>
31 #include <ht_gltessshader.h>
32 
33 namespace Hatchit {
34 
35  namespace Graphics {
36 
37  namespace OpenGL {
38 
39  class HT_API GLMaterial : public IMaterial
40  {
41  public:
42  GLMaterial();
43  virtual ~GLMaterial();
44 
45  void VOnLoaded() override;
46  void VSetShader(ShaderSlot shaderSlot, IShader* shader) override;
47 
48  //TODO: Remove
49  bool VInitFromFile(Core::File* file) override;
50 
51  virtual bool VSetInt(std::string name, int data) override;
52  virtual bool VSetFloat(std::string name, float data) override;
53  virtual bool VSetFloat2(std::string name, Math::Vector2 data) override;
54  virtual bool VSetFloat3(std::string name, Math::Vector3 data) override;
55  virtual bool VSetFloat4(std::string name, Math::Vector4 data) override;
56  virtual bool VSetMatrix3(std::string name, Math::Matrix3 data) override;
57  virtual bool VSetMatrix4(std::string name, Math::Matrix4 data) override;
58 
59  virtual bool VBindTexture(std::string name, ITexture* texture) override;
60  virtual bool VUnbindTexture(std::string name, ITexture* texture) override;
61 
62  void VBind() override;
63  void VUnbind() override;
64  private:
65  GLuint shaderProgram;
66  std::map <std::string, ShaderVariable*> variables;
67  std::map <std::string, GLuint> variableLocations;
68 
69  void printProgramLog();
70  void reflectShaderGL();
71  };
72  }
73  }
74 }
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Hatchit Engine Copyright(c) 2015-2016 Third-Degree.
Definition: ht_color.h:19
Definition: ht_glmaterial.h:39