On Wed, Aug 11, 2010 at 1:44 PM, Heiko Schulz
> Just a guess- could it be that changes made for the alternative clouds system 
> introduced it?

I'm pretty sure that has nothing to do with it.

However, I have tracked it down to simgear/scene/sky/clouds.cxx
SGCloudLayer::reposition(), which sets new texture coordinates for the
cloud layer based on the current wind, and the movement of the viewer.

This was re-factored to get rid of some old vector calculations by James:

http://gitorious.org/fg/simgear/commit/aa859c488f21d0b1f8d54c657e23a738dcadacca

>From a code read of the diffs, I think the course for the viewer
movement was reversed during the refactoring and should be from the
current position to the last position, as we want the cloud field to
move towards us. However, changing that didn't have the effect I
expected, just shifted the problem by 90 degrees so the clouds moved
away from the aircraft when heading E/W rather than N/S. Eventually I
hacked the the ay value as the patch below shows, which does appear to
give the correct behaviour (at least around EGPH).

That suggests the texture coordinates are reversed in the y-axis, but
I don't see how that could have changed recently to introduce this
discrepancy

I'll take another look when I get the chance, but in the meantime if
anyone has any bright ideas, please let me know.

-Stuart

diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx
index d7b7e2f..87f6589 100644
--- a/simgear/scene/sky/cloud.cxx
+++ b/simgear/scene/sky/cloud.cxx
@@ -681,7 +681,7 @@ bool SGCloudLayer::reposition( const SGVec3f& p, const SGVec


     if ( lon != last_pos.getLongitudeRad() || lat != last_pos.getLatitudeRad()
-        double course = SGGeodesy::courseDeg(last_pos, pos) * SG_DEGREES_TO_RAD
+        double course = SGGeodesy::courseDeg(pos, last_pos) * SG_DEGREES_TO_RAD
             dist = SGGeodesy::distanceM(last_pos, pos);

         // if start and dest are too close together,
@@ -700,7 +700,7 @@ bool SGCloudLayer::reposition( const SGVec3f& p, const SGVec

         if (dist > 0.0) {
             ax = cos(course) * dist;
-            ay = sin(course) * dist;
+            ay = -sin(course) * dist;
         }

         if (sp_dist > 0) {

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to