diff options
author | Thomas Dinges <blender@dingto.org> | 2014-01-13 23:40:13 +0400 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2014-01-14 00:17:55 +0400 |
commit | 6b61f7f755011c0ceea89a31be218e1ed4940414 (patch) | |
tree | 3bd475deb2184546cd44aae02bd917fc14f5aaae /intern/cycles | |
parent | ef67b9eec4edbeec8d21fa6db798cd6ef68ab344 (diff) |
Code cleanup / Cycles: Don't pass scale to texture functions, do the multiplication in the function call already.
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/kernel/svm/svm_brick.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_checker.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_musgrave.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_noisetex.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_voronoi.h | 6 |
5 files changed, 13 insertions, 20 deletions
diff --git a/intern/cycles/kernel/svm/svm_brick.h b/intern/cycles/kernel/svm/svm_brick.h index 7cac922d8a6..97c2b545c5f 100644 --- a/intern/cycles/kernel/svm/svm_brick.h +++ b/intern/cycles/kernel/svm/svm_brick.h @@ -26,12 +26,10 @@ ccl_device_noinline float brick_noise(int n) /* fast integer noise */ return 0.5f * ((float)nn / 1073741824.0f); } -ccl_device_noinline float2 svm_brick(float3 p, float scale, float mortar_size, float bias, +ccl_device_noinline float2 svm_brick(float3 p, float mortar_size, float bias, float brick_width, float row_height, float offset_amount, int offset_frequency, float squash_amount, int squash_frequency) -{ - p *= scale; - +{ int bricknum, rownum; float offset = 0.0f; float x, y; @@ -89,7 +87,7 @@ ccl_device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *sta float offset_amount = __int_as_float(node3.z); float squash_amount = __int_as_float(node3.w); - float2 f2 = svm_brick(co, scale, mortar_size, bias, brick_width, row_height, + float2 f2 = svm_brick(co*scale, mortar_size, bias, brick_width, row_height, offset_amount, offset_frequency, squash_amount, squash_frequency); float tint = f2.x; diff --git a/intern/cycles/kernel/svm/svm_checker.h b/intern/cycles/kernel/svm/svm_checker.h index ebc48e16d68..8d1a1a40449 100644 --- a/intern/cycles/kernel/svm/svm_checker.h +++ b/intern/cycles/kernel/svm/svm_checker.h @@ -18,10 +18,8 @@ CCL_NAMESPACE_BEGIN /* Checker */ -ccl_device_noinline float svm_checker(float3 p, float scale) -{ - p *= scale; - +ccl_device_noinline float svm_checker(float3 p) +{ /* avoid precision issues on unit coordinates */ p.x = (p.x + 0.00001f)*0.9999f; p.y = (p.y + 0.00001f)*0.9999f; @@ -47,7 +45,7 @@ ccl_device void svm_node_tex_checker(KernelGlobals *kg, ShaderData *sd, float *s float3 color2 = stack_load_float3(stack, color2_offset); float scale = stack_load_float_default(stack, scale_offset, node.w); - float f = svm_checker(co, scale); + float f = svm_checker(co*scale); if(stack_valid(color_offset)) stack_store_float3(stack, color_offset, (f == 1.0f)? color1: color2); diff --git a/intern/cycles/kernel/svm/svm_musgrave.h b/intern/cycles/kernel/svm/svm_musgrave.h index c67dc8297e4..61171d6849c 100644 --- a/intern/cycles/kernel/svm/svm_musgrave.h +++ b/intern/cycles/kernel/svm/svm_musgrave.h @@ -181,10 +181,9 @@ ccl_device_noinline float noise_musgrave_ridged_multi_fractal(float3 p, NodeNois /* Shader */ -ccl_device float svm_musgrave(NodeMusgraveType type, float dimension, float lacunarity, float octaves, float offset, float intensity, float gain, float scale, float3 p) +ccl_device float svm_musgrave(NodeMusgraveType type, float dimension, float lacunarity, float octaves, float offset, float intensity, float gain, float3 p) { NodeNoiseBasis basis = NODE_NOISE_PERLIN; - p *= scale; if(type == NODE_MUSGRAVE_MULTIFRACTAL) return intensity*noise_musgrave_multi_fractal(p, basis, dimension, lacunarity, octaves); @@ -226,7 +225,7 @@ ccl_device void svm_node_tex_musgrave(KernelGlobals *kg, ShaderData *sd, float * lacunarity = fmaxf(lacunarity, 1e-5f); float f = svm_musgrave((NodeMusgraveType)type, - dimension, lacunarity, detail, foffset, 1.0f, gain, scale, co); + dimension, lacunarity, detail, foffset, 1.0f, gain, co*scale); if(stack_valid(fac_offset)) stack_store_float(stack, fac_offset, f); diff --git a/intern/cycles/kernel/svm/svm_noisetex.h b/intern/cycles/kernel/svm/svm_noisetex.h index 02583131704..5d5cfe6ffcc 100644 --- a/intern/cycles/kernel/svm/svm_noisetex.h +++ b/intern/cycles/kernel/svm/svm_noisetex.h @@ -18,13 +18,11 @@ CCL_NAMESPACE_BEGIN /* Noise */ -ccl_device_inline void svm_noise(float3 p, float scale, float detail, float distortion, float *fac, float3 *color) +ccl_device_inline void svm_noise(float3 p, float detail, float distortion, float *fac, float3 *color) { NodeNoiseBasis basis = NODE_NOISE_PERLIN; int hard = 0; - p *= scale; - if(distortion != 0.0f) { float3 r, offset = make_float3(13.5f, 13.5f, 13.5f); @@ -57,7 +55,7 @@ ccl_device void svm_node_tex_noise(KernelGlobals *kg, ShaderData *sd, float *sta float3 color; float f; - svm_noise(co, scale, detail, distortion, &f, &color); + svm_noise(co*scale, detail, distortion, &f, &color); decode_node_uchar4(node.z, &color_offset, &fac_offset, NULL, NULL); diff --git a/intern/cycles/kernel/svm/svm_voronoi.h b/intern/cycles/kernel/svm/svm_voronoi.h index 604fd3404c5..7f597dc8bff 100644 --- a/intern/cycles/kernel/svm/svm_voronoi.h +++ b/intern/cycles/kernel/svm/svm_voronoi.h @@ -18,10 +18,10 @@ CCL_NAMESPACE_BEGIN /* Voronoi */ -ccl_device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float scale, float3 p) +ccl_device_noinline float4 svm_voronoi(NodeVoronoiColoring coloring, float3 p) { /* compute distance and point coordinate of 4 nearest neighbours */ - float4 dpa0 = voronoi_Fn(p*scale, 1.0f, 0, -1); + float4 dpa0 = voronoi_Fn(p, 1.0f, 0, -1); /* output */ float fac; @@ -49,7 +49,7 @@ ccl_device void svm_node_tex_voronoi(KernelGlobals *kg, ShaderData *sd, float *s float3 co = stack_load_float3(stack, co_offset); float scale = stack_load_float_default(stack, scale_offset, node.w); - float4 result = svm_voronoi((NodeVoronoiColoring)coloring, scale, co); + float4 result = svm_voronoi((NodeVoronoiColoring)coloring, co*scale); float3 color = make_float3(result.x, result.y, result.z); float f = result.w; |