forked from bartvdbraak/blender
Code cleanup / Cycles:
* Remove code for the unused Wave texture variations. We have quite some unused code in the texture area, I guess it doesn't harm to clean a bit up here. We can always get the code back from SVN if we need something.
This commit is contained in:
parent
743a7a4a4b
commit
30f279be26
@ -198,31 +198,6 @@ float noise_basis_hard(point p, string basis, int hard)
|
|||||||
return (hard) ? fabs(2.0 * t - 1.0) : t;
|
return (hard) ? fabs(2.0 * t - 1.0) : t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Waves */
|
|
||||||
|
|
||||||
float noise_wave(string wave, float a)
|
|
||||||
{
|
|
||||||
if (wave == "Sine") {
|
|
||||||
return 0.5 + 0.5 * sin(a);
|
|
||||||
}
|
|
||||||
if (wave == "Saw") {
|
|
||||||
float b = 2 * M_PI;
|
|
||||||
int n = (int)(a / b);
|
|
||||||
a -= n * b;
|
|
||||||
if (a < 0) a += b;
|
|
||||||
|
|
||||||
return a / b;
|
|
||||||
}
|
|
||||||
if (wave == "Tri") {
|
|
||||||
float b = 2 * M_PI;
|
|
||||||
float rmax = 1.0;
|
|
||||||
|
|
||||||
return rmax - 2.0 * fabs(floor((a * (1.0 / b)) + 0.5) - (a * (1.0 / b)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Turbulence */
|
/* Turbulence */
|
||||||
|
|
||||||
float noise_turbulence(point p, string basis, float details, int hard)
|
float noise_turbulence(point p, string basis, float details, int hard)
|
||||||
|
@ -39,7 +39,7 @@ float wave(point p, float scale, string type, float detail, float distortion, fl
|
|||||||
if (distortion != 0.0) {
|
if (distortion != 0.0) {
|
||||||
n = n + (distortion * noise_turbulence(p * dscale, "Perlin", detail, 0));
|
n = n + (distortion * noise_turbulence(p * dscale, "Perlin", detail, 0));
|
||||||
}
|
}
|
||||||
return noise_wave("Sine", n);
|
return 0.5 + 0.5 * sin(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
shader node_wave_texture(
|
shader node_wave_texture(
|
||||||
|
@ -177,31 +177,6 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard)
|
|||||||
return (hard)? fabsf(2.0f*t - 1.0f): t;
|
return (hard)? fabsf(2.0f*t - 1.0f): t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Waves */
|
|
||||||
|
|
||||||
__device float noise_wave(NodeWaveBasis wave, float a)
|
|
||||||
{
|
|
||||||
if(wave == NODE_WAVE_SINE) {
|
|
||||||
return 0.5f + 0.5f * sinf(a);
|
|
||||||
}
|
|
||||||
else if(wave == NODE_WAVE_SAW) {
|
|
||||||
float b = M_2PI_F;
|
|
||||||
int n = float_to_int(a / b);
|
|
||||||
a -= n*b;
|
|
||||||
if(a < 0.0f) a += b;
|
|
||||||
|
|
||||||
return a / b;
|
|
||||||
}
|
|
||||||
else if(wave == NODE_WAVE_TRI) {
|
|
||||||
float b = M_2PI_F;
|
|
||||||
float rmax = 1.0f;
|
|
||||||
|
|
||||||
return rmax - 2.0f*fabsf(floorf((a*(1.0f/b))+0.5f) - (a*(1.0f/b)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Turbulence */
|
/* Turbulence */
|
||||||
|
|
||||||
__device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float octaves, int hard)
|
__device_noinline float noise_turbulence(float3 p, NodeNoiseBasis basis, float octaves, int hard)
|
||||||
|
@ -274,12 +274,6 @@ typedef enum NodeNoiseBasis {
|
|||||||
NODE_NOISE_CELL_NOISE
|
NODE_NOISE_CELL_NOISE
|
||||||
} NodeNoiseBasis;
|
} NodeNoiseBasis;
|
||||||
|
|
||||||
typedef enum NodeWaveBasis {
|
|
||||||
NODE_WAVE_SINE,
|
|
||||||
NODE_WAVE_SAW,
|
|
||||||
NODE_WAVE_TRI
|
|
||||||
} NodeWaveBasis;
|
|
||||||
|
|
||||||
typedef enum NodeMusgraveType {
|
typedef enum NodeMusgraveType {
|
||||||
NODE_MUSGRAVE_MULTIFRACTAL,
|
NODE_MUSGRAVE_MULTIFRACTAL,
|
||||||
NODE_MUSGRAVE_FBM,
|
NODE_MUSGRAVE_FBM,
|
||||||
|
@ -22,21 +22,19 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
__device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float detail, float distortion, float dscale)
|
__device_noinline float svm_wave(NodeWaveType type, float3 p, float scale, float detail, float distortion, float dscale)
|
||||||
{
|
{
|
||||||
float w, n;
|
float n;
|
||||||
|
|
||||||
p *= scale;
|
p *= scale;
|
||||||
|
|
||||||
if(type == NODE_WAVE_BANDS)
|
if(type == NODE_WAVE_BANDS)
|
||||||
n = (p.x + p.y + p.z) * 10.0f;
|
n = (p.x + p.y + p.z) * 10.0f;
|
||||||
else /* if(type == NODE_WAVE_RINGS) */
|
else /* NODE_WAVE_RINGS */
|
||||||
n = len(p) * 20.0f;
|
n = len(p) * 20.0f;
|
||||||
|
|
||||||
if(distortion != 0.0f)
|
if(distortion != 0.0f)
|
||||||
n += distortion * noise_turbulence(p*dscale, NODE_NOISE_PERLIN, detail, 0);
|
n += distortion * noise_turbulence(p*dscale, NODE_NOISE_PERLIN, detail, 0);
|
||||||
|
|
||||||
w = noise_wave(NODE_WAVE_SINE, n);
|
return 0.5f + 0.5f * sinf(n);
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__device void svm_node_tex_wave(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
|
__device void svm_node_tex_wave(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
|
||||||
|
Loading…
Reference in New Issue
Block a user