[Bf-blender-cvs] [427105e] master: Code cleanup / Cycles: Remove unused interpolation code for hair triangles, we only support cardinal curves.

Thomas Dinges noreply at git.blender.org
Sun Dec 22 14:20:11 CET 2013


Commit: 427105e425118841332a31061843c616cf1ab759
Author: Thomas Dinges
Date:   Sun Dec 22 14:13:49 2013 +0100
http://developer.blender.org/rB427105e425118841332a31061843c616cf1ab759

Code cleanup / Cycles: Remove unused interpolation code for hair triangles, we only support cardinal curves.

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

M	intern/cycles/blender/blender_curves.cpp
M	intern/cycles/render/curves.h

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

diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index ed348e6..c47f410 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -32,9 +32,9 @@ CCL_NAMESPACE_BEGIN
 /* Hair curve functions */
 
 void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, float3 *v4, const float w[4]);
-void interp_weights(float t, float data[4], int type);
+void interp_weights(float t, float data[4]);
 float shaperadius(float shape, float root, float tip, float time);
-void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData, int interpolation);
+void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData);
 bool ObtainCacheParticleUV(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int uv_num);
 bool ObtainCacheParticleVcol(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background, int vcol_num);
 bool ObtainCacheParticleData(Mesh *mesh, BL::Mesh *b_mesh, BL::Object *b_ob, ParticleCurveData *CData, bool background);
@@ -67,39 +67,17 @@ ParticleCurveData::~ParticleCurveData()
 	curvekey_time.clear();
 }
 
-void interp_weights(float t, float data[4], int type)
+void interp_weights(float t, float data[4])
 {
-	float t2, t3, fc;
-	
-	switch (type) {
-		case CURVE_LINEAR:
-			data[0] =          0.0f;
-			data[1] = -t     + 1.0f;
-			data[2] =  t;
-			data[3] =          0.0f;
-			break;
-		case CURVE_CARDINAL:
-			t2 = t * t;
-			t3 = t2 * t;
-			fc = 0.71f;
-
-			data[0] = -fc          * t3  + 2.0f * fc          * t2 - fc * t;
-			data[1] =  (2.0f - fc) * t3  + (fc - 3.0f)        * t2 + 1.0f;
-			data[2] =  (fc - 2.0f) * t3  + (3.0f - 2.0f * fc) * t2 + fc * t;
-			data[3] =  fc          * t3  - fc * t2;
-			break;
-		case CURVE_BSPLINE:
-			t2 = t * t;
-			t3 = t2 * t;
-
-			data[0] = -0.16666666f * t3  + 0.5f * t2   - 0.5f * t    + 0.16666666f;
-			data[1] =  0.5f        * t3  - t2                        + 0.66666666f;
-			data[2] = -0.5f        * t3  + 0.5f * t2   + 0.5f * t    + 0.16666666f;
-			data[3] =  0.16666666f * t3;
-			break;
-		default:
-			break;
-	}
+	/* Cardinal curve interpolation */
+	float t2 = t * t;
+	float t3 = t2 * t;
+	float fc = 0.71f;
+
+	data[0] = -fc          * t3  + 2.0f * fc          * t2 - fc * t;
+	data[1] =  (2.0f - fc) * t3  + (fc - 3.0f)        * t2 + 1.0f;
+	data[2] =  (fc - 2.0f) * t3  + (3.0f - 2.0f * fc) * t2 + fc * t;
+	data[3] =  fc          * t3  - fc * t2;
 }
 
 void curveinterp_v3_v3v3v3v3(float3 *p, float3 *v1, float3 *v2, float3 *v3, float3 *v4, const float w[4])
@@ -124,7 +102,7 @@ float shaperadius(float shape, float root, float tip, float time)
 
 /* curve functions */
 
-void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData, int interpolation)
+void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyloc, float *time, ParticleCurveData *CData)
 {
 	float3 ckey_loc1 = CData->curvekey_co[key];
 	float3 ckey_loc2 = ckey_loc1;
@@ -147,7 +125,7 @@ void InterpolateKeySegments(int seg, int segno, int key, int curve, float3 *keyl
 
 	float t[4];
 
-	interp_weights((float)seg / (float)segno, t, interpolation);
+	interp_weights((float)seg / (float)segno, t);
 
 	if(keyloc)
 		curveinterp_v3_v3v3v3v3(keyloc, &ckey_loc1, &ckey_loc2, &ckey_loc3, &ckey_loc4, t);
@@ -486,7 +464,7 @@ void ExportCurveTriangleGeometry(Mesh *mesh, ParticleCurveData *CData, int resol
 					float3 ickey_loc = make_float3(0.0f,0.0f,0.0f);
 					float time = 0.0f;
 
-					InterpolateKeySegments(subv, 1, curvekey, curve, &ickey_loc, &time, CData , 1);
+					InterpolateKeySegments(subv, 1, curvekey, curve, &ickey_loc, &time, CData);
 
 					float radius = shaperadius(CData->psys_shape[sys], CData->psys_rootradius[sys], CData->psys_tipradius[sys], time);
 
diff --git a/intern/cycles/render/curves.h b/intern/cycles/render/curves.h
index 3dd492a..0759d49 100644
--- a/intern/cycles/render/curves.h
+++ b/intern/cycles/render/curves.h
@@ -52,12 +52,6 @@ typedef enum curve_lines {
 	CURVE_UNCORRECTED
 } curve_lines;
 
-typedef enum curve_interpolation {
-	CURVE_LINEAR,
-	CURVE_CARDINAL,
-	CURVE_BSPLINE
-} curve_interpolation;
-
 class ParticleCurveData {
 
 public:




More information about the Bf-blender-cvs mailing list