]> git.mxchange.org Git - flightgear.git/commitdiff
Generate RNG at start of day, and pass down the stack for cloud generation.
authorStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Wed, 5 Dec 2012 22:12:00 +0000 (22:12 +0000)
committerStuart Buchanan <stuart_d_buchanan@yahoo.co.uk>
Wed, 5 Dec 2012 22:12:00 +0000 (22:12 +0000)
src/Environment/fgclouds.cxx
src/Environment/fgclouds.hxx

index c77eb284b465b6ab8429924220dbf920a4114100..b7df4854c9baa58b02f2f84286c2cd9a71cb08eb 100644 (file)
@@ -47,6 +47,10 @@ static bool do_delete_3Dcloud (const SGPropertyNode *arg);
 static bool do_move_3Dcloud (const SGPropertyNode *arg);
 static bool do_add_3Dcloud (const SGPropertyNode *arg);
 
+// RNG seed to ensure cloud synchronization across multi-process
+// deployments
+static mt seed;
+
 FGClouds::FGClouds() :
 #if 0
     snd_lightning(0),
@@ -55,7 +59,6 @@ FGClouds::FGClouds() :
     index(0)
 {
        update_event = 0;
-       mt_init_time_10(&seed);
 }
 
 FGClouds::~FGClouds()
@@ -83,6 +86,8 @@ void FGClouds::Init(void) {
        }
 #endif
 
+       mt_init_time_10(&seed);
+
        globals->get_commands()->addCommand("add-cloud", do_add_3Dcloud);
        globals->get_commands()->addCommand("del-cloud", do_delete_3Dcloud);
        globals->get_commands()->addCommand("move-cloud", do_move_3Dcloud);
@@ -161,7 +166,7 @@ double FGClouds::buildCloud(SGPropertyNode *cloud_def_root, SGPropertyNode *box_
                                z = h * z + pos[2]; // Up/Down. pos[2] is the cloudbase
 
                                //SGVec3f newpos = SGVec3f(x, y, z);
-                               SGNewCloud cld(texture_root, cld_def);
+                               SGNewCloud cld(texture_root, cld_def, &seed);
 
                                //layer->addCloud(newpos, cld.genCloud());
                                layer->addCloud(lon, lat, z, x, y, index++, cld.genCloud());
@@ -370,7 +375,7 @@ bool FGClouds::get_3dClouds() const
 
    SGSky* thesky = globals->get_renderer()->getSky();
    SGCloudField *layer = thesky->get_cloud_layer(l)->get_layer3D();
-   SGNewCloud cld(texture_root, arg);
+   SGNewCloud cld(texture_root, arg, &seed);
    bool success = layer->addCloud(lon, lat, alt, x, y, index, cld.genCloud());
 
    // Adding a 3D cloud immediately makes this layer 3D.
index d3dd88855d66d411a598f2ed6bbd85cd80ab8182..cf3e8a4f9a07e86201ea7a94616fc0948f457673 100644 (file)
@@ -52,10 +52,6 @@ private:
        bool clouds_3d_enabled;
   int index;
   
-  // RNG seed to ensure cloud synchronization across multi-process
-  // deployments
-  mt seed;
-
 public:
        FGClouds();
        ~FGClouds();