uniform mat4 projection;
uniform mat4 modelview;
uniform mat4 modelview_prev;

uniform int motion_blur;
 
attribute float fade;
attribute vec4 position_prev;
attribute vec2 screenUv;

varying vec4 vPosition;
varying vec4 vPrevPosition;  
varying vec2 uv;
varying vec2 uv1;
varying vec4 maskPosition;
varying vec4 color;
varying float vertexFade;
 
void main()
{
    if (motion_blur == 0)
    {
      vPrevPosition = projection * modelview * gl_Vertex;
      vPosition = vPrevPosition;
    }

    else if (motion_blur == 1) 
    {
      vPrevPosition = projection * modelview_prev * gl_Vertex;
      vPosition = projection * modelview * gl_Vertex;
    }
    else
    {
      vPrevPosition = projection * modelview_prev * position_prev;
      vPosition = projection * modelview * gl_Vertex; 
    }   
        
    color = gl_Color;
    uv = gl_MultiTexCoord0;
    uv1 = gl_MultiTexCoord1;
    vertexFade = fade;
    
    vec4 point = vec4(-1.0 + 2.0 * uv,0.0,1.0);//vec4(uv * 2.0 - 1.0, 0.0, 1.0);
    maskPosition = projection * modelview * point;
                              
    //vPosition = maskPosition;

    gl_Position = vPosition; 
    
}
