plib-cvs Mailing List for PLIB (Page 45)
Brought to you by:
sjbaker
You can subscribe to this list here.
2002 |
Jan
(25) |
Feb
(10) |
Mar
(60) |
Apr
(49) |
May
(54) |
Jun
(94) |
Jul
(82) |
Aug
(251) |
Sep
(366) |
Oct
(17) |
Nov
(20) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(12) |
Feb
(8) |
Mar
(2) |
Apr
(4) |
May
(5) |
Jun
(8) |
Jul
(23) |
Aug
(8) |
Sep
(7) |
Oct
(5) |
Nov
(20) |
Dec
(20) |
2004 |
Jan
(19) |
Feb
(70) |
Mar
(108) |
Apr
(24) |
May
(6) |
Jun
(5) |
Jul
|
Aug
(8) |
Sep
(18) |
Oct
(27) |
Nov
|
Dec
(13) |
2005 |
Jan
(19) |
Feb
(13) |
Mar
(1) |
Apr
|
May
(10) |
Jun
(1) |
Jul
(10) |
Aug
(5) |
Sep
(2) |
Oct
(2) |
Nov
(6) |
Dec
(4) |
2006 |
Jan
(9) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Steve B. <sj...@us...> - 2002-08-14 00:41:04
|
Update of /cvsroot/plib/plib/doc/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv14112/plib/doc/ssgAux Modified Files: index.html Log Message: Documented the ssgaShapes. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/ssgAux/index.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- index.html 13 Aug 2002 05:11:32 -0000 1.5 +++ index.html 14 Aug 2002 00:41:01 -0000 1.6 @@ -41,13 +41,149 @@ SSGA_TYPE_CUBE </pre> -<H1>ssgaWaveSystem</H1> -This class is for handling water waves. +<H1>ssgaShape</H1> +This is an abstract base class for many of the more +complex classes in the ssgAux 'collection'. The idea +is that these are really ssgGroup nodes - but they +behave in such a way that you are never concerned +with the nodes they create beneath themselves. [...203 lines suppressed...] water - and this simulation produces the correct effects. There is an optional user-callback that can be used to feed water depth -values into the simulation. +values into the simulation. The wave system will likely call this +function many thousands of times per frame - so make sure your +depth function is very efficient. If you don't provide a depth +function then the water will be assumed to be infinitely deep. <p> You can determine the number of polygons used to render the patch of waves, the size of the wave patch and the amount -of texture repetition. +of texture repetition. The 'EdgeFlatten' setting determines +to what distance from the edge of the patch the waves are +gradually flattened out. This is useful because it allows +you to keep all those expensive wave polygons close to the +camera - and feather them out over range so that they blend +gently into a larger flat ocean. <p> Designing waves by calling the ssgaWaveSystem API is quite difficult. You are advised to use the wave designer program |
From: Steve B. <sj...@us...> - 2002-08-13 05:11:36
|
Update of /cvsroot/plib/plib/doc/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv27221/plib/doc/ssgAux Modified Files: index.html Log Message: Updated documentation for ssgAux. Fixed a bug in the fountain in the water demo. Added some syntactic sugar to dynamics. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/ssgAux/index.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- index.html 27 Oct 2001 05:34:47 -0000 1.4 +++ index.html 13 Aug 2002 05:11:32 -0000 1.5 @@ -41,8 +41,259 @@ SSGA_TYPE_CUBE </pre> +<H1>ssgaWaveSystem</H1> +This class is for handling water waves. +<pre> + + class ssgaWaveSystem ; + +</pre> +It generates a large polygonal mesh which it distorts in [...229 lines suppressed...] +and 'gone away'. +<p> +All the particles have to be the same size - but you can use +the 'setSize' function to change their size on-the-fly - for example +to make a cloud of bubbles that grow over time. +<p> +ssgaParticleSystem is derived from ssgVtxArray - so you can apply textures and +other state things using the usual ssgVtxArray::setState(ssgSimpleState*) +call. I applied a texture with a fuzzy alpha-blended circle. +<p> +While debugging this, I got a bug which caused a picture of Tux to be +applied instead of the droplet texture - it was absolutely hilarious +to see 2000 tiny penguins shooting up in a fountain and falling gently +to earth! + <hr> -This document is under construction. <hr> <ADDRESS> <A HREF="http://www.sjbaker.org"> |
From: Steve B. <sj...@us...> - 2002-08-13 05:11:36
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv27221/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Updated documentation for ssgAux. Fixed a bug in the fountain in the water demo. Added some syntactic sugar to dynamics. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- water.cxx 9 Aug 2002 19:55:44 -0000 1.13 +++ water.cxx 13 Aug 2002 05:11:33 -0000 1.14 @@ -523,13 +523,6 @@ } -static void droplet_update ( float dt, SPS *, int, ssgaParticle *p ) -{ - sgAddScaledVec3 ( p->vel, p->acc, dt ) ; - sgAddScaledVec3 ( p->pos, p->vel, dt ) ; -} - - void init_states () { plinth_state = new ssgSimpleState () ; @@ -603,8 +596,7 @@ fountain = new ssgaParticleSystem ( 1000, 100, 500, TRUE, 0.2, 1000, - droplet_create, - droplet_update, NULL ) ; + droplet_create ) ; fountain -> setState ( splash_state ) ; /* Set up some interesting defaults. */ |
From: Sebastian U. <ud...@us...> - 2002-08-12 21:57:16
|
Update of /cvsroot/plib/plib/examples/src/js In directory usw-pr-cvs1:/tmp/cvs-serv21046/src/js Modified Files: Makefile.am Log Message: Always link against libwinmm on WIN32 as ulClock uses mmtimer Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/examples/src/js/Makefile.am,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile.am 7 Jul 2002 18:07:13 -0000 1.3 +++ Makefile.am 12 Aug 2002 21:57:13 -0000 1.4 @@ -3,7 +3,7 @@ js_demo_SOURCES = js_demo.cxx -js_demo_LDADD = -lplibul $(JS_LIBS) +js_demo_LDADD = -lplibul EXTRA_DIST = js_demo.dsp |
From: Sebastian U. <ud...@us...> - 2002-08-12 21:56:48
|
Update of /cvsroot/plib/plib/examples In directory usw-pr-cvs1:/tmp/cvs-serv20828 Modified Files: configure.in Log Message: Always link against libwinmm on WIN32 as ulClock uses mmtimer Index: configure.in =================================================================== RCS file: /cvsroot/plib/plib/examples/configure.in,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- configure.in 11 Aug 2002 17:53:48 -0000 1.26 +++ configure.in 12 Aug 2002 21:56:43 -0000 1.27 @@ -78,9 +78,8 @@ *-*-cygwin* | *-*-mingw32*) dnl CygWin under Windoze. - dnl Multimedia libraries - SND_LIBS="-lwinmm" - JS_LIBS="-lwinmm" + dnl Sound / joystick stuff, mmtimer (ulClock !) + LIBS="$LIBS -lwinmm" dnl OpenGL libraries OGL_LIBS="-lglu32 -lopengl32" @@ -149,22 +148,13 @@ fi dnl Check SGI audio library - AC_CHECK_LIB(audio, ALopenport) - - if test "x$ac_cv_lib_audio_ALopenport" = "xyes" ; then - dnl this is an SGI machine... - SND_LIBS="-laudio" - fi - - CPPFLAGS="$CPPFLAGS -I/usr/local/include" - LDFLAGS="$LDFLAGS -L/usr/local/lib" + AC_CHECK_LIB(audio, ALopenport, SND_LIBS="-laudio") ;; esac AC_SUBST(OGL_LIBS) AC_SUBST(GLUT_LIBS) AC_SUBST(SND_LIBS) -AC_SUBST(JS_LIBS) dnl Check PLIB library |
From: Steve B. <sj...@us...> - 2002-08-11 19:52:11
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv1434/plib/src/sg Modified Files: sg.h Log Message: Added collisions to dynamics demo. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- sg.h 11 Aug 2002 18:34:54 -0000 1.43 +++ sg.h 11 Aug 2002 19:52:07 -0000 1.44 @@ -2707,6 +2707,15 @@ void subForce ( sgVec3 f ) { sgSubVec3 ( force, f ) ; } void gravityOnly () { sgScaleVec3 ( force, sgGetGravityVec3 (), ooMass ) ; } + void bounce ( sgVec3 normal, float coefRestitution ) + { + sgVec3 vn, vt ; + sgScaleVec3 ( vn, normal, + sgScalarProductVec3 ( normal, vel ) ) ; + sgSubVec3 ( vt, vel, vn ) ; + sgAddScaledVec3 ( vel, vt, vn, -coefRestitution ) ; + } + void update ( float dt ) { sgAddScaledVec3 ( vel, force, dt * ooMass ) ; |
From: Steve B. <sj...@us...> - 2002-08-11 19:52:11
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv1434/plib/doc/sg Modified Files: index.html Log Message: Added collisions to dynamics demo. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- index.html 11 Aug 2002 17:53:48 -0000 1.15 +++ index.html 11 Aug 2002 19:52:07 -0000 1.16 @@ -904,12 +904,18 @@ void setPos ( sgVec3 p ) ; void setVel ( sgVec3 v ) ; void setForce ( sgVec3 f ) ; + + void setPos ( float x, float y, float z ) ; + void setVel ( float x, float y, float z ) ; + void setForce ( float x, float y, float z ) ; + void setMass ( float m ) ; void zeroForce () ; void addForce ( sgVec3 f ) ; void gravityOnly () ; - + + void bounce ( sgVec3 normal, float coefRestitution ) ; void update ( float dt ) ; } ; @@ -983,6 +989,12 @@ <li> For each particle: Update it's velocity and position: <code>particle -> update ( dt )</code> (where 'dt' is the elapsed time since the previous frame). + <li> If the particle collided with something, then you can adjust + it's velocity using: + <code>sgParticle::bounce ( sgVec3 normal, float coefRestitution )</code> + (Where 'normal' is the surface normal of the plane we hit and + 'coefRestitution' is 1.0 for perfectly elastic surfaces, 0.0 for + ultra-sticky surfaces...or somewhere in between). </ul> As always with these systems, if you set the spring stiffness too high, or the damping coefficient too low, these equations will tend to <b>explode</b> - generating |
From: Steve B. <sj...@us...> - 2002-08-11 19:52:11
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv1434/plib/examples/src/ssg/dynamics Modified Files: dynamics.cxx Log Message: Added collisions to dynamics demo. Index: dynamics.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/dynamics/dynamics.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- dynamics.cxx 11 Aug 2002 18:34:54 -0000 1.3 +++ dynamics.cxx 11 Aug 2002 19:52:07 -0000 1.4 @@ -15,6 +15,8 @@ #define GUI_BASE 80 #define VIEW_GUI_BASE 20 #define FONT_COLOUR 1,1,1,1 +#define DEEPEST_HELL -10000.0 +#define HOT_TOLERANCE 1.0 ssgRoot *scene = NULL ; ssgaWaveSystem *ocean = NULL ; @@ -33,11 +35,11 @@ { particle [ 0 ] -> setPos ( 2.0f, -4.0f, 0.0f ) ; [...94 lines suppressed...] + particle [ i ] -> update ( dt ) ; - if ( particle [ i ] -> getVel ()[2] < 0.0f ) - particle [ i ] -> getVel ()[2] = 0.0f ; + sgVec3 normal ; - if ( particle [ i ] -> getForce ()[2] < 0.0f ) - particle [ i ] -> getForce ()[2] = 0.0f ; - } + float hot = getHeightAndNormal ( particle [ i ] -> getPos(), normal ) ; - particle [ i ] -> update ( dt ) ; + if ( particle [ i ] -> getPos ()[2] <= hot ) + { + particle [ i ] -> bounce ( normal, RESTITUTION ) ; + particle [ i ] -> getPos ()[2] = hot ; + } } for ( int i = 0 ; i < num_particles ; i++ ) |
From: Sebastian U. <ud...@us...> - 2002-08-11 19:23:52
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv25662 Modified Files: ssgaWaveSystem.cxx Log Message: Erik Hofman: Fixed another for loop / scope of "i" issue Index: ssgaWaveSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgaWaveSystem.cxx 9 Aug 2002 19:55:45 -0000 1.7 +++ ssgaWaveSystem.cxx 11 Aug 2002 19:23:48 -0000 1.8 @@ -49,7 +49,7 @@ int num_trains = 0 ; - for ( int i = 0 ; i < SSGA_MAX_WAVETRAIN ; i++ ) + for ( i = 0 ; i < SSGA_MAX_WAVETRAIN ; i++ ) if ( train [ i ] != NULL ) { adjSpeed [num_trains] = train [ i ] -> getSpeed () * G * @@ -64,7 +64,7 @@ num_trains++ ; } - for ( int i = 0 ; i <= nstrips ; i++ ) + for ( i = 0 ; i <= nstrips ; i++ ) { float fade_i = (i<2) ? 0.0f : (i<7) ? (float)(i-2)/5.0f : (i>nstrips-2) ? 0.0f : |
From: Steve B. <sj...@us...> - 2002-08-11 18:34:57
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv11571/plib/src/sg Modified Files: sg.h Log Message: Added some more convenience functions. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- sg.h 11 Aug 2002 18:20:30 -0000 1.42 +++ sg.h 11 Aug 2002 18:34:54 -0000 1.43 @@ -2690,6 +2690,10 @@ void setVel ( sgVec3 v ) { sgCopyVec3 ( vel , v ) ; } void setForce ( sgVec3 f ) { sgCopyVec3 ( force, f ) ; } + void setPos ( float x, float y, float z ) { sgSetVec3 ( pos ,x,y,z ) ; } + void setVel ( float x, float y, float z ) { sgSetVec3 ( vel ,x,y,z ) ; } + void setForce ( float x, float y, float z ) { sgSetVec3 ( force,x,y,z ) ; } + void setOneOverMass ( float oom ) { ooMass = oom ; } void setMass ( float m ) |
From: Steve B. <sj...@us...> - 2002-08-11 18:34:57
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv11571/plib/examples/src/ssg/dynamics Modified Files: dynamics.cxx Log Message: Added some more convenience functions. Index: dynamics.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/dynamics/dynamics.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dynamics.cxx 11 Aug 2002 18:20:30 -0000 1.2 +++ dynamics.cxx 11 Aug 2002 18:34:54 -0000 1.3 @@ -29,6 +29,25 @@ int num_particles ; int num_springs ; +void resetSMD () +{ + particle [ 0 ] -> setPos ( 2.0f, -4.0f, 0.0f ) ; + particle [ 1 ] -> setPos ( 2.4f, 0.0f, 6.0f ) ; + particle [ 2 ] -> setPos ( 2.0f, 4.0f, 0.0f ) ; + particle [ 3 ] -> setPos ( 4.0f, -4.0f, 0.0f ) ; + particle [ 4 ] -> setPos ( 0.0f, -4.0f, 0.0f ) ; + particle [ 5 ] -> setPos ( 4.0f, 4.0f, 0.0f ) ; + particle [ 6 ] -> setPos ( 0.0f, 4.0f, 0.0f ) ; + + particle [ 0 ] -> setVel ( 0, 0, 0 ) ; + particle [ 1 ] -> setVel ( 0, 0, 30 ) ; + particle [ 2 ] -> setVel ( 0, 0, 0 ) ; + particle [ 3 ] -> setVel ( 0, 0, 0 ) ; + particle [ 4 ] -> setVel ( 0, 0, 0 ) ; + particle [ 5 ] -> setVel ( 0, 0, 0 ) ; + particle [ 6 ] -> setVel ( 0, 0, 0 ) ; +} + void initSMD () { particle [ 0 ] = new sgParticle ( 1.0f, 2.0f, -4.0f, 4.0f ) ; @@ -101,7 +120,12 @@ if ( particle [ i ] -> getPos()[2] <= 0.0f ) { particle [ i ] -> getPos ()[2] = 0.0f ; - particle [ i ] -> getVel ()[2] = 0.0f ; + + if ( particle [ i ] -> getVel ()[2] < 0.0f ) + particle [ i ] -> getVel ()[2] = 0.0f ; + + if ( particle [ i ] -> getForce ()[2] < 0.0f ) + particle [ i ] -> getForce ()[2] = 0.0f ; } particle [ i ] -> update ( dt ) ; @@ -155,6 +179,7 @@ switch ( key ) { case 0x03 : exit ( 0 ) ; + default : resetSMD () ; break ; } } |
From: Sebastian U. <ud...@us...> - 2002-08-11 18:20:40
|
Update of /cvsroot/plib/plib/examples In directory usw-pr-cvs1:/tmp/cvs-serv6583 Modified Files: plib_examples.dsw Log Message: Added "water" and "dynamics" examples Index: plib_examples.dsw =================================================================== RCS file: /cvsroot/plib/plib/examples/plib_examples.dsw,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- plib_examples.dsw 8 May 2002 21:02:38 -0000 1.20 +++ plib_examples.dsw 11 Aug 2002 18:20:37 -0000 1.21 @@ -188,6 +188,12 @@ Begin Project Dependency Project_Dep_Name widget_list End Project Dependency + Begin Project Dependency + Project_Dep_Name water + End Project Dependency + Begin Project Dependency + Project_Dep_Name dynamics + End Project Dependency }}} ############################################################################### @@ -349,6 +355,30 @@ ############################################################################### Project: "tween_test"=.\src\ssg\tween_test\tween_test.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "water"=.\src\ssg\water\water.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Project: "dynamics"=.\src\ssg\dynamics\dynamics.dsp - Package Owner=<4> Package=<5> {{{ |
From: Steve B. <sj...@us...> - 2002-08-11 18:20:33
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv6343/plib/src/sg Modified Files: sg.h Log Message: Dynamics demo now looks cool. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- sg.h 11 Aug 2002 17:53:49 -0000 1.41 +++ sg.h 11 Aug 2002 18:20:30 -0000 1.42 @@ -2674,8 +2674,8 @@ sgParticle ( float mass, float x = 0.0f, float y = 0.0f, float z = 0.0f ) { - setMass ( mass ) ; - sgSetVec3 ( pos, x, y, z) ; + setMass ( mass ) ; + sgSetVec3 ( pos, x, y, z ) ; sgZeroVec3 ( vel ) ; sgZeroVec3 ( force ) ; } @@ -2686,14 +2686,13 @@ float getOneOverMass () { return ooMass ; } float getMass () { return 1.0f / ooMass ; } - void setPos ( sgVec3 p ) { sgCopyVec3 ( pos , p ) ; } - void setVel ( sgVec3 v ) { sgCopyVec3 ( vel , v ) ; } - void setForce ( sgVec3 f ) { sgCopyVec3 ( force, f ) ; } - + void setPos ( sgVec3 p ) { sgCopyVec3 ( pos , p ) ; } + void setVel ( sgVec3 v ) { sgCopyVec3 ( vel , v ) ; } + void setForce ( sgVec3 f ) { sgCopyVec3 ( force, f ) ; } void setOneOverMass ( float oom ) { ooMass = oom ; } - void setMass ( float m ) + void setMass ( float m ) { assert ( m > 0.0f ) ; ooMass = 1.0f / m ; |
From: Steve B. <sj...@us...> - 2002-08-11 18:20:33
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv6343/plib/examples/src/ssg/dynamics Modified Files: dynamics.cxx Log Message: Dynamics demo now looks cool. Index: dynamics.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/dynamics/dynamics.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dynamics.cxx 11 Aug 2002 17:53:49 -0000 1.1 +++ dynamics.cxx 11 Aug 2002 18:20:30 -0000 1.2 @@ -31,9 +31,9 @@ void initSMD () { - particle [ 0 ] = new sgParticle ( 1.0f, 4.0f, -4.0f, 4.0f ) ; - particle [ 1 ] = new sgParticle ( 1.0f, 8.0f, 0.0f, 4.0f ) ; - particle [ 2 ] = new sgParticle ( 1.0f, 4.0f, 4.0f, 4.0f ) ; + particle [ 0 ] = new sgParticle ( 1.0f, 2.0f, -4.0f, 4.0f ) ; + particle [ 1 ] = new sgParticle ( 1.0f, 2.4f, 0.0f, 6.0f ) ; + particle [ 2 ] = new sgParticle ( 1.0f, 2.0f, 4.0f, 4.0f ) ; particle [ 3 ] = new sgParticle ( 1.0f, 4.0f, -4.0f, 0.0f ) ; particle [ 4 ] = new sgParticle ( 1.0f, 0.0f, -4.0f, 0.0f ) ; particle [ 5 ] = new sgParticle ( 1.0f, 4.0f, 4.0f, 0.0f ) ; @@ -41,23 +41,28 @@ num_particles = 7 ; - spring [ 0] = new sgSpringDamper ( particle[0], particle[1], 0.1f, 1.0f ) ; - spring [ 1] = new sgSpringDamper ( particle[0], particle[2], 0.1f, 1.0f ) ; - spring [ 2] = new sgSpringDamper ( particle[0], particle[3], 0.1f, 1.0f ) ; - spring [ 3] = new sgSpringDamper ( particle[0], particle[4], 0.1f, 1.0f ) ; - spring [ 4] = new sgSpringDamper ( particle[0], particle[5], 0.1f, 1.0f ) ; - spring [ 5] = new sgSpringDamper ( particle[1], particle[2], 0.1f, 1.0f ) ; - spring [ 6] = new sgSpringDamper ( particle[2], particle[3], 0.1f, 1.0f ) ; - spring [ 7] = new sgSpringDamper ( particle[2], particle[5], 0.1f, 1.0f ) ; - spring [ 8] = new sgSpringDamper ( particle[2], particle[6], 0.1f, 1.0f ) ; - spring [ 9] = new sgSpringDamper ( particle[3], particle[4], 0.1f, 1.0f ) ; - spring [10] = new sgSpringDamper ( particle[3], particle[5], 0.1f, 1.0f ) ; - spring [11] = new sgSpringDamper ( particle[4], particle[6], 0.1f, 1.0f ) ; - spring [12] = new sgSpringDamper ( particle[5], particle[6], 0.1f, 1.0f ) ; - spring [13] = new sgSpringDamper ( particle[3], particle[6], 0.1f, 1.0f ) ; - spring [14] = new sgSpringDamper ( particle[4], particle[5], 0.1f, 1.0f ) ; + int s=0; - num_springs = 15 ; + spring [s++] = new sgSpringDamper ( particle[0], particle[1], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[0], particle[2], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[0], particle[3], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[0], particle[4], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[0], particle[5], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[1], particle[2], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[2], particle[3], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[2], particle[5], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[2], particle[6], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[3], particle[4], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[3], particle[5], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[4], particle[6], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[5], particle[6], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[3], particle[6], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[4], particle[5], 50.0f, 1.0f ) ; + + spring [s++] = new sgSpringDamper ( particle[2], particle[4], 50.0f, 1.0f ) ; + spring [s++] = new sgSpringDamper ( particle[0], particle[6], 50.0f, 1.0f ) ; + + num_springs = s ; for ( int i = 0 ; i < num_particles ; i++ ) { @@ -78,14 +83,14 @@ { sgVec3 friction ; - sgScaleVec3 ( friction, particle[i]->getVel (), -1.0 ) ; + sgScaleVec3 ( friction, particle[i]->getVel (), 0.1 ) ; if ( particle [ i ] -> getPos()[2] <= 0.0f ) particle [ i ] -> zeroForce () ; else particle [ i ] -> gravityOnly () ; -// particle [ i ] -> addForce ( friction ) ; + particle [ i ] -> subForce ( friction ) ; } for ( int i = 0 ; i < num_springs ; i++ ) @@ -119,8 +124,12 @@ float t = ck . getAbsTime () ; float dt = ck . getDeltaTime () ; + + if ( dt > 0.05f ) dt = 0.05f ; + ocean -> updateAnimation ( t ) ; - updateSMD ( dt/10.0f ) ; + + updateSMD ( dt ) ; } |
From: Sebastian U. <ud...@us...> - 2002-08-11 18:13:01
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv3678 Added Files: dynamics.dsp Log Message: Added MSVC project file for the "dynamics" example --- NEW FILE: dynamics.dsp --- # Microsoft Developer Studio Project File - Name="dynamics" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=dynamics - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "dynamics.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "dynamics.mak" CFG="dynamics - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "dynamics - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "dynamics - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "dynamics" # PROP Scc_LocalPath "." CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "dynamics - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssgAux.lib ssg.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"dynamics.exe" /libpath:"..\..\..\..\..\plib" !ELSEIF "$(CFG)" == "dynamics - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ssgAux_d.lib ssg_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"dynamics.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib" !ENDIF # Begin Target # Name "dynamics - Win32 Release" # Name "dynamics - Win32 Debug" # Begin Source File SOURCE=.\dynamics.cxx # End Source File # End Target # End Project |
From: Steve B. <sj...@us...> - 2002-08-11 17:57:37
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics/data In directory usw-pr-cvs1:/tmp/cvs-serv31181/plib/examples/src/ssg/dynamics/data Added Files: bw.rgb mg.rgb Log Message: Added two missing texture maps. --- NEW FILE: bw.rgb --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mg.rgb --- (This appears to be a binary file; contents omitted.) |
From: Sebastian U. <ud...@us...> - 2002-08-11 17:53:55
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv29982 Modified Files: puPopupMenu.cxx Log Message: Frederic Bouvier: Fixed bug in checkHit () Index: puPopupMenu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puPopupMenu.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- puPopupMenu.cxx 3 Aug 2002 22:44:48 -0000 1.13 +++ puPopupMenu.cxx 11 Aug 2002 17:53:49 -0000 1.14 @@ -191,7 +191,7 @@ return FALSE ; puObject *bo ; - int objecthit ; + int objecthit = FALSE ; /* We have to walk the list backwards to ensure that the click order is the same as the DRAW order. |
From: Steve B. <sj...@us...> - 2002-08-11 17:53:52
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv29899/plib/src/sg Modified Files: sg.h Log Message: Lots of Typo's. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- sg.h 11 Aug 2002 16:18:40 -0000 1.40 +++ sg.h 11 Aug 2002 17:53:49 -0000 1.41 @@ -2701,6 +2701,7 @@ void zeroForce () { sgZeroVec3 ( force ) ; } void addForce ( sgVec3 f ) { sgAddVec3 ( force, f ) ; } + void subForce ( sgVec3 f ) { sgSubVec3 ( force, f ) ; } void gravityOnly () { sgScaleVec3 ( force, sgGetGravityVec3 (), ooMass ) ; } void update ( float dt ) @@ -2775,10 +2776,10 @@ float H = ( L - restLength ) * stiffness ; float D = sgScalarProductVec3 ( dV, dP ) * damping / L ; - sgVec3 F ; sgScaleVec3 ( dP, - ( H + D ) / L ) ; + sgVec3 F ; sgScaleVec3 ( F, dP, - ( H + D ) / L ) ; p0 -> addForce ( F ) ; - p1 -> addForce ( F ) ; + p1 -> subForce ( F ) ; } } ; |
From: Steve B. <sj...@us...> - 2002-08-11 17:53:52
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv29899/plib/examples/src/ssg/dynamics Added Files: Makefile.am dynamics.cxx Log Message: Lots of Typo's. --- NEW FILE: Makefile.am --- noinst_PROGRAMS = dynamics dynamics_SOURCES = dynamics.cxx dynamics_LDADD = -lplibpu -lplibfnt -lplibssgaux -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS) EXTRA_DIST = dynamics.dsp --- NEW FILE: dynamics.cxx --- #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #ifdef WIN32 #include <windows.h> #else #include <unistd.h> #endif #include <math.h> #include <plib/ssg.h> #include <plib/ssgAux.h> #include <GL/glut.h> #define GUI_BASE 80 #define VIEW_GUI_BASE 20 #define FONT_COLOUR 1,1,1,1 ssgRoot *scene = NULL ; [...298 lines suppressed...] scene -> addKid ( ocean ) ; initSMD () ; } /* The works. */ int main ( int, char ** ) { init_graphics () ; load_database () ; glutMainLoop () ; return 0 ; } |
From: Steve B. <sj...@us...> - 2002-08-11 17:53:51
|
Update of /cvsroot/plib/plib/examples/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv29899/plib/examples/src/ssg Modified Files: Makefile.am README Log Message: Lots of Typo's. Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 4 Aug 2002 05:53:44 -0000 1.5 +++ Makefile.am 11 Aug 2002 17:53:49 -0000 1.6 @@ -1,3 +1,3 @@ -SUBDIRS = tux majik load_save state_test viewer tween_test water +SUBDIRS = tux majik load_save state_test viewer tween_test water dynamics EXTRA_DIST = README Index: README =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 13 Jul 2000 04:07:09 -0000 1.1 +++ README 11 Aug 2002 17:53:49 -0000 1.2 @@ -11,3 +11,8 @@ make a viewer for large area terrain. It's pretty basic. +Water -- A demo of some ssgAux stuff - waves, particle-systems + a teapot and a cube. + +Dynamics -- Spring/Mass/Damper demo. + |
From: Steve B. <sj...@us...> - 2002-08-11 17:53:51
|
Update of /cvsroot/plib/plib/examples In directory usw-pr-cvs1:/tmp/cvs-serv29899/plib/examples Modified Files: configure.in Log Message: Lots of Typo's. Index: configure.in =================================================================== RCS file: /cvsroot/plib/plib/examples/configure.in,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- configure.in 4 Aug 2002 05:53:43 -0000 1.25 +++ configure.in 11 Aug 2002 17:53:48 -0000 1.26 @@ -201,6 +201,7 @@ src/ssg/tween_test/Makefile \ src/ssg/viewer/Makefile \ src/ssg/water/Makefile \ + src/ssg/dynamics/Makefile \ src/fnt/Makefile \ src/net/Makefile \ src/net/client_server/Makefile \ |
From: Steve B. <sj...@us...> - 2002-08-11 17:53:51
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv29899/plib/doc/sg Modified Files: index.html Log Message: Lots of Typo's. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- index.html 11 Aug 2002 14:48:50 -0000 1.14 +++ index.html 11 Aug 2002 17:53:48 -0000 1.15 @@ -893,6 +893,8 @@ class sgParticle { sgParticle ( float mass ) ; + sgParticle ( float mass, float x, float y, float z ) ; + sgParticle ( float mass, sgVec3 position ) ; float *getPos () ; float *getVel () ; @@ -916,7 +918,10 @@ particles mass, position, velocity and the total force that's applied to it, you can also zero the force (a usual thing to do at the start of each cycle) or set the force equal to normal gravity, or you can add a force to whatever -is currently being applied. +is currently being applied. The constructor function requires that you +pass in the mass and (optionally) the initial position. The mass of a +particle cannot ever be zero because you'll get divide-by-zero errors +all over the place if you do. <pre> class sgSpringDamper |
From: Steve B. <sj...@us...> - 2002-08-11 16:23:18
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics/data In directory usw-pr-cvs1:/tmp/cvs-serv2004/data Log Message: Directory /cvsroot/plib/plib/examples/src/ssg/dynamics/data added to the repository |
From: Steve B. <sj...@us...> - 2002-08-11 16:19:25
|
Update of /cvsroot/plib/plib/examples/src/ssg/dynamics In directory usw-pr-cvs1:/tmp/cvs-serv1052/dynamics Log Message: Directory /cvsroot/plib/plib/examples/src/ssg/dynamics added to the repository |
From: Steve B. <sj...@us...> - 2002-08-11 16:18:43
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv848/plib/src/sg Modified Files: sg.h Log Message: Added a more friendly constructor for sgParticle. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- sg.h 11 Aug 2002 14:48:50 -0000 1.39 +++ sg.h 11 Aug 2002 16:18:40 -0000 1.40 @@ -2664,10 +2664,18 @@ public: - sgParticle ( float mass ) + sgParticle ( float mass, sgVec3 _pos ) { - setMass ( mass ) ; - sgZeroVec3 ( pos ) ; + setMass ( mass ) ; + sgCopyVec3 ( pos, _pos ) ; + sgZeroVec3 ( vel ) ; + sgZeroVec3 ( force ) ; + } + + sgParticle ( float mass, float x = 0.0f, float y = 0.0f, float z = 0.0f ) + { + setMass ( mass ) ; + sgSetVec3 ( pos, x, y, z) ; sgZeroVec3 ( vel ) ; sgZeroVec3 ( force ) ; } |