Remove randomness from SceneCombiner.
This offers two advantages: firstly, boost::random isn't used by Assimp at all with these changes. Secondly, the results of the IRR/LWS loaders are guaranteed to be identical on each run now. That's crucial of course, I just failed to recognize it in the past. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@559 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
78f27eef13
commit
df13041f42
|
@ -41,9 +41,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** @file Implements Assimp::SceneCombiner. This is a smart utility
|
||||
* class that can be used to combine several scenes, meshes, ...
|
||||
* in one. Currently these utilities are used by the IRR and LWS
|
||||
* loaders and by the OptimizeGraph step.
|
||||
* class that combines multiple scenes, meshes, ... into one. Currently
|
||||
* these utilities are used by the IRR and LWS loaders and the
|
||||
* OptimizeGraph step.
|
||||
*/
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "AssimpPCH.h"
|
||||
|
@ -52,26 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "Hash.h"
|
||||
#include "time.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// We need boost::random here. The workaround uses rand() instead of a proper
|
||||
// Mersenne twister, but I think it should still be 'random' enough for our
|
||||
// purposes.
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef ASSIMP_BUILD_BOOST_WORKAROUND
|
||||
|
||||
# include "../include/BoostWorkaround/boost/random/uniform_int.hpp"
|
||||
# include "../include/BoostWorkaround/boost/random/variate_generator.hpp"
|
||||
# include "../include/BoostWorkaround/boost/random/mersenne_twister.hpp"
|
||||
|
||||
#else
|
||||
|
||||
# include <boost/random/uniform_int.hpp>
|
||||
# include <boost/random/variate_generator.hpp>
|
||||
# include <boost/random/mersenne_twister.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -299,11 +279,12 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
|
|||
// Generate unique names for all named stuff?
|
||||
if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES)
|
||||
{
|
||||
#if 0
|
||||
// Construct a proper random number generator
|
||||
boost::mt19937 rng( ::clock() );
|
||||
boost::mt19937 rng( );
|
||||
boost::uniform_int<> dist(1u,1 << 24u);
|
||||
boost::variate_generator<boost::mt19937&, boost::uniform_int<> > rndGen(rng, dist);
|
||||
|
||||
#endif
|
||||
for (unsigned int i = 1; i < src.size();++i)
|
||||
{
|
||||
//if (i != duplicates[i])
|
||||
|
@ -315,8 +296,7 @@ void SceneCombiner::MergeScenes(aiScene** _dest, aiScene* master,
|
|||
// continue;
|
||||
//}
|
||||
|
||||
const unsigned int random = rndGen();
|
||||
src[i].idlen = ::sprintf(src[i].id,"$%.6X$_",random);
|
||||
src[i].idlen = ::sprintf(src[i].id,"$%.6X$_",i);
|
||||
|
||||
if (flags & AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue