#version 330


layout (location=0) in vec3 vsPosition;
layout (location=1) in vec2 vsTexture;


uniform mat4 worldViewProj;
uniform float transitionProgress=1.0;

out vec2 fsTexture;

void main()
{
    vec4 deltaTrans=vec4(2.,2.,8.,.0);
    vec4 transOffset=vec4(1.,1.,4.0,.0);
    
    mat4 projection = mat4(
                           2.4140,0.0000,0.0000,0.0000,
                           0.0000,3.8624,0.0000,0.0000,
                           0.0000,0.0000,-1.020,-.4870,
                           0.0000,0.0000,-1.000,0.0000);
    mat4 translation=mat4(
                            1.0, 0.0, 0.0, 0.00,
                            0.0, 1.0, 0.0, 0.00,
                            0.0, 0.0, 1.0,-2.42,
                            0.0, 0.0, 0.0, 1.00);
    mat4 scale=mat4(
                          1.0, 0.0, 0.0, 0.00,
                          0.0, 0.625, 0.0, 0.00,
                          0.0, 0.0, 1.0, 0.00,
                          0.0, 0.0, 0.0, 1.00);
    
    vec4 tmpPos=vec4(vsPosition.x,vsPosition.y,vsPosition.z,1.0);
    vec4 worldPos=tmpPos*scale;

    transOffset-=deltaTrans*transitionProgress;
    
    translation[0][3]+=transOffset.x;
    translation[1][3]+=transOffset.y;
    translation[2][3]+=transOffset.z;
    
    worldPos*=translation;
    worldPos*=worldViewProj;
	gl_Position = worldPos*projection;
    
	fsTexture = vsTexture;
}
