Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg	(revision 3009)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg	(revision 3040)
@@ -5,5 +5,5 @@
 
 
-struct VertexInput
+struct vtxin
 {
 	float4 position: POSITION;
@@ -24,13 +24,5 @@
 	float3 normal: TEXCOORD2;
 	float4 mypos: TEXCOORD3;
-	float4 color2: TEXCOORD4;
-};
-
-
-struct pixel
-{
-	float4 col: COLOR0;
-	float4 norm: COLOR1;
-	float3 pos: COLOR2;
+	float4 hdrColor: TEXCOORD4;
 };
 
@@ -44,9 +36,18 @@
 
 	float4 projPos: WPOS;
-	float4 worldPos: TEXCOORD1; // world position
 	float3 normal: TEXCOORD2;
-	float4 mypos: TEXCOORD3;
-	float4 color2: TEXCOORD4;
+	float4 hdrColor: TEXCOORD4;
 };
+
+
+struct fragout
+{
+	float4 col: COLOR0;
+	float4 norm: COLOR1;
+	float3 pos: COLOR2;
+};
+
+
+
 //--------------------------------------------------------------------------------------
 // Vertex Shaders
@@ -54,5 +55,5 @@
 
 
-vtxout default_vs(VertexInput IN,
+vtxout default_vs(vtxin IN,
 				  uniform float3 lightDir,
 				  uniform float2 thetaSun,
@@ -63,5 +64,4 @@
 				  uniform float3 dColor,
 				  uniform float3 eColor,
-				  uniform float4x4 ModelView,
 				  uniform float multiplier)
 {
@@ -70,13 +70,12 @@
 	OUT.position = mul(glstate.matrix.mvp, IN.position);
 
-
 	const float dotLN = dot(lightDir, IN.normal);   
 	const float cos2gamma = dotLN * dotLN; 
 
 	const float gamma = acos(dotLN);    
-	const float theta = dot(float3(0.0, 0.0, 1.0), IN.normal);
+	const float theta = dot(float3(.0f, .0f, 1.0f), IN.normal);
 
-    float3 num = (1.0 + aColor * exp(bColor / theta)) * (1.0 + cColor * exp(dColor * gamma) + eColor * cos2gamma);    
-	float3 den = (1.0 + aColor * exp(bColor)) * (1.0 + cColor * exp(dColor * thetaSun.x) + eColor * thetaSun.y);   
+    float3 num = (1.0f + aColor * exp(bColor / theta)) * (1.0f + cColor * exp(dColor * gamma) + eColor * cos2gamma);    
+	float3 den = (1.0f + aColor * exp(bColor)) * (1.0f + cColor * exp(dColor * thetaSun.x) + eColor * thetaSun.y);   
     float3 xyY = (num / den) * zenithColor;    
     
@@ -88,18 +87,16 @@
 	
     const static float3x3 conv_Mat = 
-		float3x3(3.240479, -1.537150, -0.498535,
-		         -0.969256, 1.875992,  0.041556,
-			     0.055648, -0.204043,  1.057311);
+		float3x3( 3.240479f, -1.537150f, -0.498535f,
+		         -0.969256f,  1.875992f,  0.041556f,
+			      0.055648f, -0.204043f,  1.057311f);
 
 	float3 hcol = mul(conv_Mat, XYZ);
-	OUT.color = float4(hcol, 1.0);
+	OUT.color = float4(hcol, 1.0f);
 
 	OUT.color.rgb *= multiplier;
-
-	OUT.color2 = OUT.color;
-	OUT.worldPos = mul(ModelView, IN.position);
+	/// put out color into different color channel to avoid clamping
+	OUT.hdrColor  = OUT.color;
 
 	OUT.normal = IN.normal;
-	OUT.mypos = OUT.position;
 
 	return OUT;
@@ -107,15 +104,11 @@
 
 
-pixel frag_skydome(fragin IN)
+fragout frag_skydome(fragin IN)
 {
-	pixel pix;
+	fragout pix;
 
-	pix.col = IN.color2;
+	pix.col = IN.hdrColor;
 	pix.col.w = 1e20f;
-
-	pix.norm.xyz = IN.normal;
-	pix.norm.w = IN.mypos.w;
-
-	//pix.pos = 1e20f;
+	pix.norm = IN.normal;
 	
 	return pix;
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg	(revision 3038)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg	(revision 3040)
@@ -4,6 +4,5 @@
 
 
-
-struct VertexInput
+struct vtxin
 {
 	float4 position: POSITION;
@@ -21,32 +20,10 @@
 
 	float4 color: COLOR0;  
-	float4 worldPos: TEXCOORD1; // world position
 	float3 normal: TEXCOORD2;
-	float4 mypos: TEXCOORD3;
-	float4 color2: TEXCOORD4;
+	float4 eyePos: TEXCOORD3;
 };
 
 
-struct pixel
-{
-	float4 col: COLOR0;
-	float4 norm: COLOR1;
-	float3 pos: COLOR2;
-};
 
-
-// fragment input
-struct fragin
-{
-	float4 color: COLOR0;  
-	float4 position: POSITION; // eye space
-	float4 texCoord: TEXCOORD0;    
-
-	float4 projPos: WPOS;
-	float4 worldPos: TEXCOORD1; // world position
-	float3 normal: TEXCOORD2;
-	float4 mypos: TEXCOORD3;
-	float4 color2: TEXCOORD4;
-};
 //--------------------------------------------------------------------------------------
 // Vertex Shaders
@@ -54,69 +31,28 @@
 
 
-vtxout default_vs(VertexInput IN,
-				  uniform float3 lightDir,
-				  uniform float2 thetaSun,
-				  uniform float3 zenithColor,
-				  uniform float3 aColor,
-				  uniform float3 bColor,
-				  uniform float3 cColor,
-				  uniform float3 dColor,
-				  uniform float3 eColor,
-				  uniform float4x4 ModelView,
-				  uniform float multiplier)
+vtxout animateVtx(vtxin IN,
+				  uniform float3 windDir,
+				  uniform float windStrength,
+				  uniform float2 minmaxPos,
+				  uniform float timer)
 {
 	vtxout OUT;
 
+	OUT.color = IN.color;
+	OUT.texCoord = IN.texCoord;
+	// transform the vertex position into eye space
+	OUT.eyePos = mul(glstate.matrix.modelview[0], IN.position);
+	
+	const float pos = (minmaxPos.x - IN.position.y / (minmaxPos.x - minmaxPos.y);
+
+	float factor = windStrength * sin(timer);
+
+	// displace the input position
+	float4 newPos = IN.position + float4(factor * windDir, 0.0f);
+	// transform the vertex position into post projection space
 	OUT.position = mul(glstate.matrix.mvp, IN.position);
 
-
-	const float dotLN = dot(lightDir, IN.normal);   
-	const float cos2gamma = dotLN * dotLN; 
-
-	const float gamma = acos(dotLN);    
-	const float theta = dot(float3(0.0, 0.0, 1.0), IN.normal);
-
-    float3 num = (1.0 + aColor * exp(bColor / theta)) * (1.0 + cColor * exp(dColor * gamma) + eColor * cos2gamma);    
-	float3 den = (1.0 + aColor * exp(bColor)) * (1.0 + cColor * exp(dColor * thetaSun.x) + eColor * thetaSun.y);   
-    float3 xyY = (num / den) * zenithColor;    
-    
-    float3 XYZ;                                                                                             
-                                                                                                            
-    XYZ.x = (xyY.x / xyY.y) * xyY.z;                                                                        
-	XYZ.y = xyY.z;                                                                                          
-	XYZ.z = ((1.0f - xyY.x - xyY.y) / xyY.y) * xyY.z;   
-	
-    const static float3x3 conv_Mat = 
-		float3x3(3.240479, -1.537150, -0.498535,
-		         -0.969256, 1.875992,  0.041556,
-			     0.055648, -0.204043,  1.057311);
-
-	float3 hcol = mul(conv_Mat, XYZ);
-	OUT.color = float4(hcol, 1.0);
-
-	OUT.color.rgb *= multiplier;
-
-	OUT.color2 = OUT.color;
-	OUT.worldPos = mul(ModelView, IN.position);
-
 	OUT.normal = IN.normal;
-	OUT.mypos = OUT.position;
 
 	return OUT;
 }
-
-
-pixel frag_skydome(fragin IN)
-{
-	pixel pix;
-
-	pix.col = IN.color2;
-	pix.col.w = 1e20f;
-
-	pix.norm.xyz = IN.normal;
-	pix.norm.w = IN.mypos.w;
-
-	//pix.pos = 1e20f;
-	
-	return pix;
-}
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3039)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3040)
@@ -478,5 +478,5 @@
 
 	//InitCg();
-
+	ShaderProgram *treeAnimation = loader->CreateVertexProgram("treeanimation", "animateVtx");
 	const float turbitiy = 5.0f;
 	preetham = new SkyPreetham(turbitiy, skyDome);
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 3025)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj	(revision 3040)
@@ -779,4 +779,8 @@
 				>
 			</File>
+			<File
+				RelativePath=".\src\shaders\treeanimation.cg"
+				>
+			</File>
 		</Filter>
 		<Filter
