#version 450

layout(location = 0) in vec4 color;
layout(location = 1) in vec2 pos;
layout(location = 2) in vec2 tex_cord;
layout(location = 3) in uint tex_ind;

layout(push_constant, std430) uniform pc {
    float width;
    float height;
};

layout (location=0) flat out vec4 vsout_color;
layout (location=1) out vec2 vsout_tex_cord;
layout (location=2) flat out uint vsout_tex_ind;

float lint(float A1, float B1, float A2, float B2, float x){
    return A2 + (B2 - A2) * (x - A1) / (B1 - A1);
}

float deng(float B1, float x){
    return lint(0, B1, -1, 1, x);
}

void main(){
    vsout_color = color;
    vsout_tex_cord = tex_cord;
    vsout_tex_ind = tex_ind;
    gl_Position = vec4(deng(width, pos.x), deng(height, pos.y), 0, 1);
}
