[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35625] trunk/blender/source/blender/ blenkernel/intern/particle_system.c: Fix for [#26546] Particles leak through deforming quad mesh
Janne Karhu
jhkarh at gmail.com
Sat Mar 19 14:33:03 CET 2011
Revision: 35625
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35625
Author: jhk
Date: 2011-03-19 13:33:03 +0000 (Sat, 19 Mar 2011)
Log Message:
-----------
Fix for [#26546] Particles leak through deforming quad mesh
* Slightly too strong optimization in the new collisions code, the "edges" in the middle of quads weren't checked at all.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/particle_system.c
Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c 2011-03-19 11:12:48 UTC (rev 35624)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c 2011-03-19 13:33:03 UTC (rev 35625)
@@ -2875,7 +2875,7 @@
}
return 0;
}
-static int collision_sphere_to_edges(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t, int quad)
+static int collision_sphere_to_edges(ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t)
{
ParticleCollisionElement edge[3], *cur = NULL, *hit = NULL;
ParticleCollisionElement *result = &col->pce;
@@ -2884,8 +2884,8 @@
int i;
for(i=0; i<3; i++) {
- /* in case of a quad, no need to check "edge" that goes through face */
- if((pce->x[3] && i==2) || (quad && i==0))
+ /* in case of a quad, no need to check "edge" that goes through face twice */
+ if((pce->x[3] && i==2))
continue;
cur = edge+i;
@@ -2966,7 +2966,7 @@
MVert *x = col->md->x;
MVert *v = col->md->current_v;
float t = hit->dist/col->original_ray_length;
- int collision = 0, quad = 0;
+ int collision = 0;
pce.x[0] = x[face->v1].co;
pce.x[1] = x[face->v2].co;
@@ -2985,7 +2985,7 @@
{
collision = collision_sphere_to_tri(col, ray->radius, &pce, &t);
if(col->pce.inside == 0) {
- collision += collision_sphere_to_edges(col, ray->radius, &pce, &t, quad);
+ collision += collision_sphere_to_edges(col, ray->radius, &pce, &t);
collision += collision_sphere_to_verts(col, ray->radius, &pce, &t);
}
@@ -3005,7 +3005,6 @@
pce.v[1] = pce.v[2];
pce.v[2] = pce.v[3];
pce.v[3] = NULL;
- quad++;
} while(pce.x[2]);
}
@@ -3231,7 +3230,7 @@
mul_v3_fl(pa->state.vel, col->inv_timestep);
- /* printf("max iterations\n"); */
+ printf("max iterations\n");
}
/* Particle - Mesh collision detection and response
More information about the Bf-blender-cvs
mailing list