Cycles / Hair: Some cleanup and optimizations for hair code.

* Remove dead code from line segments BVH refine.
CURVE_KN_TANGENTGNORMAL and CURVE_KN_TRUETANGENTGNORMAL are either both true, or both false. Therefore a true/false condition is impossible.
This was a leftover of CURVE_CUSTOM, which was removed in r59234.

* Use "else if" in blender_curves.cpp.
This commit is contained in:
Thomas Dinges 2013-12-26 02:02:14 +01:00
parent ef9a9428a5
commit a649b6eef5
2 changed files with 4 additions and 16 deletions

View File

@ -701,11 +701,11 @@ void BlenderSync::sync_curve_settings()
curve_system_manager->triangle_method = CURVE_CAMERA_TRIANGLES;
curve_system_manager->resolution = 1;
}
if(curve_system_manager->primitive == CURVE_TRIANGLES && curve_system_manager->curve_shape == CURVE_THICK) {
else if(curve_system_manager->primitive == CURVE_TRIANGLES && curve_system_manager->curve_shape == CURVE_THICK) {
/* camera facing planes */
curve_system_manager->triangle_method = CURVE_TESSELATED_TRIANGLES;
}
if(curve_system_manager->primitive == CURVE_LINE_SEGMENTS && curve_system_manager->curve_shape == CURVE_RIBBON) {
else if(curve_system_manager->primitive == CURVE_LINE_SEGMENTS && curve_system_manager->curve_shape == CURVE_RIBBON) {
/* tangent shading */
curve_system_manager->line_method = CURVE_UNCORRECTED;
curve_system_manager->use_encasing = true;
@ -713,13 +713,13 @@ void BlenderSync::sync_curve_settings()
curve_system_manager->use_tangent_normal = true;
curve_system_manager->use_tangent_normal_geometry = true;
}
if(curve_system_manager->primitive == CURVE_LINE_SEGMENTS && curve_system_manager->curve_shape == CURVE_THICK) {
else if(curve_system_manager->primitive == CURVE_LINE_SEGMENTS && curve_system_manager->curve_shape == CURVE_THICK) {
curve_system_manager->line_method = CURVE_ACCURATE;
curve_system_manager->use_encasing = false;
curve_system_manager->use_tangent_normal = false;
curve_system_manager->use_tangent_normal_geometry = false;
}
if(curve_system_manager->primitive == CURVE_SEGMENTS && curve_system_manager->curve_shape == CURVE_RIBBON) {
else if(curve_system_manager->primitive == CURVE_SEGMENTS && curve_system_manager->curve_shape == CURVE_RIBBON) {
curve_system_manager->primitive = CURVE_RIBBONS;
curve_system_manager->use_backfacing = false;
}

View File

@ -1157,18 +1157,6 @@ ccl_device_inline float3 bvh_curve_refine(KernelGlobals *kg, ShaderData *sd, con
}
sd->N = sd->Ng;
if (flag & CURVE_KN_TANGENTGNORMAL && !(flag & CURVE_KN_TRUETANGENTGNORMAL)) {
sd->N = -(D - tg * dot(tg, D));
sd->N = normalize(sd->N);
}
if (!(flag & CURVE_KN_TANGENTGNORMAL) && flag & CURVE_KN_TRUETANGENTGNORMAL) {
sd->N = (dif - tg * sd->u * l) / (P1.w + sd->u * l * gd);
if (gd != 0.0f) {
sd->N = sd->N - gd * tg ;
sd->N = normalize(sd->N);
}
}
}
#ifdef __DPDU__