plib-cvs Mailing List for PLIB (Page 46)
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-11 14:48:54
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv9317/plib/src/sg Modified Files: sg.h Log Message: Added documentation, inlined some functions. Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- sg.h 11 Aug 2002 14:11:18 -0000 1.38 +++ sg.h 11 Aug 2002 14:48:50 -0000 1.39 @@ -2649,10 +2649,10 @@ extern sgVec3 _sgGravity ; -void sgSetGravity ( float g ) { sgSetVec3 ( _sgGravity, 0.0f, 0.0f, -g ) ; } -void sgSetGravityVec3 ( sgVec3 g ) { sgCopyVec3 ( _sgGravity, g ) ; } -float *sgGetGravityVec3 () { return _sgGravity ; } -float sgGetGravity () { return - _sgGravity[2] ; } +inline void sgSetGravity ( float g ) { sgSetVec3 ( _sgGravity, 0.0f, 0.0f, -g ) ; } +inline void sgSetGravityVec3 ( sgVec3 g ) { sgCopyVec3 ( _sgGravity, g ) ; } +inline float *sgGetGravityVec3 () { return _sgGravity ; } +inline float sgGetGravity () { return - _sgGravity[2] ; } class sgParticle |
From: Steve B. <sj...@us...> - 2002-08-11 14:48:54
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv9317/plib/doc/sg Modified Files: index.html Log Message: Added documentation, inlined some functions. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- index.html 13 Jun 2002 05:53:02 -0000 1.13 +++ index.html 11 Aug 2002 14:48:50 -0000 1.14 @@ -870,6 +870,153 @@ void sgSetMat4 ( sgMat4 dst, sgdMat4 src ) ; void sgSetCoord ( sgCoord *dst, sgdCoord *src ) ; </pre> +<H3>Spring/Mass/Damper model.</H3> +Many applications can greatly benefit from some simple dynamics +modelling. SG includes two classes that taken together implement +a standard Spring-Mass-Damper model with Euler integration. +<pre> + + class sgParticle ; + class sgSpringDamper ; [...122 lines suppressed...] +accelleration due to gravity - and assume Z-is-up. But the 'Vec3' versions +make neither of those assumptions - so make sure the vector you give points +DOWNWARDS! +<p> +eg +<pre> + + sgSetGravity ( 1.6 ) ; /* On the Moon! */ + +</pre> +...but... +<pre> + + sgSetVec3 ( lunar_gravity, 0.0, 0.0, -1.6 ) ; /* Note minus sign! */ + sgSetGravityVec3 ( lunar_gravity ) ; + +</pre> <hr> <H2>Credits.</H2> Thanks to <A HREF="mailto:kev...@ya...">Kevin Thompson</A> |
From: Steve B. <sj...@us...> - 2002-08-11 14:11:22
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv30678/plib/src/sg Modified Files: sg.h Log Message: Oops! Committed the wrong version! Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- sg.h 11 Aug 2002 14:07:09 -0000 1.37 +++ sg.h 11 Aug 2002 14:11:18 -0000 1.38 @@ -2675,8 +2675,8 @@ float *getPos () { return pos ; } float *getVel () { return vel ; } float *getForce () { return force ; } - float *getOneOverMass () { return ooMass ; } - float *getMass () { return 1.0f / ooMass ; } + float getOneOverMass () { return ooMass ; } + float getMass () { return 1.0f / ooMass ; } void setPos ( sgVec3 p ) { sgCopyVec3 ( pos , p ) ; } void setVel ( sgVec3 v ) { sgCopyVec3 ( vel , v ) ; } @@ -2693,7 +2693,7 @@ void zeroForce () { sgZeroVec3 ( force ) ; } void addForce ( sgVec3 f ) { sgAddVec3 ( force, f ) ; } - void gravityOnly () { sgScaleVec3 ( force, sgGetGravity (), ooMass ) ; } + void gravityOnly () { sgScaleVec3 ( force, sgGetGravityVec3 (), ooMass ) ; } void update ( float dt ) { |
From: Steve B. <sj...@us...> - 2002-08-11 14:07:12
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv29374/plib/src/sg Modified Files: sg.cxx sg.h Log Message: Added a simple Spring/Mass/Damper model to SG. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- sg.cxx 14 Jun 2002 04:38:23 -0000 1.34 +++ sg.cxx 11 Aug 2002 14:07:09 -0000 1.35 @@ -24,6 +24,8 @@ #include "sg.h" +sgVec3 _sgGravity = { 0.0f, 0.0f, -9.8f } ; + void sgVectorProductVec3 ( sgVec3 dst, const sgVec3 a, const sgVec3 b ) { dst[0] = a[1] * b[2] - a[2] * b[1] ; Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- sg.h 14 Jun 2002 04:38:23 -0000 1.36 +++ sg.h 11 Aug 2002 14:07:09 -0000 1.37 @@ -2642,5 +2642,139 @@ void sgdTriangleSolver_SAAtoASS(SGDfloat lenA,SGDfloat angB,SGDfloat angA, SGDfloat *angC,SGDfloat *lenB,SGDfloat *lenC ) ; +/* + SPRING-MASS-DAMPER (with simple Euler integrator) +*/ + + +extern sgVec3 _sgGravity ; + +void sgSetGravity ( float g ) { sgSetVec3 ( _sgGravity, 0.0f, 0.0f, -g ) ; } [...108 lines suppressed...] + void update () + { + sgVec3 dP ; sgSubVec3 ( dP, p0->getPos(), p1->getPos() ) ; + sgVec3 dV ; sgSubVec3 ( dV, p0->getVel(), p1->getVel() ) ; + + float L = sgLengthVec3 ( dP ) ; if ( L == 0.0f ) L = 0.0000001 ; + float H = ( L - restLength ) * stiffness ; + float D = sgScalarProductVec3 ( dV, dP ) * damping / L ; + + sgVec3 F ; sgScaleVec3 ( dP, - ( H + D ) / L ) ; + + p0 -> addForce ( F ) ; + p1 -> addForce ( F ) ; + } + +} ; + + #endif |
From: Sebastian U. <ud...@us...> - 2002-08-10 08:57:39
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv12224 Modified Files: Makefile.am water.dsp Log Message: Added MSVC project file for "water" demo Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 6 Aug 2002 18:44:34 -0000 1.2 +++ Makefile.am 10 Aug 2002 08:57:36 -0000 1.3 @@ -4,5 +4,5 @@ water_LDADD = -lplibpu -lplibfnt -lplibssgaux -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS) -EXTRA_DIST = water.dsp +EXTRA_DIST = water.dsp README Index: water.dsp =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- water.dsp 4 Aug 2002 06:01:04 -0000 1.1 +++ water.dsp 10 Aug 2002 08:57:36 -0000 1.2 @@ -1,34 +1,34 @@ -# Microsoft Developer Studio Project File - Name="tux_example" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="water" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 -CFG=tux_example - Win32 Debug +CFG=water - 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 "tux_example.mak". +!MESSAGE NMAKE /f "water.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 "tux_example.mak" CFG="tux_example - Win32 Debug" +!MESSAGE NMAKE /f "water.mak" CFG="water - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "tux_example - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "tux_example - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "water - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "water - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "tux_example" +# PROP Scc_ProjName "water" # PROP Scc_LocalPath "." CPP=cl.exe RSC=rc.exe -!IF "$(CFG)" == "tux_example - Win32 Release" +!IF "$(CFG)" == "water - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 @@ -50,9 +50,9 @@ # 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 ssg.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"tux_example.exe" /libpath:"..\..\..\..\..\plib" +# 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 pui.lib fnt.lib ssgAux.lib ssg.lib sg.lib ul.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /machine:I386 /out:"water.exe" /libpath:"..\..\..\..\..\plib" -!ELSEIF "$(CFG)" == "tux_example - Win32 Debug" +!ELSEIF "$(CFG)" == "water - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 @@ -74,17 +74,17 @@ # 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 ssg_d.lib sg_d.lib ul_d.lib opengl32.lib glu32.lib glut32.lib /nologo /subsystem:console /debug /machine:I386 /out:"tux_example.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib" +# 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 pui_d.lib fnt_d.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:"water.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib" !ENDIF # Begin Target -# Name "tux_example - Win32 Release" -# Name "tux_example - Win32 Debug" +# Name "water - Win32 Release" +# Name "water - Win32 Debug" # Begin Source File -SOURCE=.\tux_example.cxx +SOURCE=.\water.cxx # End Source File # End Target # End Project |
From: Sebastian U. <ud...@us...> - 2002-08-10 08:45:24
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv8804 Modified Files: ssgAux.dsp Log Message: Updated for ssgaParticleSystem and ssgaWaveSystem Index: ssgAux.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgAux.dsp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ssgAux.dsp 17 Jan 2002 16:42:32 -0000 1.13 +++ ssgAux.dsp 10 Aug 2002 08:45:20 -0000 1.14 @@ -54,7 +54,7 @@ # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Copy Library to plib directory -PostBuild_Cmds=copy release\*.lib ..\..\*.* copy ssgAux.h ..\..\ssgAux.h copy ssgaShapes.h ..\..\ssgaShapes.h +PostBuild_Cmds=copy release\*.lib ..\..\*.* copy ssgAux.h ..\..\ssgAux.h copy ssgaShapes.h ..\..\ssgaShapes.h copy ssgaParticleSystem.h ..\..\ssgaParticleSystem.h copy ssgaWaveSystem.h ..\..\ssgaWaveSystem.h # End Special Build Tool !ELSEIF "$(CFG)" == "ssgAux - Win32 Debug" @@ -83,7 +83,7 @@ # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Desc=Copy Library to plib directory -PostBuild_Cmds=copy debug\*.lib ..\..\*.* copy ssgAux.h ..\..\ssgAux.h copy ssgaShapes.h ..\..\ssgaShapes.h copy ssgaParticleSystem.h ..\..\ssgaParticleSystem.h +PostBuild_Cmds=copy debug\*.lib ..\..\*.* copy ssgAux.h ..\..\ssgAux.h copy ssgaShapes.h ..\..\ssgaShapes.h copy ssgaParticleSystem.h ..\..\ssgaParticleSystem.h copy ssgaWaveSystem.h ..\..\ssgaWaveSystem.h # End Special Build Tool !ENDIF @@ -97,6 +97,10 @@ # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File +SOURCE=.\ssgaParticleSystem.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgaPatch.cxx # End Source File # Begin Source File @@ -109,6 +113,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgaWaveSystem.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgAux.cxx # End Source File # End Group @@ -117,7 +125,15 @@ # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File +SOURCE=.\ssgaParticleSystem.h +# End Source File +# Begin Source File + SOURCE=.\ssgaShapes.h +# End Source File +# Begin Source File + +SOURCE=.\ssgaWaveSystem.h # End Source File # Begin Source File |
From: Steve B. <sj...@us...> - 2002-08-09 19:55:48
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv22621/plib/src/ssgAux Modified Files: ssgaWaveSystem.cxx Log Message: Added water depth effects into GUI. Made space bar toggle the GUI. Fixed a problem with water depth in the ssgAux code. Index: ssgaWaveSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ssgaWaveSystem.cxx 8 Aug 2002 00:59:16 -0000 1.6 +++ ssgaWaveSystem.cxx 9 Aug 2002 19:55:45 -0000 1.7 @@ -93,9 +93,8 @@ for ( int t = 0 ; t < num_trains ; t++ ) { float adjHeight = height [ t ] * edge_fade ; - float adjLength = ( depth < 0.0f ) ? 0.5f : - ( depth > 1.0f ) ? length[t] : - length[t] * depth + 0.5f * (1.0f - depth) ; + float adjLength = ( depth < 0.2f ) ? 0.2f : + ( depth > length[t] ) ? length[t] : depth ; float phase = ( x0 * sinHeading[t] + y0 * cosHeading[t] ) / adjLength - adjSpeed[t] - lambda[t] * z0 ; |
From: Steve B. <sj...@us...> - 2002-08-09 19:55:48
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv22621/plib/examples/src/ssg/water Modified Files: README water.cxx Log Message: Added water depth effects into GUI. Made space bar toggle the GUI. Fixed a problem with water depth in the ssgAux code. Index: README =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 6 Aug 2002 20:54:51 -0000 1.2 +++ README 9 Aug 2002 19:55:44 -0000 1.3 @@ -32,12 +32,21 @@ the height of the wave and a 'curl' term (which controls how much the tops of the waves bend over). +The appearance of waves varies greatly with the depth of the +water - and this simulation produces the correct effects. There +are a number of preset water depths that you can select between, +notice that the effect of varying the depth is more pronounced +for long Wave Lengths. + There are also controls to set the eyepoint pan/tilt/range and to toggle the system into wireframe. 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 with the three sliders in the bottom right. + +Hitting the space bar toggles the GUI on and off so you can see +your creation without any clutter on the screen. Finally, when you have your waves exactly how you like them, hit the 'Write C++' button and a C++ subroutine to recreate the Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- water.cxx 8 Aug 2002 00:59:16 -0000 1.12 +++ water.cxx 9 Aug 2002 19:55:44 -0000 1.13 @@ -29,6 +29,8 @@ puSelectBox *trainSelectBox = (puSelectBox *) NULL ; puText *timeText = (puText *) NULL ; +puSelectBox *depthSelectBox = (puSelectBox *) NULL ; + puDial *viewHeadingDial = (puDial *) NULL ; puDial *viewPitchDial = (puDial *) NULL ; puSlider *viewRangeSlider = (puSlider *) NULL ; @@ -65,7 +67,9 @@ } ; [...153 lines suppressed...] ocean -> setWindSpeed ( 10.0f ) ; ocean -> setWaveTrain ( 0, & trains[0] ) ; @@ -663,6 +757,17 @@ /* Set everything up on the first time around */ trainSelectBox_cb ( trainSelectBox ) ; + + depthSelectBox = new puSelectBox ( 193, GUI_BASE, 400, GUI_BASE+20, + depthNames ) ; + depthSelectBox->setCallback ( depthSelectBox_cb ) ; + depthSelectBox->setCurrentItem ( 0 ) ; + depthSelectBox->setLabel ( "Water Depth" ) ; + depthSelectBox->setLabelPlace ( PUPLACE_CENTERED_LEFT ) ; + depthSelectBox->setColour( PUCOL_LABEL, FONT_COLOUR ) ; + + /* Set everything up on the first time around */ + depthSelectBox_cb ( depthSelectBox ) ; viewHeadingDial = new puDial ( 50, VIEW_GUI_BASE, 50 ) ; viewHeadingDial->setValue ( 0.0f ) ; |
From: Steve B. <sj...@us...> - 2002-08-08 00:59:19
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv6559/plib/src/ssgAux Modified Files: ssgaWaveSystem.cxx Log Message: Optimised a little. Changed menu colour. Index: ssgaWaveSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ssgaWaveSystem.cxx 6 Aug 2002 18:44:35 -0000 1.5 +++ ssgaWaveSystem.cxx 8 Aug 2002 00:59:16 -0000 1.6 @@ -38,18 +38,30 @@ int i ; - float adjSpeed [ SSGA_MAX_WAVETRAIN ] ; + float adjSpeed [ SSGA_MAX_WAVETRAIN ] ; float sinHeading [ SSGA_MAX_WAVETRAIN ] ; float cosHeading [ SSGA_MAX_WAVETRAIN ] ; + float length [ SSGA_MAX_WAVETRAIN ] ; + float lambda [ SSGA_MAX_WAVETRAIN ] ; + float height [ SSGA_MAX_WAVETRAIN ] ; [...104 lines suppressed...] - int idx = (i+1) * (nstrips+1) + j ; - - vv -> set ( vertices [idx], jj ) ; nn -> set ( normals [idx], jj ) ; - cc -> set ( colours [idx], jj ) ; tt -> set ( texcoords[idx], jj ) ; - - idx = i * (nstrips+1) + j ; + int i1 = (i+1) * (nstrips+1) ; + int i2 = i * (nstrips+1) ; - vv -> set ( vertices [idx], jj+1 ) ; nn -> set ( normals [idx], jj+1 ) ; - cc -> set ( colours [idx], jj+1 ) ; tt -> set ( texcoords[idx], jj+1 ) ; + for ( int j = 0, jj = 0 ; j < nstacks + 1 ; j++, jj += 2, i1++, i2++ ) + { + vv -> set ( vertices [i1], jj ) ; vv -> set ( vertices [i2], jj+1 ) ; + nn -> set ( normals [i1], jj ) ; nn -> set ( normals [i2], jj+1 ) ; + cc -> set ( colours [i1], jj ) ; cc -> set ( colours [i2], jj+1 ) ; + tt -> set ( texcoords[i1], jj ) ; tt -> set ( texcoords[i2], jj+1 ) ; } } } |
From: Steve B. <sj...@us...> - 2002-08-08 00:59:19
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv6559/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Optimised a little. Changed menu colour. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- water.cxx 6 Aug 2002 22:18:19 -0000 1.11 +++ water.cxx 8 Aug 2002 00:59:16 -0000 1.12 @@ -415,9 +415,9 @@ static void droplet_create ( SPS *, int, ssgaParticle *p ) { - float c = 0.6 + (float)(rand()%1000)/4000.0f ; + float c = ((float)(rand()%100)/100.0f) * (256.0f-163.0f)/255.0f ; - sgSetVec4 ( p -> col, c - 0.2f, c, 1, 0.5 ) ; + sgSetVec4 ( p -> col, 96.0f/255.0f+c, 147.0f/255.0f+c, 163.0f/255.0f+c, 0.5); sgSetVec3 ( p -> pos, -2.4, -0.1, 1.9 ) ; sgSetVec3 ( p -> vel, -(float)(rand()%1000)/200.0f, @@ -586,7 +586,7 @@ puSetDefaultFonts ( *sorority, *sorority ) ; puSetDefaultStyle ( PUSTYLE_SMALL_SHADED ) ; - puSetDefaultColourScheme ( 1.0, 0.6, 0.2, 0.5 ) ; + puSetDefaultColourScheme ( 0.2, 0.5, 0.2, 0.5 ) ; puGroup *window_group = new puGroup ( 0, 0 ) ; @@ -703,7 +703,7 @@ viewWireframeButton->setCallback ( viewWireframeButton_cb ) ; viewWireframeButton->setValue ( FALSE ) ; - writeButton = new puOneShot ( 400, VIEW_GUI_BASE + 20, "Write C++" ) ; + writeButton = new puOneShot ( 400, VIEW_GUI_BASE + 30, "Write C++" ) ; writeButton->setCallback ( writeButton_cb ) ; writeButton->setValue ( FALSE ) ; |
From: Will L. <lac...@us...> - 2002-08-07 06:15:27
|
Update of /cvsroot/plib/plib/doc/ssg In directory usw-pr-cvs1:/tmp/cvs-serv5903 Modified Files: non_class.html Log Message: adding yet more information on VRML1/IV Index: non_class.html =================================================================== RCS file: /cvsroot/plib/plib/doc/ssg/non_class.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- non_class.html 7 Aug 2002 06:08:00 -0000 1.27 +++ non_class.html 7 Aug 2002 06:15:24 -0000 1.28 @@ -190,6 +190,8 @@ <li> ssgLoadOFF - Geomview's OFF <li> ssgLoadM - ??? <li> ssgLoadATG - Ascii TerraGear. Used by Flight Gear Flight Sim. +<li> ssgLoadVRML1 - VRML1 format, only partially implemented. +<li> ssgLoadIV - Inventor format, only partially implemented. <li> ssgLoadStrip - The format of a stripifier. </ul> @@ -946,6 +948,12 @@ If you convert files into .X with "3D Exploration", you can check the option "without frames". +<BR><BR> +VRML1/IV file loaders: +<BR> +These are only partially implemented, and are useful primarily for +mesh-based models (textured or untextured). It would be useful to add +material support to these loaders, as well as explicit normal definition. <hr> <table width="100%"> |
From: Will L. <lac...@us...> - 2002-08-07 06:08:03
|
Update of /cvsroot/plib/plib/doc/ssg In directory usw-pr-cvs1:/tmp/cvs-serv3752 Modified Files: non_class.html Log Message: add information on the vrml and iv formats Index: non_class.html =================================================================== RCS file: /cvsroot/plib/plib/doc/ssg/non_class.html,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- non_class.html 17 Jan 2002 15:47:04 -0000 1.26 +++ non_class.html 7 Aug 2002 06:08:00 -0000 1.27 @@ -417,6 +417,8 @@ <td> Strip<BR>load</td> <td> TRI<BR>load/<BR>save</td> <td> X<BR>load</td> + <td> IV<BR>load</td> + <td> VRML1<BR>load</td> </tr> <tr> <td> Filled polys</td> @@ -439,6 +441,8 @@ <td> E</td> <td> </td> [...139 lines suppressed...] <tr> <td> Other switches</td> @@ -791,6 +825,8 @@ <td> A</td> <td> </td> <td> A</td> + <td> D</td> + <td> D</td> </tr> <tr> <td> A=Ascii or<BR>B=Binary</td> @@ -813,6 +849,8 @@ <td> ?</td> <td> A</td> <td> A+B(3)</td> + <td> A</td> + <td> A</td> </tr> </table> footnotes: |
From: Will L. <lac...@us...> - 2002-08-07 06:03:47
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv1594 Modified Files: ssgLoadVRML1.cxx ssgLoadIV.cxx ssgLoadVRML.h Log Message: Fix minor problem with errant named scene graph nodes, assigned copyright to Steve Baker Index: ssgLoadVRML1.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadVRML1.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ssgLoadVRML1.cxx 10 Jun 2002 16:34:32 -0000 1.8 +++ ssgLoadVRML1.cxx 7 Aug 2002 06:03:44 -0000 1.9 @@ -1,6 +1,6 @@ /* PLIB - A Suite of Portable Game Libraries - Copyright (C) 2001 William Lachance + Copyright (C) 2001, 2002 William Lachance, Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -558,7 +558,7 @@ if( currentData->getTransform() != NULL ) { - parentBranch->addKid( currentData->getTransform() ); // FIXME: in case we're reusing transforms, perhaps they should be reinstanced? (currently we don't allow transforms to be defed) + currentBranch->addKid( currentData->getTransform() ); // FIXME: in case we're reusing transforms, perhaps they should be reinstanced? (currently we don't allow transforms to be defed) loaderMesh->addToSSG( ss, currentOptions, currentData->getTransform() ); } else Index: ssgLoadIV.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadIV.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ssgLoadIV.cxx 10 Jun 2002 16:34:32 -0000 1.8 +++ ssgLoadIV.cxx 7 Aug 2002 06:03:44 -0000 1.9 @@ -1,6 +1,6 @@ /* PLIB - A Suite of Portable Game Libraries - Copyright (C) 2001 William Lachance + Copyright (C) 2001, 2002 William Lachance, Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -318,7 +318,7 @@ if( currentData->getTransform() != NULL ) { - parentBranch->addKid( currentData->getTransform() ); // FIXME: in case we're reusing transforms, perhaps they should be reinstanced? (currently we don't allow this) + currentBranch->addKid( currentData->getTransform() ); // FIXME: in case we're reusing transforms, perhaps they should be reinstanced? (currently we don't allow this) loaderMesh->addToSSG( ss, currentOptions, currentData->getTransform() ); } else Index: ssgLoadVRML.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadVRML.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ssgLoadVRML.h 10 Jun 2002 14:15:14 -0000 1.10 +++ ssgLoadVRML.h 7 Aug 2002 06:03:44 -0000 1.11 @@ -1,6 +1,6 @@ /* PLIB - A Suite of Portable Game Libraries - Copyright (C) 2001 William Lachance + Copyright (C) 2001, 2002 William Lachance, Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public |
From: Steve B. <sj...@us...> - 2002-08-06 22:18:24
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv18604/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Fixed C++ code writer. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- water.cxx 6 Aug 2002 20:57:27 -0000 1.10 +++ water.cxx 6 Aug 2002 22:18:19 -0000 1.11 @@ -77,7 +77,6 @@ printf ( "{\n" ) ; printf ( " ssgaWaveTrain *wavetrain ;\n" ) ; printf ( " ssgaWaveSystem *ocean ;\n" ) ; - printf ( " sgVec4 WHITE = { 1,1,1,1 } ;\n" ) ; printf ( " ocean = new ssgaWaveSystem ( %d ) ;\n", ocean->getNumTris() ) ; printf ( " ocean -> setSize ( %g ) ;\n", ocean->getSize()[0] ) ; printf ( " ocean -> setKidState ( state ) ;\n" ) ; @@ -96,7 +95,7 @@ printf ( " wavetrain->setLength ( %g ) ;\n",trains[i].getLength ()); printf ( " wavetrain->setLambda ( %g ) ;\n",trains[i].getLambda ()); printf ( " wavetrain->setHeading ( %g ) ;\n",trains[i].getHeading ()); - printf ( " wavetrain->getWaveHeight ( %g ) ;\n",trains[i].getWaveHeight()); + printf ( " wavetrain->setWaveHeight ( %g ) ;\n",trains[i].getWaveHeight()); printf ( " ocean -> setWaveTrain ( %d, wavetrain ) ;\n\n", i ) ; } |
From: Steve B. <sj...@us...> - 2002-08-06 20:57:31
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv11850/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Removed usleep. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- water.cxx 6 Aug 2002 20:54:51 -0000 1.9 +++ water.cxx 6 Aug 2002 20:57:27 -0000 1.10 @@ -352,7 +352,6 @@ glutPostRedisplay () ; glutSwapBuffers () ; - usleep ( 15000 ) ; } |
From: Steve B. <sj...@us...> - 2002-08-06 20:54:56
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv10617/plib/examples/src/ssg/water Modified Files: README water.cxx Log Message: Improved text legibility, added timing info. Index: README =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 6 Aug 2002 18:45:11 -0000 1.1 +++ README 6 Aug 2002 20:54:51 -0000 1.2 @@ -35,7 +35,13 @@ There are also controls to set the eyepoint pan/tilt/range and to toggle the system into wireframe. -Finally, you can determine the number of polygons used to render +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 with the three sliders in the bottom right. + +Finally, when you have your waves exactly how you like them, hit +the 'Write C++' button and a C++ subroutine to recreate the +exact same-looking waves will be written to stdout. + + Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- water.cxx 6 Aug 2002 19:26:18 -0000 1.8 +++ water.cxx 6 Aug 2002 20:54:51 -0000 1.9 @@ -15,6 +15,9 @@ #define GUI_BASE 80 #define VIEW_GUI_BASE 20 +#define FONT_COLOUR 1,1,1,1 + +ulClock *clock ; puSlider *trainLengthSlider = (puSlider *) NULL ; puSlider *trainSpeedSlider = (puSlider *) NULL ; @@ -24,6 +27,7 @@ puOneShot *trainDisableButton = (puOneShot *) NULL ; [...136 lines suppressed...] @@ -705,6 +729,7 @@ waveSizeSlider->setCallback ( waveSizeSlider_cb ) ; waveSizeSlider->setLabel ( "Size" ) ; waveSizeSlider->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ; + waveSizeSlider->setColour( PUCOL_LABEL, FONT_COLOUR ) ; wavePolycountSlider= new puSlider ( 500, VIEW_GUI_BASE+60, 90, false, 20 ) ; wavePolycountSlider->setValue ( 10000 ) ; @@ -715,7 +740,11 @@ wavePolycountSlider->setCallback ( wavePolycountSlider_cb ) ; wavePolycountSlider->setLabel ( "Polygons" ) ; wavePolycountSlider->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ; + wavePolycountSlider->setColour( PUCOL_LABEL, FONT_COLOUR ) ; + timeText = new puText ( 500, VIEW_GUI_BASE+80 ) ; + timeText->setColour( PUCOL_LABEL, FONT_COLOUR ) ; + window_group->close () ; } |
From: Steve B. <sj...@us...> - 2002-08-06 19:26:25
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv29786/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Much better initial setup. Ability to write out C++ code. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- water.cxx 6 Aug 2002 18:44:34 -0000 1.7 +++ water.cxx 6 Aug 2002 19:26:18 -0000 1.8 @@ -30,6 +30,8 @@ puSlider *viewRangeSlider = (puSlider *) NULL ; puButton *viewWireframeButton= (puButton *) NULL ; +puOneShot *writeButton = (puOneShot *) NULL ; + puSlider *waveTextureSlider = (puSlider *) NULL ; puSlider *waveSizeSlider = (puSlider *) NULL ; puSlider *wavePolycountSlider= (puSlider *) NULL ; @@ -64,6 +66,43 @@ sgCoord campos = { { 0, -20, 8 }, { 0, -30, 0 } } ; [...84 lines suppressed...] ocean = new ssgaWaveSystem ( 10000 ) ; ocean -> setColour ( WHITE ) ; - ocean -> setSize ( 50 ) ; - ocean -> setTexScale ( 8, 8 ) ; + ocean -> setSize ( 100 ) ; + ocean -> setTexScale ( 3, 3 ) ; ocean -> setCenter ( pos ) ; ocean -> setDepthCallback ( getDepth ) ; ocean -> setKidState ( sea_state ) ; @@ -632,6 +681,10 @@ viewWireframeButton= new puButton ( 400, VIEW_GUI_BASE, "Wireframe" ) ; viewWireframeButton->setCallback ( viewWireframeButton_cb ) ; viewWireframeButton->setValue ( FALSE ) ; + + writeButton = new puOneShot ( 400, VIEW_GUI_BASE + 20, "Write C++" ) ; + writeButton->setCallback ( writeButton_cb ) ; + writeButton->setValue ( FALSE ) ; waveTextureSlider = new puSlider ( 500, VIEW_GUI_BASE , 90, false, 20 ) ; waveTextureSlider->setValue ( 1.0f ) ; |
From: Steve B. <sj...@us...> - 2002-08-06 19:26:25
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv29786/plib/src/ssgAux Modified Files: ssgaWaveSystem.h Log Message: Much better initial setup. Ability to write out C++ code. Index: ssgaWaveSystem.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ssgaWaveSystem.h 6 Aug 2002 18:44:35 -0000 1.3 +++ ssgaWaveSystem.h 6 Aug 2002 19:26:19 -0000 1.4 @@ -92,6 +92,8 @@ float getWindSpeed () { return windSpeed ; } float getWindDirn () { return windHeading ; } float getEdgeFlatten () { return edgeFlatten ; } + float getTexScaleU () { return tu ; } + float getTexScaleV () { return tv ; } void setDepthCallback ( ssgaWSDepthCallback cb ) { gridGetter = cb ; } void setWindSpeed ( float speed ) { windSpeed = speed ; } |
From: Steve B. <sj...@us...> - 2002-08-06 18:45:15
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv10500/plib/examples/src/ssg/water Added Files: README Log Message: Added a README file. --- NEW FILE: README --- Designing Waves. ~~~~~~~~~~~~~~~~ The PLIB ssgAux library contains a class for handling water waves. class ssgaWaveSystem ; This generates a large polygonal mesh which it distorts in realtime to simulate water waves. The simulation uses between one and sixteen "Wave Trains" - each using a class: class ssgaWaveTrain ; The program in this directory demonstrates this system and allows you to play with the wave train parameters. Use the 'Edit Wave Train Number' widget to select which of the 16 wave trains you want to play with. There is a button just below that to enable or disable that particular wave train - and for convenience, there is a button to disable ALL wave trains. It's often convenient to turn on just one wave train at a time and set it's parameters - then combine two, three or more to produce the final effect. Each wave train has a direction in which the waves are travelling, a speed, a wave length (which also affects the shape of the wave), the height of the wave and a 'curl' term (which controls how much the tops of the waves bend over). There are also controls to set the eyepoint pan/tilt/range and to toggle the system into wireframe. Finally, 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. |
From: Steve B. <sj...@us...> - 2002-08-06 18:44:39
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv10103/plib/src/ssgAux Modified Files: ssgaWaveSystem.cxx ssgaWaveSystem.h Log Message: Added menu system. Index: ssgaWaveSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ssgaWaveSystem.cxx 6 Aug 2002 02:21:05 -0000 1.4 +++ ssgaWaveSystem.cxx 6 Aug 2002 18:44:35 -0000 1.5 @@ -26,6 +26,8 @@ #include "ssgAux.h" #include <string.h> +#define G 9.8f + void ssgaWaveSystem::updateAnimation ( float tim ) { if ( ntriangles <= 0 || @@ -36,18 +38,18 @@ int i ; - float adjOmega [ SSGA_MAX_WAVETRAIN ] ; - float sinTheta [ SSGA_MAX_WAVETRAIN ] ; - float cosTheta [ SSGA_MAX_WAVETRAIN ] ; + float adjSpeed [ SSGA_MAX_WAVETRAIN ] ; + float sinHeading [ SSGA_MAX_WAVETRAIN ] ; + float cosHeading [ SSGA_MAX_WAVETRAIN ] ; - /* Pre-adjust omega's to allow for wind speed. */ + /* Pre-adjust speed's to allow for wind speed. */ for ( int i = 0 ; i < SSGA_MAX_WAVETRAIN ; i++ ) if ( train [ i ] != NULL ) { - adjOmega [ i ] = train [ i ] -> getOmega () * tim / windSpeed ; - sinTheta [ i ] = -sin ( train[i]->getTheta()*SG_DEGREES_TO_RADIANS ) ; - cosTheta [ i ] = cos ( train[i]->getTheta()*SG_DEGREES_TO_RADIANS ) ; + adjSpeed [ i ] = train [ i ] -> getSpeed () * G * tim / windSpeed ; + sinHeading [ i ] = -sin ( train[i]->getHeading()*SG_DEGREES_TO_RADIANS ) ; + cosHeading [ i ] = cos ( train[i]->getHeading()*SG_DEGREES_TO_RADIANS ) ; } for ( int i = 0 ; i <= nstrips ; i++ ) @@ -68,37 +70,37 @@ float x0 = orig_vertices [idx][0] + center[0] ; float y0 = orig_vertices [idx][1] + center[1] ; - float z0 = center[2] ; + float z0 = vertices [idx][2] ; float depth = (gridGetter==NULL) ? 1000000.0f : gridGetter ( x0, y0 ) ; float xx = x0 ; float yy = y0 ; - float zz = 0 ; + float zz = center[2] ; for ( int t = 0 ; t < SSGA_MAX_WAVETRAIN ; t++ ) { if ( train [ t ] == NULL ) continue ; - float kappa = train [ t ] -> getKappa () ; + float length = train [ t ] -> getLength () ; float lambda = train [ t ] -> getLambda () ; float height = train [ t ] -> getWaveHeight () * edge_fade ; - kappa = ( depth < 0.0f ) ? 1.8f : - ( depth > 1.0f ) ? kappa : - kappa * depth + 1.8f * (1.0f - depth) ; + length = ( depth < 0.0f ) ? 0.5f : + ( depth > 1.0f ) ? length : + length * depth + 0.5f * (1.0f - depth) ; - float phase = kappa * ( x0 * sinTheta[t] + y0 * cosTheta[t] ) - - adjOmega[t] - lambda * zz ; + float phase = ( x0 * sinHeading[t] + y0 * cosHeading[t] ) / length - + adjSpeed[t] - lambda * z0 ; float delta = height * (float) sin ( phase ) ; - xx += delta * sinTheta [ t ] ; - yy += delta * cosTheta [ t ] ; + xx += delta * sinHeading [ t ] ; + yy += delta * cosHeading [ t ] ; zz += height * (float) -cos ( phase ) ; } - sgSetVec3 ( vertices [idx], xx, yy, zz + z0 ) ; + sgSetVec3 ( vertices [idx], xx, yy, zz ) ; sgSetVec2 ( texcoords [idx], tu * x0 / size[0], tv * y0 /size[1] ) ; } } Index: ssgaWaveSystem.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ssgaWaveSystem.h 6 Aug 2002 02:21:06 -0000 1.2 +++ ssgaWaveSystem.h 6 Aug 2002 18:44:35 -0000 1.3 @@ -8,33 +8,33 @@ class ssgaWaveTrain { float height ; - float kappa ; + float length ; float lambda ; - float omega ; - float theta ; + float speed ; + float heading; public: ssgaWaveTrain () { - height = 0.5f ; - kappa = 0.8f ; - lambda = 1.0f ; - omega = 9.8f * (float) sqrt ( 2.0f/3.0f ) ; - theta = 0.0f ; + height = 0.5f ; + length = 0.8f ; + lambda = 1.0f ; + speed = (float) sqrt ( 2.0f/3.0f ) ; + heading = 0.0f ; } - float getOmega () { return omega ; } - void setOmega ( float h ) { omega = h ; } + float getSpeed () { return speed ; } + void setSpeed ( float h ) { speed = h ; } - float getKappa () { return kappa ; } - void setKappa ( float h ) { kappa = h ; } + float getLength () { return length ; } + void setLength ( float h ) { length = h ; } float getLambda () { return lambda ; } void setLambda ( float h ) { lambda = h ; } - float getTheta () { return theta ; } - void setTheta ( float h ) { theta = h ; } + float getHeading () { return heading ; } + void setHeading ( float h ) { heading = h ; } float getWaveHeight () { return height ; } void setWaveHeight ( float h ) { height = h ; } |
From: Steve B. <sj...@us...> - 2002-08-06 18:44:38
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv10103/plib/examples/src/ssg/water Modified Files: Makefile.am water.cxx Log Message: Added menu system. Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 4 Aug 2002 06:01:04 -0000 1.1 +++ Makefile.am 6 Aug 2002 18:44:34 -0000 1.2 @@ -2,7 +2,7 @@ water_SOURCES = water.cxx -water_LDADD = -lplibssgaux -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS) +water_LDADD = -lplibpu -lplibfnt -lplibssgaux -lplibssg -lplibsg -lplibul $(GLUT_LIBS) $(OGL_LIBS) EXTRA_DIST = water.dsp Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- water.cxx 6 Aug 2002 12:32:06 -0000 1.6 +++ water.cxx 6 Aug 2002 18:44:34 -0000 1.7 @@ -10,8 +10,30 @@ #include <math.h> #include <plib/ssg.h> #include <plib/ssgAux.h> +#include <plib/pu.h> #include <GL/glut.h> +#define GUI_BASE 80 +#define VIEW_GUI_BASE 20 + +puSlider *trainLengthSlider = (puSlider *) NULL ; +puSlider *trainSpeedSlider = (puSlider *) NULL ; [...467 lines suppressed...] + wavePolycountSlider->setMinValue ( 4000 ) ; + wavePolycountSlider->setStepSize ( 0 ) ; + wavePolycountSlider->setCBMode ( PUSLIDER_ALWAYS ) ; + wavePolycountSlider->setCallback ( wavePolycountSlider_cb ) ; + wavePolycountSlider->setLabel ( "Polygons" ) ; + wavePolycountSlider->setLabelPlace ( PUPLACE_CENTERED_RIGHT ) ; + + window_group->close () ; +} /* The works. @@ -338,6 +674,7 @@ { init_graphics () ; load_database () ; + init_gui () ; glutMainLoop () ; return 0 ; } |
From: Steve B. <sj...@us...> - 2002-08-06 18:44:38
|
Update of /cvsroot/plib/plib/examples/src/ssg/water/data In directory usw-pr-cvs1:/tmp/cvs-serv10103/plib/examples/src/ssg/water/data Added Files: sorority.txf Log Message: Added menu system. --- NEW FILE: sorority.txf --- (This appears to be a binary file; contents omitted.) |
From: Steve B. <sj...@us...> - 2002-08-06 12:32:14
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv23262/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Improved camera angles. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- water.cxx 6 Aug 2002 02:21:05 -0000 1.5 +++ water.cxx 6 Aug 2002 12:32:06 -0000 1.6 @@ -43,14 +43,14 @@ /* Move the camera in some kind of interesting way */ - if ( frameno < 600 ) + if ( frameno > 600 ) sgSetCoord ( & campos, 0.0f, -20.0f, 8.0f, 25.0f * (float) sin(frameno/100.0), -30.0f, 0.0f ) ; else - sgSetCoord ( & campos, 0.0f, 0.0f, 2.0f, + sgSetCoord ( & campos, 0.0f, 0.0f, 3.5f, frameno, -10.0f, 0.0f ) ; - sgSetCoord ( & tptpos, 0.0f, 0.0f, 0.6f, frameno, 0.0f, 0.0f ) ; + sgSetCoord ( & tptpos, 0.0f, 0.0f, 0.6f, -frameno, 0.0f, 0.0f ) ; ssgSetCamera ( & campos ) ; teapot -> setTransform ( & tptpos ) ; @@ -184,7 +184,7 @@ float c = 0.6 + (float)(rand()%1000)/4000.0f ; sgSetVec4 ( p -> col, c - 0.2f, c, 1, 0.5 ) ; - sgSetVec3 ( p -> pos, -2.5, 0, 2 ) ; + sgSetVec3 ( p -> pos, -2.4, -0.1, 1.9 ) ; sgSetVec3 ( p -> vel, -(float)(rand()%1000)/200.0f, (float)(rand()%1000 - 500)/400.0f, |
From: Steve B. <sj...@us...> - 2002-08-06 02:21:09
|
Update of /cvsroot/plib/plib/examples/src/ssg/water In directory usw-pr-cvs1:/tmp/cvs-serv18676/plib/examples/src/ssg/water Modified Files: water.cxx Log Message: Added multiple wave-trains. Index: water.cxx =================================================================== RCS file: /cvsroot/plib/plib/examples/src/ssg/water/water.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- water.cxx 4 Aug 2002 23:45:31 -0000 1.4 +++ water.cxx 6 Aug 2002 02:21:05 -0000 1.5 @@ -25,10 +25,14 @@ ssgSimpleState *teapot_state = NULL ; ssgSimpleState *plinth_state = NULL ; +ssgaWaveTrain trainA ; +ssgaWaveTrain trainB ; +ssgaWaveTrain trainC ; float getDepth ( float x, float y ) { - return (x > 0.0f) ? fabs ( sin(x/15.0f) * sin(y/10.0f) * 0.5 + 0.5 ) : 1.0f; +// return (x > 0.0f) ? fabs ( sin(x/15.0f) * sin(y/10.0f) * 0.5 + 0.5 ) : 1.0f; + return 1000.0f ; } @@ -275,6 +279,16 @@ droplet_update, NULL ) ; fountain -> setState ( splash_state ) ; + trainA . setWaveHeight ( 0.2f ) ; + trainA . setTheta ( 0.0f ) ; + trainB . setWaveHeight ( 0.1f ) ; + trainB . setTheta ( 25.0f ) ; + trainB . setOmega ( 17.0f ) ; + trainC . setWaveHeight ( 0.1f ) ; + trainC . setTheta ( 45.0f ) ; + trainC . setOmega ( 17.0f ) ; + trainC . setKappa ( 2.4f ) ; + ocean = new ssgaWaveSystem ( 10000 ) ; ocean -> setColour ( WHITE ) ; ocean -> setSize ( 50 ) ; @@ -282,8 +296,10 @@ ocean -> setCenter ( pos ) ; ocean -> setDepthCallback ( getDepth ) ; ocean -> setKidState ( sea_state ) ; - ocean -> setWaveHeight ( 0.3 ) ; ocean -> setWindSpeed ( 10.0f ) ; + ocean -> setWaveTrain ( 0, & trainA ) ; + ocean -> setWaveTrain ( 1, & trainB ) ; + ocean -> setWaveTrain ( 2, & trainC ) ; ocean -> regenerate () ; ped_obj = new ssgaCube () ; |
From: Steve B. <sj...@us...> - 2002-08-06 02:21:09
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv18676/plib/src/ssgAux Modified Files: ssgaWaveSystem.cxx ssgaWaveSystem.h Log Message: Added multiple wave-trains. Index: ssgaWaveSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ssgaWaveSystem.cxx 5 Aug 2002 23:10:05 -0000 1.3 +++ ssgaWaveSystem.cxx 6 Aug 2002 02:21:05 -0000 1.4 @@ -26,59 +26,84 @@ #include "ssgAux.h" #include <string.h> -void ssgaWaveSystem::updateAnimation ( float t ) +void ssgaWaveSystem::updateAnimation ( float tim ) { if ( ntriangles <= 0 || - normals == NULL || - colours == NULL || - texcoords == NULL || - vertices == NULL || [...135 lines suppressed...] return ( load_field ( fp, windSpeed ) && load_field ( fp, windHeading ) && - load_field ( fp, waveHeight ) && - load_field ( fp, kappa ) && - load_field ( fp, lambda ) && - load_field ( fp, omega ) && load_field ( fp, edgeFlatten ) && load_field ( fp, tu ) && load_field ( fp, tv ) && @@ -297,10 +316,6 @@ { return ( save_field ( fp, windSpeed ) && save_field ( fp, windHeading ) && - save_field ( fp, waveHeight ) && - save_field ( fp, kappa ) && - save_field ( fp, lambda ) && - save_field ( fp, omega ) && save_field ( fp, edgeFlatten ) && save_field ( fp, tu ) && save_field ( fp, tv ) && Index: ssgaWaveSystem.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaWaveSystem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgaWaveSystem.h 4 Aug 2002 05:53:44 -0000 1.1 +++ ssgaWaveSystem.h 6 Aug 2002 02:21:06 -0000 1.2 @@ -3,6 +3,43 @@ typedef float (* ssgaWSDepthCallback ) ( float x, float y ) ; +#define SSGA_MAX_WAVETRAIN 16 + +class ssgaWaveTrain +{ + float height ; + float kappa ; + float lambda ; + float omega ; + float theta ; + +public: + + ssgaWaveTrain () + { + height = 0.5f ; + kappa = 0.8f ; + lambda = 1.0f ; + omega = 9.8f * (float) sqrt ( 2.0f/3.0f ) ; + theta = 0.0f ; + } + + float getOmega () { return omega ; } + void setOmega ( float h ) { omega = h ; } + + float getKappa () { return kappa ; } + void setKappa ( float h ) { kappa = h ; } + + float getLambda () { return lambda ; } + void setLambda ( float h ) { lambda = h ; } + + float getTheta () { return theta ; } + void setTheta ( float h ) { theta = h ; } + + float getWaveHeight () { return height ; } + void setWaveHeight ( float h ) { height = h ; } +} ; + class ssgaWaveSystem : public ssgaShape { ssgaWSDepthCallback gridGetter ; @@ -13,12 +50,10 @@ sgVec3 *vertices ; sgVec3 *orig_vertices ; + ssgaWaveTrain *train [ SSGA_MAX_WAVETRAIN ] ; + float windSpeed ; float windHeading ; - float waveHeight ; - float kappa ; - float lambda ; - float omega ; float edgeFlatten ; float tu, tv ; @@ -43,15 +78,24 @@ ssgaWSDepthCallback getDepthCallback () { return gridGetter ; } + ssgaWaveTrain *getWaveTrain ( int i ) + { + return ( i < 0 || i >= SSGA_MAX_WAVETRAIN ) ? NULL : train [ i ] ; + } + + void setWaveTrain ( int i, ssgaWaveTrain *t ) + { + assert ( i >= 0 && i < SSGA_MAX_WAVETRAIN ) ; + train [ i ] = t ; + } + float getWindSpeed () { return windSpeed ; } float getWindDirn () { return windHeading ; } - float getWaveHeight () { return waveHeight ; } float getEdgeFlatten () { return edgeFlatten ; } void setDepthCallback ( ssgaWSDepthCallback cb ) { gridGetter = cb ; } void setWindSpeed ( float speed ) { windSpeed = speed ; } void setWindDirn ( float dirn ) { windHeading = dirn ; } - void setWaveHeight ( float height ) { waveHeight = height ; } void setEdgeFlatten ( float dist ) { edgeFlatten = dist ; } void setTexScale ( float u, float v ) { tu = u ; tv = v ; } |