varying vec3 lightVec;\r
varying vec3 tsEyeVec;\r
varying vec3 tsLightVec;\r
-varying float generate_heightmaps;\r
+varying float generate_heightmaps;
\r
const float e = 2.718281828459;\r
const float BS = 10.0;\r
\r
-float smoothCurve(float x)\r
-{\r
- return x * x * (3.0 - 2.0 * x);\r
+float smoothCurve(float x)
+{
+ return x * x * (3.0 - 2.0 * x);
}\r
-float triangleWave(float x)\r
-{\r
- return abs(fract(x + 0.5) * 2.0 - 1.0);\r
+float triangleWave(float x)
+{
+ return abs(fract(x + 0.5) * 2.0 - 1.0);
}\r
-float smoothTriangleWave(float x)\r
-{\r
- return smoothCurve(triangleWave(x)) * 2.0 - 1.0;\r
+float smoothTriangleWave(float x)
+{
+ return smoothCurve(triangleWave(x)) * 2.0 - 1.0;
}\r
\r
void main(void)\r
{\r
gl_TexCoord[0] = gl_MultiTexCoord0;\r
- gl_TexCoord[0].y += 0.008;\r
-\r
-#if ((DRAW_TYPE == NDT_NORMAL || DRAW_TYPE == NDT_LIQUID || DRAW_TYPE == NDT_FLOWINGLIQUID) && GENERATE_NORMALMAPS)\r
- generate_heightmaps = 1.0;\r
-#else \r
- generate_heightmaps = 0.0;\r
-#endif\r
-\r
-#if ((MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER)\r
+ 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;\r
pos.y -= 2.0;\r
\r
\r
vPosition = gl_Position.xyz;\r
worldPosition = (mWorld * gl_Vertex).xyz;\r
-\r
- // Don't generate heightmaps when too far from the eye\r
- float dist = distance (worldPosition, eyePosition);\r
- if (dist > 100.00) {\r
- generate_heightmaps = 0.0;\r
- }\r
-\r
+
+ // 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);\r
\r
vec3 normal, tangent, binormal;\r
normal = normalize(gl_NormalMatrix * gl_Normal);\r
- tangent = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);\r
- binormal = normalize(gl_NormalMatrix * -gl_MultiTexCoord2.xyz);\r
-\r
- vec3 v;\r
+ tangent = normalize(gl_NormalMatrix * gl_MultiTexCoord1.xyz);
+ binormal = normalize(gl_NormalMatrix * -gl_MultiTexCoord2.xyz);
+
+ vec3 v;
\r
lightVec = sunPosition - worldPosition;\r
- v.x = dot(lightVec, tangent);\r
- v.y = dot(lightVec, binormal);\r
- v.z = dot(lightVec, normal);\r
- tsLightVec = v;\r
-\r
- eyeVec = -(gl_ModelViewMatrix * gl_Vertex).xyz;\r
- v.x = dot(eyeVec, tangent);\r
- v.y = dot(eyeVec, binormal);\r
- v.z = dot(eyeVec, normal);\r
- tsEyeVec = v;\r
+ 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;
\r
vec4 color;\r
float day = gl_Color.r;\r
const float e = 2.718281828459;\r
const float BS = 10.0;\r
\r
-float smoothCurve(float x)\r
-{\r
- return x * x * (3.0 - 2.0 * x);\r
+float smoothCurve(float x)
+{
+ return x * x * (3.0 - 2.0 * x);
}\r
-float triangleWave(float x)\r
-{\r
- return abs(fract( x + 0.5 ) * 2.0 - 1.0);\r
+float triangleWave(float x)
+{
+ return abs(fract( x + 0.5 ) * 2.0 - 1.0);
}\r
-float smoothTriangleWave(float x)\r
-{\r
- return smoothCurve(triangleWave( x )) * 2.0 - 1.0;\r
+float smoothTriangleWave(float x)
+{
+ return smoothCurve(triangleWave( x )) * 2.0 - 1.0;
}\r
\r
void main(void)\r
{\r
gl_TexCoord[0] = gl_MultiTexCoord0;\r
-\r
+
#if (MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER\r
vec4 pos = gl_Vertex;\r
pos.y -= 2.0;\r
const u32 stride = getVertexPitchFromType(buf->getVertexType());
u32 vertex_count = buf->getVertexCount();
u8 *vertices = (u8 *)buf->getVertices();
- for (u32 i = 0; i < vertex_count; i++)
+ for (u32 i = 0; i < vertex_count; i++)
((video::S3DVertex *)(vertices + i * stride))->Pos *= scale;
buf->recalculateBoundingBox();
const u32 stride = getVertexPitchFromType(buf->getVertexType());
u32 vertex_count = buf->getVertexCount();
u8 *vertices = (u8 *)buf->getVertices();
- for (u32 i = 0; i < vertex_count; i++)
+ for (u32 i = 0; i < vertex_count; i++)
((video::S3DVertex *)(vertices + i * stride))->Pos += vec;
buf->recalculateBoundingBox();
const u32 stride = getVertexPitchFromType(buf->getVertexType());
u32 vertex_count = buf->getVertexCount();
u8 *vertices = (u8 *)buf->getVertices();
- for (u32 i = 0; i < vertex_count; i++)
+ for (u32 i = 0; i < vertex_count; i++)
((video::S3DVertex *)(vertices + i * stride))->Color = color;
}
}