scg3  0.6
ShaderCoreFactory.h
Go to the documentation of this file.
1 
12 /*
13  * Copyright 2014 Volker Ahlers
14  *
15  * Licensed under the Apache License, Version 2.0 (the "License");
16  * you may not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * http://www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an "AS IS" BASIS,
23  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  */
27 
28 #ifndef SHADERCOREFACTORY_H_
29 #define SHADERCOREFACTORY_H_
30 
31 #include <string>
32 #include <vector>
33 #include "scg_glew.h"
34 #include "scg_internals.h"
35 
36 namespace scg {
37 
38 
43 struct ShaderFile {
44  ShaderFile(const std::string& fileName0, GLenum shaderType0) :
45  fileName(fileName0), shaderType(shaderType0) {
46  }
47 
48  std::string fileName;
49  GLenum shaderType;
50 };
51 
52 
57 
58 public:
59 
64 
71  ShaderCoreFactory(const std::string& filePath);
72 
76  virtual ~ShaderCoreFactory();
77 
84  void addFilePath(const std::string& filePath);
85 
93 
103 
111  const std::vector<ShaderFile>& shaderFiles);
112 
120  std::vector<ShaderFile>&& shaderFiles);
121 
122 protected:
123 
130  int loadSourceFile_(GLuint shader, const std::string& fileName) const;
131 
132 protected:
133 
134  std::vector<std::string> filePaths_;
135 
136 };
137 
138 
139 } /* namespace scg */
140 
141 #endif /* SHADERCOREFACTORY_H_ */
A core to set a shader program to be applied to subsequent nodes.
Definition: ShaderCore.h:69
std::string fileName
ShaderCoreSP createGouraudShader()
A factory to create shader cores.
void addFilePath(const std::string &filePath)
ShaderCoreSP createShaderFromSourceFiles(const std::vector< ShaderFile > &shaderFiles)
Local header file for GLEW library.
virtual ~ShaderCoreFactory()
std::vector< std::string > filePaths_
ShaderFile(const std::string &fileName0, GLenum shaderType0)
A shader file consisting of a file name and a shader type (GL_VERTEX_SHADER, GL_FRAGMENT_SHADER,...
Definition: Animation.h:28
Internal definitions required by most classes.
int loadSourceFile_(GLuint shader, const std::string &fileName) const
ShaderCoreSP createColorShader()