Re: [Flightgear-devel] Patch v6 - Rain & Snow

2008-03-11 Thread Nicolas
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/vse012070mrt/direct/01/

> ___

> Flightgear-devel mailing list

> Flightgear-devel@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/flightgear-develIndex: 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 -	1.3
+++ src/Environment/precipitation_mgr.cxx	11 Mar 2008 14:09:20 -
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -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)) {
 

Re: [Flightgear-devel] Patch v6 - Rain & Snow

2008-03-11 Thread Ron Jensen
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/vse012070mrt/direct/01/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] Patch v6 - Rain & Snow

2008-03-11 Thread Nicolas
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/vse012070mrt/direct/01/

> ___

> Flightgear-devel mailing list

> Flightgear-devel@lists.sourceforge.net

> https://lists.sourceforge.net/lists/listinfo/flightgear-develIndex: 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 -	1.3
+++ src/Environment/precipitation_mgr.cxx	11 Mar 2008 08:59:03 -
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -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 > al

Re: [Flightgear-devel] Patch v6 - Rain & Snow

2008-03-04 Thread Tim Moore
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/vse012070mrt/direct/01/
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] Patch v6 - Rain & Snow

2008-02-28 Thread Nicolas
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)

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.

Regards,

-- 
Nicolas



fg-patch.tar.gz
Description: Binary data
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel