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'
This commit is contained in:
parent
155f42a12f
commit
29401f8ca2
|
@ -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:
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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,7 @@ static float orgBlenderNoiseS(float x, float y, float z)
|
|||
}
|
||||
|
||||
/* separated from orgBlenderNoise above, with scaling */
|
||||
float BLI_hnoise(float noisesize, float x, float y, float z)
|
||||
float BLI_noise_hnoise(float noisesize, float x, float y, float z)
|
||||
{
|
||||
if (noisesize == 0.0f) {
|
||||
return 0.0f;
|
||||
|
@ -437,15 +438,15 @@ float BLI_hnoise(float noisesize, float x, float y, float z)
|
|||
}
|
||||
|
||||
/* original turbulence functions */
|
||||
float BLI_turbulence(float noisesize, float x, float y, float z, int nr)
|
||||
float BLI_noise_turbulence(float noisesize, float x, float y, float z, int nr)
|
||||
{
|
||||
float s, d = 0.5, div = 1.0;
|
||||
|
||||
s = BLI_hnoise(noisesize, x, y, z);
|
||||
s = BLI_noise_hnoise(noisesize, x, y, z);
|
||||
|
||||
while (nr > 0) {
|
||||
|
||||
s += d * BLI_hnoise(noisesize * d, x, y, z);
|
||||
s += d * BLI_noise_hnoise(noisesize * d, x, y, z);
|
||||
div += d;
|
||||
d *= 0.5f;
|
||||
|
||||
|
@ -825,14 +826,14 @@ static float noise3_perlin(const float vec[3])
|
|||
#undef SURVE
|
||||
}
|
||||
|
||||
/* for use with BLI_gNoise/gTurbulence, returns signed noise */
|
||||
/* for use with BLI_noise_generic_noise/gTurbulence, returns signed noise */
|
||||
static float orgPerlinNoise(float x, float y, float z)
|
||||
{
|
||||
float v[3] = {x, y, z};
|
||||
return noise3_perlin(v);
|
||||
}
|
||||
|
||||
/* for use with BLI_gNoise/gTurbulence, returns unsigned noise */
|
||||
/* for use with BLI_noise_generic_noise/gTurbulence, returns unsigned noise */
|
||||
static float orgPerlinNoiseU(float x, float y, float z)
|
||||
{
|
||||
float v[3] = {x, y, z};
|
||||
|
@ -841,7 +842,7 @@ static float orgPerlinNoiseU(float x, float y, float z)
|
|||
|
||||
/* *************** CALL AS: *************** */
|
||||
|
||||
float BLI_hnoisep(float noisesize, float x, float y, float z)
|
||||
float BLI_noise_hnoisep(float noisesize, float x, float y, float z)
|
||||
{
|
||||
float vec[3];
|
||||
|
||||
|
@ -915,7 +916,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 BLI_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype)
|
||||
void BLI_noise_voronoi(float x, float y, float z, float *da, float *pa, float me, int dtype)
|
||||
{
|
||||
float (*distfunc)(float, float, float, float);
|
||||
switch (dtype) {
|
||||
|
@ -1008,39 +1009,39 @@ void BLI_voronoi(float x, float y, float z, float *da, float *pa, float me, int
|
|||
}
|
||||
}
|
||||
|
||||
/* returns different feature points for use in BLI_gNoise() */
|
||||
/* returns different feature points for use in BLI_noise_generic_noise() */
|
||||
static float voronoi_F1(float x, float y, float z)
|
||||
{
|
||||
float da[4], pa[12];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_voronoi(x, y, z, da, pa, 1, 0);
|
||||
return (da[1] - da[0]);
|
||||
}
|
||||
|
||||
|
@ -1060,35 +1061,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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_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];
|
||||
BLI_voronoi(x, y, z, da, pa, 1, 0);
|
||||
BLI_noise_voronoi(x, y, z, da, pa, 1, 0);
|
||||
return (2.0f * (da[1] - da[0]) - 1.0f);
|
||||
}
|
||||
|
||||
|
@ -1127,13 +1128,13 @@ static float BLI_cellNoiseU(float x, float y, float z)
|
|||
}
|
||||
|
||||
/* idem, signed */
|
||||
float BLI_cellNoise(float x, float y, float z)
|
||||
float BLI_noise_cell(float x, float y, float z)
|
||||
{
|
||||
return (2.0f * BLI_cellNoiseU(x, y, z) - 1.0f);
|
||||
}
|
||||
|
||||
/* returns a vector/point/color in ca, using point hasharray directly */
|
||||
void BLI_cellNoiseV(float x, float y, float z, float ca[3])
|
||||
void BLI_noise_cell_v3(float x, float y, float z, float ca[3])
|
||||
{
|
||||
/* avoid precision issues on unit coordinates */
|
||||
x = (x + 0.000001f) * 1.00001f;
|
||||
|
@ -1154,7 +1155,7 @@ void BLI_cellNoiseV(float x, float y, float z, float ca[3])
|
|||
/*****************/
|
||||
|
||||
/* newnoise: generic noise function for use with different noisebases */
|
||||
float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noisebasis)
|
||||
float BLI_noise_generic_noise(float noisesize, float x, float y, float z, int hard, int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
|
||||
|
@ -1189,7 +1190,7 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise
|
|||
case 0:
|
||||
default: {
|
||||
noisefunc = orgBlenderNoise;
|
||||
/* add one to make return value same as BLI_hnoise */
|
||||
/* add one to make return value same as BLI_noise_hnoise */
|
||||
x += 1;
|
||||
y += 1;
|
||||
z += 1;
|
||||
|
@ -1211,7 +1212,7 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise
|
|||
}
|
||||
|
||||
/* newnoise: generic turbulence function for use with different noisebasis */
|
||||
float BLI_gTurbulence(
|
||||
float BLI_noise_generic_turbulence(
|
||||
float noisesize, float x, float y, float z, int oct, int hard, int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
|
@ -1286,7 +1287,7 @@ float BLI_gTurbulence(
|
|||
* ``lacunarity'' is the gap between successive frequencies
|
||||
* ``octaves'' is the number of frequencies in the fBm
|
||||
*/
|
||||
float BLI_mg_fBm(
|
||||
float BLI_noise_mg_fbm(
|
||||
float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
|
@ -1316,7 +1317,7 @@ float BLI_mg_fBm(
|
|||
noisefunc = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc = BLI_cellNoise;
|
||||
noisefunc = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1357,7 +1358,7 @@ float BLI_mg_fBm(
|
|||
/* 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 BLI_mg_MultiFractal(
|
||||
float BLI_noise_mg_multi_fractal(
|
||||
float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
|
@ -1387,7 +1388,7 @@ float BLI_mg_MultiFractal(
|
|||
noisefunc = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc = BLI_cellNoise;
|
||||
noisefunc = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1423,14 +1424,14 @@ float BLI_mg_MultiFractal(
|
|||
* ``octaves'' is the number of frequencies in the fBm
|
||||
* ``offset'' raises the terrain from `sea level'
|
||||
*/
|
||||
float BLI_mg_HeteroTerrain(float x,
|
||||
float y,
|
||||
float z,
|
||||
float H,
|
||||
float lacunarity,
|
||||
float octaves,
|
||||
float offset,
|
||||
int noisebasis)
|
||||
float BLI_noise_mg_hetero_terrain(float x,
|
||||
float y,
|
||||
float z,
|
||||
float H,
|
||||
float lacunarity,
|
||||
float octaves,
|
||||
float offset,
|
||||
int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
switch (noisebasis) {
|
||||
|
@ -1459,7 +1460,7 @@ float BLI_mg_HeteroTerrain(float x,
|
|||
noisefunc = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc = BLI_cellNoise;
|
||||
noisefunc = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1500,15 +1501,15 @@ float BLI_mg_HeteroTerrain(float x,
|
|||
* H: 0.25
|
||||
* offset: 0.7
|
||||
*/
|
||||
float BLI_mg_HybridMultiFractal(float x,
|
||||
float y,
|
||||
float z,
|
||||
float H,
|
||||
float lacunarity,
|
||||
float octaves,
|
||||
float offset,
|
||||
float gain,
|
||||
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 (*noisefunc)(float, float, float);
|
||||
switch (noisebasis) {
|
||||
|
@ -1537,7 +1538,7 @@ float BLI_mg_HybridMultiFractal(float x,
|
|||
noisefunc = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc = BLI_cellNoise;
|
||||
noisefunc = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1584,15 +1585,15 @@ float BLI_mg_HybridMultiFractal(float x,
|
|||
* offset: 1.0
|
||||
* gain: 2.0
|
||||
*/
|
||||
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_ridged_multi_fractal(float x,
|
||||
float y,
|
||||
float z,
|
||||
float H,
|
||||
float lacunarity,
|
||||
float octaves,
|
||||
float offset,
|
||||
float gain,
|
||||
int noisebasis)
|
||||
{
|
||||
float (*noisefunc)(float, float, float);
|
||||
switch (noisebasis) {
|
||||
|
@ -1621,7 +1622,7 @@ float BLI_mg_RidgedMultiFractal(float x,
|
|||
noisefunc = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc = BLI_cellNoise;
|
||||
noisefunc = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1657,7 +1658,8 @@ float BLI_mg_RidgedMultiFractal(float x,
|
|||
/* "Variable Lacunarity Noise"
|
||||
* A distorted variety of Perlin noise.
|
||||
*/
|
||||
float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nbas2)
|
||||
float BLI_noise_mg_variable_lacunarity(
|
||||
float x, float y, float z, float distortion, int nbas1, int nbas2)
|
||||
{
|
||||
float (*noisefunc1)(float, float, float);
|
||||
switch (nbas1) {
|
||||
|
@ -1686,7 +1688,7 @@ float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int
|
|||
noisefunc1 = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc1 = BLI_cellNoise;
|
||||
noisefunc1 = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
@ -1722,7 +1724,7 @@ float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int
|
|||
noisefunc2 = voronoi_CrS;
|
||||
break;
|
||||
case 14:
|
||||
noisefunc2 = BLI_cellNoise;
|
||||
noisefunc2 = BLI_noise_cell;
|
||||
break;
|
||||
case 0:
|
||||
default: {
|
||||
|
|
|
@ -338,9 +338,9 @@ static void alter_co(BMVert *v,
|
|||
add_v3_v3v3(co2, v->co, params->fractal_ofs);
|
||||
mul_v3_fl(co2, 10.0f);
|
||||
|
||||
tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 2) - 0.5f);
|
||||
tvec[1] = fac * (BLI_gTurbulence(1.0, co2[1], co2[0], co2[2], 15, 0, 2) - 0.5f);
|
||||
tvec[2] = fac * (BLI_gTurbulence(1.0, co2[1], co2[2], co2[0], 15, 0, 2) - 0.5f);
|
||||
tvec[0] = fac * (BLI_noise_generic_turbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 2) - 0.5f);
|
||||
tvec[1] = fac * (BLI_noise_generic_turbulence(1.0, co2[1], co2[0], co2[2], 15, 0, 2) - 0.5f);
|
||||
tvec[2] = fac * (BLI_noise_generic_turbulence(1.0, co2[1], co2[2], co2[0], 15, 0, 2) - 0.5f);
|
||||
|
||||
/* add displacement */
|
||||
madd_v3_v3fl(co, normal, tvec[0]);
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef enum ePFieldType {
|
|||
PFIELD_LENNARDJ = 9,
|
||||
/** Defines predator / goal for boids. */
|
||||
PFIELD_BOID = 10,
|
||||
/** Force defined by BLI_gTurbulence. */
|
||||
/** Force defined by BLI_noise_generic_turbulence. */
|
||||
PFIELD_TURBULENCE = 11,
|
||||
/** Linear & quadratic drag. */
|
||||
PFIELD_DRAG = 12,
|
||||
|
|
|
@ -246,7 +246,8 @@ static void noise_vector(float x, float y, float z, int nb, float v[3])
|
|||
/* Simply evaluate noise at 3 different positions */
|
||||
const float *ofs = state_offset_vector;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
v[j] = (2.0f * BLI_gNoise(1.0f, x + ofs[0], y + ofs[1], z + ofs[2], 0, nb) - 1.0f);
|
||||
v[j] = (2.0f * BLI_noise_generic_noise(1.0f, x + ofs[0], y + ofs[1], z + ofs[2], 0, nb) -
|
||||
1.0f);
|
||||
ofs += 3;
|
||||
}
|
||||
}
|
||||
|
@ -258,7 +259,7 @@ static float turb(
|
|||
float amp, out, t;
|
||||
int i;
|
||||
amp = 1.f;
|
||||
out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
|
||||
out = (float)(2.0f * BLI_noise_generic_noise(1.f, x, y, z, 0, nb) - 1.0f);
|
||||
if (hard) {
|
||||
out = fabsf(out);
|
||||
}
|
||||
|
@ -267,7 +268,7 @@ static float turb(
|
|||
x *= freqscale;
|
||||
y *= freqscale;
|
||||
z *= freqscale;
|
||||
t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f));
|
||||
t = (float)(amp * (2.0f * BLI_noise_generic_noise(1.f, x, y, z, 0, nb) - 1.0f));
|
||||
if (hard) {
|
||||
t = fabsf(t);
|
||||
}
|
||||
|
@ -450,7 +451,7 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args, PyObject
|
|||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
(2.0f * BLI_gNoise(1.0f, vec[0], vec[1], vec[2], 0, noise_basis_enum) - 1.0f));
|
||||
(2.0f * BLI_noise_generic_noise(1.0f, vec[0], vec[1], vec[2], 0, noise_basis_enum) - 1.0f));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_noise_vector_doc,
|
||||
|
@ -659,7 +660,8 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args, PyObjec
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(BLI_mg_fBm(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum));
|
||||
return PyFloat_FromDouble(
|
||||
BLI_noise_mg_fbm(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
@ -713,7 +715,7 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P
|
|||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
BLI_mg_MultiFractal(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum));
|
||||
BLI_noise_mg_multi_fractal(vec[0], vec[1], vec[2], H, lac, oct, noise_basis_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_variable_lacunarity_doc,
|
||||
|
@ -780,8 +782,8 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
BLI_mg_VLNoise(vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum));
|
||||
return PyFloat_FromDouble(BLI_noise_mg_variable_lacunarity(
|
||||
vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
@ -838,7 +840,7 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args,
|
|||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
BLI_mg_HeteroTerrain(vec[0], vec[1], vec[2], H, lac, oct, ofs, noise_basis_enum));
|
||||
BLI_noise_mg_hetero_terrain(vec[0], vec[1], vec[2], H, lac, oct, ofs, noise_basis_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
@ -899,8 +901,8 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
BLI_mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||
return PyFloat_FromDouble(BLI_noise_mg_hybrid_multi_fractal(
|
||||
vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(
|
||||
|
@ -961,8 +963,8 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(
|
||||
BLI_mg_RidgedMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||
return PyFloat_FromDouble(BLI_noise_mg_ridged_multi_fractal(
|
||||
vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_voronoi_doc,
|
||||
|
@ -1008,7 +1010,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args, PyObjec
|
|||
|
||||
list = PyList_New(4);
|
||||
|
||||
BLI_voronoi(vec[0], vec[1], vec[2], da, pa, me, metric_enum);
|
||||
BLI_noise_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 +1044,7 @@ static PyObject *M_Noise_cell(PyObject *UNUSED(self), PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return PyFloat_FromDouble(BLI_cellNoise(vec[0], vec[1], vec[2]));
|
||||
return PyFloat_FromDouble(BLI_noise_cell(vec[0], vec[1], vec[2]));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(M_Noise_cell_vector_doc,
|
||||
|
@ -1067,7 +1069,7 @@ static PyObject *M_Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BLI_cellNoiseV(vec[0], vec[1], vec[2], r_vec);
|
||||
BLI_noise_cell_v3(vec[0], vec[1], vec[2], r_vec);
|
||||
return Vector_CreatePyObject(r_vec, 3, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -656,13 +656,13 @@ static int pointdensity(PointDensity *pd,
|
|||
}
|
||||
|
||||
if (pd->flag & TEX_PD_TURBULENCE) {
|
||||
turb = BLI_gTurbulence(pd->noise_size,
|
||||
texvec[0] + vec[0],
|
||||
texvec[1] + vec[1],
|
||||
texvec[2] + vec[2],
|
||||
pd->noise_depth,
|
||||
0,
|
||||
pd->noise_basis);
|
||||
turb = BLI_noise_generic_turbulence(pd->noise_size,
|
||||
texvec[0] + vec[0],
|
||||
texvec[1] + vec[1],
|
||||
texvec[2] + vec[2],
|
||||
pd->noise_depth,
|
||||
0,
|
||||
pd->noise_basis);
|
||||
|
||||
turb -= 0.5f; /* re-center 0.0-1.0 range around 0 to prevent offsetting result */
|
||||
|
||||
|
|
|
@ -174,37 +174,37 @@ static int clouds(const Tex *tex, const float texvec[3], TexResult *texres)
|
|||
{
|
||||
int rv = TEX_INT;
|
||||
|
||||
texres->tin = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->tin = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
|
||||
if (texres->nor != NULL) {
|
||||
/* calculate bumpnormal */
|
||||
texres->nor[0] = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[0] + tex->nabla,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->nor[1] = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1] + tex->nabla,
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->nor[2] = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + tex->nabla,
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->nor[0] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[0] + tex->nabla,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->nor[1] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1] + tex->nabla,
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->nor[2] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + tex->nabla,
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
|
||||
tex_normal_derivate(tex, texres);
|
||||
rv |= TEX_NOR;
|
||||
|
@ -214,20 +214,20 @@ static int clouds(const Tex *tex, const float texvec[3], TexResult *texres)
|
|||
/* in this case, int. value should really be computed from color,
|
||||
* and bumpnormal from that, would be too slow, looks ok as is */
|
||||
texres->tr = texres->tin;
|
||||
texres->tg = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[1],
|
||||
texvec[0],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->tb = BLI_gTurbulence(tex->noisesize,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
texvec[0],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->tg = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[1],
|
||||
texvec[0],
|
||||
texvec[2],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
texres->tb = BLI_noise_generic_turbulence(tex->noisesize,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
texvec[0],
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
BRICONTRGB;
|
||||
texres->ta = 1.0;
|
||||
return (rv | TEX_RGB);
|
||||
|
@ -296,12 +296,14 @@ static float wood_int(const Tex *tex, float x, float y, float z)
|
|||
}
|
||||
else if (wt == TEX_BANDNOISE) {
|
||||
wi = tex->turbul *
|
||||
BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype != TEX_NOISESOFT), tex->noisebasis);
|
||||
BLI_noise_generic_noise(
|
||||
tex->noisesize, x, y, z, (tex->noisetype != TEX_NOISESOFT), tex->noisebasis);
|
||||
wi = waveform[wf]((x + y + z) * 10.0f + wi);
|
||||
}
|
||||
else if (wt == TEX_RINGNOISE) {
|
||||
wi = tex->turbul *
|
||||
BLI_gNoise(tex->noisesize, x, y, z, (tex->noisetype != TEX_NOISESOFT), tex->noisebasis);
|
||||
BLI_noise_generic_noise(
|
||||
tex->noisesize, x, y, z, (tex->noisetype != TEX_NOISESOFT), tex->noisebasis);
|
||||
wi = waveform[wf](sqrtf(x * x + y * y + z * z) * 20.0f + wi);
|
||||
}
|
||||
|
||||
|
@ -346,13 +348,13 @@ static float marble_int(const Tex *tex, float x, float y, float z)
|
|||
|
||||
n = 5.0f * (x + y + z);
|
||||
|
||||
mi = n + tex->turbul * BLI_gTurbulence(tex->noisesize,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
mi = n + tex->turbul * BLI_noise_generic_turbulence(tex->noisesize,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
tex->noisedepth,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
|
||||
if (mt >= TEX_SOFT) { /* TEX_SOFT always true */
|
||||
mi = waveform[wf](mi);
|
||||
|
@ -472,36 +474,36 @@ static int stucci(const Tex *tex, const float texvec[3], TexResult *texres)
|
|||
float nor[3], b2, ofs;
|
||||
int retval = TEX_INT;
|
||||
|
||||
b2 = BLI_gNoise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
b2 = BLI_noise_generic_noise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
|
||||
ofs = tex->turbul / 200.0f;
|
||||
|
||||
if (tex->stype) {
|
||||
ofs *= (b2 * b2);
|
||||
}
|
||||
nor[0] = BLI_gNoise(tex->noisesize,
|
||||
texvec[0] + ofs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
nor[1] = BLI_gNoise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1] + ofs,
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
nor[2] = BLI_gNoise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + ofs,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
nor[0] = BLI_noise_generic_noise(tex->noisesize,
|
||||
texvec[0] + ofs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
nor[1] = BLI_noise_generic_noise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1] + ofs,
|
||||
texvec[2],
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
nor[2] = BLI_noise_generic_noise(tex->noisesize,
|
||||
texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + ofs,
|
||||
(tex->noisetype != TEX_NOISESOFT),
|
||||
tex->noisebasis);
|
||||
|
||||
texres->tin = nor[2];
|
||||
|
||||
|
@ -539,10 +541,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 = BLI_mg_MultiFractal;
|
||||
mgravefunc = BLI_noise_mg_multi_fractal;
|
||||
}
|
||||
else {
|
||||
mgravefunc = BLI_mg_fBm;
|
||||
mgravefunc = BLI_noise_mg_fbm;
|
||||
}
|
||||
|
||||
texres->tin = tex->ns_outscale * mgravefunc(texvec[0],
|
||||
|
@ -594,10 +596,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 = BLI_mg_RidgedMultiFractal;
|
||||
mgravefunc = BLI_noise_mg_ridged_multi_fractal;
|
||||
}
|
||||
else {
|
||||
mgravefunc = BLI_mg_HybridMultiFractal;
|
||||
mgravefunc = BLI_noise_mg_hybrid_multi_fractal;
|
||||
}
|
||||
|
||||
texres->tin = tex->ns_outscale * mgravefunc(texvec[0],
|
||||
|
@ -655,43 +657,43 @@ static int mg_HTerrainTex(const Tex *tex, const float texvec[3], TexResult *texr
|
|||
{
|
||||
int rv = TEX_INT;
|
||||
|
||||
texres->tin = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->tin = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
|
||||
if (texres->nor != NULL) {
|
||||
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
||||
|
||||
/* calculate bumpnormal */
|
||||
texres->nor[0] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0] + offs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->nor[1] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
||||
texvec[1] + offs,
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->nor[2] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + offs,
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + offs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->nor[1] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||
texvec[1] + offs,
|
||||
texvec[2],
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
texres->nor[2] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + offs,
|
||||
tex->mg_H,
|
||||
tex->mg_lacunarity,
|
||||
tex->mg_octaves,
|
||||
tex->mg_offset,
|
||||
tex->noisebasis);
|
||||
|
||||
tex_normal_derivate(tex, texres);
|
||||
rv |= TEX_NOR;
|
||||
|
@ -706,31 +708,31 @@ static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *tex
|
|||
{
|
||||
int rv = TEX_INT;
|
||||
|
||||
texres->tin = BLI_mg_VLNoise(
|
||||
texres->tin = BLI_noise_mg_variable_lacunarity(
|
||||
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] = BLI_mg_VLNoise(texvec[0] + offs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
texres->nor[1] = BLI_mg_VLNoise(texvec[0],
|
||||
texvec[1] + offs,
|
||||
texvec[2],
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
texres->nor[2] = BLI_mg_VLNoise(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + offs,
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + offs,
|
||||
texvec[1],
|
||||
texvec[2],
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
texres->nor[1] = BLI_noise_mg_variable_lacunarity(texvec[0],
|
||||
texvec[1] + offs,
|
||||
texvec[2],
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
texres->nor[2] = BLI_noise_mg_variable_lacunarity(texvec[0],
|
||||
texvec[1],
|
||||
texvec[2] + offs,
|
||||
tex->dist_amount,
|
||||
tex->noisebasis,
|
||||
tex->noisebasis2);
|
||||
|
||||
tex_normal_derivate(tex, texres);
|
||||
rv |= TEX_NOR;
|
||||
|
@ -760,24 +762,24 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres)
|
|||
sc = tex->ns_outscale / sc;
|
||||
}
|
||||
|
||||
BLI_voronoi(texvec[0], texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
|
||||
BLI_noise_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 */
|
||||
BLI_cellNoiseV(pa[0], pa[1], pa[2], ca);
|
||||
BLI_noise_cell_v3(pa[0], pa[1], pa[2], ca);
|
||||
texres->tr = aw1 * ca[0];
|
||||
texres->tg = aw1 * ca[1];
|
||||
texres->tb = aw1 * ca[2];
|
||||
BLI_cellNoiseV(pa[3], pa[4], pa[5], ca);
|
||||
BLI_noise_cell_v3(pa[3], pa[4], pa[5], ca);
|
||||
texres->tr += aw2 * ca[0];
|
||||
texres->tg += aw2 * ca[1];
|
||||
texres->tb += aw2 * ca[2];
|
||||
BLI_cellNoiseV(pa[6], pa[7], pa[8], ca);
|
||||
BLI_noise_cell_v3(pa[6], pa[7], pa[8], ca);
|
||||
texres->tr += aw3 * ca[0];
|
||||
texres->tg += aw3 * ca[1];
|
||||
texres->tb += aw3 * ca[2];
|
||||
BLI_cellNoiseV(pa[9], pa[10], pa[11], ca);
|
||||
BLI_noise_cell_v3(pa[9], pa[10], pa[11], ca);
|
||||
texres->tr += aw4 * ca[0];
|
||||
texres->tg += aw4 * ca[1];
|
||||
texres->tb += aw4 * ca[2];
|
||||
|
@ -807,11 +809,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 */
|
||||
BLI_voronoi(texvec[0] + offs, texvec[1], texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
|
||||
BLI_noise_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));
|
||||
BLI_voronoi(texvec[0], texvec[1] + offs, texvec[2], da, pa, tex->vn_mexp, tex->vn_distm);
|
||||
BLI_noise_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));
|
||||
BLI_voronoi(texvec[0], texvec[1], texvec[2] + offs, da, pa, tex->vn_mexp, tex->vn_distm);
|
||||
BLI_noise_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);
|
||||
|
|
Loading…
Reference in New Issue