[Bf-blender-cvs] [c944665] fracture_modifier: improvement of pre-split dynamic fracture

Martin Felke noreply at git.blender.org
Mon Oct 10 18:57:19 CEST 2016


Commit: c9446653e95137bcb7cb0a89bb262f537fe7fcca
Author: Martin Felke
Date:   Mon Oct 10 18:56:47 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBc9446653e95137bcb7cb0a89bb262f537fe7fcca

improvement of pre-split dynamic fracture

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

M	source/blender/blenkernel/intern/rigidbody.c
M	source/blender/modifiers/intern/MOD_fracture.c

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

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index e87252e..1b438ef 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -2069,7 +2069,7 @@ static Shard* findShard(FractureModifierData *fmd, int id)
 static bool check_shard_size(FractureModifierData *fmd, int id)
 {
 	FractureID *fid;
-	float size = 1.0f;
+	float size = 1.0f, diff[3];
 	Shard *s = NULL;
 
 	s = findShard(fmd, id);
@@ -2081,9 +2081,8 @@ static bool check_shard_size(FractureModifierData *fmd, int id)
 
 	BKE_shard_calc_minmax(s);
 
-	if ((fabsf(s->max[0] - s->min[0]) < size) &&
-	   (fabsf(s->max[1] - s->min[1]) < size) &&
-	   (fabsf(s->max[2] - s->min[2]) < size))
+	sub_v3_v3v3(diff, s->max, s->min);
+	if (diff[max_axis_v3(diff)] < size)
 	{
 		return false;
 	}
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 0002db6..1ca44da 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -1178,10 +1178,14 @@ static FracPointCloud get_points_global(FractureModifierData *emd, Object *ob, D
 		add_v3_v3v3(bmin, min, cent);
 
 		//first impact only, so shard has id 0
-		if (emd->fracture_mode == MOD_FRACTURE_DYNAMIC && emd->limit_impact) {
+		if (emd->fracture_mode == MOD_FRACTURE_DYNAMIC) {
 			//shrink pointcloud container around impact point, to a size
 			s = BKE_shard_by_id(emd->frac_mesh, id, fracmesh);
-			if (s != NULL && s->impact_size[0] > 0.0f) {
+
+			copy_v3_v3(max, bmax);
+			copy_v3_v3(min, bmin);
+
+			if (s != NULL && s->impact_size[0] > 0.0f && emd->limit_impact) {
 				float size[3], nmin[3], nmax[3], loc[3], tmin[3], tmax[3], rloc[3] = {0,0,0};
 				MeshIslandSequence *msq = emd->current_mi_entry->prev ? emd->current_mi_entry->prev : emd->current_mi_entry;
 				MeshIsland *mi = NULL;




More information about the Bf-blender-cvs mailing list