]> git.mxchange.org Git - simgear.git/commitdiff
Misc. tweaks that have been laying around.
authorcurt <curt>
Thu, 23 Jan 2003 21:59:07 +0000 (21:59 +0000)
committercurt <curt>
Thu, 23 Jan 2003 21:59:07 +0000 (21:59 +0000)
configure.ac
simgear/scene/sky/cloud.cxx

index 7846a9b4c394726a70cabd83dcf3ec906811ffea..0d4131cfd76d9969dcf2bc5c331e8b9722be4b7d 100644 (file)
@@ -379,7 +379,7 @@ dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS( \
        fcntl.h getopt.h malloc.h memory.h stdint.h stdlib.h sys/param.h \
-       sys/stat.h sys/time.h sys/timeb.h unistd.h winbase.h values.h )
+       sys/stat.h sys/time.h sys/timeb.h unistd.h values.h )
 
 if test "x$ac_cv_header_stdint_h" = "xyes"; then
     AC_DEFINE([HAVE_STDINT_H], 1, [Define if stdint.h exists])
index 74fd99e6cad1b15d7cd34e9fad0e6f9f9719d6dd..5cb994f029d34a022388b137c813282fba9bda90 100644 (file)
@@ -37,17 +37,26 @@ SGCloudLayer::layer_states[SGCloudLayer::SG_MAX_CLOUD_TYPES];
 
 
 // Constructor
-SGCloudLayer::SGCloudLayer( const string &tex_path )
-  : layer_root(new ssgRoot),
+SGCloudLayer::SGCloudLayer( const string &tex_path ) :
+    layer_root(new ssgRoot),
     layer_transform(new ssgTransform),
-    layer(0),
+    layer(NULL),
+    cl(NULL),
+    vl(NULL),
+    tl(NULL),
     texture_path(tex_path),
-    layer_span(0),
-    layer_asl(0),
-    layer_thickness(0),
-    layer_transition(0),
-    layer_type(SG_CLOUD_CLEAR)
+    layer_span(0.0),
+    layer_asl(0.0),
+    layer_thickness(0.0),
+    layer_transition(0.0),
+    layer_type(SG_CLOUD_CLEAR),
+    scale(4000.0),
+    last_lon(0.0),
+    last_lat(0.0)
 {
+    for ( int i = 0; i < SG_MAX_CLOUD_TYPES; ++i ) {
+        layer_states[i] = NULL;
+    }
     layer_root->addKid(layer_transform);
     rebuild();
 }
@@ -130,33 +139,38 @@ void
 SGCloudLayer::rebuild()
 {
                                // Initialize states and sizes if necessary.
-    if (layer_states[0] == 0) {
-      SGPath cloud_path;
+    if ( layer_states[0] == NULL ) {
+        SGPath cloud_path;
 
-      cloud_path.set(texture_path.str());
-      cloud_path.append("overcast.rgb");
-      layer_states[SG_CLOUD_OVERCAST] = SGCloudMakeState(cloud_path.str());
+        cloud_path.set(texture_path.str());
+        cloud_path.append("overcast.rgb");
+        layer_states[SG_CLOUD_OVERCAST] = SGCloudMakeState(cloud_path.str());
 
-      cloud_path.set(texture_path.str());
-      cloud_path.append("mostlycloudy.rgba");
-      layer_states[SG_CLOUD_MOSTLY_CLOUDY] =
-       SGCloudMakeState(cloud_path.str());
+        cloud_path.set(texture_path.str());
+        cloud_path.append("mostlycloudy.rgba");
+        layer_states[SG_CLOUD_MOSTLY_CLOUDY]
+            = SGCloudMakeState(cloud_path.str());
 
-      cloud_path.set(texture_path.str());
-      cloud_path.append("mostlysunny.rgba");
-      layer_states[SG_CLOUD_MOSTLY_SUNNY] = SGCloudMakeState(cloud_path.str());
+        cloud_path.set(texture_path.str());
+        cloud_path.append("mostlysunny.rgba");
+        layer_states[SG_CLOUD_MOSTLY_SUNNY]
+            = SGCloudMakeState(cloud_path.str());
 
-      cloud_path.set(texture_path.str());
-      cloud_path.append("cirrus.rgba");
-      layer_states[SG_CLOUD_CIRRUS] = SGCloudMakeState(cloud_path.str());
+        cloud_path.set(texture_path.str());
+        cloud_path.append("cirrus.rgba");
+        layer_states[SG_CLOUD_CIRRUS] = SGCloudMakeState(cloud_path.str());
 
-      layer_states[SG_CLOUD_CLEAR] = 0;
+        layer_states[SG_CLOUD_CLEAR] = 0;
     }
 
     scale = 4000.0;
 
     last_lon = last_lat = -999.0f;
 
+    if ( layer != NULL ) {
+        layer_transform->removeKid(layer); // automatic delete
+    }
+
     cl = new ssgColourArray( 4 );
     vl = new ssgVertexArray( 4 );
     tl = new ssgTexCoordArray( 4 );
@@ -193,17 +207,15 @@ SGCloudLayer::rebuild()
     vl->add( vertex );
     tl->add( tc );
 
-    if (layer != 0)
-      layer_transform->removeKid(layer); // automatic delete
     layer = new ssgVtxTable ( GL_TRIANGLE_STRIP, vl, NULL, tl, cl );
-    if (layer_states[layer_type] != 0)
-      layer->setState( layer_states[layer_type] );
+    layer_transform->addKid( layer );
+    if ( layer_states[layer_type] != NULL ) {
+        layer->setState( layer_states[layer_type] );
+    }
 
-    // force a repaint of the moon colors with arbitrary defaults
+    // force a repaint of the sky colors with arbitrary defaults
     repaint( color );
 
-    // moon_transform->addKid( halo );
-    layer_transform->addKid( layer );
 }
 
 
@@ -346,8 +358,9 @@ bool SGCloudLayer::reposition( sgVec3 p, sgVec3 up, double lon, double lat,
 
 
 void SGCloudLayer::draw() {
-    if (layer_type != SG_CLOUD_CLEAR)
-      ssgCullAndDraw( layer_root );
+    if ( layer_type != SG_CLOUD_CLEAR ) {
+        ssgCullAndDraw( layer_root );
+    }
 }