From cc37e635615bfab7022ab67e9f5a3dbdcd6404df Mon Sep 17 00:00:00 2001
From: Torsten Dreyer <Torsten@t3r.de>
Date: Wed, 8 Jun 2011 17:08:33 +0200
Subject: [PATCH] Fix bug#123: 3d cloud flicker on Mac

---
 Shaders/3dcloud.vert | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Shaders/3dcloud.vert b/Shaders/3dcloud.vert
index 135658ddb..8d743f9d2 100644
--- a/Shaders/3dcloud.vert
+++ b/Shaders/3dcloud.vert
@@ -36,8 +36,12 @@ void main(void)
 
   // Determine a lighting normal based on the vertex position from the
   // center of the cloud, so that sprite on the opposite side of the cloud to the sun are darker.
-  float n = dot(normalize(-gl_LightSource[0].position.xyz),
-                normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));;
+
+// fix flickering of 3d clouds on some macs
+// http://code.google.com/p/flightgear-bugs/issues/detail?id=123
+//  float n = dot(normalize(-gl_LightSource[0].position.xyz),
+//                normalize(mat3x3(gl_ModelViewMatrix) * (- gl_Position.xyz)));;
+  float n = dot(normalize(-gl_LightSource[0].position.xyz), vec3(0.0,0.0,-1.0));
 
   // Determine the position - used for fog and shading calculations
   vec3 ecPosition = vec3(gl_ModelViewMatrix * gl_Position);