[Bf-blender-cvs] [82d3cd586c] cloth-improvements: Remove unused selfbvh stuff

Luca Rood noreply at git.blender.org
Fri Jan 20 05:38:48 CET 2017


Commit: 82d3cd586ca1ea851c6909aa2d3d1af00210c727
Author: Luca Rood
Date:   Thu Jan 19 22:12:48 2017 -0200
Branches: cloth-improvements
https://developer.blender.org/rB82d3cd586ca1ea851c6909aa2d3d1af00210c727

Remove unused selfbvh stuff

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

M	source/blender/blenkernel/intern/cloth.c

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

diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index c717967e6a..ad7bb9c84e 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -151,44 +151,6 @@ void cloth_init(ClothModifierData *clmd )
 		clmd->point_cache->step = 1;
 }
 
-static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)
-{
-	unsigned int i;
-	BVHTree *bvhtree;
-	Cloth *cloth;
-	ClothVertex *verts;
-
-	if (!clmd)
-		return NULL;
-
-	cloth = clmd->clothObject;
-
-	if (!cloth)
-		return NULL;
-	
-	verts = cloth->verts;
-	
-	/* in the moment, return zero if no faces there */
-	if (!cloth->mvert_num)
-		return NULL;
-	
-	/* create quadtree with k=26 */
-	bvhtree = BLI_bvhtree_new(cloth->mvert_num, epsilon, 4, 6);
-	
-	/* fill tree */
-	for (i = 0; i < cloth->mvert_num; i++, verts++) {
-		const float *co;
-		co = verts->xold;
-		
-		BLI_bvhtree_insert(bvhtree, i, co, 1);
-	}
-	
-	/* balance tree */
-	BLI_bvhtree_balance(bvhtree);
-	
-	return bvhtree;
-}
-
 static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon)
 {
 	unsigned int i;
@@ -285,47 +247,6 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving, bool self)
 	}
 }
 
-void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving)
-{	
-	unsigned int i = 0;
-	Cloth *cloth = clmd->clothObject;
-	BVHTree *bvhtree = cloth->bvhselftree;
-	ClothVertex *verts = cloth->verts;
-	const MVertTri *vt;
-	
-	if (!bvhtree)
-		return;
-
-	vt = cloth->tri;
-
-	/* update vertex position in bvh tree */
-	if (verts && vt) {
-		for (i = 0; i < cloth->mvert_num; i++, verts++) {
-			const float *co, *co_moving;
-			bool ret;
-
-			co = verts->txold;
-
-			/* copy new locations into array */
-			if (moving) {
-				/* update moving positions */
-				co_moving = verts->tx;
-				ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, 1);
-			}
-			else {
-				ret = BLI_bvhtree_update_node(bvhtree, i, co, NULL, 1);
-			}
-
-			/* check if tree is already full */
-			if (ret == false) {
-				break;
-			}
-		}
-		
-		BLI_bvhtree_update_tree(bvhtree);
-	}
-}
-
 void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
 {
 	PTCacheID pid;
@@ -807,7 +728,6 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 	float (*shapekey_rest)[3] = NULL;
 	float tnull[3] = {0, 0, 0};
 	Cloth *cloth = NULL;
-	float maxdist = 0;
 
 	// If we have a clothObject, free it. 
 	if ( clmd->clothObject != NULL ) {
@@ -909,10 +829,6 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 
 	clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, clmd->coll_parms->epsilon );
 	
-	for (i = 0; i < dm->getNumVerts(dm); i++) {
-		maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
-	}
-	
 	clmd->clothObject->bvhselftree = bvhtree_build_from_cloth ( clmd, clmd->coll_parms->selfepsilon );
 
 	return 1;




More information about the Bf-blender-cvs mailing list