#version 450
// lens distortion 1
layout(set = 1, binding = 0) uniform sampler2D gBufferMap;
layout(set = 1, binding = 1) uniform sampler2D gBuffer1Map;

layout(location = 0) in VertexBlock
{
    vec2 mTexCoordsVec2;
} In;

layout(location = 0) out vec4 out_color0;
layout(location = 1) out vec4 out_color1;

//Vk3DVision (http://3dsurroundgaming.com/) - Stereo Injection
layout(set = 0, binding = 45, std140) uniform Vk3DParams
{
    vec4 stereo;
    vec4 custom_params;
} vk3d_params;

void main()
{

vec2 lens = In.mTexCoordsVec2;
lens.x += vk3d_params.stereo.x * 0.5;

    vec3 _67a = textureLod(gBufferMap, lens, 0.0).xyz;
    float _195a = dot(_67a, vec3(0.1500000059604644775390625, 0.25, 0.60000002384185791015625));
    float _201a = max((_195a - 3.0) * 0.25, 0.0);
    vec3 _81a = textureLod(gBuffer1Map, lens, 0.0).xyz;

    vec3 _67 = textureLod(gBufferMap, In.mTexCoordsVec2, 0.0).xyz;
    float _195 = dot(_67, vec3(0.1500000059604644775390625, 0.25, 0.60000002384185791015625));
    float _201 = max((_195 - 3.0) * 0.25, 0.0);
    vec3 _81 = textureLod(gBuffer1Map, In.mTexCoordsVec2, 0.0).xyz;
    out_color0 = vec4(max((_67a * _201a) / vec3(1.0 + _201a), _81a), 1.0);
    float _96 = length(_81) * 1.2000000476837158203125;
    float _219 = max((_195 - max(5.0 - _96, 0.0)) * (0.75 + _96), 0.0);
    out_color1 = vec4((_67 * _219) / vec3(1.0 + _219), 1.0);
}


