diff options
Diffstat (limited to 'client/shaders/nodes_shader/opengl_vertex.glsl')
-rw-r--r-- | client/shaders/nodes_shader/opengl_vertex.glsl | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index e5644b8b2..42a5f6cbf 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -14,36 +14,36 @@ varying vec3 eyeVec; varying vec3 lightVec;
varying vec3 tsEyeVec;
varying vec3 tsLightVec;
-varying float generate_heightmaps;
+varying float generate_heightmaps; const float e = 2.718281828459;
const float BS = 10.0;
-float smoothCurve(float x)
-{
- return x * x * (3.0 - 2.0 * x);
+float smoothCurve(float x) +{ + return x * x * (3.0 - 2.0 * x); }
-float triangleWave(float x)
-{
- return abs(fract(x + 0.5) * 2.0 - 1.0);
+float triangleWave(float x) +{ + return abs(fract(x + 0.5) * 2.0 - 1.0); }
-float smoothTriangleWave(float x)
-{
- return smoothCurve(triangleWave(x)) * 2.0 - 1.0;
+float smoothTriangleWave(float x) +{ + return smoothCurve(triangleWave(x)) * 2.0 - 1.0; }
void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[0].y += 0.008;
-
-#if ((DRAW_TYPE == NDT_NORMAL || DRAW_TYPE == NDT_LIQUID || DRAW_TYPE == NDT_FLOWINGLIQUID) && GENERATE_NORMALMAPS)
- generate_heightmaps = 1.0;
-#else
- generate_heightmaps = 0.0;
-#endif
-
-#if ((MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER)
+ gl_TexCoord[0].y += 0.008; + +#if ((DRAW_TYPE == NDT_NORMAL || DRAW_TYPE == NDT_LIQUID || DRAW_TYPE == NDT_FLOWINGLIQUID) && GENERATE_NORMALMAPS) + generate_heightmaps = 1.0; +#else + generate_heightmaps = 0.0; +#endif + +#if ((MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER) vec4 pos = gl_Vertex;
pos.y -= 2.0;
@@ -87,33 +87,33 @@ void main(void) vPosition = gl_Position.xyz;
worldPosition = (mWorld * gl_Vertex).xyz;
-
- // Don't generate heightmaps when too far from the eye
- float dist = distance (worldPosition, eyePosition);
- if (dist > 100.00) {
- generate_heightmaps = 0.0;
- }
-
+ + // Don't generate heightmaps when too far from the eye + float dist = distance (worldPosition, eyePosition); + if (dist > 100.00) { + generate_heightmaps = 0.0; + } + vec3 sunPosition = vec3 (0.0, eyePosition.y * BS + 900.0, 0.0);
vec3 normal, tangent, binormal;
normal = normalize(gl_NormalMatrix * gl_Normal);
- tangent = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);
- binormal = normalize(gl_NormalMatrix * -gl_MultiTexCoord2.xyz);
-
- vec3 v;
+ tangent = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz); + binormal = normalize(gl_NormalMatrix * -gl_MultiTexCoord2.xyz); + + vec3 v; lightVec = sunPosition - worldPosition;
- v.x = dot(lightVec, tangent);
- v.y = dot(lightVec, binormal);
- v.z = dot(lightVec, normal);
- tsLightVec = v;
-
- eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz;
- v.x = dot(eyeVec, tangent);
- v.y = dot(eyeVec, binormal);
- v.z = dot(eyeVec, normal);
- tsEyeVec = v;
+ v.x = dot(lightVec, tangent); + v.y = dot(lightVec, binormal); + v.z = dot(lightVec, normal); + tsLightVec = v; + + eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz; + v.x = dot(eyeVec, tangent); + v.y = dot(eyeVec, binormal); + v.z = dot(eyeVec, normal); + tsEyeVec = v; vec4 color;
float day = gl_Color.r;
|