]> git.mxchange.org Git - simgear.git/commitdiff
Use a different coloring scheme.
authorehofman <ehofman>
Tue, 25 May 2004 07:58:33 +0000 (07:58 +0000)
committerehofman <ehofman>
Tue, 25 May 2004 07:58:33 +0000 (07:58 +0000)
simgear/scene/sky/cloud.cxx

index 963c18b3b99b8c8a94c6d43749afb6f37cc1daca..b376b88b0db2a3448fb54d1d8fb4c3d4ef1064ee 100644 (file)
@@ -28,10 +28,6 @@ inline int (isinf)(double r) { return isinf(r); }
 inline int (isnan)(double r) { return isnan(r); } 
 #endif
 
-#if defined(__MINGW32__)
-#define isnan(x) _isnan(x)
-#endif
-
 // #include STL_IOSTREAM
 
 #include <plib/sg.h>
@@ -47,6 +43,10 @@ inline int (isnan)(double r) { return isnan(r); }
 
 #include "cloud.hxx"
 
+#if defined(__MINGW32__)
+#define isnan(x) _isnan(x)
+#endif
+
 
 static ssgStateSelector *layer_states[SGCloudLayer::SG_MAX_CLOUD_COVERAGES];
 static bool state_initialized = false;
@@ -865,17 +865,23 @@ void SGCloudLayer::draw( bool top ) {
             glEnable( GL_BLEND ); 
             glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
 
-            glPolygonMode( GL_FILL, GL_FRONT_AND_BACK );
             glShadeModel( GL_SMOOTH );
             glEnable( GL_COLOR_MATERIAL ); 
             sgVec4 color;
-            sgSetVec4( color, 0.05, 0.05, 0.05, 0.0 );
+            float emis = 0.05;
+            if ( top ) {
+                ssgGetLight( 0 )->getColour( GL_DIFFUSE, color );
+                emis = ( color[0]+color[1]+color[2] ) / 3.0;
+                if ( emis < 0.05 )
+                    emis = 0.05;
+            }
+            sgSetVec4( color, emis, emis, emis, 0.0 );
             glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, color );
-            sgSetVec4( color, 0.8, 0.8, 0.8, 0.0 );
+            sgSetVec4( color, 1.0f, 1.0f, 1.0f, 0.0 );
             glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, color );
             sgSetVec4( color, 0.5, 0.5, 0.5, 0.0 );
             glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, color );
-            sgSetVec4( color, 1.0, 1.0, 1.0, 1.0 );
+            sgSetVec4( color, 0.0, 0.0, 0.0, 0.0 );
             glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, color );
 
             glActiveTexturePtr( GL_TEXTURE0_ARB );