void Light::injectOnProgram(std::shared_ptr<ShaderProgram> _shader) { // Inject all needed #defines for this light instance _shader->addSourceBlock("defines", getInstanceDefinesBlock(), false); _shader->addSourceBlock("__lighting", getClassBlock(), false); _shader->addSourceBlock("__lighting", getInstanceBlock()); _shader->addSourceBlock("__lights_to_compute", getInstanceComputeBlock()); }
void Light::injectSourceBlocks(ShaderProgram& _shader) { // Inject all needed #defines for this light instance _shader.addSourceBlock("defines", getInstanceDefinesBlock(), false); if (m_dynamic) { // If the light is dynamic, initialize it using the corresponding uniform at the start of main() _shader.addSourceBlock("setup", getInstanceName() + " = " + getUniformName() + ";", false); } _shader.addSourceBlock("__lighting", getClassBlock(), false); _shader.addSourceBlock("__lighting", getInstanceBlock()); _shader.addSourceBlock("__lights_to_compute", getInstanceComputeBlock()); }
void Material::injectOnProgram(ShaderProgram& _shader ) { _shader.addSourceBlock("defines", getDefinesBlock(), false); _shader.addSourceBlock("material", getClassBlock(), false); }