2 uniform mat4 projection_matrix;
5 uniform mat4 modelview_matrix;
12 #if ENVIRONMENT_MAPPING || LIGHTING_ON
13 varying vec3 nnEyeToSurface;
17 attribute vec3 normal;
18 attribute vec3 tangent1;
19 attribute vec3 tangent2;
21 uniform float nearPlane;
22 uniform mat4 normals_matrix;
25 varying vec4 diffuseColor; // w: opacity
26 varying vec3 ambientColor;
31 varying vec3 tTangent1;
32 varying vec3 tTangent2;
35 #elif PER_VERTEX_COLOR
36 uniform vec4 matDiffuse;
41 uniform float fogDensity;
46 varying vec3 fTexCoord;
49 #if TEXTURE_ON || NORMALS_MAPPING || SPECULAR_MAPPING || REFLECTION_MAP
50 attribute vec2 texCoord;
51 varying vec2 fTexCoord;
57 vec4 pos = modelview_matrix * vec4(vertex, 1.0);
59 vec4 pos = vec4(vertex, 1.0);
62 #if ENVIRONMENT_MAPPING || LIGHTING_ON
63 nnEyeToSurface = vec3(pos.x, -pos.y, pos.z) * nearPlane;
69 ambientColor = color.xyz;
72 tNormal = mat3(normals_matrix) * normal;
74 tTangent1 = mat3(normals_matrix) * tangent1;
75 tTangent2 = mat3(normals_matrix) * tangent2;
77 #elif PER_VERTEX_COLOR
78 fColor = matDiffuse * color;
81 gl_Position = projection_matrix * pos;
83 #if TEXTURE_ON || NORMALS_MAPPING || SPECULAR_MAPPING || REFLECTION_MAP
88 fTexCoord = vec3(vertex.x, -vertex.y, -vertex.z);
92 fogZ = pos.z * fogDensity;