# PBR effect with emission texture support
# This effect extends the default PBR pipeline to support emission textures

fragment:
    defines: |
        #define USE_EMISSION_TEXTURE 1

    inout: |
        uniform sampler2D p3d_Texture6;  // Emission texture

    material: |
        // Fetch emission value from texture if available
        #if USE_EMISSION_TEXTURE
            vec3 sampled_emission = texture(p3d_Texture6, texcoord).xyz;
            // For emissive materials, add the texture emission to the base color
            if (mInput.shading_model == SHADING_MODEL_EMISSIVE) {
                m.basecolor += sampled_emission * 2.0;  // Boost emission intensity
            }
        #endif
