]> git.mxchange.org Git - simgear.git/commitdiff
Let the cloud layers follow the earth's surface. If you want the clouds to touch...
authorehofman <ehofman>
Mon, 22 Mar 2004 21:31:24 +0000 (21:31 +0000)
committerehofman <ehofman>
Mon, 22 Mar 2004 21:31:24 +0000 (21:31 +0000)
simgear/scene/sky/cloud.cxx

index c98582a413ee516277a3884cfbf1952692e00209..309572314c4b4d0717277766b10d39bb347f32cc 100644 (file)
@@ -203,7 +203,16 @@ SGCloudLayer::rebuild()
 
     const float layer_scale = layer_span / scale;
     const float mpi = SG_PI/4;
-    const float alt_diff = layer_asl * 0.8;
+
+    // caclculate the difference between a flat-earth model and 
+    // a round earth model given the span and altutude ASL of
+    // the cloud layer. This is the difference in altitude between
+    // the top of the inverted bowl and the edge of the bowl.
+    // const float alt_diff = layer_asl * 0.8;
+    const float layer_to_core = (SG_EARTH_RAD * 1000 + layer_asl);
+    const float layer_angle = acos( 0.5*layer_span / layer_to_core);
+    const float border_to_core = layer_to_core * sin(layer_angle);
+    const float alt_diff = layer_to_core - border_to_core;
 
     for (int i = 0; i < 4; i++)
     {