// $LastChangedDate: 2009-11-25 15:56:38 -0600 (Wed, 25 Nov 2009) $
// Vertex shader (aircraft, a=color.a).

@include inc_vert.glsl
@include inc_ComputeDiffuseSpecular_vert.glsl

#ifndef SPECULAR_SCALE
#define SPECULAR_SCALE 0.4
#define DIFFUSE_SCALE  (1.0 - SPECULAR_SCALE)
#endif
#ifndef VAR_LIGHT_INTENSITY_MUL
#define VAR_LIGHT_INTENSITY_MUL 1.30
#define VAR_LIGHT_INTENSITY_ADD 0.30
#define VAR_LIGHT_INTENSITY_MIN 1.75
#endif

/*****************************************************************************
 * Vertex shader.
 *****************************************************************************/
void main( void )
{
    // Compute diffuse/specular light intensity.
    const vec4 ecPosition4 = gl_ModelViewMatrix * gl_Vertex;
    var_lightIntensity = ComputeDiffuseSpecular( ecPosition4.xyz, DIFFUSE_SCALE, SPECULAR_SCALE, 4.0 );
    var_lightIntensity *= VAR_LIGHT_INTENSITY_MUL;
    var_lightIntensity += VAR_LIGHT_INTENSITY_ADD;
    var_lightIntensity = min( VAR_LIGHT_INTENSITY_MIN, var_lightIntensity );

    // Compute color.
    @include inc_color_vert.glsl

    // Compute fog.
    @include inc_fog_vert.glsl

    // Compute shadow.
    @include inc_shadow_vert.glsl

    // Other outputs.
    gl_Position    = ftransform();
    gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}
