OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
shadermanager.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 SHADERMANAGER_H
19 #define SHADERMANAGER_H
20 
21 #include "index.h"
22 #include "shader.h"
23 #include "shaderarb.h"
24 
25 namespace Engine
26 {
27  /* Map of Attribute Shader Name with Attribute Location ID */
28  using ShaderAttribute = std::map< int , const char * >;
29 
38  class ShaderManager : public Arch::ITempDatabase< IShader >
39  {
40  public:
41  ShaderManager();
42  ~ShaderManager()=default;
43 
50  IShader * createShader ( const std::string & shader_name );
51  IShader * createShaderARB( const std::string & shader_name );
52 
61  void addSource ( IShader * shader , const std::string & shader_file , uint shader_types );
62  void addSourceARB( IShader * shader , const std::string & shader_file , uint shader_types );
63  void addEmbeddedSource( IShader * shader , const std::string & name , const std::string & source , uint shader_types );
64 
71  IShader * getShader( uint container_id );
72 
73  void destroy( uint container_id );
74 
75 
76  /* Debug */
77  void getProgramErrorARB ( uint program , const std::string & information );
78  void getProgramError ( uint program , const std::string & information );
79  void getShaderError ( uint shader , const std::string & information );
80 
81 
82  //------------------------------------------------------------------
83  std::string LoadShader( const string &fileName );
84  uint CreateShader(const std::string & name , const string &text, uint type);
85  uint CreateShaderARB( const std::string & name , const string &text , uint type );
86 
87  /* Shader Types */
88  uint createShaderType (const string & shader_file , const string extension , uint shader_type );
89  uint createShaderTypeARB(const string & shader_file , const string extension , uint shader_type );
90  };
91 }
92 
93 #endif // SHADERMANAGER_H
void addSource(IShader *shader, const std::string &shader_file, uint shader_types)
addSource
Definition: ShaderManager.cpp:145
Definition: element.h:23
The IShader - abstract / interface class.
Definition: IShader.h:30
IShader * createShader(const std::string &shader_name)
createShader
Definition: ShaderManager.cpp:36
The ShaderManager controlled IShader ( Shader , ShaderARB )
Definition: shadermanager.h:38
IShader * getShader(uint container_id)
getShader
Definition: ShaderManager.cpp:198