CVS: data/Shaders landmass.frag, 1.6, 1.7 landmass.geom, 1.1, 1.2 landmass.vert, 1.4, 1.5

Frederic Bouvier <[email protected]> Fri, 2 Apr 2010 02:06:42 -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-serv17243/Shaders

Modified Files:
	landmass.frag landmass.geom landmass.vert 
Log Message:
Landmass update: add a triangle for the ground and don't apply relief on it

Index: landmass.frag
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Shaders/landmass.frag,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- landmass.frag	1 Apr 2010 20:59:17 -0000	1.6
+++ landmass.frag	2 Apr 2010 07:06:40 -0000	1.7
@@ -7,6 +7,7 @@
 varying vec3  VBinormal;
 varying vec3  Normal;
 varying vec4  constantColor;
+varying float bump;
 
 uniform sampler3D NoiseTex;
 uniform sampler2D BaseTex;
@@ -53,16 +54,26 @@
 
 void main (void)
 {
-	vec3 V = normalize(ecPosition.xyz);
-	float a = dot(VNormal, -V);
-	vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
-	s *= depth_factor / a;
-	vec2 ds = s;
-	vec2 dp = gl_TexCoord[0].st;
-	float d = ray_intersect(NormalTex, dp, ds);
+	vec2 uv;
+	vec3 N;
+	if ( bump > 0.9 )
+	{
+		vec3 V = normalize(ecPosition.xyz);
+		float a = dot(VNormal, -V);
+		vec2 s = vec2(dot(V, VTangent), dot(V, VBinormal));
+		s *= depth_factor / a;
+		vec2 ds = s;
+		vec2 dp = gl_TexCoord[0].st;
+		float d = ray_intersect(NormalTex, dp, ds);
 
-	vec2 uv = dp + ds * d;
-	vec3 N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
+		uv = dp + ds * d;
+		N = texture2D(NormalTex, uv).xyz * 2.0 - 1.0;
+	}
+	else
+	{
+		uv = gl_TexCoord[0].st;
+		N = vec3(0.0, 0.0, 1.0);
+	}
 
 
 	vec4 noisevec   = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);

Index: landmass.geom
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Shaders/landmass.geom,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- landmass.geom	29 Mar 2010 06:13:43 -0000	1.1
+++ landmass.geom	2 Apr 2010 07:06:40 -0000	1.2
@@ -13,6 +13,7 @@
 varying out vec3 VBinormal;
 varying out vec3 Normal;
 varying out vec4 constantColor;
+varying out float bump;
 
 uniform float canopy_height;
 
@@ -41,6 +42,7 @@
 	VNormal = normalize(gl_NormalMatrix * Normal);
 	VTangent  = VTangentIn[i];
 	VBinormal = VBinormalIn[i];
+	bump = s;
 
 	gl_FrontColor = gl_FrontColorIn[i];
 	constantColor = gl_FrontMaterial.emission
@@ -72,4 +74,8 @@
 	createVertex(1, 2, canopy_height, 1.0);
 	createVertex(2, 0, canopy_height, 1.0);
 	EndPrimitive();
+	createVertex(0, 1, 0.0, 0.0);
+	createVertex(1, 2, 0.0, 0.0);
+	createVertex(2, 0, 0.0, 0.0);
+	EndPrimitive();
 }

Index: landmass.vert
===================================================================
RCS file: /var/cvs/FlightGear-0.9/data/Shaders/landmass.vert,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- landmass.vert	28 Mar 2010 17:00:21 -0000	1.4
+++ landmass.vert	2 Apr 2010 07:06:40 -0000	1.5
@@ -5,6 +5,7 @@
 varying vec3  VBinormal;
 varying vec3  Normal;
 varying vec4  constantColor;
+varying float bump;
 
 attribute vec3 tangent;
 attribute vec3 binormal;
@@ -17,6 +18,7 @@
 	VNormal = gl_NormalMatrix * gl_Normal;
 	VTangent = gl_NormalMatrix * tangent;
 	VBinormal = gl_NormalMatrix * binormal;
+	bump = 1.0;
 
 	gl_FrontColor = gl_Color;
 	constantColor = gl_FrontMaterial.emission


------------------------------------------------------------------------------
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