#version 400 compatibility
#define WORLD_END
#define PROGRAM_DEFERRED4
#define fsh

#include "/program/d4_deferred_shading.fsh"
#include "/include/misc/end_effects.glsl"

/* RENDERTARGETS: 0 */
void main() {
    vec3 color = texture2D(colortex0, texcoord).rgb;
    
    #ifdef WORLD_END
    vec3 worldPos = getWorldPos(texcoord, texture2D(depthtex0, texcoord).r);
    if (!isEyeInWater) {
        vec3 particles = get_end_particles(worldPos, frameTimeCounter);
        color += particles;
    }
    #endif

    gl_FragData[0] = vec4(color, 1.0);
} 