#include "shadersource.h" #include #include #include #include #include "shader.h" #include "mesh.h" #include "light.h" ShaderSource::ShaderSource() { for(int i=0; i defines; for(int i=0; i> i) & 0x00000001) defines.push_back(Mesh::flagStr[i]); } for(int i=0; i> i) & 0x00000001) defines.push_back(Light::flagStr[i]); } return compile(defines); } Shader* ShaderSource::compile(const std::vector &defines) { std::string header = "#version 330 core"; for(const char* def : defines) header += "\n#define "+std::string(def); header += "\n#line 1\n"; if(sources[VERTEX] == NULL || sources[FRAGMENT] == NULL) return NULL; std::string compiledSources[NB_TYPES]; for(int i=0; i