void Renderer::SetupPrograms() { std::string srcVS = File::LoadAsString("Rarium/Texture.vs.glsl"); Shader* VSPtr = new Shader("Texture.vs", srcVS); std::string srcFS = File::LoadAsString("Rarium/Texture.fs.glsl"); Shader* FSPtr = new Shader("Texture.fs", srcFS); Program* TestProg = new Program(VSPtr, FSPtr); TestProg->ExtractData(); _shaders.insert(std::make_pair("Texture.vs", VSPtr)); _shaders.insert(std::make_pair("Texture.fs", FSPtr)); _programs.insert(std::make_pair("Texture", TestProg)); }
void Renderer::LoadShaderToyProgram(UiResource pRs, bool pOverrideExitsCheck) { if (_userPrograms.find(pRs.Id) == _userPrograms.end() || pOverrideExitsCheck) { ShaderData* shaderDataPtr = dynamic_cast<ShaderData*>(pRs.RsData); std::string srcFS = File::LoadAsString(shaderDataPtr->SrcPath); std::string srcFSStart = File::LoadAsString("Rarium/ShaderToy.start.fs.glsl"); std::string srcFSEnd = File::LoadAsString("Rarium/ShaderToy.end.fs.glsl"); srcFS = srcFSStart + srcFS + srcFSEnd; Shader* FSSDPtr = new Shader(shaderDataPtr->SrcPath, srcFS); Program* ToyProgPtr = new Program(_shaders["Texture.vs"], FSSDPtr); ToyProgPtr->ExtractData(); _userShaders[pRs.Id] = FSSDPtr; _userPrograms[pRs.Id] = ToyProgPtr; } }