#version 150

in  vec4 vPosition;
in  vec4 vColor;
in  vec2 vTexCoord;
in  vec4 vTexCoord3D;

out vec3 fV;
out vec3 fL;
out vec4 ambient2;

// Llum

uniform    vec4 Lpos;
uniform    vec3 Ldir;
uniform    vec4 Lint_ambient;
uniform    vec4 Lint_difusa;
uniform    vec4 Lint_especular;
uniform    float Lang;


// Material

uniform   vec4 Mcomp_ambient;
uniform   vec4 Mcomp_difusa;
uniform   vec4 Mcomp_especular;
uniform   float Mcoef;


uniform vec4 obs;
uniform vec4 ambient;

// Define the interface between the vertex- and the fragment programs

out   vec4 Position; // For the rasterizer
out   vec4 TexCoord;
out   vec4 Pos;
out   vec4 Color;

uniform mat4 model_view;
uniform mat4 projection;

void main(void)
{

    fV = vPosition.xyz;
    fL = Lpos.xyz;

    ambient2 = ambient;

    if( Lpos.w != 0.0 ) fL = Lpos.xyz - vPosition.xyz;

    gl_Position = projection*model_view*vPosition;
    gl_Position = gl_Position/vPosition.w;


    Position = projection*model_view*vPosition;
    Pos = projection*model_view*vPosition;
    TexCoord = vTexCoord3D;
    Color = vColor;

}
