From 71770eb92ed7439b7089f08179ceb02d854924e5 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 22 Mar 2004 21:31:24 +0000 Subject: [PATCH] Let the cloud layers follow the earth's surface. If you want the clouds to touch the horizon, just increase the spaen. --- simgear/scene/sky/cloud.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index c98582a4..30957231 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -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++) { -- 2.39.5