Random number generator: replace a bunch of usage of the global random number

generator with a local one. It's not thread safe and will not give repeatable
results, so in most cases it should not be used.

Also fixes #34992 where the noise texture of a displacement modifier was not
properly random in opengl animation render, because the seed got reset to a
fixed value by an unrelated function while for final render it changed each
frame.
This commit is contained in:
2013-04-15 23:12:40 +00:00
parent 638b084f82
commit afb4b65167
31 changed files with 247 additions and 158 deletions

View File

@@ -313,8 +313,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
{
float ran = 0.0f;
if (pimd->random_position != 0.0f) {
BLI_srandom(psys->seed + p);
ran = pimd->random_position * BLI_frand();
ran = pimd->random_position * BLI_hash_frand(psys->seed + p);
}
if (pimd->flag & eParticleInstanceFlag_KeepShape) {