OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
IShader.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef ISHADER_H
19 #define ISHADER_H
20 
21 #include "index.h"
22 #include "texture.h"
23 
24 namespace Engine
25 {
26 
30  class IShader : public Arch::IComponent
31  {
32  public:
33  IShader()
34  : Arch::IComponent("shader") ,
35  mUsing(false) ,
36  mSource(false) ,
37  mLink(false)
38  {}
39 
40  virtual ~IShader(){}
41 
42  virtual void UseProgram(void)=0;
43 
44  virtual void Unused(void)=0;
45 
46  virtual void LinkProgram(void)=0;
47 
48  virtual void AttachShader( uint shader )=0;
49 
50  virtual void BindUniform1i( const char * location , int number ) =0 ;
51 
52  virtual void BindUniform1f( const char * location , float number ) =0;
53 
54  virtual void BindMatrix( const char * location , glm::mat4 matrix ) =0;
55 
56  virtual void BindVec3i( const char * location , const Vector3i & vector )=0;
57 
58  virtual void BindVec3f( const char * location , const Vector3f & vector )=0;
59 
60  virtual void BindVec4i( const char * location , const Vector4i & vector )=0;
61 
62  virtual void BindVec4f( const char * location , const Vector4f & vector )=0;
63 
64  virtual void BindTexture( Texture * texture , const char * location , int texture_unit )=0;
65 
66 
67  /* ##### for Shader extensions ##### */
68 
69  virtual void BindFragData( const char * location , int frag_position)=0;
70 
71  virtual void BindAttributeLocation( const char * location , int attribute_id )=0;
72 
73  /* ##### -------------------- #####*/
74 
75  bool isUsing(void)
76  {
77  return mUsing;
78  }
79 
80  void setUsing( bool state )
81  {
82  mUsing = state;
83  }
84 
85  void setLinked( bool state )
86  {
87  mLink = state;
88  }
89 
90  void setSource( bool state )
91  {
92  mSource = state;
93  }
94 
95  uint getProgram(void)
96  {
97  return mProgram;
98  }
99 
100  bool hasSource(void)
101  {
102  return mSource;
103  }
104 
105  bool hasLinked(void)
106  {
107  return mLink;
108  }
109 
110 
111  protected:
112 
113  bool mUsing;
114  bool mSource;
115  bool mLink;
116 
117  uint mProgram;
118 
119  std::vector< uint > mShaders;
120 
121  };
122 
123 }
124 
125 #endif // ISHADER_H
The Texture class.
Definition: texture.h:37
Definition: element.h:23
The IShader - abstract / interface class.
Definition: IShader.h:30
Definition: vector.h:95
Definition: vector.h:55