Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-16 03:12:40 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-16 03:12:40 +0400
commitafb4b65167165613f177a531bd3d4dcb3649c1c6 (patch)
tree32e1446b5fc3ce8ec00fa0e8b9e0fcb2eedda127 /source/blender/modifiers/intern/MOD_weightvg_util.c
parent638b084f824bc345468bc8e02422b5da65a641a7 (diff)
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.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvg_util.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 7181b5bbb44..a5e63a7832f 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -59,7 +59,7 @@
* vertex index (in case the weight tables do not cover the whole vertices...).
* cmap might be NULL, in which case curve mapping mode will return unmodified data.
*/
-void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap)
+void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cmap, RNG *rng)
{
int i;
@@ -100,8 +100,7 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
fac = (float)sqrt(2 * fac - fac * fac);
break;
case MOD_WVG_MAPPING_RANDOM:
- BLI_srand(BLI_rand()); /* random seed */
- fac = BLI_frand() * fac;
+ fac = BLI_rng_get_float(rng) * fac;
break;
case MOD_WVG_MAPPING_STEP:
fac = (fac >= 0.5f) ? 1.0f : 0.0f;