13#ifndef SO_SHADER_BUILDER_H
14#define SO_SHADER_BUILDER_H
30 bool isValid()
const {
return code.size()>0; }
44 typedef std::map<std::string, SourceInfo> SourceInfoMap;
46 SourceInfoMap _repository;
70 std::string
createShader(
const std::string name,
const std::vector<std::string>& directives = std::vector<std::string>(),
SoShaderRepository* repository =
nullptr);
75 SoShaderRepository* repository =
nullptr,
int directivesFlag = FRAGMENT_SHADER | GEOMETRY_SHADER | VERTEX_SHADER);
81 std::ostringstream directives;
82 std::ostringstream header;
83 std::ostringstream body;
85 void addDirectived(
const std::vector<std::string>& directives);
87 std::string toString();
89 std::set<std::string> usedIncludes;
96 std::vector<SoShaderRepository*> _repositories;
std::vector< std::string > StringVector
#define INVENTOR_SHADER_API
Define class export specifier.
Shader class which directly takes src for vertex, geometry and/or fragment shader,...
SoGLCompleteShader * createCompleteShader(const std::string name, const std::vector< std::string > &directives=std::vector< std::string >(), SoShaderRepository *repository=nullptr, int directivesFlag=FRAGMENT_SHADER|GEOMETRY_SHADER|VERTEX_SHADER)
Creates a complete shader from the given name (.VS, .FS and .GS are appended, VS and FS are required!...
std::string createShader(const std::string name, const std::vector< std::string > &directives=std::vector< std::string >(), SoShaderRepository *repository=nullptr)
Creates the shader source for the given shader.
void addRepository(SoShaderRepository *repository)
Adds the given repository, ownership stays with the caller.
void addSource(const char *data)
adds the given source to the default repository
void addSource(const char *data)
const SourceInfo & lookup(const std::string name) const
void insert(const std::string name, const SourceInfo &info)