diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-30 06:03:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-30 08:04:20 +0400 |
commit | faf529d03689c0c472ee5895625cd2902915cfd6 (patch) | |
tree | 04416880217ef8cf4eec0fcd4a1a6b5e699d680d /source/blender/render | |
parent | a6e8137983d74ebff785ee134f635e1a08f58237 (diff) |
BLI_rand: Add BLI_rng_get_float_unit_v3, was static rayshade func
Diffstat (limited to 'source/blender/render')
-rw-r--r-- | source/blender/render/intern/source/rayshade.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index ae5b9ec5999..ed2c7455250 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -1672,18 +1672,6 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int /* aolight: function to create random unit sphere vectors for total random sampling */ -static void RandomSpherical(RNG *rng, float v[3]) -{ - float r; - v[2] = 2.f*BLI_rng_get_float(rng)-1.f; - if ((r = 1.f - v[2]*v[2])>0.f) { - float a = 6.283185307f*BLI_rng_get_float(rng); - r = sqrt(r); - v[0] = r * cosf(a); - v[1] = r * sinf(a); - } - else v[2] = 1.f; -} /* calc distributed spherical energy */ static void DS_energy(float *sphere, int tot, float vec[3]) @@ -1729,7 +1717,7 @@ void init_ao_sphere(World *wrld) /* init */ fp= wrld->aosphere; for (a=0; a<tot; a++, fp+= 3) { - RandomSpherical(rng, fp); + BLI_rng_get_float_unit_v3(rng, fp); } while (iter--) { @@ -1780,7 +1768,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in vec= sphere; for (a=0; a<tot; a++, vec+=3) { - RandomSpherical(rng, vec); + BLI_rng_get_float_unit_v3(rng, vec); } BLI_rng_free(rng); |