[Bf-blender-cvs] [29401f8ca2c] master: Cleanup: BLI_noise
Campbell Barton
noreply at git.blender.org
Fri Nov 6 02:41:46 CET 2020
Commit: 29401f8ca2c813e50093d2f5503c9bb8868bdde5
Author: Campbell Barton
Date: Fri Nov 6 10:59:32 2020 +1100
Branches: master
https://developer.blender.org/rB29401f8ca2c813e50093d2f5503c9bb8868bdde5
Cleanup: BLI_noise
Use common prefix as this collided with existing API's (eg BLI_voronoi).
Also expand some non-obvious abbreviations:
- 'g' -> 'generic'
- 'vl' -> 'variable_lacunarity'
- 'V' -> 'v3'
===================================================================
M source/blender/blenkernel/intern/effect.c
M source/blender/blenkernel/intern/fmodifier.c
M source/blender/blenkernel/intern/particle_child.c
M source/blender/blenlib/BLI_noise.h
M source/blender/blenlib/intern/noise.c
M source/blender/bmesh/operators/bmo_subdivide.c
M source/blender/makesdna/DNA_object_force_types.h
M source/blender/python/mathutils/mathutils_noise.c
M source/blender/render/intern/source/pointdensity.c
M source/blender/render/intern/source/render_texture.c
===================================================================
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 967b961dbea..f51683ea351 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -1009,9 +1009,12 @@ static void do_physical_effector(EffectorCache *eff,
else {
add_v3_v3v3(temp, efd->vec_to_point2, efd->nor2);
}
- force[0] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[0], temp[1], temp[2], 2, 0, 2);
- force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2, 0, 2);
- force[2] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[2], temp[0], temp[1], 2, 0, 2);
+ force[0] = -1.0f + 2.0f * BLI_noise_generic_turbulence(
+ pd->f_size, temp[0], temp[1], temp[2], 2, 0, 2);
+ force[1] = -1.0f + 2.0f * BLI_noise_generic_turbulence(
+ pd->f_size, temp[1], temp[2], temp[0], 2, 0, 2);
+ force[2] = -1.0f + 2.0f * BLI_noise_generic_turbulence(
+ pd->f_size, temp[2], temp[0], temp[1], 2, 0, 2);
mul_v3_fl(force, strength * efd->falloff);
break;
case PFIELD_DRAG:
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index d13425f5ec9..6ebcef5caef 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -824,7 +824,8 @@ static void fcm_noise_evaluate(
* - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1
* with evaltime being an integer (which happens when evaluating on frame by frame basis)
*/
- noise = BLI_turbulence(data->size, evaltime - data->offset, data->phase, 0.1f, data->depth);
+ noise = BLI_noise_turbulence(
+ data->size, evaltime - data->offset, data->phase, 0.1f, data->depth);
/* combine the noise with existing motion data */
switch (data->modification) {
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c
index 0c4d5876e07..31332cd6d98 100644
--- a/source/blender/blenkernel/intern/particle_child.c
+++ b/source/blender/blenkernel/intern/particle_child.c
@@ -642,7 +642,7 @@ float do_clump(ParticleKey *state,
float da[4], pa[12];
mul_v3_v3fl(noisevec, orco_offset, 1.0f / clump_noise_size);
- BLI_voronoi(noisevec[0], noisevec[1], noisevec[2], da, pa, 1.0f, 0);
+ BLI_noise_voronoi(noisevec[0], noisevec[1], noisevec[2], da, pa, 1.0f, 0);
mul_v3_fl(&pa[0], clump_noise_size);
add_v3_v3v3(center, par_co, &pa[0]);
@@ -674,9 +674,9 @@ static void do_rough(const float loc[3],
copy_v3_v3(rco, loc);
mul_v3_fl(rco, t);
- rough[0] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[0], rco[1], rco[2], 2, 0, 2);
- rough[1] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[1], rco[2], rco[0], 2, 0, 2);
- rough[2] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[2], rco[0], rco[1], 2, 0, 2);
+ rough[0] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[0], rco[1], rco[2], 2, 0, 2);
+ rough[1] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[1], rco[2], rco[0], 2, 0, 2);
+ rough[2] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[2], rco[0], rco[1], 2, 0, 2);
madd_v3_v3fl(state->co, mat[0], fac * rough[0]);
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
@@ -718,9 +718,9 @@ static void do_rough_curve(const float loc[3],
copy_v3_v3(rco, loc);
mul_v3_fl(rco, time);
- rough[0] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[0], rco[1], rco[2], 2, 0, 2);
- rough[1] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[1], rco[2], rco[0], 2, 0, 2);
- rough[2] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[2], rco[0], rco[1], 2, 0, 2);
+ rough[0] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[0], rco[1], rco[2], 2, 0, 2);
+ rough[1] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[1], rco[2], rco[0], 2, 0, 2);
+ rough[2] = -1.0f + 2.0f * BLI_noise_generic_turbulence(size, rco[2], rco[0], rco[1], 2, 0, 2);
madd_v3_v3fl(state->co, mat[0], fac * rough[0]);
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index 8cb30ef62c8..4a41ee68ca9 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -28,52 +28,54 @@ extern "C" {
#endif
/* noise.h: */
-float BLI_hnoise(float noisesize, float x, float y, float z);
-float BLI_hnoisep(float noisesize, float x, float y, float z);
-float BLI_turbulence(float noisesize, float x, float y, float z, int nr);
+float BLI_noise_hnoise(float noisesize, float x, float y, float z);
+float BLI_noise_hnoisep(float noisesize, float x, float y, float z);
+float BLI_noise_turbulence(float noisesize, float x, float y, float z, int nr);
/* newnoise: generic noise & turbulence functions
- * to replace the above BLI_hnoise/p & BLI_turbulence/1.
+ * to replace the above BLI_noise_hnoise/p & BLI_noise_turbulence/1.
* This is done so different noise basis functions can be used */
-float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noisebasis);
-float BLI_gTurbulence(
+float BLI_noise_generic_noise(
+ float noisesize, float x, float y, float z, int hard, int noisebasis);
+float BLI_noise_generic_turbulence(
float noisesize, float x, float y, float z, int oct, int hard, int noisebasis);
/* newnoise: musgrave functions */
-float BLI_mg_fBm(
+float BLI_noise_mg_fbm(
float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis);
-float BLI_mg_MultiFractal(
+float BLI_noise_mg_multi_fractal(
float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis);
-float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2);
-float BLI_mg_HeteroTerrain(float x,
- float y,
- float z,
- float H,
- float lacunarity,
- float octaves,
- float offset,
- int noisebasis);
-float BLI_mg_HybridMultiFractal(float x,
- float y,
- float z,
- float H,
- float lacunarity,
- float octaves,
- float offset,
- float gain,
- int noisebasis);
-float BLI_mg_RidgedMultiFractal(float x,
- float y,
- float z,
- float H,
- float lacunarity,
- float octaves,
- float offset,
- float gain,
- int noisebasis);
+float BLI_noise_mg_variable_lacunarity(
+ float x, float y, float z, float distortion, int nbas1, int nbas2);
+float BLI_noise_mg_hetero_terrain(float x,
+ float y,
+ float z,
+ float H,
+ float lacunarity,
+ float octaves,
+ float offset,
+ int noisebasis);
+float BLI_noise_mg_hybrid_multi_fractal(float x,
+ float y,
+ float z,
+ float H,
+ float lacunarity,
+ float octaves,
+ float offset,
+ float gain,
+ int noisebasis);
+float BLI_noise_mg_ridged_multi_fractal(float x,
+ float y,
+ float z,
+ float H,
+ float lacunarity,
+ float octaves,
+ float offset,
+ float gain,
+ int noisebasis);
/* newnoise: voronoi */
-void BLI_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype);
-/* newnoise: BLI_cellNoise & BLI_cellNoiseV (for vector/point/color) */
-float BLI_cellNoise(float x, float y, float z);
-void BLI_cellNoiseV(float x, float y, float z, float r_ca[3]);
+void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype);
+/* newnoise: BLI_noise_cell & BLI_noise_cell_v3 (for vector/point/color) */
+float BLI_noise_cell(float x, float y, float z);
+void BLI_noise_cell_v3(float x, float y, float z, float r_ca[3]);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index 889e336bb52..b47de145e2a 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -319,7 +319,8 @@ static float newPerlin(float x, float y, float z)
lerp(u, grad(hash[AB + 1], x, y - 1, z - 1), grad(hash[BB + 1], x - 1, y - 1, z - 1))));
}
-/* for use with BLI_gNoise()/BLI_gTurbulence(), returns unsigned improved perlin noise */
+/* for use with BLI_noise_generic_noise()/BLI_noise_generic_turbulence(), returns unsigned improved
+ * perlin noise */
static float newPerlinU(float x, float y, float z)
{
return (0.5f + 0.5f * newPerlin(x, y, z));
@@ -329,7 +330,7 @@ static float newPerlinU(float x, float y, float z)
/* END OF IMPROVED PERLIN */
/**************************/
-/* Was BLI_hnoise(), removed noisesize, so other functions can call it without scaling. */
+/* Was BLI_noise_hnoise(), removed noisesize, so other functions can call it without scaling. */
static float orgBlenderNoise(float x, float y, float z)
{
float cn1, cn2, cn3, cn4, cn5, cn6, i;
@@ -425,7 +426
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list