forked from blender/blender
Code improvements + Mix node #30
@ -135,9 +135,9 @@ class WaveFunction : public mf::MultiFunction {
|
|||||||
MutableSpan<float> r_fac = params.uninitialized_single_output<float>(8, "Fac");
|
MutableSpan<float> r_fac = params.uninitialized_single_output<float>(8, "Fac");
|
||||||
|
|
||||||
mask.foreach_index([&](const int64_t i) {
|
mask.foreach_index([&](const int64_t i) {
|
||||||
float3 pos = vector[i] * scale[i];
|
float3 p = vector[i] * scale[i];
|
||||||
/* Prevent precision issues on unit coordinates. */
|
/* Prevent precision issues on unit coordinates. */
|
||||||
pos = (pos + 0.000001f) * 0.999999f;
|
p = (p + 0.000001f) * 0.999999f;
|
||||||
|
|
||||||
float n = 0.0f;
|
float n = 0.0f;
|
||||||
float val = 0.0f;
|
float val = 0.0f;
|
||||||
@ -146,21 +146,21 @@ class WaveFunction : public mf::MultiFunction {
|
|||||||
case SHD_WAVE_BANDS:
|
case SHD_WAVE_BANDS:
|
||||||
switch (bands_direction_) {
|
switch (bands_direction_) {
|
||||||
case SHD_WAVE_BANDS_DIRECTION_X:
|
case SHD_WAVE_BANDS_DIRECTION_X:
|
||||||
n = pos.x * 20.0f;
|
n = p.x * 20.0f;
|
||||||
break;
|
break;
|
||||||
case SHD_WAVE_BANDS_DIRECTION_Y:
|
case SHD_WAVE_BANDS_DIRECTION_Y:
|
||||||
n = pos.y * 20.0f;
|
n = p.y * 20.0f;
|
||||||
break;
|
break;
|
||||||
case SHD_WAVE_BANDS_DIRECTION_Z:
|
case SHD_WAVE_BANDS_DIRECTION_Z:
|
||||||
n = pos.z * 20.0f;
|
n = p.z * 20.0f;
|
||||||
break;
|
break;
|
||||||
case SHD_WAVE_BANDS_DIRECTION_DIAGONAL:
|
case SHD_WAVE_BANDS_DIRECTION_DIAGONAL:
|
||||||
n = (pos.x + pos.y + pos.z) * 10.0f;
|
n = (p.x + p.y + p.z) * 10.0f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SHD_WAVE_RINGS:
|
case SHD_WAVE_RINGS:
|
||||||
float3 rp = pos;
|
float3 rp = p;
|
||||||
switch (rings_direction_) {
|
switch (rings_direction_) {
|
||||||
case SHD_WAVE_RINGS_DIRECTION_X:
|
case SHD_WAVE_RINGS_DIRECTION_X:
|
||||||
rp *= float3(0.0f, 1.0f, 1.0f);
|
rp *= float3(0.0f, 1.0f, 1.0f);
|
||||||
@ -183,7 +183,7 @@ class WaveFunction : public mf::MultiFunction {
|
|||||||
|
|
||||||
if (distortion[i] != 0.0f) {
|
if (distortion[i] != 0.0f) {
|
||||||
n += distortion[i] *
|
n += distortion[i] *
|
||||||
(noise::perlin_fractal(pos * dscale[i], detail[i], droughness[i], 2.0f, true) * 2.0f -
|
(noise::perlin_fractal(p * dscale[i], detail[i], droughness[i], 2.0f, true) * 2.0f -
|
||||||
1.0f);
|
1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user