diff options
Diffstat (limited to 'client/shaders/nodes_shader/opengl_vertex.glsl')
-rw-r--r-- | client/shaders/nodes_shader/opengl_vertex.glsl | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/client/shaders/nodes_shader/opengl_vertex.glsl b/client/shaders/nodes_shader/opengl_vertex.glsl index 42a5f6cbf..5c4d46be6 100644 --- a/client/shaders/nodes_shader/opengl_vertex.glsl +++ b/client/shaders/nodes_shader/opengl_vertex.glsl @@ -14,7 +14,7 @@ varying vec3 eyeVec; varying vec3 lightVec;
varying vec3 tsEyeVec;
varying vec3 tsLightVec;
-varying float generate_heightmaps; +varying float area_enable_parallax; const float e = 2.718281828459;
const float BS = 10.0;
@@ -35,12 +35,16 @@ float smoothTriangleWave(float x) void main(void)
{
gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_TexCoord[0].y += 0.008; - + //TODO: make offset depending on view angle and parallax uv displacement
+ //thats for textures that doesnt align vertically, like dirt with grass
+ //gl_TexCoord[0].y += 0.008; +
+ //Allow parallax/relief mapping only for certain kind of nodes
+ //Variable is also used to control area of the effect #if ((DRAW_TYPE == NDT_NORMAL || DRAW_TYPE == NDT_LIQUID || DRAW_TYPE == NDT_FLOWINGLIQUID) && GENERATE_NORMALMAPS) - generate_heightmaps = 1.0; + area_enable_parallax = 1.0; #else - generate_heightmaps = 0.0; + area_enable_parallax = 0.0; #endif #if ((MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER) @@ -89,9 +93,9 @@ void main(void) 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; + float dist = distance (vec3(0.0, 0.0 ,0.0), vPosition); + if (dist > 100.0) { + area_enable_parallax = 0.0; } vec3 sunPosition = vec3 (0.0, eyePosition.y * BS + 900.0, 0.0);
|