
// Vk3DVision (http://3dsurroundgaming.com/) - Original Shader
#version 450

layout(set = 0, binding = 1, std140) uniform freqLow_vertexUniforms_ubo
{
    vec4 vertexstscalebias;
    vec4 vertexxyzscale;
    vec4 vertexxyzbias;
} freqLow_vertexUniforms;

layout(set = 0, binding = 0, std140) uniform freqHigh_vertexUniforms_ubo
{
    vec4 mvpmatrixx;
    vec4 mvpmatrixy;
    vec4 mvpmatrixz;
    vec4 mvpmatrixw;
} freqHigh_vertexUniforms;

layout(location = 2) out vec4 vofi_TexCoord0;
layout(location = 1) in vec2 in_TexCoord;
layout(location = 12) in vec2 in_VmtrTC;
layout(location = 0) in vec4 in_Position;
layout(location = 2) in vec3 in_PackedTnputs;
layout(location = 5) out vec4 vofi_TexCoord3;
layout(location = 13) in vec4 in_VmtrSB;
layout(location = 7) out vec4 vofi_TexCoord5;

uint asuint(float x)
{
    return floatBitsToUint(x);
}

vec4 unpackR8G8B8A8(uint value)
{
    return vec4(float((value >> uint(24)) & 255u), float((value >> uint(16)) & 255u), float((value >> uint(8)) & 255u), float(value & 255u)) / vec4(255.0);
}

float dot4(vec4 a, vec4 b)
{
    return dot(a, b);
}

void main()
{
    vofi_TexCoord0 = ((in_TexCoord * freqLow_vertexUniforms.vertexstscalebias.xy) + freqLow_vertexUniforms.vertexstscalebias.zw).xyxy;
    vec2 _89 = (in_VmtrTC * freqLow_vertexUniforms.vertexstscalebias.xy) + freqLow_vertexUniforms.vertexstscalebias.zw;
    vofi_TexCoord0 = vec4(vofi_TexCoord0.x, vofi_TexCoord0.y, _89.x, _89.y);
    vec4 localPosition = (in_Position * freqLow_vertexUniforms.vertexxyzscale) + freqLow_vertexUniforms.vertexxyzbias;
    float param = in_PackedTnputs.x;
    uint param_1 = asuint(param);
    vec4 localNormal = (unpackR8G8B8A8(param_1).wzyx * 2.0) - vec4(1.0);
    float param_2 = in_PackedTnputs.y;
    uint param_3 = asuint(param_2);
    vec4 unpacked_tangent = unpackR8G8B8A8(param_3).wzyx;
    vec3 _136 = (unpacked_tangent.xyz * 2.0) - vec3(1.0);
    vec4 localTangent;
    localTangent = vec4(_136.x, _136.y, _136.z, localTangent.w);
    localTangent.w = (floor((unpacked_tangent.w * 255.100006103515625) / 128.0) * 2.0) - 1.0;
    vec4 param_4 = localPosition;
    vec4 param_5 = freqHigh_vertexUniforms.mvpmatrixx;
    gl_Position.x = dot4(param_4, param_5);
    vec4 param_6 = localPosition;
    vec4 param_7 = freqHigh_vertexUniforms.mvpmatrixy;
    gl_Position.y = dot4(param_6, param_7);
    vec4 param_8 = localPosition;
    vec4 param_9 = freqHigh_vertexUniforms.mvpmatrixz;
    gl_Position.z = dot4(param_8, param_9);
    vec4 param_10 = localPosition;
    vec4 param_11 = freqHigh_vertexUniforms.mvpmatrixw;
    gl_Position.w = dot4(param_10, param_11);
    vofi_TexCoord3 = in_VmtrSB;
    vofi_TexCoord5 = vofi_TexCoord3 / vec4(2048.0);
    gl_Position.y = -gl_Position.y;
}

