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:
authorCampbell Barton <ideasman42@gmail.com>2012-10-23 17:50:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-23 17:50:44 +0400
commit101660c809f0e0c6068cb7271caa122524ba38e6 (patch)
tree24dd8e3988427e07272785bf7c9003c743cb442e /source/blender/blenkernel/intern
parentda9f9c27bc35f032f283cefc51e9055e761212b9 (diff)
code cleanup: give rng functions BLI prefix.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/effect.c10
-rw-r--r--source/blender/blenkernel/intern/particle.c2
-rw-r--r--source/blender/blenkernel/intern/particle_system.c36
3 files changed, 24 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 88490dbb960..1f6db19ac27 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -166,7 +166,7 @@ void free_partdeflect(PartDeflect *pd)
pd->tex->id.us--;
if (pd->rng)
- rng_free(pd->rng);
+ BLI_rng_free(pd->rng);
MEM_freeN(pd);
}
@@ -175,9 +175,9 @@ static void precalculate_effector(EffectorCache *eff)
{
unsigned int cfra = (unsigned int)(eff->scene->r.cfra >= 0 ? eff->scene->r.cfra : -eff->scene->r.cfra);
if (!eff->pd->rng)
- eff->pd->rng = rng_new(eff->pd->seed + cfra);
+ eff->pd->rng = BLI_rng_new(eff->pd->seed + cfra);
else
- rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
+ BLI_rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
Curve *cu= eff->ob->data;
@@ -455,8 +455,8 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
// noise function for wind e.g.
static float wind_func(struct RNG *rng, float strength)
{
- int random = (rng_getInt(rng)+1) % 128; // max 2357
- float force = rng_getFloat(rng) + 1.0f;
+ int random = (BLI_rng_get_int(rng)+1) % 128; // max 2357
+ float force = BLI_rng_get_float(rng) + 1.0f;
float ret;
float sign = 0;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 8bf11723fd5..50927d705e2 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2464,7 +2464,7 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
totthread = 1;
for (i = 0; i < totthread; i++) {
- threads[i].rng_path = rng_new(seed);
+ threads[i].rng_path = BLI_rng_new(seed);
threads[i].tot = totthread;
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index d3f416b34ae..3354ea7ddce 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -632,10 +632,10 @@ static void hammersley_create(float *out, int n, int seed, float amount)
double p, t, offs[2];
int k, kk;
- rng = rng_new(31415926 + n + seed);
- offs[0] = rng_getDouble(rng) + (double)amount;
- offs[1] = rng_getDouble(rng) + (double)amount;
- rng_free(rng);
+ rng = BLI_rng_new(31415926 + n + seed);
+ offs[0] = BLI_rng_get_double(rng) + (double)amount;
+ offs[1] = BLI_rng_get_double(rng) + (double)amount;
+ BLI_rng_free(rng);
for (k = 0; k < n; k++) {
t = 0;
@@ -661,13 +661,13 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
rad2= (float)(1.0f/((float)num));
rad3= (float)sqrt((float)num)/((float)num);
- rng = rng_new(31415926 + num + seed2);
+ rng = BLI_rng_new(31415926 + num + seed2);
x= 0;
num2 = 2 * num;
for (i=0; i<num2; i+=2) {
- jit[i] = x + amount*rad1*(0.5f - rng_getFloat(rng));
- jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - rng_getFloat(rng));
+ jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng));
+ jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - BLI_rng_get_float(rng));
jit[i]-= (float)floor(jit[i]);
jit[i+1]-= (float)floor(jit[i+1]);
@@ -684,7 +684,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
BLI_jitterate2(jit, jit2, num, rad2);
}
MEM_freeN(jit2);
- rng_free(rng);
+ BLI_rng_free(rng);
}
static void psys_uv_to_w(float u, float v, int quad, float *w)
@@ -804,8 +804,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
break;
case PART_DISTR_RAND:
- randu= rng_getFloat(thread->rng);
- randv= rng_getFloat(thread->rng);
+ randu= BLI_rng_get_float(thread->rng);
+ randv= BLI_rng_get_float(thread->rng);
rng_skip_tot -= 2;
psys_uv_to_w(randu, randv, mface->v4, pa->fuv);
@@ -881,8 +881,8 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE);
- randu= rng_getFloat(thread->rng);
- randv= rng_getFloat(thread->rng);
+ randu= BLI_rng_get_float(thread->rng);
+ randv= BLI_rng_get_float(thread->rng);
rng_skip_tot -= 2;
psys_uv_to_w(randu, randv, mf->v4, cpa->fuv);
@@ -934,7 +934,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
}
if (rng_skip_tot > 0) /* should never be below zero */
- rng_skip(thread->rng, rng_skip_tot);
+ BLI_rng_skip(thread->rng, rng_skip_tot);
}
static void *distribute_threads_exec_cb(void *data)
@@ -951,12 +951,12 @@ static void *distribute_threads_exec_cb(void *data)
for (p=0; p<totpart; p++, cpa++) {
if (thread->ctx->skip) /* simplification skip */
- rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]);
+ BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP * thread->ctx->skip[p]);
if ((p+thread->num) % thread->tot == 0)
distribute_threads_exec(thread, NULL, cpa, p);
else /* thread skip */
- rng_skip(thread->rng, PSYS_RND_DIST_SKIP);
+ BLI_rng_skip(thread->rng, PSYS_RND_DIST_SKIP);
}
}
else {
@@ -1353,7 +1353,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
seed= 31415926 + ctx->sim.psys->seed;
for (i=0; i<totthread; i++) {
- threads[i].rng= rng_new(seed);
+ threads[i].rng= BLI_rng_new(seed);
threads[i].tot= totthread;
}
@@ -1492,9 +1492,9 @@ void psys_threads_free(ParticleThread *threads)
/* threads */
for (i=0; i<totthread; i++) {
if (threads[i].rng)
- rng_free(threads[i].rng);
+ BLI_rng_free(threads[i].rng);
if (threads[i].rng_path)
- rng_free(threads[i].rng_path);
+ BLI_rng_free(threads[i].rng_path);
}
MEM_freeN(ctx);