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:
@@ -1009,9 +1009,12 @@ static void do_physical_effector(EffectorCache *eff,
|
|||||||
else {
|
else {
|
||||||
add_v3_v3v3(temp, efd->vec_to_point2, efd->nor2);
|
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[0] = -1.0f + 2.0f * BLI_noise_generic_turbulence(
|
||||||
force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2, 0, 2);
|
pd->f_size, temp[0], temp[1], temp[2], 2, 0, 2);
|
||||||
force[2] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[2], temp[0], temp[1], 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);
|
mul_v3_fl(force, strength * efd->falloff);
|
||||||
break;
|
break;
|
||||||
case PFIELD_DRAG:
|
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
|
* - 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)
|
* 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 */
|
/* combine the noise with existing motion data */
|
||||||
switch (data->modification) {
|
switch (data->modification) {
|
||||||
|
|||||||
@@ -642,7 +642,7 @@ float do_clump(ParticleKey *state,
|
|||||||
float da[4], pa[12];
|
float da[4], pa[12];
|
||||||
|
|
||||||
mul_v3_v3fl(noisevec, orco_offset, 1.0f / clump_noise_size);
|
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);
|
mul_v3_fl(&pa[0], clump_noise_size);
|
||||||
add_v3_v3v3(center, par_co, &pa[0]);
|
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);
|
copy_v3_v3(rco, loc);
|
||||||
mul_v3_fl(rco, t);
|
mul_v3_fl(rco, t);
|
||||||
rough[0] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[0], rco[1], rco[2], 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_gTurbulence(size, rco[1], rco[2], rco[0], 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_gTurbulence(size, rco[2], rco[0], rco[1], 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[0], fac * rough[0]);
|
||||||
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
|
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);
|
copy_v3_v3(rco, loc);
|
||||||
mul_v3_fl(rco, time);
|
mul_v3_fl(rco, time);
|
||||||
rough[0] = -1.0f + 2.0f * BLI_gTurbulence(size, rco[0], rco[1], rco[2], 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_gTurbulence(size, rco[1], rco[2], rco[0], 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_gTurbulence(size, rco[2], rco[0], rco[1], 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[0], fac * rough[0]);
|
||||||
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
|
madd_v3_v3fl(state->co, mat[1], fac * rough[1]);
|
||||||
|
|||||||
@@ -28,52 +28,54 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* noise.h: */
|
/* noise.h: */
|
||||||
float BLI_hnoise(float noisesize, float x, float y, float z);
|
float BLI_noise_hnoise(float noisesize, float x, float y, float z);
|
||||||
float BLI_hnoisep(float noisesize, float x, float y, float z);
|
float BLI_noise_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_turbulence(float noisesize, float x, float y, float z, int nr);
|
||||||
/* newnoise: generic noise & turbulence functions
|
/* 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 */
|
* 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_noise_generic_noise(
|
||||||
float BLI_gTurbulence(
|
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);
|
float noisesize, float x, float y, float z, int oct, int hard, int noisebasis);
|
||||||
/* newnoise: musgrave functions */
|
/* 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 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 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_noise_mg_variable_lacunarity(
|
||||||
float BLI_mg_HeteroTerrain(float x,
|
float x, float y, float z, float distortion, int nbas1, int nbas2);
|
||||||
float y,
|
float BLI_noise_mg_hetero_terrain(float x,
|
||||||
float z,
|
float y,
|
||||||
float H,
|
float z,
|
||||||
float lacunarity,
|
float H,
|
||||||
float octaves,
|
float lacunarity,
|
||||||
float offset,
|
float octaves,
|
||||||
int noisebasis);
|
float offset,
|
||||||
float BLI_mg_HybridMultiFractal(float x,
|
int noisebasis);
|
||||||
float y,
|
float BLI_noise_mg_hybrid_multi_fractal(float x,
|
||||||
float z,
|
float y,
|
||||||
float H,
|
float z,
|
||||||
float lacunarity,
|
float H,
|
||||||
float octaves,
|
float lacunarity,
|
||||||
float offset,
|
float octaves,
|
||||||
float gain,
|
float offset,
|
||||||
int noisebasis);
|
float gain,
|
||||||
float BLI_mg_RidgedMultiFractal(float x,
|
int noisebasis);
|
||||||
float y,
|
float BLI_noise_mg_ridged_multi_fractal(float x,
|
||||||
float z,
|
float y,
|
||||||
float H,
|
float z,
|
||||||
float lacunarity,
|
float H,
|
||||||
float octaves,
|
float lacunarity,
|
||||||
float offset,
|
float octaves,
|
||||||
float gain,
|
float offset,
|
||||||
int noisebasis);
|
float gain,
|
||||||
|
int noisebasis);
|
||||||
/* newnoise: voronoi */
|
/* newnoise: voronoi */
|
||||||
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);
|
||||||
/* newnoise: BLI_cellNoise & BLI_cellNoiseV (for vector/point/color) */
|
/* newnoise: BLI_noise_cell & BLI_noise_cell_v3 (for vector/point/color) */
|
||||||
float BLI_cellNoise(float x, float y, float z);
|
float BLI_noise_cell(float x, float y, float z);
|
||||||
void BLI_cellNoiseV(float x, float y, float z, float r_ca[3]);
|
void BLI_noise_cell_v3(float x, float y, float z, float r_ca[3]);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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))));
|
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)
|
static float newPerlinU(float x, float y, float z)
|
||||||
{
|
{
|
||||||
return (0.5f + 0.5f * newPerlin(x, y, 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 */
|
/* 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)
|
static float orgBlenderNoise(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float cn1, cn2, cn3, cn4, cn5, cn6, i;
|
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 */
|
/* 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) {
|
if (noisesize == 0.0f) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
@@ -437,15 +438,15 @@ float BLI_hnoise(float noisesize, float x, float y, float z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* original turbulence functions */
|
/* 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;
|
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) {
|
while (nr > 0) {
|
||||||
|
|
||||||
s += d * BLI_hnoise(noisesize * d, x, y, z);
|
s += d * BLI_noise_hnoise(noisesize * d, x, y, z);
|
||||||
div += d;
|
div += d;
|
||||||
d *= 0.5f;
|
d *= 0.5f;
|
||||||
|
|
||||||
@@ -825,14 +826,14 @@ static float noise3_perlin(const float vec[3])
|
|||||||
#undef SURVE
|
#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)
|
static float orgPerlinNoise(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float v[3] = {x, y, z};
|
float v[3] = {x, y, z};
|
||||||
return noise3_perlin(v);
|
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)
|
static float orgPerlinNoiseU(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float v[3] = {x, y, z};
|
float v[3] = {x, y, z};
|
||||||
@@ -841,7 +842,7 @@ static float orgPerlinNoiseU(float x, float y, float z)
|
|||||||
|
|
||||||
/* *************** CALL AS: *************** */
|
/* *************** 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];
|
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.
|
/* Not 'pure' Worley, but the results are virtually the same.
|
||||||
* Returns distances in da and point coords in pa */
|
* 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);
|
float (*distfunc)(float, float, float, float);
|
||||||
switch (dtype) {
|
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)
|
static float voronoi_F1(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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];
|
return da[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F2(float x, float y, float z)
|
static float voronoi_F2(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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];
|
return da[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F3(float x, float y, float z)
|
static float voronoi_F3(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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];
|
return da[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F4(float x, float y, float z)
|
static float voronoi_F4(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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];
|
return da[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F1F2(float x, float y, float z)
|
static float voronoi_F1F2(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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]);
|
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)
|
static float voronoi_F1S(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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);
|
return (2.0f * da[0] - 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F2S(float x, float y, float z)
|
static float voronoi_F2S(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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);
|
return (2.0f * da[1] - 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F3S(float x, float y, float z)
|
static float voronoi_F3S(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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);
|
return (2.0f * da[2] - 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F4S(float x, float y, float z)
|
static float voronoi_F4S(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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);
|
return (2.0f * da[3] - 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float voronoi_F1F2S(float x, float y, float z)
|
static float voronoi_F1F2S(float x, float y, float z)
|
||||||
{
|
{
|
||||||
float da[4], pa[12];
|
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);
|
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 */
|
/* 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);
|
return (2.0f * BLI_cellNoiseU(x, y, z) - 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns a vector/point/color in ca, using point hasharray directly */
|
/* 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 */
|
/* avoid precision issues on unit coordinates */
|
||||||
x = (x + 0.000001f) * 1.00001f;
|
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 */
|
/* 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);
|
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:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
noisefunc = orgBlenderNoise;
|
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;
|
x += 1;
|
||||||
y += 1;
|
y += 1;
|
||||||
z += 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 */
|
/* 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 noisesize, float x, float y, float z, int oct, int hard, int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
@@ -1286,7 +1287,7 @@ float BLI_gTurbulence(
|
|||||||
* ``lacunarity'' is the gap between successive frequencies
|
* ``lacunarity'' is the gap between successive frequencies
|
||||||
* ``octaves'' is the number of frequencies in the fBm
|
* ``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 x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
@@ -1316,7 +1317,7 @@ float BLI_mg_fBm(
|
|||||||
noisefunc = voronoi_CrS;
|
noisefunc = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc = BLI_cellNoise;
|
noisefunc = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1357,7 +1358,7 @@ float BLI_mg_fBm(
|
|||||||
/* this one is in fact rather confusing,
|
/* 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),
|
* 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... */
|
* 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 x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
@@ -1387,7 +1388,7 @@ float BLI_mg_MultiFractal(
|
|||||||
noisefunc = voronoi_CrS;
|
noisefunc = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc = BLI_cellNoise;
|
noisefunc = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1423,14 +1424,14 @@ float BLI_mg_MultiFractal(
|
|||||||
* ``octaves'' is the number of frequencies in the fBm
|
* ``octaves'' is the number of frequencies in the fBm
|
||||||
* ``offset'' raises the terrain from `sea level'
|
* ``offset'' raises the terrain from `sea level'
|
||||||
*/
|
*/
|
||||||
float BLI_mg_HeteroTerrain(float x,
|
float BLI_noise_mg_hetero_terrain(float x,
|
||||||
float y,
|
float y,
|
||||||
float z,
|
float z,
|
||||||
float H,
|
float H,
|
||||||
float lacunarity,
|
float lacunarity,
|
||||||
float octaves,
|
float octaves,
|
||||||
float offset,
|
float offset,
|
||||||
int noisebasis)
|
int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
switch (noisebasis) {
|
switch (noisebasis) {
|
||||||
@@ -1459,7 +1460,7 @@ float BLI_mg_HeteroTerrain(float x,
|
|||||||
noisefunc = voronoi_CrS;
|
noisefunc = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc = BLI_cellNoise;
|
noisefunc = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1500,15 +1501,15 @@ float BLI_mg_HeteroTerrain(float x,
|
|||||||
* H: 0.25
|
* H: 0.25
|
||||||
* offset: 0.7
|
* offset: 0.7
|
||||||
*/
|
*/
|
||||||
float BLI_mg_HybridMultiFractal(float x,
|
float BLI_noise_mg_hybrid_multi_fractal(float x,
|
||||||
float y,
|
float y,
|
||||||
float z,
|
float z,
|
||||||
float H,
|
float H,
|
||||||
float lacunarity,
|
float lacunarity,
|
||||||
float octaves,
|
float octaves,
|
||||||
float offset,
|
float offset,
|
||||||
float gain,
|
float gain,
|
||||||
int noisebasis)
|
int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
switch (noisebasis) {
|
switch (noisebasis) {
|
||||||
@@ -1537,7 +1538,7 @@ float BLI_mg_HybridMultiFractal(float x,
|
|||||||
noisefunc = voronoi_CrS;
|
noisefunc = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc = BLI_cellNoise;
|
noisefunc = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1584,15 +1585,15 @@ float BLI_mg_HybridMultiFractal(float x,
|
|||||||
* offset: 1.0
|
* offset: 1.0
|
||||||
* gain: 2.0
|
* gain: 2.0
|
||||||
*/
|
*/
|
||||||
float BLI_mg_RidgedMultiFractal(float x,
|
float BLI_noise_mg_ridged_multi_fractal(float x,
|
||||||
float y,
|
float y,
|
||||||
float z,
|
float z,
|
||||||
float H,
|
float H,
|
||||||
float lacunarity,
|
float lacunarity,
|
||||||
float octaves,
|
float octaves,
|
||||||
float offset,
|
float offset,
|
||||||
float gain,
|
float gain,
|
||||||
int noisebasis)
|
int noisebasis)
|
||||||
{
|
{
|
||||||
float (*noisefunc)(float, float, float);
|
float (*noisefunc)(float, float, float);
|
||||||
switch (noisebasis) {
|
switch (noisebasis) {
|
||||||
@@ -1621,7 +1622,7 @@ float BLI_mg_RidgedMultiFractal(float x,
|
|||||||
noisefunc = voronoi_CrS;
|
noisefunc = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc = BLI_cellNoise;
|
noisefunc = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1657,7 +1658,8 @@ float BLI_mg_RidgedMultiFractal(float x,
|
|||||||
/* "Variable Lacunarity Noise"
|
/* "Variable Lacunarity Noise"
|
||||||
* A distorted variety of Perlin 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);
|
float (*noisefunc1)(float, float, float);
|
||||||
switch (nbas1) {
|
switch (nbas1) {
|
||||||
@@ -1686,7 +1688,7 @@ float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int
|
|||||||
noisefunc1 = voronoi_CrS;
|
noisefunc1 = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc1 = BLI_cellNoise;
|
noisefunc1 = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
@@ -1722,7 +1724,7 @@ float BLI_mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int
|
|||||||
noisefunc2 = voronoi_CrS;
|
noisefunc2 = voronoi_CrS;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
noisefunc2 = BLI_cellNoise;
|
noisefunc2 = BLI_noise_cell;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
@@ -338,9 +338,9 @@ static void alter_co(BMVert *v,
|
|||||||
add_v3_v3v3(co2, v->co, params->fractal_ofs);
|
add_v3_v3v3(co2, v->co, params->fractal_ofs);
|
||||||
mul_v3_fl(co2, 10.0f);
|
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[0] = fac * (BLI_noise_generic_turbulence(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[1] = fac * (BLI_noise_generic_turbulence(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[2] = fac * (BLI_noise_generic_turbulence(1.0, co2[1], co2[2], co2[0], 15, 0, 2) - 0.5f);
|
||||||
|
|
||||||
/* add displacement */
|
/* add displacement */
|
||||||
madd_v3_v3fl(co, normal, tvec[0]);
|
madd_v3_v3fl(co, normal, tvec[0]);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ typedef enum ePFieldType {
|
|||||||
PFIELD_LENNARDJ = 9,
|
PFIELD_LENNARDJ = 9,
|
||||||
/** Defines predator / goal for boids. */
|
/** Defines predator / goal for boids. */
|
||||||
PFIELD_BOID = 10,
|
PFIELD_BOID = 10,
|
||||||
/** Force defined by BLI_gTurbulence. */
|
/** Force defined by BLI_noise_generic_turbulence. */
|
||||||
PFIELD_TURBULENCE = 11,
|
PFIELD_TURBULENCE = 11,
|
||||||
/** Linear & quadratic drag. */
|
/** Linear & quadratic drag. */
|
||||||
PFIELD_DRAG = 12,
|
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 */
|
/* Simply evaluate noise at 3 different positions */
|
||||||
const float *ofs = state_offset_vector;
|
const float *ofs = state_offset_vector;
|
||||||
for (int j = 0; j < 3; j++) {
|
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;
|
ofs += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +259,7 @@ static float turb(
|
|||||||
float amp, out, t;
|
float amp, out, t;
|
||||||
int i;
|
int i;
|
||||||
amp = 1.f;
|
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) {
|
if (hard) {
|
||||||
out = fabsf(out);
|
out = fabsf(out);
|
||||||
}
|
}
|
||||||
@@ -267,7 +268,7 @@ static float turb(
|
|||||||
x *= freqscale;
|
x *= freqscale;
|
||||||
y *= freqscale;
|
y *= freqscale;
|
||||||
z *= 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) {
|
if (hard) {
|
||||||
t = fabsf(t);
|
t = fabsf(t);
|
||||||
}
|
}
|
||||||
@@ -450,7 +451,7 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args, PyObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
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,
|
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 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(
|
PyDoc_STRVAR(
|
||||||
@@ -713,7 +715,7 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
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,
|
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 NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
return PyFloat_FromDouble(BLI_noise_mg_variable_lacunarity(
|
||||||
BLI_mg_VLNoise(vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum));
|
vec[0], vec[1], vec[2], d, noise_type1_enum, noise_type2_enum));
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(
|
||||||
@@ -838,7 +840,7 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
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(
|
PyDoc_STRVAR(
|
||||||
@@ -899,8 +901,8 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
return PyFloat_FromDouble(BLI_noise_mg_hybrid_multi_fractal(
|
||||||
BLI_mg_HybridMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(
|
PyDoc_STRVAR(
|
||||||
@@ -961,8 +963,8 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PyFloat_FromDouble(
|
return PyFloat_FromDouble(BLI_noise_mg_ridged_multi_fractal(
|
||||||
BLI_mg_RidgedMultiFractal(vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
vec[0], vec[1], vec[2], H, lac, oct, ofs, gn, noise_basis_enum));
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(M_Noise_voronoi_doc,
|
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);
|
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++) {
|
for (i = 0; i < 4; i++) {
|
||||||
PyObject *v = Vector_CreatePyObject(pa + 3 * i, 3, NULL);
|
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 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,
|
PyDoc_STRVAR(M_Noise_cell_vector_doc,
|
||||||
@@ -1067,7 +1069,7 @@ static PyObject *M_Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
|
|||||||
return NULL;
|
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);
|
return Vector_CreatePyObject(r_vec, 3, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -656,13 +656,13 @@ static int pointdensity(PointDensity *pd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pd->flag & TEX_PD_TURBULENCE) {
|
if (pd->flag & TEX_PD_TURBULENCE) {
|
||||||
turb = BLI_gTurbulence(pd->noise_size,
|
turb = BLI_noise_generic_turbulence(pd->noise_size,
|
||||||
texvec[0] + vec[0],
|
texvec[0] + vec[0],
|
||||||
texvec[1] + vec[1],
|
texvec[1] + vec[1],
|
||||||
texvec[2] + vec[2],
|
texvec[2] + vec[2],
|
||||||
pd->noise_depth,
|
pd->noise_depth,
|
||||||
0,
|
0,
|
||||||
pd->noise_basis);
|
pd->noise_basis);
|
||||||
|
|
||||||
turb -= 0.5f; /* re-center 0.0-1.0 range around 0 to prevent offsetting result */
|
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;
|
int rv = TEX_INT;
|
||||||
|
|
||||||
texres->tin = BLI_gTurbulence(tex->noisesize,
|
texres->tin = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
if (texres->nor != NULL) {
|
if (texres->nor != NULL) {
|
||||||
/* calculate bumpnormal */
|
/* calculate bumpnormal */
|
||||||
texres->nor[0] = BLI_gTurbulence(tex->noisesize,
|
texres->nor[0] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[0] + tex->nabla,
|
texvec[0] + tex->nabla,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
texres->nor[1] = BLI_gTurbulence(tex->noisesize,
|
texres->nor[1] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1] + tex->nabla,
|
texvec[1] + tex->nabla,
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
texres->nor[2] = BLI_gTurbulence(tex->noisesize,
|
texres->nor[2] = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2] + tex->nabla,
|
texvec[2] + tex->nabla,
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
tex_normal_derivate(tex, texres);
|
tex_normal_derivate(tex, texres);
|
||||||
rv |= TEX_NOR;
|
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,
|
/* in this case, int. value should really be computed from color,
|
||||||
* and bumpnormal from that, would be too slow, looks ok as is */
|
* and bumpnormal from that, would be too slow, looks ok as is */
|
||||||
texres->tr = texres->tin;
|
texres->tr = texres->tin;
|
||||||
texres->tg = BLI_gTurbulence(tex->noisesize,
|
texres->tg = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
texres->tb = BLI_gTurbulence(tex->noisesize,
|
texres->tb = BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
texvec[0],
|
texvec[0],
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
BRICONTRGB;
|
BRICONTRGB;
|
||||||
texres->ta = 1.0;
|
texres->ta = 1.0;
|
||||||
return (rv | TEX_RGB);
|
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) {
|
else if (wt == TEX_BANDNOISE) {
|
||||||
wi = tex->turbul *
|
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);
|
wi = waveform[wf]((x + y + z) * 10.0f + wi);
|
||||||
}
|
}
|
||||||
else if (wt == TEX_RINGNOISE) {
|
else if (wt == TEX_RINGNOISE) {
|
||||||
wi = tex->turbul *
|
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);
|
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);
|
n = 5.0f * (x + y + z);
|
||||||
|
|
||||||
mi = n + tex->turbul * BLI_gTurbulence(tex->noisesize,
|
mi = n + tex->turbul * BLI_noise_generic_turbulence(tex->noisesize,
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
z,
|
z,
|
||||||
tex->noisedepth,
|
tex->noisedepth,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
if (mt >= TEX_SOFT) { /* TEX_SOFT always true */
|
if (mt >= TEX_SOFT) { /* TEX_SOFT always true */
|
||||||
mi = waveform[wf](mi);
|
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;
|
float nor[3], b2, ofs;
|
||||||
int retval = TEX_INT;
|
int retval = TEX_INT;
|
||||||
|
|
||||||
b2 = BLI_gNoise(tex->noisesize,
|
b2 = BLI_noise_generic_noise(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
ofs = tex->turbul / 200.0f;
|
ofs = tex->turbul / 200.0f;
|
||||||
|
|
||||||
if (tex->stype) {
|
if (tex->stype) {
|
||||||
ofs *= (b2 * b2);
|
ofs *= (b2 * b2);
|
||||||
}
|
}
|
||||||
nor[0] = BLI_gNoise(tex->noisesize,
|
nor[0] = BLI_noise_generic_noise(tex->noisesize,
|
||||||
texvec[0] + ofs,
|
texvec[0] + ofs,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
nor[1] = BLI_gNoise(tex->noisesize,
|
nor[1] = BLI_noise_generic_noise(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1] + ofs,
|
texvec[1] + ofs,
|
||||||
texvec[2],
|
texvec[2],
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
nor[2] = BLI_gNoise(tex->noisesize,
|
nor[2] = BLI_noise_generic_noise(tex->noisesize,
|
||||||
texvec[0],
|
texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2] + ofs,
|
texvec[2] + ofs,
|
||||||
(tex->noisetype != TEX_NOISESOFT),
|
(tex->noisetype != TEX_NOISESOFT),
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
texres->tin = nor[2];
|
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);
|
float (*mgravefunc)(float, float, float, float, float, float, int);
|
||||||
|
|
||||||
if (tex->stype == TEX_MFRACTAL) {
|
if (tex->stype == TEX_MFRACTAL) {
|
||||||
mgravefunc = BLI_mg_MultiFractal;
|
mgravefunc = BLI_noise_mg_multi_fractal;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mgravefunc = BLI_mg_fBm;
|
mgravefunc = BLI_noise_mg_fbm;
|
||||||
}
|
}
|
||||||
|
|
||||||
texres->tin = tex->ns_outscale * mgravefunc(texvec[0],
|
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);
|
float (*mgravefunc)(float, float, float, float, float, float, float, float, int);
|
||||||
|
|
||||||
if (tex->stype == TEX_RIDGEDMF) {
|
if (tex->stype == TEX_RIDGEDMF) {
|
||||||
mgravefunc = BLI_mg_RidgedMultiFractal;
|
mgravefunc = BLI_noise_mg_ridged_multi_fractal;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mgravefunc = BLI_mg_HybridMultiFractal;
|
mgravefunc = BLI_noise_mg_hybrid_multi_fractal;
|
||||||
}
|
}
|
||||||
|
|
||||||
texres->tin = tex->ns_outscale * mgravefunc(texvec[0],
|
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;
|
int rv = TEX_INT;
|
||||||
|
|
||||||
texres->tin = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
texres->tin = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->mg_H,
|
tex->mg_H,
|
||||||
tex->mg_lacunarity,
|
tex->mg_lacunarity,
|
||||||
tex->mg_octaves,
|
tex->mg_octaves,
|
||||||
tex->mg_offset,
|
tex->mg_offset,
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
if (texres->nor != NULL) {
|
if (texres->nor != NULL) {
|
||||||
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
||||||
|
|
||||||
/* calculate bumpnormal */
|
/* calculate bumpnormal */
|
||||||
texres->nor[0] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0] + offs,
|
texres->nor[0] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0] + offs,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->mg_H,
|
tex->mg_H,
|
||||||
tex->mg_lacunarity,
|
tex->mg_lacunarity,
|
||||||
tex->mg_octaves,
|
tex->mg_octaves,
|
||||||
tex->mg_offset,
|
tex->mg_offset,
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
texres->nor[1] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
texres->nor[1] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||||
texvec[1] + offs,
|
texvec[1] + offs,
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->mg_H,
|
tex->mg_H,
|
||||||
tex->mg_lacunarity,
|
tex->mg_lacunarity,
|
||||||
tex->mg_octaves,
|
tex->mg_octaves,
|
||||||
tex->mg_offset,
|
tex->mg_offset,
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
texres->nor[2] = tex->ns_outscale * BLI_mg_HeteroTerrain(texvec[0],
|
texres->nor[2] = tex->ns_outscale * BLI_noise_mg_hetero_terrain(texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2] + offs,
|
texvec[2] + offs,
|
||||||
tex->mg_H,
|
tex->mg_H,
|
||||||
tex->mg_lacunarity,
|
tex->mg_lacunarity,
|
||||||
tex->mg_octaves,
|
tex->mg_octaves,
|
||||||
tex->mg_offset,
|
tex->mg_offset,
|
||||||
tex->noisebasis);
|
tex->noisebasis);
|
||||||
|
|
||||||
tex_normal_derivate(tex, texres);
|
tex_normal_derivate(tex, texres);
|
||||||
rv |= TEX_NOR;
|
rv |= TEX_NOR;
|
||||||
@@ -706,31 +708,31 @@ static int mg_distNoiseTex(const Tex *tex, const float texvec[3], TexResult *tex
|
|||||||
{
|
{
|
||||||
int rv = TEX_INT;
|
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);
|
texvec[0], texvec[1], texvec[2], tex->dist_amount, tex->noisebasis, tex->noisebasis2);
|
||||||
|
|
||||||
if (texres->nor != NULL) {
|
if (texres->nor != NULL) {
|
||||||
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
||||||
|
|
||||||
/* calculate bumpnormal */
|
/* calculate bumpnormal */
|
||||||
texres->nor[0] = BLI_mg_VLNoise(texvec[0] + offs,
|
texres->nor[0] = BLI_noise_mg_variable_lacunarity(texvec[0] + offs,
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->dist_amount,
|
tex->dist_amount,
|
||||||
tex->noisebasis,
|
tex->noisebasis,
|
||||||
tex->noisebasis2);
|
tex->noisebasis2);
|
||||||
texres->nor[1] = BLI_mg_VLNoise(texvec[0],
|
texres->nor[1] = BLI_noise_mg_variable_lacunarity(texvec[0],
|
||||||
texvec[1] + offs,
|
texvec[1] + offs,
|
||||||
texvec[2],
|
texvec[2],
|
||||||
tex->dist_amount,
|
tex->dist_amount,
|
||||||
tex->noisebasis,
|
tex->noisebasis,
|
||||||
tex->noisebasis2);
|
tex->noisebasis2);
|
||||||
texres->nor[2] = BLI_mg_VLNoise(texvec[0],
|
texres->nor[2] = BLI_noise_mg_variable_lacunarity(texvec[0],
|
||||||
texvec[1],
|
texvec[1],
|
||||||
texvec[2] + offs,
|
texvec[2] + offs,
|
||||||
tex->dist_amount,
|
tex->dist_amount,
|
||||||
tex->noisebasis,
|
tex->noisebasis,
|
||||||
tex->noisebasis2);
|
tex->noisebasis2);
|
||||||
|
|
||||||
tex_normal_derivate(tex, texres);
|
tex_normal_derivate(tex, texres);
|
||||||
rv |= TEX_NOR;
|
rv |= TEX_NOR;
|
||||||
@@ -760,24 +762,24 @@ static int voronoiTex(const Tex *tex, const float texvec[3], TexResult *texres)
|
|||||||
sc = tex->ns_outscale / sc;
|
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));
|
texres->tin = sc * fabsf(dot_v4v4(&tex->vn_w1, da));
|
||||||
|
|
||||||
if (tex->vn_coltype) {
|
if (tex->vn_coltype) {
|
||||||
float ca[3]; /* cell color */
|
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->tr = aw1 * ca[0];
|
||||||
texres->tg = aw1 * ca[1];
|
texres->tg = aw1 * ca[1];
|
||||||
texres->tb = aw1 * ca[2];
|
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->tr += aw2 * ca[0];
|
||||||
texres->tg += aw2 * ca[1];
|
texres->tg += aw2 * ca[1];
|
||||||
texres->tb += aw2 * ca[2];
|
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->tr += aw3 * ca[0];
|
||||||
texres->tg += aw3 * ca[1];
|
texres->tg += aw3 * ca[1];
|
||||||
texres->tb += aw3 * ca[2];
|
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->tr += aw4 * ca[0];
|
||||||
texres->tg += aw4 * ca[1];
|
texres->tg += aw4 * ca[1];
|
||||||
texres->tb += aw4 * ca[2];
|
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 */
|
float offs = tex->nabla / tex->noisesize; /* also scaling of texvec */
|
||||||
|
|
||||||
/* calculate bumpnormal */
|
/* 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));
|
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));
|
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));
|
texres->nor[2] = sc * fabsf(dot_v4v4(&tex->vn_w1, da));
|
||||||
|
|
||||||
tex_normal_derivate(tex, texres);
|
tex_normal_derivate(tex, texres);
|
||||||
|
|||||||
Reference in New Issue
Block a user