Hi Ron,
I have updated the patch... (in remplacement of last)
I have taken into account your comments.
Thx
Nicolas
On Tue, 11 Mar 2008 07:30:53 -0600, Ron Jensen <[EMAIL PROTECTED]> wrote:
> On Tue, 2008-03-11 at 10:05 +0100, Nicolas wrote:
>> 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
>>
>
> Hi Nicolas,
>
> Great work on the rain so far!
>
> A couple of points on this patch:
>
>> + SGPropertyNode *node, *child;
> Can we have better names for these variables?
>
>> + // 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;
>> + }
>
> "result" is stored in meters and compared to "elev" which is feet!
>
> How about:
>
> // For each boundary layers
> while ( ( child = node->getNode( "entry", i ) ) != NULL ) {
> elev = child->getDoubleValue( "elevation-ft" ) * SG_FEET_TO_METER;
>
> if (elev > result)
> result = elev;
> ++i;
> }
>
>> + * 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.
>
> How about:
>
> * To seem real, we stop the precipitation above the cloud or boundry
> layer.
> * If METAR information doesn't give us this altitude, we will see
> precipitation
> * in space...
> * Moreover, above 0°C we change snow into rain.
>
> Thanks,
>
> Ron
>
>
>
>
> -------------------------------------------------------------------------
> 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 14:09:20 -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 *boundaryNode, *boundaryEntry;
// By default (not cloud layer)
@@ -148,6 +151,32 @@
}
}
+
+ // If we haven't found clouds layers, we read the bounday layers table.
+ if (result > 0)
+ return result;
+
+
+ // Read boundary layers node
+ boundaryNode = fgGetNode("/environment/config/boundary");
+
+ if (boundaryNode != NULL) {
+ i = 0;
+
+ // For each boundary layers
+ while ( ( boundaryEntry = boundaryNode->getNode( "entry", i ) ) != NULL ) {
+ elev = boundaryEntry->getDoubleValue( "elevation-ft" );
+
+ if (elev > result)
+ result = elev;
+
+ ++i;
+ }
+ }
+
+ // Convert the result in meter
+ result = result * SG_FEET_TO_METER;
+
return result;
}
@@ -155,6 +184,10 @@
/**
* @brief Update the precipitation drawing
*
+ * To seem real, we stop the precipitation above the cloud or boundary layer.
+ * If METAR information doesn't give us this altitude, we will see precipitations
+ * in space...
+ * Moreover, below 0°C we change rain into snow.
*/
void FGPrecipitationMgr::update(double dt)
{
@@ -166,11 +199,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