xoreos  0.0.5
shaderbuilder.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
30 #ifndef GRAPHICS_SHADER_SHADERBUILDER_H
31 #define GRAPHICS_SHADER_SHADERBUILDER_H
32 
33 #include <vector>
34 #include <map>
35 
36 #include "glm/mat4x4.hpp"
37 
38 #include "src/common/ustring.h"
39 #include "src/common/singleton.h"
40 #include "src/common/mutex.h"
41 
42 namespace Graphics {
43 
44 namespace Shader {
45 
47 {
48 public:
50  enum Input {
66  };
67 
69  enum Sampler {
79  };
80 
82  enum SamplerType {
87  };
88 
90  enum Uniform {
96  };
97 
99  enum Action {
109  };
110 
112  enum Blend {
119  };
120 
122 
124 
126 
128 
130 
137  void connect(ShaderDescriptor::Sampler sampler,
139  ShaderDescriptor::Action action);
140 
142 
143  void build(bool isGL3, Common::UString &v_string, Common::UString &f_string);
144 
148  void clear();
149 
154  void genName(Common::UString &n_string);
155 
156 private:
157  // Input descriptors.
158  // Sampler descriptors.
159  // sampler -> uv coord descriptors (from inputs)
160  // render passes
163  };
164 
168  };
169 
172  };
173 
174  struct Connector {
178  };
179 
180  struct Pass {
183  };
184 
185  std::vector<Input> _inputDescriptors;
186  std::vector<SamplerDescriptor> _samplerDescriptors;
187  std::vector<UniformDescriptor> _uniformDescriptors;
188  std::vector<Connector> _connectors;
189  std::vector<Pass> _passes;
190 };
191 
192 } // End of namespace Shader
193 
194 } // End of namespace Graphics
195 
196 #endif // GRAPHICS_SHADER_SHADERBUILDER_H
Input
< Vertex shader input data. Each should have a corresponding output.
Definition: shaderbuilder.h:50
Class and macro for implementing singletons.
void build(bool isGL3, Common::UString &v_string, Common::UString &f_string)
Not strictly speaking an input, but generated for an output.
Definition: shaderbuilder.h:63
A class holding an UTF-8 string.
Definition: ustring.h:48
std::vector< Input > _inputDescriptors
void declareSampler(ShaderDescriptor::Sampler sampler, ShaderDescriptor::SamplerType type)
void connect(ShaderDescriptor::Sampler sampler, ShaderDescriptor::Input input, ShaderDescriptor::Action action)
Connect an input to a sampler and an action.
Same as INPUT_UV1, but specifies input matrix too.
Definition: shaderbuilder.h:62
void clear()
Clear shader descriptor information.
Not strictly speaking an input, but generated for an output.
Definition: shaderbuilder.h:64
Not really blending, but component-wise multiply.
void declareUniform(ShaderDescriptor::Uniform uniform)
std::vector< Connector > _connectors
Unicode string handling.
std::vector< UniformDescriptor > _uniformDescriptors
Thread mutex classes.
Same as INPUT_UV0, but specifies input matrix too.
Definition: shaderbuilder.h:61
Uniform variable colour information.
Blending not applicable to the component.
void genName(Common::UString &n_string)
Generate a name to asscoiate with the current description.
void addPass(ShaderDescriptor::Action action, ShaderDescriptor::Blend blend)
std::vector< SamplerDescriptor > _samplerDescriptors
void declareInput(ShaderDescriptor::Input input)
Per-vertex colour information.