Hi,


Thank's for this quickly integration.



I send you a little improvement to fix :



- no rain when there isn't clouds layer

=> Now, I read  the boundary layer too



- disable the precipitation if the user doesn't want them !

=> Now, I read the property tree to know if precipitation are enable /

disable

(sgEnviro.get_precipitation_enable_state())



Regards



Nicolas





On Tue, 04 Mar 2008 10:27:44 +0100, Tim Moore <[EMAIL PROTECTED]> wrote:

> Nicolas wrote:

>> Hi,

>> 

>> I have added some features.

>> 

>> Now, the precipitation changements aren't abrupt... but smooth.

>> 

>> The precipitation effects depend on the freezing temperature and dew

>> point.

>> 

>> Changelog :

>> - Fixe the turn off rain to snow (at 0°C about)

>> - Fixe the dew point using.

>> - Add precipitation changement smoothly.

>> - Add a precipitation menu (thanks to Emmanuel BARANGER)

>> 

> I've checked this into CVS; thank you for this contribution. I've also

> checked in my

> cleanups, some of which were suggested by andy on IRC. These include:

> 

> * reformatting to Stroustrup indentation style. This may not be

> universally agreed upon

> in the project, but if I'm checking in a new contribution, that's the

> style I'm going to

> use.

> 

> * make FGPrecipitationManager an SGSubsystem. This is a nice way to avoid

> adding

> explicit initialization and update calls to main.cxx and renderer.cxx.

> 

> * Refactoring (and rewrite) of private function used from tileentry.cxx.

> In general,

> never use a private function; do the refactoring to make it public or

move

> it to simgear.

> 

>> Now, we need an umbrella in the cockpit. Maybe in using a clip plane.

>> But I think that this feature has to be added in aircraft code. Because,

>> it may find the same issue with clouds.

> 

> I fear that clip planes won't work; the precipitation effect uses

shaders,

> and there a

> bunch of issues, including driver performance problems, when trying to

use

> shaders and

> clip planes together. Eventually we'll either make our own version of the

> precipitation

> effect and change the shaders, or pursue something else, like a stencil

> test, similar

> to a shadow volume, that disables the precipitation inside the aircraft.

> 

> Tim

> 

> -------------------------------------------------------------------------

> This SF.net email is sponsored by: Microsoft

> Defy all challenges. Microsoft(R) Visual Studio 2008.

> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

> _______________________________________________

> Flightgear-devel mailing list

> Flightgear-devel@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
Index: src/Environment/precipitation_mgr.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/Environment/precipitation_mgr.cxx,v
retrieving revision 1.3
diff -u -r1.3 precipitation_mgr.cxx
--- src/Environment/precipitation_mgr.cxx	9 Mar 2008 22:09:17 -0000	1.3
+++ src/Environment/precipitation_mgr.cxx	11 Mar 2008 08:59:03 -0000
@@ -36,6 +36,7 @@
 #include <simgear/math/SGMath.hxx>
 #include <simgear/scene/sky/sky.hxx>
 #include <simgear/scene/sky/cloud.hxx>
+#include <simgear/environment/visual_enviro.hxx>
 
 #include <Main/fg_props.hxx>
 #include <Main/globals.hxx>
@@ -116,7 +117,9 @@
 {
     int i;
     int max;
+	double elev;
     float result;
+    SGPropertyNode *node, *child;
 
 
     // By default (not cloud layer)
@@ -148,6 +151,29 @@
         }
     }
 
+
+    // If we haven't found clouds layers, we read the bounday layers table.
+    if (result > 0)
+        return result;
+
+
+    // Read boundary layers node
+    node = fgGetNode("/environment/config/boundary");
+
+    if (node != NULL) {
+        i = 0;
+
+        // For each boundary layers
+        while ( ( child = node->getNode( "entry", i ) ) != NULL ) {
+            elev = child->getDoubleValue( "elevation-ft" );
+
+            if (elev > result)
+                result = elev * SG_FEET_TO_METER;
+
+            ++i;
+        }
+    }
+
     return result;
 }
 
@@ -155,6 +181,10 @@
 /** 
  * @brief Update the precipitation drawing
  * 
+ * To seems real, we stop the precipitation above of clouds layer (or bounday layer).
+ * If METAR informations don't give us this altitude, we will be able to find precipitations
+ * in the space...
+ * Moreover, above 0°C, we turn off the rain to snow.
  */
 void FGPrecipitationMgr::update(double dt)
 {
@@ -166,11 +196,24 @@
     float altitudeAircraft;
     float altitudeCloudLayer;
 
+	// Does the user enable the precipitation ?
+	if (!sgEnviro.get_precipitation_enable_state()) {
+		// Disable precipitations
+	    precipitation->setRainIntensity(0);
+	    precipitation->setSnowIntensity(0);
+
+	    // Update the drawing...
+	    precipitation->update();
+
+		// Exit
+		return;
+	}
+
     // Get the elevation of aicraft and of the cloud layer
     altitudeAircraft = fgGetDouble("/position/altitude-ft", 0.0);
     altitudeCloudLayer = this->getPrecipitationAtAltitudeMax() * SG_METER_TO_FEET;
 
-    if (altitudeAircraft > altitudeCloudLayer) {
+    if ((altitudeCloudLayer > 0) && (altitudeAircraft > altitudeCloudLayer)) {
         // The aircraft is above the cloud layer
         rain_intensity = 0;
         snow_intensity = 0;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to