diff options
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/bvh/bvh_util.h | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_curve_intersect.h | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_vector_rotate.h | 11 |
4 files changed, 17 insertions, 11 deletions
diff --git a/intern/cycles/kernel/bvh/bvh_util.h b/intern/cycles/kernel/bvh/bvh_util.h index 6c152cbb249..867ea3af8d1 100644 --- a/intern/cycles/kernel/bvh/bvh_util.h +++ b/intern/cycles/kernel/bvh/bvh_util.h @@ -86,8 +86,7 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */ float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */ - n = normalize( - transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */ + object_normal_transform(kg, sd, &n); /* Normal x scale, world space */ /* Parabolic approximation */ float a = dot(N[2] - N[0], V[0] - V[2]); diff --git a/intern/cycles/kernel/geom/geom_curve_intersect.h b/intern/cycles/kernel/geom/geom_curve_intersect.h index 40b2059194b..e25bf5b4660 100644 --- a/intern/cycles/kernel/geom/geom_curve_intersect.h +++ b/intern/cycles/kernel/geom/geom_curve_intersect.h @@ -237,7 +237,7 @@ ccl_device bool curve_intersect_iterative(const float3 ray_dir, return false; /* Rejects NaNs */ } - /* Backface culling. */ + /* Back-face culling. */ const float3 R = normalize(Q - P); const float3 U = dradiusdu * R + dPdu; const float3 V = cross(dPdu, R); @@ -458,10 +458,12 @@ ccl_device_inline bool cylinder_culling_test(const float2 p1, const float2 p2, c return num * num <= r * r * den2; } -/*! Intersects a ray with a quad with backface culling - * enabled. The quad v0,v1,v2,v3 is split into two triangles - * v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two - * triangles gets intersected. */ +/** + * Intersects a ray with a quad with back-face culling + * enabled. The quad v0,v1,v2,v3 is split into two triangles + * v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two + * triangles gets intersected. + */ ccl_device_inline bool ribbon_intersect_quad(const float ray_tfar, const float3 quad_v0, const float3 quad_v1, diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index bdedf0c20a8..d1f33a4d0f0 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -40,7 +40,7 @@ ccl_device_noinline void compute_light_pass( /* Evaluate surface shader. */ shader_eval_surface(kg, sd, &state, NULL, state.flag); - /* TODO, disable more closures we don't need besides transparent */ + /* TODO: disable more closures we don't need besides transparent. */ shader_bsdf_disable_transparency(kg, sd); /* Init ray. */ diff --git a/intern/cycles/kernel/svm/svm_vector_rotate.h b/intern/cycles/kernel/svm/svm_vector_rotate.h index 79a4ec2c40e..50045752484 100644 --- a/intern/cycles/kernel/svm/svm_vector_rotate.h +++ b/intern/cycles/kernel/svm/svm_vector_rotate.h @@ -50,24 +50,29 @@ ccl_device void svm_node_vector_rotate(ShaderData *sd, } else { float3 axis; + float axis_length; switch (type) { case NODE_VECTOR_ROTATE_TYPE_AXIS_X: axis = make_float3(1.0f, 0.0f, 0.0f); + axis_length = 1.0f; break; case NODE_VECTOR_ROTATE_TYPE_AXIS_Y: axis = make_float3(0.0f, 1.0f, 0.0f); + axis_length = 1.0f; break; case NODE_VECTOR_ROTATE_TYPE_AXIS_Z: axis = make_float3(0.0f, 0.0f, 1.0f); + axis_length = 1.0f; break; default: - axis = normalize(stack_load_float3(stack, axis_stack_offset)); + axis = stack_load_float3(stack, axis_stack_offset); + axis_length = len(axis); break; } float angle = stack_load_float(stack, angle_stack_offset); angle = invert ? -angle : angle; - result = (len_squared(axis) != 0.0f) ? - rotate_around_axis(vector - center, axis, angle) + center : + result = (axis_length != 0.0f) ? + rotate_around_axis(vector - center, axis / axis_length, angle) + center : vector; } |