Ejemplo n.º 1
0
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());

}
Ejemplo n.º 2
0
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());
}