From 281445e31e93d494e1ba8676f0ac8ff0db889f77 Mon Sep 17 00:00:00 2001 From: Erik Hofman Date: Sat, 16 Jul 2011 11:51:45 +0200 Subject: [PATCH] Like the landmass sharder, move the bump factor to the shader file to limit the number of varyings to 7 --- Shaders/forest.frag | 4 ++-- Shaders/forest.vert | 6 ------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Shaders/forest.frag b/Shaders/forest.frag index f68c33a29..8bafbf3f9 100644 --- a/Shaders/forest.frag +++ b/Shaders/forest.frag @@ -6,8 +6,6 @@ varying vec3 VTangent; varying vec3 VBinormal; varying vec3 VNormal; varying vec3 Normal; -varying float bump; -varying float fogCoord; uniform sampler3D NoiseTex; uniform sampler2D SampleTex; @@ -61,6 +59,7 @@ float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds) void main (void) { + float bump = 1.0; if ( quality_level >= 3.5 ) { linear_search_steps = 20; @@ -100,6 +99,7 @@ void main (void) float vegetationlevel = (rawpos.z)+nvL[2]*3000.0; const float LOG2 = 1.442695; + float fogCoord = abs(ecPosition.z / ecPosition.w); float fogFactor = exp(-gl_Fog.density * gl_Fog.density * fogCoord * fogCoord); float biasFactor = exp2(-0.00000002 * fogCoord * fogCoord * LOG2); diff --git a/Shaders/forest.vert b/Shaders/forest.vert index 8cf6cbb7e..0c717001e 100644 --- a/Shaders/forest.vert +++ b/Shaders/forest.vert @@ -5,8 +5,6 @@ varying vec3 VTangent; varying vec3 VBinormal; varying vec3 Normal; varying vec4 constantColor; -varying float bump; -varying float fogCoord; attribute vec3 tangent; attribute vec3 binormal; @@ -19,14 +17,10 @@ void main(void) VNormal = gl_NormalMatrix * gl_Normal; VTangent = gl_NormalMatrix * tangent; VBinormal = gl_NormalMatrix * binormal; - bump = 1.0; gl_FrontColor = gl_Color; constantColor = gl_FrontMaterial.emission + gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient); gl_Position = ftransform(); gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - fogCoord = abs(ecPosition.z / ecPosition.w); - }