From: Stuart Buchanan Date: Wed, 5 Dec 2012 22:12:00 +0000 (+0000) Subject: Generate RNG at start of day, and pass down the stack for cloud generation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b7f739ced4418c00614a770edeb0e7776fefa461;p=flightgear.git Generate RNG at start of day, and pass down the stack for cloud generation. --- diff --git a/src/Environment/fgclouds.cxx b/src/Environment/fgclouds.cxx index c77eb284b..b7df4854c 100644 --- a/src/Environment/fgclouds.cxx +++ b/src/Environment/fgclouds.cxx @@ -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. diff --git a/src/Environment/fgclouds.hxx b/src/Environment/fgclouds.hxx index d3dd88855..cf3e8a4f9 100644 --- a/src/Environment/fgclouds.hxx +++ b/src/Environment/fgclouds.hxx @@ -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();