Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-06-10 20:07:07 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-06-22 14:28:01 +0300
commit2c41c8e94fa8740f67dc39150dd1ab66b506adc9 (patch)
tree3a83a02217946feb89b5cc0a77cc3ed088eb1aad /intern/cycles/kernel/geom
parent207338bb58b1a44c531e6d78fad68672c6d3b2e1 (diff)
Cycles: internal refactoring to make thick/ribbon curve separate primitives
Also removing the curve system manager which only stored a few curve intersection settings. These are all changes towards making shape and subdivision settings per-object instead of per-scene, but there is more work to do here. Ref T73778 Depends on D8013 Maniphest Tasks: T73778 Differential Revision: https://developer.blender.org/D8014
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r--intern/cycles/kernel/geom/geom_curve.h2
-rw-r--r--intern/cycles/kernel/geom/geom_curve_intersect.h15
2 files changed, 8 insertions, 9 deletions
diff --git a/intern/cycles/kernel/geom/geom_curve.h b/intern/cycles/kernel/geom/geom_curve.h
index d2ac2d60435..a7a262c029f 100644
--- a/intern/cycles/kernel/geom/geom_curve.h
+++ b/intern/cycles/kernel/geom/geom_curve.h
@@ -211,7 +211,7 @@ ccl_device float curve_thickness(KernelGlobals *kg, ShaderData *sd)
float4 P_curve[2];
- if (sd->type & PRIMITIVE_CURVE) {
+ if (!(sd->type & PRIMITIVE_ALL_MOTION)) {
P_curve[0] = kernel_tex_fetch(__curve_keys, k0);
P_curve[1] = kernel_tex_fetch(__curve_keys, k1);
}
diff --git a/intern/cycles/kernel/geom/geom_curve_intersect.h b/intern/cycles/kernel/geom/geom_curve_intersect.h
index c4a614ab676..86f7f246c6e 100644
--- a/intern/cycles/kernel/geom/geom_curve_intersect.h
+++ b/intern/cycles/kernel/geom/geom_curve_intersect.h
@@ -627,10 +627,10 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
float time,
int type)
{
- const bool is_curve_primitive = (type & PRIMITIVE_CURVE);
+ const bool is_motion = (type & PRIMITIVE_ALL_MOTION);
# ifndef __KERNEL_OPTIX__ /* See OptiX motion flag OPTIX_MOTION_FLAG_[START|END]_VANISH */
- if (!is_curve_primitive && kernel_data.bvh.use_bvh_steps) {
+ if (is_motion && kernel_data.bvh.use_bvh_steps) {
const float2 prim_time = kernel_tex_fetch(__prim_time, curveAddr);
if (time < prim_time.x || time > prim_time.y) {
return false;
@@ -650,7 +650,7 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
int kb = min(k1 + 1, __float_as_int(v00.x) + __float_as_int(v00.y) - 1);
float4 curve[4];
- if (is_curve_primitive) {
+ if (!is_motion) {
curve[0] = kernel_tex_fetch(__curve_keys, ka);
curve[1] = kernel_tex_fetch(__curve_keys, k0);
curve[2] = kernel_tex_fetch(__curve_keys, k1);
@@ -667,10 +667,9 @@ ccl_device_forceinline bool curve_intersect(KernelGlobals *kg,
}
# endif
- const bool use_ribbon = (kernel_data.curve.curveflags & CURVE_KN_RIBBONS) != 0;
- if (use_ribbon) {
+ if (type & (PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON)) {
/* todo: adaptive number of subdivisions could help performance here. */
- const int subdivisions = kernel_data.curve.subdivisions;
+ const int subdivisions = kernel_data.bvh.curve_subdivisions;
if (ribbon_intersect(P, dir, isect->t, subdivisions, curve, isect)) {
isect->prim = curveAddr;
isect->object = object;
@@ -724,7 +723,7 @@ ccl_device_inline void curve_shader_setup(KernelGlobals *kg,
float4 P_curve[4];
- if (sd->type & PRIMITIVE_CURVE) {
+ if (!(sd->type & PRIMITIVE_ALL_MOTION)) {
P_curve[0] = kernel_tex_fetch(__curve_keys, ka);
P_curve[1] = kernel_tex_fetch(__curve_keys, k0);
P_curve[2] = kernel_tex_fetch(__curve_keys, k1);
@@ -742,7 +741,7 @@ ccl_device_inline void curve_shader_setup(KernelGlobals *kg,
const float4 dPdu4 = catmull_rom_basis_derivative(P_curve, isect->u);
const float3 dPdu = float4_to_float3(dPdu4);
- if (kernel_data.curve.curveflags & CURVE_KN_RIBBONS) {
+ if (sd->type & (PRIMITIVE_CURVE_RIBBON | PRIMITIVE_MOTION_CURVE_RIBBON)) {
/* Rounded smooth normals for ribbons, to approximate thick curve shape. */
const float3 tangent = normalize(dPdu);
const float3 bitangent = normalize(cross(tangent, -D));