[Bf-blender-cvs] [a649b6e] master: Cycles / Hair: Some cleanup and optimizations for hair code.

Thomas Dinges noreply at git.blender.org
Thu Dec 26 02:02:43 CET 2013


Commit: a649b6eef515aacccf01114c0bfa87cb22b29c22
Author: Thomas Dinges
Date:   Thu Dec 26 02:02:14 2013 +0100
https://developer.blender.org/rBa649b6eef515aacccf01114c0bfa87cb22b29c22

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.

===================================================================

M	intern/cycles/blender/blender_curves.cpp
M	intern/cycles/kernel/kernel_bvh.h

===================================================================

diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index c47f410..d13c532 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -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;
 	}
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h
index de200b7..6c5bac5 100644
--- a/intern/cycles/kernel/kernel_bvh.h
+++ b/intern/cycles/kernel/kernel_bvh.h
@@ -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__




More information about the Bf-blender-cvs mailing list