From: Enlightenment C. <no...@cv...> - 2007-03-22 17:05:09
|
Enlightenment CVS committal Author : rephorm Project : e17 Module : proto Dir : e17/proto/e_phys/src/lib Modified Files: e_phys_world.c Log Message: fix some compiler warnings add mesh test (i did this a while back, not sure that it works very well) revert to using fixed time delta per tick instead of elapsed system time (high cpu could cause timer calls to stack up and get called in rapid succession resulting in excessive amounts of energy getting added into the system) =================================================================== RCS file: /cvs/e/e17/proto/e_phys/src/lib/e_phys_world.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- e_phys_world.c 27 Nov 2006 21:38:06 -0000 1.4 +++ e_phys_world.c 22 Mar 2007 17:04:32 -0000 1.5 @@ -45,13 +45,10 @@ e_phys_world_timer(void *data) { E_Phys_World *world; - double now; int i; world = data; - now = ecore_time_get(); - world->elapsed = now - world->time; - world->time = now; + world->time = ecore_time_get(); e_phys_world_accumulate_forces(world); e_phys_world_verlet_integrate(world); for (i = 0; i < world->constraint_iter; i++) @@ -87,7 +84,7 @@ { Evas_List *l; E_Phys_Particle *nearest = NULL; - float distance; + float distance = 0.0; for (l = world->particles; l; l = l->next) @@ -155,8 +152,8 @@ tmp.y = p->cur.y; //printf("force: (%0.2f, %0.2f)\n", p->force.x, p->force.y); - p->cur.x = (2 - world->friction) * p->cur.x - (1 - world->friction) * p->prev.x + p->force.x * world->elapsed * world->elapsed / p->m; - p->cur.y = (2 - world->friction) * p->cur.y - (1 - world->friction) *p->prev.y + p->force.y * world->elapsed * world->elapsed / p->m; + p->cur.x = (2 - world->friction) * p->cur.x - (1 - world->friction) * p->prev.x + p->force.x * world->dt * world->dt / p->m; + p->cur.y = (2 - world->friction) * p->cur.y - (1 - world->friction) *p->prev.y + p->force.y * world->dt * world->dt / p->m; p->prev.x = tmp.x; p->prev.y = tmp.y; |