diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/particle_child.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_noise.h | 20 | ||||
-rw-r--r-- | source/blender/blenlib/intern/noise.c | 60 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_noise.c | 18 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_texture.c | 40 |
5 files changed, 70 insertions, 70 deletions
diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index da5fdc85561..0c4d5876e07 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); - voronoi(noisevec[0], noisevec[1], noisevec[2], da, pa, 1.0f, 0); + BLI_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]); diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h index cb66b0552df..267f1361a89 100644 --- a/source/blender/blenlib/BLI_noise.h +++ b/source/blender/blenlib/BLI_noise.h @@ -39,11 +39,11 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise float BLI_gTurbulence( float noisesize, float x, float y, float z, int oct, int hard, int noisebasis); /* newnoise: musgrave functions */ -float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis); -float mg_MultiFractal( +float BLI_mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis); +float BLI_mg_MultiFractal( float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis); -float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2); -float mg_HeteroTerrain(float x, +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, @@ -51,7 +51,7 @@ float mg_HeteroTerrain(float x, float octaves, float offset, int noisebasis); -float mg_HybridMultiFractal(float x, +float BLI_mg_HybridMultiFractal(float x, float y, float z, float H, @@ -60,7 +60,7 @@ float mg_HybridMultiFractal(float x, float offset, float gain, int noisebasis); -float mg_RidgedMultiFractal(float x, +float BLI_mg_RidgedMultiFractal(float x, float y, float z, float H, @@ -70,10 +70,10 @@ float mg_RidgedMultiFractal(float x, float gain, int noisebasis); /* newnoise: voronoi */ -void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype); -/* newnoise: cellNoise & cellNoiseV (for vector/point/color) */ -float cellNoise(float x, float y, float z); -void cellNoiseV(float x, float y, float z, float r_ca[3]); +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]); #ifdef __cplusplus } diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 1ae1c91a3bd..cbb02cce288 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -942,7 +942,7 @@ static float dist_Minkovsky(float x, float y, float z, float e) /* Not 'pure' Worley, but the results are virtually the same. * Returns distances in da and point coords in pa */ -void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype) +void BLI_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype) { int xx, yy, zz, xi, yi, zi; float xd, yd, zd, d; @@ -1042,35 +1042,35 @@ void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtyp static float voronoi_F1(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return da[0]; } static float voronoi_F2(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return da[1]; } static float voronoi_F3(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return da[2]; } static float voronoi_F4(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return da[3]; } static float voronoi_F1F2(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (da[1] - da[0]); } @@ -1090,35 +1090,35 @@ static float voronoi_Cr(float x, float y, float z) static float voronoi_F1S(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (2.0f * da[0] - 1.0f); } static float voronoi_F2S(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (2.0f * da[1] - 1.0f); } static float voronoi_F3S(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (2.0f * da[2] - 1.0f); } static float voronoi_F4S(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (2.0f * da[3] - 1.0f); } static float voronoi_F1F2S(float x, float y, float z) { float da[4], pa[12]; - voronoi(x, y, z, da, pa, 1, 0); + BLI_voronoi(x, y, z, da, pa, 1, 0); return (2.0f * (da[1] - da[0]) - 1.0f); } @@ -1141,7 +1141,7 @@ static float voronoi_CrS(float x, float y, float z) /*************/ /* returns unsigned cellnoise */ -static float cellNoiseU(float x, float y, float z) +static float BLI_cellNoiseU(float x, float y, float z) { /* avoid precision issues on unit coordinates */ x = (x + 0.000001f) * 1.00001f; @@ -1157,13 +1157,13 @@ static float cellNoiseU(float x, float y, float z) } /* idem, signed */ -float cellNoise(float x, float y, float z) +float BLI_cellNoise(float x, float y, float z) { - return (2.0f * cellNoiseU(x, y, z) - 1.0f); + return (2.0f * BLI_cellNoiseU(x, y, z) - 1.0f); } /* returns a vector/point/color in ca, using point hasharray directly */ -void cellNoiseV(float x, float y, float z, float ca[3]) +void BLI_cellNoiseV(float x, float y, float z, float ca[3]) { /* avoid precision issues on unit coordinates */ x = (x + 0.000001f) * 1.00001f; @@ -1214,7 +1214,7 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise noisefunc = voronoi_Cr; break; case 14: - noisefunc = cellNoiseU; + noisefunc = BLI_cellNoiseU; break; case 0: default: { @@ -1274,7 +1274,7 @@ float BLI_gTurbulence( noisefunc = voronoi_Cr; break; case 14: - noisefunc = cellNoiseU; + noisefunc = BLI_cellNoiseU; break; case 0: default: @@ -1319,7 +1319,7 @@ float BLI_gTurbulence( * ``lacunarity'' is the gap between successive frequencies * ``octaves'' is the number of frequencies in the fBm */ -float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) +float BLI_mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) { float rmd, value = 0.0, pwr = 1.0, pwHL = powf(lacunarity, -H); int i; @@ -1351,7 +1351,7 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves noisefunc = voronoi_CrS; break; case 14: - noisefunc = cellNoise; + noisefunc = BLI_cellNoise; break; case 0: default: { @@ -1391,7 +1391,7 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves /* this one is in fact rather confusing, * there seem to be errors in the original source code (in all three versions of proc.text&mod), * I modified it to something that made sense to me, so it might be wrong... */ -float mg_MultiFractal( +float BLI_mg_MultiFractal( float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis) { float rmd, value = 1.0, pwr = 1.0, pwHL = powf(lacunarity, -H); @@ -1424,7 +1424,7 @@ float mg_MultiFractal( noisefunc = voronoi_CrS; break; case 14: - noisefunc = cellNoise; + noisefunc = BLI_cellNoise; break; case 0: default: { @@ -1459,7 +1459,7 @@ float mg_MultiFractal( * ``octaves'' is the number of frequencies in the fBm * ``offset'' raises the terrain from `sea level' */ -float mg_HeteroTerrain(float x, +float BLI_mg_HeteroTerrain(float x, float y, float z, float H, @@ -1500,7 +1500,7 @@ float mg_HeteroTerrain(float x, noisefunc = voronoi_CrS; break; case 14: - noisefunc = cellNoise; + noisefunc = BLI_cellNoise; break; case 0: default: { @@ -1539,7 +1539,7 @@ float mg_HeteroTerrain(float x, * H: 0.25 * offset: 0.7 */ -float mg_HybridMultiFractal(float x, +float BLI_mg_HybridMultiFractal(float x, float y, float z, float H, @@ -1581,7 +1581,7 @@ float mg_HybridMultiFractal(float x, noisefunc = voronoi_CrS; break; case 14: - noisefunc = cellNoise; + noisefunc = BLI_cellNoise; break; case 0: default: { @@ -1626,7 +1626,7 @@ float mg_HybridMultiFractal(float x, * offset: 1.0 * gain: 2.0 */ -float mg_RidgedMultiFractal(float x, +float BLI_mg_RidgedMultiFractal(float x, float y, float z, float H, @@ -1668,7 +1668,7 @@ float mg_RidgedMultiFractal(float x, noisefunc = voronoi_CrS; break; case 14: - noisefunc = cellNoise; + noisefunc = BLI_cellNoise; break; case 0: default: { @@ -1705,7 +1705,7 @@ float mg_RidgedMultiFractal(float x, /* "Variable Lacunarity Noise" * A distorted variety of Perlin noise. */ -float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2) +float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2) { float rv[3]; float (*noisefunc1)(float, float, float); @@ -1737,7 +1737,7 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba noisefunc1 = voronoi_CrS; break; case 14: - noisefunc1 = cellNoise; + noisefunc1 = BLI_cellNoise; break; case 0: default: { @@ -1772,7 +1772,7 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba noisefunc2 = voronoi_CrS; break; case 14: - noisefunc2 = cellNoise; + noisefunc2 = BLI_cellNoise; break; case 0: default: { diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index 49a3f114ebb..3e78628d473 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -659,7 +659,7 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args, PyObjec return NULL; } - return PyFloat_FromDouble(mg_fBm(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum)); + return PyFloat_FromDouble(BLI_mg_fBm(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum)); } PyDoc_STRVAR( @@ -713,7 +713,7 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P } return PyFloat_FromDouble( - mg_MultiFractal(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum)); + BLI_mg_MultiFractal(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum)); } PyDoc_STRVAR(M_Noise_variable_lacunarity_doc, @@ -781,7 +781,7 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a } return PyFloat_FromDouble( - mg_VLNoise(vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum)); + BLI_mg_VLNoise(vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum)); } PyDoc_STRVAR( @@ -838,7 +838,7 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args, } return PyFloat_FromDouble( - mg_HeteroTerrain(vec[0], vec[1], vec[2], H, lac, oct, ofs, noise_basis_enum)); + BLI_mg_HeteroTerrain(vec[0], vec[1], vec[2], H, lac, oct, ofs, noise_basis_enum)); } PyDoc_STRVAR( @@ -900,7 +900,7 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject * } return PyFloat_FromDouble( - mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum)); + BLI_mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum)); } PyDoc_STRVAR( @@ -962,7 +962,7 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject * } return PyFloat_FromDouble( - mg_RidgedMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum)); + BLI_mg_RidgedMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum)); } PyDoc_STRVAR(M_Noise_voronoi_doc, @@ -1008,7 +1008,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args, PyObjec list = PyList_New(4); - voronoi(vec[0], vec[1], vec[2], da, pa, me, metric_enum); + BLI_voronoi(vec[0], vec[1], vec[2], da, pa, me, metric_enum); for (i = 0; i < 4; i++) { PyObject *v = Vector_CreatePyObject(pa + 3 * i, 3, NULL); @@ -1042,7 +1042,7 @@ static PyObject *M_Noise_cell(PyObject *UNUSED(self), PyObject *args) return NULL; } - return PyFloat_FromDouble(cellNoise(vec[0], vec[1], vec[2])); + return PyFloat_FromDouble(BLI_cellNoise(vec[0], vec[1], vec[2])); } PyDoc_STRVAR(M_Noise_cell_vector_doc, @@ -1067,7 +1067,7 @@ static PyObject *M_Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) return NULL; } - cellNoiseV(vec[0], vec[1], vec[2], r_vec); + BLI_cellNoiseV(vec[0], vec[1], vec[2], r_vec); return Vector_CreatePyObject(r_vec, 3, NULL); } diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 12abc0f9216..6626feddf5b 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -539,10 +539,10 @@ static int mg_mFractalOrfBmTex(const Tex *tex, const float texvec[3], TexResult float (*mgravefunc)(float, float, float, float, float, float, int); if (tex->stype == TEX_MFRACTAL) { - mgravefunc = mg_MultiFractal; + mgravefunc = BLI_mg_MultiFractal; } else { - mgravefunc = mg_fBm; + mgravefunc = BLI_mg_fBm; } texres->tin = tex->ns_outscale * mgravefunc(texvec[0], @@ -594,10 +594,10 @@ static int mg_ridgedOrHybridMFTex(const Tex *tex, const float texvec[3], TexResu float (*mgravefunc)(float, float, float, float, float, float, float, float, int); if (tex->stype == TEX_RIDGEDMF) { - mgravefunc = mg_RidgedMultiFractal; + mgravefunc = BLI_mg_RidgedMultiFractal; } else { - mgravefunc = mg_HybridMultiFractal; + mgravefunc = BLI_mg_HybridMultiFractal; } texres->tin = tex->ns_outscale * mgravefunc(texvec[0], @@ -655,7 +655,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr { int rv = TEX_INT; - texres->tin = tex->ns_outscale * mg_HeteroTerrain(texvec[0], + texres->tin = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0], texvec[1], texvec[2], tex->mg_H, @@ -668,7 +668,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = tex->ns_outscale * mg_HeteroTerrain(texvec[0] + offs, + texres->nor[0] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0] + offs, texvec[1], texvec[2], tex->mg_H, @@ -676,7 +676,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr tex->mg_octaves, tex->mg_offset, tex->noisebasis); - texres->nor[1] = tex->ns_outscale * mg_HeteroTerrain(texvec[0], + texres->nor[1] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0], texvec[1] + offs, texvec[2], tex->mg_H, @@ -684,7 +684,7 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr tex->mg_octaves, tex->mg_offset, tex->noisebasis); - texres->nor[2] = tex->ns_outscale * mg_HeteroTerrain(texvec[0], + texres->nor[2] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0], texvec[1], texvec[2] + offs, tex->mg_H, @@ -706,26 +706,26 @@ static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *tex { int rv = TEX_INT; - texres->tin = mg_VLNoise( + texres->tin = BLI_mg_VLNoise( texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); if (texres->nor != NULL) { float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - texres->nor[0] = mg_VLNoise(texvec[0] + offs, + texres->nor[0] = BLI_mg_VLNoise(texvec[0] + offs, texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); - texres->nor[1] = mg_VLNoise(texvec[0], + texres->nor[1] = BLI_mg_VLNoise(texvec[0], texvec[1] + offs, texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2); - texres->nor[2] = mg_VLNoise(texvec[0], + texres->nor[2] = BLI_mg_VLNoise(texvec[0], texvec[1], texvec[2] + offs, tex->dist_amount, @@ -760,24 +760,24 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres) sc = tex->ns_outscale / sc; } - voronoi(texvec[0], texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + BLI_voronoi(texvec[0], texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); texres->tin = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); if (tex->vn_coltype) { float ca[3]; /* cell color */ - cellNoiseV(pa[0], pa[1], pa[2], ca); + BLI_cellNoiseV(pa[0], pa[1], pa[2], ca); texres->tr = aw1 * ca[0]; texres->tg = aw1 * ca[1]; texres->tb = aw1 * ca[2]; - cellNoiseV(pa[3], pa[4], pa[5], ca); + BLI_cellNoiseV(pa[3], pa[4], pa[5], ca); texres->tr += aw2 * ca[0]; texres->tg += aw2 * ca[1]; texres->tb += aw2 * ca[2]; - cellNoiseV(pa[6], pa[7], pa[8], ca); + BLI_cellNoiseV(pa[6], pa[7], pa[8], ca); texres->tr += aw3 * ca[0]; texres->tg += aw3 * ca[1]; texres->tb += aw3 * ca[2]; - cellNoiseV(pa[9], pa[10], pa[11], ca); + BLI_cellNoiseV(pa[9], pa[10], pa[11], ca); texres->tr += aw4 * ca[0]; texres->tg += aw4 * ca[1]; texres->tb += aw4 * ca[2]; @@ -807,11 +807,11 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres) float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */ /* calculate bumpnormal */ - voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + BLI_voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[0] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); - voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); + BLI_voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[1] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); - voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); + BLI_voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm); texres->nor[2] = sc * fabsf(dot_v4v4(&tex->vn_w1, da)); tex_normal_derivate(tex, texres); |