Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : proto

Dir     : e17/proto/e_phys/src/bin


Modified Files:
        Makefile.am test_snow.c 


Log Message:
compile with debugging symbols and treat warnigns as errors
add constant and uniform (time dependent) forces
use these in the snow test (much more efficient)
add doc comments for forces

===================================================================
RCS file: /cvs/e/e17/proto/e_phys/src/bin/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- Makefile.am 13 Sep 2006 04:42:02 -0000      1.1
+++ Makefile.am 17 Sep 2006 22:59:15 -0000      1.2
@@ -2,7 +2,8 @@
 
 INCLUDES = -I$(top_srcdir)/src/lib \
 @EVAS_CFLAGS@ \
[EMAIL PROTECTED]@ 
[EMAIL PROTECTED]@ \
+-g -Werror
 
 bin_PROGRAMS = e_phys_demo 
 
===================================================================
RCS file: /cvs/e/e17/proto/e_phys/src/bin/test_snow.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- test_snow.c 13 Sep 2006 04:42:02 -0000      1.1
+++ test_snow.c 17 Sep 2006 22:59:15 -0000      1.2
@@ -1,17 +1,7 @@
 #include "demo.h"
 
 static void      snow_test_constraint_wrap_around_apply(E_Phys_Constraint 
*con);
-
-int
-cb_wind_timer(void *data)
-{
-  E_Phys_Particle *wind = data;
-
-  wind->m = rand_range_f(-1e14, 1e14);
-
-  //printf("snow time, mass: %f\n", wind->m);
-  return 1;
-}
+static E_Phys_Vector snow_test_wind(float time);
 
 void
 init_snow_test(E_Phys_World *world)
@@ -19,23 +9,33 @@
   E_Phys_Constraint_Boundary *bound;
   E_Phys_Particle *p, *c, *w;
   Constraint_Wrap *cw;
+  E_Phys_Vector g;
 
   int i, num = 300;
 
-  c = e_phys_particle_add(world, 1e13, world->w / 2, 1e5, 0, 0);
-  e_phys_particle_size_set(c, 0, 0);
+  int padding = 10;
+  
+  g.x = 0;
+  g.y = 1;
 
-  w = e_phys_particle_add(world, 1, 1e5, world->h / 2, 0, 0);
   for (i = 0; i < num; i++)
   {
-    p = e_phys_particle_add(world, rand_range_f(3.0, 6.0), rand_range(-10, 
world->w + 10), rand_range(-10, 610), rand_range_f(-0.1, 0.1), 
rand_range_f(0.0, 0.1));
+    E_Phys_Vector pos, v0;
+
+    pos.x = rand_range(-1 * padding, world->w + padding);
+    pos.y = rand_range(-1 * padding, world->h + padding);
+
+    v0.x = 0;
+    v0.y = sqrt(2 * g.y * pos.y) * world->dt;
+
+    p = e_phys_particle_add(world, rand_range(3, 5), pos.x, pos.y, v0.x, v0.y);
     e_phys_particle_size_set(p, p->m, p->m);
   }
 
-  e_phys_force_gravity_add(world, .001);
+
   cw = snow_test_constraint_wrap_around_add(world, 10);
-  snow_test_constraint_wrap_around_exclude(cw, c);
-  snow_test_constraint_wrap_around_exclude(cw, w);
+  e_phys_force_constant_add(world, g, 1);
+  e_phys_force_uniform_add(world, snow_test_wind, 0);
 
   printf("init snow\n");
 }
@@ -92,12 +92,23 @@
     }
 
     /* when flakes fall off the bottom, start them over at the top */
-    if (p->cur.y > world->h + cw->margin)
+    if (p->cur.y > world->h)
     {
-      float vy;
-      vy = p->cur.y - p->prev.y;
-      p->cur.y = -1 * cw->margin + (p->cur.y - (world->h + cw->margin));
-      p->prev.y = p->cur.y; // - vy;
+      p->cur.x = rand_range(-1 * cw->margin, world->w + cw->margin);
+      p->cur.y = -1 * cw->margin;
+      p->prev.x = p->cur.x; 
+      p->prev.y = p->cur.y; 
     }
   }
+}
+
+static E_Phys_Vector
+snow_test_wind(float time)
+{
+  E_Phys_Vector f;
+
+
+  f.x = rand_range(-50, 50);
+  f.y = 0;
+  return f;
 }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to