CVS: data/Shaders urban.frag,1.6,1.7

Frederic Bouvier <[email protected]> Sat, 10 Apr 2010 09:39:25 -0500
Newsgroups gmane.games.flightgear.cvc
Message-ID <[email protected]>
Update of /var/cvs/FlightGear-0.9/data/Shaders
In directory baron.flightgear.org:/tmp/cvs-serv18514/Shaders

Modified Files:
	urban.frag 
Log Message:
Use quality level inside urban fragment shader

Index: urban.frag
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Shaders/urban.frag,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- urban.frag	1 Apr 2010 20:59:17 -0000	1.6
+++ urban.frag	10 Apr 2010 14:36:37 -0000	1.7
@@ -17,15 +17,13 @@
 uniform sampler2D NormalTex;
 uniform float depth_factor;
 uniform float tile_size;
+uniform float quality_level;
 uniform vec3 night_color;
 
-const float zFar = 120000.0;
-const float zNear = 100.0;
+int linear_search_steps = 10;
 
 float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
 {
-	const int linear_search_steps = 10;
-
 	float size = 1.0 / float(linear_search_steps);
 	float depth = 0.0;
 	float best_depth = 1.0;
@@ -59,6 +57,9 @@
 
 void main (void)
 {
+	if ( quality_level >= 3.5 ) {
+		linear_search_steps = 20;
+	}
 	vec3 ecPos3 = ecPosition.xyz / ecPosition.w;
 	vec3 V = normalize(ecPos3);
 	vec3 s = vec3(dot(V, VTangent), dot(V, VBinormal), dot(VNormal, -V));
@@ -77,17 +78,19 @@
 	vec3 l = gl_LightSource[0].position.xyz;
 	vec3 diffuse = gl_Color.rgb * max(0.0, dot(N, l));
 	float shadow_factor = 1.0;
-/*
+
 // Shadow
-	dp += ds * d;
-	vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
-	ds = sl.xy * depth_factor / sl.z;
-	dp -= ds * d;
-	float dl = ray_intersect(NormalTex, dp, ds);
-	if ( dl < d - 0.05 )
-		shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
+	if ( quality_level >= 3.0 ) {
+		dp += ds * d;
+		vec3 sl = normalize( vec3( dot( l, VTangent ), dot( l, VBinormal ), dot( -l, VNormal ) ) );
+		ds = sl.xy * depth_factor / sl.z;
+		dp -= ds * d;
+		float dl = ray_intersect(NormalTex, dp, ds);
+		if ( dl < d - 0.05 )
+			shadow_factor = dot( constantColor.xyz, vec3( 1.0, 1.0, 1.0 ) ) * 0.25;
+	}
 // end shadow
-*/
+
 	vec4 ambient_light = constantColor + gl_LightSource[0].diffuse * vec4(diffuse, 1.0);
 	float reflectance = ambient_light.r * 0.3 + ambient_light.g * 0.59 + ambient_light.b * 0.11;
 	if ( shadow_factor < 1.0 )


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev