plib-cvs Mailing List for PLIB (Page 62)
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: M?rten Str?m. <str...@us...> - 2002-01-25 16:28:04
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv16016/src/sg Modified Files: sg.cxx sg.h Log Message: Added documentation for sgClassifyMat4. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- sg.cxx 2001/11/07 23:51:09 1.27 +++ sg.cxx 2002/01/25 16:28:00 1.28 @@ -1603,7 +1603,7 @@ if ( n > 1 ) flags |= SG_ROTATION ; - if ( n % 2 ) + if ( n % 2 != 0 ) flags |= SG_MIRROR ; sx = m[0][0] * m[0][0] ; @@ -1640,12 +1640,13 @@ if ( sgAbs ( sx - sy ) > epsilon || sgAbs ( sx - sz ) > epsilon ) { - flags |= SG_GENERAL_SCALE ; + flags |= SG_NONORTHO ; + flags |= SG_GENERAL_SCALE ; // also set general scale bit, though it may be deleted in the future } else { if ( sgAbs ( sx - SG_ONE ) > epsilon ) - flags |= SG_UNIFORM_SCALE ; + flags |= SG_SCALE ; } Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- sg.h 2002/01/01 15:40:32 1.30 +++ sg.h 2002/01/25 16:28:00 1.31 @@ -180,11 +180,15 @@ #define SG_IDENTITY 0x00 // for clarity #define SG_ROTATION 0x01 // includes a rotational component #define SG_MIRROR 0x02 // changes handedness (det < 0) -#define SG_UNIFORM_SCALE 0x04 // uniform scaling -#define SG_GENERAL_SCALE 0x08 // x, y and z scaled differently -#define SG_NONORTHO 0x10 // 3x3 row vectors not orthogonal +#define SG_SCALE 0x04 // uniform scaling +#define SG_NONORTHO 0x10 // 3x3 not orthogonal #define SG_TRANSLATION 0x20 // translates #define SG_PROJECTION 0x40 // forth column not 0,0,0,1 + +/* Are these needed? sgClassifyMat4() does set the general scale bit for some matrices, + * but it is not easily defined. Use SG_NONORTHO instead (which is also set). */ +#define SG_UNIFORM_SCALE SG_SCALE +#define SG_GENERAL_SCALE 0x08 // x, y and z scaled differently extern int sgClassifyMat4 ( const sgMat4 mat ) ; |
From: M?rten Str?m. <str...@us...> - 2002-01-25 16:28:03
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv16016/doc/sg Modified Files: index.html Log Message: Added documentation for sgClassifyMat4. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- index.html 2001/10/27 05:34:47 1.8 +++ index.html 2002/01/25 16:28:00 1.9 @@ -590,6 +590,39 @@ void sgFullXformPnt4 ( sgVec4 dst, sgVec4 src, sgMat4 mat ) ; </pre> +The properties of a matrix can be tested with: +<pre> + int sgClassifyMat4 ( const sgMat4 mat ) ; +</pre> +which returns a bitmask with zero or more of the following bits set: +<p> +<table> + <tr> + <td>SG_ROTATION</td> + <td>Upper 3x3 includes a rotational component.</td> + </tr> + <tr> + <td>SG_MIRROR</td> + <td>Changes handedness.</td> + </tr> + <tr> + <td>SG_SCALE</td> + <td>Uniform scaling going on.</td> + </tr> + <tr> + <td>SG_NONORTHO</td> + <td>Upper 3x3 not orthogonal (including non-uniform scaling).</td> + </tr> + <tr> + <td>SG_TRANSLATION</td> + <td>Translates.</td> + </tr> + <tr> + <td>SG_PROJECTION</td> + <td>Forth column not 0,0,0,1.</td> + </tr> +</table> + <H3>Coord routines:</H3> These routines operate on 'sgCoord' structures: <pre> |
From: Steve B. <sj...@us...> - 2002-01-24 16:55:50
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv15726/plib/src/ssg Modified Files: ssgLoadAC.cxx Log Message: Replaced a '{' that I accidentally deleted! Index: ssgLoadAC.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadAC.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ssgLoadAC.cxx 2002/01/24 15:14:10 1.22 +++ ssgLoadAC.cxx 2002/01/24 16:55:47 1.23 @@ -661,7 +661,7 @@ firsttime = FALSE ; if ( ! ulStrNEqual ( s, "AC3D", 4 ) ) - + { fclose ( loader_fd ) ; ulSetError ( UL_WARNING, "ssgLoadAC: '%s' is not in AC3D format.", filename ) ; return NULL ; @@ -678,3 +678,5 @@ return current_branch ; } + + |
From: Steve B. <sj...@us...> - 2002-01-24 15:14:14
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv19264/plib/src/ssg Modified Files: ssgLoadAC.cxx Log Message: Added a newline to the end of js.h to stop G++ 3.0 from whining. Index: ssgLoadAC.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadAC.cxx,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- ssgLoadAC.cxx 2001/12/18 16:35:59 1.21 +++ ssgLoadAC.cxx 2002/01/24 15:14:10 1.22 @@ -661,7 +661,7 @@ firsttime = FALSE ; if ( ! ulStrNEqual ( s, "AC3D", 4 ) ) - { + fclose ( loader_fd ) ; ulSetError ( UL_WARNING, "ssgLoadAC: '%s' is not in AC3D format.", filename ) ; return NULL ; |
From: Steve B. <sj...@us...> - 2002-01-24 15:14:13
|
Update of /cvsroot/plib/plib/src/js In directory usw-pr-cvs1:/tmp/cvs-serv19264/plib/src/js Modified Files: js.h Log Message: Added a newline to the end of js.h to stop G++ 3.0 from whining. Index: js.h =================================================================== RCS file: /cvsroot/plib/plib/src/js/js.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- js.h 2001/11/07 23:51:09 1.12 +++ js.h 2002/01/24 15:14:09 1.13 @@ -726,4 +726,6 @@ } ; //lint -restore -#endif \ No newline at end of file +#endif + + |
From: Steve B. <sj...@us...> - 2002-01-19 20:46:11
|
Update of /cvsroot/plib/plib/demos/exposer/src In directory usw-pr-cvs1:/tmp/cvs-serv5020/plib/demos/exposer/src Modified Files: exposer.cxx Log Message: Improved command-line parameter checks. Index: exposer.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/exposer.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- exposer.cxx 2002/01/19 20:37:20 1.18 +++ exposer.cxx 2002/01/19 20:46:08 1.19 @@ -125,7 +125,7 @@ static void deleteEventCB ( puObject * ) { timebox -> deleteEvent () ; } static void addNewEventCB ( puObject * ) { timebox -> addNewEvent () ; } static void reverseRegionCB ( puObject * ) { timebox -> reverseRegion () ; } -static void deleteAllCB ( puObject * ) { timebox -> deleteAll () ; } +// static void deleteAllCB ( puObject * ) { timebox -> deleteAll () ; } static void deleteRegionCB ( puObject * ) { timebox -> deleteRegion () ; } static void deleteRegionAndCompressCB ( puObject * ) { timebox -> deleteRegionAndCompress () ; } @@ -408,13 +408,13 @@ static void help () { - fprintf ( stderr, "\n\n" ) ; - fprintf ( stderr, "exposer: Interactive Usage -\n\n" ) ; - fprintf ( stderr, " exposer\n" ) ; - fprintf ( stderr, " ...or...\n" ) ; - fprintf ( stderr, "exposer: Batch Tweenfile generation Usage -\n\n" ) ; + fprintf ( stderr, "\n" ) ; + fprintf ( stderr, "exposer: Interactive Usage -\n" ) ; + fprintf ( stderr, " exposer\n\n" ) ; + fprintf ( stderr, " ...or...\n\n" ) ; + fprintf ( stderr, "exposer: Batch Tweenfile generation Usage -\n" ) ; fprintf ( stderr, " exposer -f framerate modelfile bonefile tweenfile\n" ); - fprintf ( stderr, "\n\n" ) ; + fprintf ( stderr, "\n" ) ; } @@ -438,10 +438,18 @@ return 0 ; } + if ( argc != 6 || strcmp ( argv [ 1 ], "-f" ) != 0 || + atof ( argv [ 2 ] ) > 100.0f || atof ( argv[2] ) < 0.1f ) + { + help () ; + return 1 ; + } + setTweenInterval ( 1.0f / atof ( argv [ 2 ] ) ) ; loadFile ( argv [ 3 ], FALSE ) ; loadBoneFile ( argv [ 4 ], FALSE ) ; saveTweenFile ( argv [ 5 ], FALSE ) ; + return 0 ; } |
From: Steve B. <sj...@us...> - 2002-01-19 20:37:24
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv2656/plib/src/ssgAux Modified Files: ssgaParticleSystem.cxx ssgaParticleSystem.h Log Message: Exposer will now operate in command-line mode to convert model+bones into tweened model. The SSG loader now observes the 'appstate' callback. ssgTween and ssgTweenController now include print() and getTypeName(). Significant changes to ssgaParticleSystem have taken place. Index: ssgaParticleSystem.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaParticleSystem.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgaParticleSystem.cxx 2002/01/13 02:13:15 1.1 +++ ssgaParticleSystem.cxx 2002/01/19 20:37:21 1.2 @@ -1,28 +1,12 @@ #include "ssgAux.h" -void ssgaParticle::init () -{ - sgSetVec4 ( col, 1, 1, 1, 1 ) ; - sgZeroVec3 ( pos ) ; - sgZeroVec3 ( vel ) ; - sgZeroVec3 ( acc ) ; - time_to_live = 0 ; -} - -void ssgaParticle::update ( float dt ) -{ - sgAddScaledVec3 ( vel, acc, dt ) ; - sgAddScaledVec3 ( pos, vel, dt ) ; - time_to_live -= dt ; -} - - ssgaParticleSystem::ssgaParticleSystem ( int num, int initial_num, float _create_rate, int _ttf, float sz, float bsphere_size, - ssgaParticleFunc _particle_create, - ssgaParticleFunc _particle_update ) : + ssgaParticleCreateFunc _particle_create, + ssgaParticleUpdateFunc _particle_update, + ssgaParticleDeleteFunc _particle_delete ) : ssgVtxArray ( GL_QUADS, new ssgVertexArray ( num * 4, new sgVec3 [ num * 4 ] ), new ssgNormalArray ( num * 4, new sgVec3 [ num * 4 ] ), @@ -35,40 +19,39 @@ create_rate = _create_rate ; particle_create = _particle_create ; particle_update = _particle_update ; + particle_delete = _particle_delete ; size = sz ; num_particles = num ; num_verts = num * 4 ; + getBSphere () -> setRadius ( bsphere_size ) ; + getBSphere () -> setCenter ( 0, 0, 0 ) ; + particle = new ssgaParticle [ num ] ; for ( int i = 0 ; i < num_verts ; i++ ) { - sgSetVec3 ( getNormal ( i ), 0, -1, 0 ) ; - sgSetVec4 ( getColour ( i ), 1, 1, 1, 1 ) ; + sgSetVec3 ( getNormal ( i ), 0, -1, 0 ) ; + sgSetVec4 ( getColour ( i ), 1, 1, 1, 1 ) ; + sgZeroVec3 ( getVertex ( i ) ) ; *(getIndex( i )) = i ; } for ( int i = 0 ; i < num_particles ; i++ ) { - particle [ i ] . init () ; - - sgSetVec3 ( getVertex ( i*4+0 ), 0 , 0, 0 ) ; - sgSetVec3 ( getVertex ( i*4+1 ), 0 , 0, size ) ; - sgSetVec3 ( getVertex ( i*4+2 ), size, 0, size ) ; - sgSetVec3 ( getVertex ( i*4+3 ), size, 0, 0 ) ; sgSetVec2 ( getTexCoord ( i*4+0 ), 0, 0 ) ; sgSetVec2 ( getTexCoord ( i*4+1 ), 1, 0 ) ; sgSetVec2 ( getTexCoord ( i*4+2 ), 1, 1 ) ; sgSetVec2 ( getTexCoord ( i*4+3 ), 0, 1 ) ; - - if ( i < initial_num && particle_create ) - (*particle_create) ( & particle [ i ] ) ; } - getBSphere () -> setRadius ( bsphere_size ) ; - getBSphere () -> setCenter ( 0, 0, 0 ) ; + if ( particle_create ) + for ( int i = 0 ; i < initial_num ; i++ ) + (*particle_create) ( this, i, & particle [ i ] ) ; + + update ( 0.1 ) ; } @@ -97,25 +80,15 @@ for ( int i = 0 ; i < num_particles ; i++, j += 4 ) { - if ( particle [ i ] . time_to_live < 0.0 ) - { - getVertex ( j + 0 ) [ 2 ] = -1000000.0f ; - getVertex ( j + 1 ) [ 2 ] = -1000000.0f ; - getVertex ( j + 2 ) [ 2 ] = -1000000.0f ; - getVertex ( j + 3 ) [ 2 ] = -1000000.0f ; - } - else - { - sgCopyVec4 ( getColour ( j + 0 ), particle[i].col ) ; - sgCopyVec4 ( getColour ( j + 1 ), particle[i].col ) ; - sgCopyVec4 ( getColour ( j + 2 ), particle[i].col ) ; - sgCopyVec4 ( getColour ( j + 3 ), particle[i].col ) ; + sgCopyVec4 ( getColour ( j + 0 ), particle[i].col ) ; + sgCopyVec4 ( getColour ( j + 1 ), particle[i].col ) ; + sgCopyVec4 ( getColour ( j + 2 ), particle[i].col ) ; + sgCopyVec4 ( getColour ( j + 3 ), particle[i].col ) ; - sgCopyVec3 ( getVertex ( j + 0 ), particle[i].pos ) ; - sgAddVec3 ( getVertex ( j + 1 ), particle[i].pos, xx ) ; - sgAddVec3 ( getVertex ( j + 2 ), particle[i].pos, xxyy ) ; - sgAddVec3 ( getVertex ( j + 3 ), particle[i].pos, yy ) ; - } + sgCopyVec3 ( getVertex ( j + 0 ), particle[i].pos ) ; + sgAddVec3 ( getVertex ( j + 1 ), particle[i].pos, xx ) ; + sgAddVec3 ( getVertex ( j + 2 ), particle[i].pos, xxyy ) ; + sgAddVec3 ( getVertex ( j + 3 ), particle[i].pos, yy ) ; } glDisable ( GL_CULL_FACE ) ; @@ -128,23 +101,54 @@ } +ssgaParticleSystem::~ssgaParticleSystem () +{ + if ( particle_delete ) + for ( int i = 0 ; i < num_particles ; i++ ) + if ( particle [ i ] . time_to_live >= 0.0 ) + (*particle_delete) ( this, i, & particle [ i ] ) ; + + delete particle ; +} + + void ssgaParticleSystem::update ( float t ) { + int i ; + create_error += create_rate * t ; - for ( int i = 0 ; i < num_particles ; i++ ) - { + num_active = 0 ; + + /* Update all the particles */ + + for ( i = 0 ; i < num_particles ; i++ ) particle [ i ] . update ( t ) ; - if ( particle_update ) - (*particle_update) ( & particle [ i ] ) ; + /* Call the update routine for all the particles */ - if ( particle [ i ] . time_to_live < 0.0 && - create_error >= 1.0f && particle_create ) + if ( particle_update ) + for ( i = 0 ; i < num_particles ; i++ ) + (*particle_update) ( t, this, i, & particle [ i ] ) ; + + /* Check for death of particles */ + + for ( i = 0 ; i < num_particles ; i++ ) + if ( particle [ i ] . time_to_live < 0.0 ) { - (*particle_create) ( & particle [ i ] ) ; - create_error -= 1.0f ; + if ( particle_delete ) + (*particle_delete) ( this, i, & particle [ i ] ) ; + + particle [ i ] . pos [ 2 ] = -1000000.0f ; + + if ( create_error >= 1.0f && particle_create ) + { + (*particle_create) ( this, i, & particle [ i ] ) ; + create_error -= 1.0f ; + } } - } + else + num_active++ ; } + Index: ssgaParticleSystem.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgaParticleSystem.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgaParticleSystem.h 2002/01/13 02:13:15 1.1 +++ ssgaParticleSystem.h 2002/01/19 20:37:21 1.2 @@ -1,26 +1,58 @@ -struct ssgaParticle +class ssgaParticle { +public: + sgVec4 col ; sgVec3 pos ; sgVec3 vel ; sgVec3 acc ; float time_to_live ; + void *userData ; - void init () ; - void update ( float dt ) ; + void update ( float dt ) + { + sgAddScaledVec3 ( vel, acc, dt ) ; + sgAddScaledVec3 ( pos, vel, dt ) ; + time_to_live -= dt ; + } + + ssgaParticle () + { + sgSetVec4 ( col, 1, 1, 1, 1 ) ; + sgZeroVec3 ( pos ) ; + sgZeroVec3 ( vel ) ; + sgZeroVec3 ( acc ) ; + time_to_live = 0 ; + userData = NULL ; + } + } ; -typedef void (* ssgaParticleFunc) ( ssgaParticle *p ) ; +class ssgaParticleSystem ; + + +typedef void (* ssgaParticleCreateFunc) ( ssgaParticleSystem *ps, + int index, + ssgaParticle *p ) ; +typedef void (* ssgaParticleUpdateFunc) ( float deltaTime, + ssgaParticleSystem *ps, + int index, + ssgaParticle *p ) ; +typedef void (* ssgaParticleDeleteFunc) ( ssgaParticleSystem *ps, + int index, + ssgaParticle *p ) ; + class ssgaParticleSystem : public ssgVtxArray { int num_particles ; int num_verts ; int turn_to_face ; + int num_active ; ssgaParticle *particle ; float create_error ; @@ -28,19 +60,29 @@ float size ; - ssgaParticleFunc particle_create ; - ssgaParticleFunc particle_update ; + ssgaParticleCreateFunc particle_create ; + ssgaParticleUpdateFunc particle_update ; + ssgaParticleDeleteFunc particle_delete ; public: ssgaParticleSystem ( int num, int initial_num, float _create_rate, int _turn_to_face, float sz, float bsphere_size, - ssgaParticleFunc _particle_create, - ssgaParticleFunc _particle_update ) ; + ssgaParticleCreateFunc _particle_create, + ssgaParticleUpdateFunc _particle_update = NULL, + ssgaParticleDeleteFunc _particle_delete = NULL ) ; + + virtual ~ssgaParticleSystem () ; + + void setSize ( float sz ) { size = sz ; } + float getSize () { return size ; } void update ( float t ) ; void draw_geometry () ; + + int getNumActiveParticles () { return num_active ; } + } ; |
From: Steve B. <sj...@us...> - 2002-01-19 20:37:24
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv2656/plib/src/ssg Modified Files: ssg.h ssgLeaf.cxx ssgTween.cxx ssgTweenController.cxx Log Message: Exposer will now operate in command-line mode to convert model+bones into tweened model. The SSG loader now observes the 'appstate' callback. ssgTween and ssgTweenController now include print() and getTypeName(). Significant changes to ssgaParticleSystem have taken place. Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.129 retrieving revision 1.130 diff -u -d -r1.129 -r1.130 --- ssg.h 2002/01/17 16:14:23 1.129 +++ ssg.h 2002/01/19 20:37:21 1.130 @@ -1481,6 +1481,7 @@ virtual void draw () ; virtual void transform ( const sgMat4 m ) ; + virtual char *getTypeName(void) ; virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2); virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; @@ -1608,6 +1609,8 @@ float getCurrBank () { return curr_bank ; } virtual void cull ( sgFrustum *f, sgMat4 m, int test_needed ) ; + virtual char *getTypeName(void) ; + virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ; virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; } ; Index: ssgLeaf.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLeaf.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ssgLeaf.cxx 2001/12/14 12:30:22 1.18 +++ ssgLeaf.cxx 2002/01/19 20:37:21 1.19 @@ -201,6 +201,20 @@ if ( ! _ssgLoadObject ( fd, (ssgBase **) &st, ssgTypeState () ) ) return FALSE ; + if ( st -> isAKindOf ( ssgTypeSimpleState () ) ) + { + ssgSimpleState *ss = (ssgSimpleState *) st ; + char *tfname = ss -> getTextureFilename () ; + + if ( tfname != NULL ) + { + ssgState *new_st = ssgGetCurrentOptions () -> createState ( tfname ) ; + + if ( new_st != NULL ) + st = new_st ; + } + } + setState ( st ) ; return ssgEntity::load(fd) ; Index: ssgTween.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgTween.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ssgTween.cxx 2001/11/07 23:51:10 1.6 +++ ssgTween.cxx 2002/01/19 20:37:21 1.7 @@ -28,6 +28,8 @@ static float current_tween_state = 0.0f ; +char *ssgTween::getTypeName (void) { return "ssgTween" ; } + float _ssgGetCurrentTweenState () { return current_tween_state ; } @@ -467,3 +469,6 @@ texcoords -> print ( fd, in, how_much ) ; colours -> print ( fd, in, how_much ) ; } + + + Index: ssgTweenController.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgTweenController.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ssgTweenController.cxx 2001/11/07 23:51:10 1.2 +++ ssgTweenController.cxx 2002/01/19 20:37:21 1.3 @@ -25,6 +25,8 @@ #include "ssgLocal.h" +char *ssgTweenController::getTypeName (void) { return "ssgTweenController" ; } + void ssgTweenController::copy_from ( ssgTweenController *src, int clone_flags ) { selectBank ( src->getCurrBank () ) ; @@ -77,6 +79,18 @@ { _ssgWriteFloat ( fd, curr_bank ) ; return ssgBranch::save ( fd ) ; +} + + + +void ssgTweenController::print ( FILE *fd, char *indent, int how_much ) +{ + if ( how_much == 0 ) + return ; + + fprintf ( fd, "%sCurrent Bank = %f\n", indent, curr_bank ); + + ssgBranch::print ( fd, indent, how_much ) ; } |
From: Steve B. <sj...@us...> - 2002-01-19 20:37:23
|
Update of /cvsroot/plib/plib/demos/exposer/src In directory usw-pr-cvs1:/tmp/cvs-serv2656/plib/demos/exposer/src Modified Files: bones.cxx exposer.cxx load_save.cxx load_save.h Log Message: Exposer will now operate in command-line mode to convert model+bones into tweened model. The SSG loader now observes the 'appstate' callback. ssgTween and ssgTweenController now include print() and getTypeName(). Significant changes to ssgaParticleSystem have taken place. Index: bones.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/bones.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- bones.cxx 2001/10/27 05:34:46 1.13 +++ bones.cxx 2002/01/19 20:37:20 1.14 @@ -16,8 +16,6 @@ bone = new Bone [ 1000 ] ; sgZeroVec3 ( curr_translate ) ; - - initBoneGUI () ; } @@ -42,7 +40,7 @@ hb -> setValue ( (shb == 'H') ? 0 : 1 ) ; pb -> setValue ( (spb == 'P') ? 0 : 1 ) ; rb -> setValue ( (srb == 'R') ? 0 : 1 ) ; - + hide_headingCB ( hb ) ; hide_pitchCB ( pb ) ; hide_rollCB ( rb ) ; Index: exposer.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/exposer.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- exposer.cxx 2001/07/23 22:40:50 1.17 +++ exposer.cxx 2002/01/19 20:37:20 1.18 @@ -409,8 +409,11 @@ static void help () { fprintf ( stderr, "\n\n" ) ; - fprintf ( stderr, "exposer: Usage -\n\n" ) ; + fprintf ( stderr, "exposer: Interactive Usage -\n\n" ) ; fprintf ( stderr, " exposer\n" ) ; + fprintf ( stderr, " ...or...\n" ) ; + fprintf ( stderr, "exposer: Batch Tweenfile generation Usage -\n\n" ) ; + fprintf ( stderr, " exposer -f framerate modelfile bonefile tweenfile\n" ); fprintf ( stderr, "\n\n" ) ; } @@ -422,12 +425,23 @@ init_graphics () ; init_database () ; init_bones () ; + initBoneGUI () ; - loadCB ( NULL ) ; + /* Interactive? */ - glutPostRedisplay () ; - glutMainLoop () ; - return 0 ; + if ( argc <= 1 ) + { + loadCB ( NULL ) ; + + glutPostRedisplay () ; + glutMainLoop () ; + return 0 ; + } + + setTweenInterval ( 1.0f / atof ( argv [ 2 ] ) ) ; + loadFile ( argv [ 3 ], FALSE ) ; + loadBoneFile ( argv [ 4 ], FALSE ) ; + saveTweenFile ( argv [ 5 ], FALSE ) ; } Index: load_save.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/load_save.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- load_save.cxx 2001/07/23 22:40:50 1.6 +++ load_save.cxx 2002/01/19 20:37:21 1.7 @@ -53,7 +53,6 @@ void twsavepickfn ( puObject * ) { char path [ PUSTRING_MAX ] ; - char fname [ PUSTRING_MAX ] ; file_selector -> getValue ( path ) ; @@ -66,9 +65,19 @@ return ; } + saveTweenFile ( path, TRUE ) ; +} + + +void saveTweenFile ( char *path, int interactive ) +{ + char orig_path [ PUSTRING_MAX ] ; + char fname [ PUSTRING_MAX ] ; char *p = NULL ; int i ; + strcpy ( orig_path, path ) ; + for ( i = strlen(path) ; i >= 0 ; i-- ) if ( path[i] == '/' || path[i] == '\\' ) { @@ -92,12 +101,20 @@ /* SAVE THE TWEENED MODEL */ - if ( file_selector->getStringValue()[0] == '\0' ) + if ( orig_path[0] == '\0' ) { - puDeleteObject ( file_selector ) ; - file_selector = NULL ; - dialog ( "FAILED TO SAVE TWEENED MODEL!", 1, 0, 0 ) ; - return ; + if ( interactive ) + { + puDeleteObject ( file_selector ) ; + file_selector = NULL ; + dialog ( "FAILED TO SAVE TWEENED MODEL!", 1, 0, 0 ) ; + return ; + } + else + { + perror ( "saveTween:" ) ; + exit ( 1 ) ; + } } tweenScene = (ssgRoot *) makeTweenCopy ( skinScene ) ; @@ -111,18 +128,28 @@ makeTweenCopy ( tweenScene, skinScene ) ; } - if ( ! ssgSave ( file_selector->getStringValue(), tweenScene ) ) + if ( ! ssgSave ( orig_path, tweenScene ) ) { + if ( interactive ) + { + puDeleteObject ( file_selector ) ; + file_selector = NULL ; + dialog ( "FAILED TO SAVE TWEENED MODEL!", 1, 0, 0 ) ; + return ; + } + else + { + perror ( "saveTween:" ) ; + exit ( 1 ) ; + } + } + + if ( interactive ) + { puDeleteObject ( file_selector ) ; file_selector = NULL ; - dialog ( "FAILED TO SAVE TWEENED MODEL!", 1, 0, 0 ) ; - return ; + dialog ( "TWEENED MODEL WAS SAVED OK.", 1, 1, 0 ) ; } - - puDeleteObject ( file_selector ) ; - file_selector = NULL ; - - dialog ( "TWEENED MODEL WAS SAVED OK.", 1, 1, 0 ) ; } @@ -204,7 +231,6 @@ void bnpickfn ( puObject * ) { char path [ PUSTRING_MAX ] ; - char fname [ PUSTRING_MAX ] ; file_selector -> getValue ( path ) ; @@ -215,9 +241,18 @@ return ; } + loadBoneFile ( path, TRUE ) ; +} + +void loadBoneFile ( char *path, int interactive ) +{ + char orig_path [ PUSTRING_MAX ] ; + char fname [ PUSTRING_MAX ] ; char *p = NULL ; int i ; + strcpy ( orig_path, path ) ; + for ( i = strlen(path) ; i >= 0 ; i-- ) if ( path[i] == '/' || path[i] == '\\' ) { @@ -241,20 +276,36 @@ /* LOAD THE BONES */ - if ( file_selector->getStringValue()[0] == '\0' ) + if ( orig_path[0] == '\0' ) { - puDeleteObject ( file_selector ) ; - file_selector = NULL ; - return ; + if ( interactive ) + { + puDeleteObject ( file_selector ) ; + file_selector = NULL ; + return ; + } + else + { + perror ( "loadBones:" ) ; + exit ( 1 ) ; + } } - FILE *fd = fopen ( file_selector->getStringValue(), "ra" ) ; + FILE *fd = fopen ( orig_path, "ra" ) ; if ( fd == NULL ) { - puDeleteObject ( file_selector ) ; - file_selector = NULL ; - return ; + if ( interactive ) + { + puDeleteObject ( file_selector ) ; + file_selector = NULL ; + return ; + } + else + { + perror ( "loadBones:" ) ; + exit ( 1 ) ; + } } timebox->deleteAll () ; @@ -262,9 +313,11 @@ int numbones, numevents ; float floor_z_coord, maxtime, new_ground_speed ; - fscanf ( fd, "NUMBONES=%d NUMEVENTS=%d MAXTIME=%f Z_OFFSET=%f SPEED=%f\n", - &numbones, &numevents, - &maxtime, &floor_z_coord, &new_ground_speed ) ; + fscanf ( fd, + "NUMBONES=%d NUMEVENTS=%d MAXTIME=%f Z_OFFSET=%f SPEED=%f\n", + &numbones, &numevents, + &maxtime, &floor_z_coord, &new_ground_speed ) ; + /* Don't use the floor_z_coord from the file. */ /* ground -> setZcoord ( floor_z_coord ) ; */ @@ -275,7 +328,7 @@ if ( numbones != getNumBones () ) { fprintf ( stderr, - "Number of bones in model doesn't agree with number in bones file!\n" ) ; + "Number of bones in model (%d) doesn't agree with number in bones file (%d)!\n", getNumBones (), numbones ) ; exit ( 1 ) ; } @@ -285,8 +338,12 @@ eventList -> read ( numevents, fd ) ; fclose ( fd ) ; - puDeleteObject ( file_selector ) ; - file_selector = NULL ; + + if ( interactive ) + { + puDeleteObject ( file_selector ) ; + file_selector = NULL ; + } } @@ -344,7 +401,6 @@ void pickfn ( puObject * ) { char path [ PUSTRING_MAX ] ; - char fname [ PUSTRING_MAX ] ; file_selector -> getValue ( path ) ; @@ -362,6 +418,12 @@ return ; } + loadFile ( path, TRUE ) ; +} + +void loadFile ( char *path, int interactive ) +{ + char fname [ PUSTRING_MAX ] ; char *p = NULL ; for ( int i = strlen(path) ; i >= 0 ; i-- ) @@ -389,6 +451,8 @@ strcpy ( lastModelFileName, fname ) ; skinScene -> addKid ( ssgLoad ( fname, NULL ) ) ; + ssgFlatten ( skinScene -> getKid ( 0 ) ) ; + ssgStripify ( skinScene -> getKid ( 0 ) ) ; boneScene -> addKid ( extractBones ( skinScene ) ) ; extractVertices ( skinScene ) ; Index: load_save.h =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/load_save.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- load_save.h 2001/07/23 22:40:50 1.3 +++ load_save.h 2002/01/19 20:37:21 1.4 @@ -5,5 +5,9 @@ void bnsaveCB ( puObject * ) ; void twsaveCB ( puObject * ) ; +void loadFile ( char *fname, int interactive ) ; +void loadBoneFile ( char *fname, int interactive ) ; +void saveTweenFile ( char *fname, int interactive ) ; + void setTweenInterval ( float t ) ; |
From: Wolfram K. <wol...@us...> - 2002-01-17 16:42:36
|
Update of /cvsroot/plib/plib/src/ssgAux In directory usw-pr-cvs1:/tmp/cvs-serv16440 Modified Files: ssgAux.dsp Log Message: Added ssgaParticleSystem.h Index: ssgAux.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssgAux/ssgAux.dsp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ssgAux.dsp 2001/12/17 22:44:46 1.12 +++ ssgAux.dsp 2002/01/17 16:42:32 1.13 @@ -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 +PostBuild_Cmds=copy debug\*.lib ..\..\*.* copy ssgAux.h ..\..\ssgAux.h copy ssgaShapes.h ..\..\ssgaShapes.h copy ssgaParticleSystem.h ..\..\ssgaParticleSystem.h # End Special Build Tool !ENDIF |
From: Wolfram K. <wol...@us...> - 2002-01-17 16:14:27
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv8987 Modified Files: Makefile.am ssg.cxx ssg.h Added Files: ssgSaveVRML1.cxx Log Message: Adding ssgSaveVRML1 --- NEW FILE: ssgSaveVRML1.cxx --- /* PLIB - A Suite of Portable Game Libraries Copyright (C) 2001 Steve Baker This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA For further information visit http://plib.sourceforge.net $Id: ssgSaveVRML1.cxx,v 1.1 2002/01/17 16:14:23 wolfram_kuss Exp $ -------------------------------------------------------------------- This save routine was written by Warren Wilbur to support a sub-set of the standard Virtual Reality Modelling Language v1.0 (i.e. VRML1.0). The Version 1.0 Specification, 9-Nov-95 was used and should be available at www.vrml.org When reporting bugs/difficulties please mention 'VRML' in the subject of your email and post to the plib developers mailing list. */ #include <stdio.h> #include "ssgLocal.h" #include "ssgLoaderWriterStuff.h" /* Function name: SaveVRML1MaterialNode * * Limitations: Before calling this function you must verify that * at least one material exists whose textureName * matches the one passed in to this function, * otherwise you might save a empty Material node! * * Notes: Saving empty Material notes will create an * unnecessary choking hazard for VRML loaders :( */ static void SaveVRML1MaterialNode(FILE *fd, ssgIndexArray *materials_ptr, ssgSimpleStateArray *ssa_ptr, char *textureName, bool saveDiffuse, bool saveAmbient, bool saveEmission, bool saveSpecular) { ssgSimpleState *ss_ptr; int i; /* Tell VRML loaders that we are providing a single color for each * face in the array of indices written below. */ fprintf(fd, " MaterialBinding { value PER_FACE }\n"); fprintf(fd, " Material {\n"); if (saveDiffuse) { fprintf(fd, " diffuseColor [\n"); for (i = 0; i < materials_ptr->getNum(); i++) { ss_ptr = ssa_ptr->get(*(materials_ptr->get(i))); /* If we are trying to save all untextured materials then check * if either ptr is NULL */ if ( ( (textureName == NULL)&& ((ss_ptr == NULL)||(ss_ptr->getTextureFilename() == NULL)) )|| /* If we are trying to save all materials that are textured by * a specific texture then check if the texture filename matches */ ( (textureName != NULL)&&(ss_ptr != NULL)&& (ss_ptr->getTextureFilename() != NULL)&& (!strcmp(textureName, ss_ptr->getTextureFilename())) ) ) { float diffuse0, diffuse1, diffuse2; diffuse0 = ss_ptr->diffuse_colour[0]; diffuse1 = ss_ptr->diffuse_colour[1]; diffuse2 = ss_ptr->diffuse_colour[2]; #ifdef EXPERIMENTAL_ADD_AMBIENT_TO_DIFFUSE diffuse0 += ss_ptr->ambient_colour[0]; diffuse1 += ss_ptr->ambient_colour[1]; diffuse2 += ss_ptr->ambient_colour[2]; #endif //EXPERIMENTAL_ADD_AMBIENT_TO_DIFFUSE #ifdef EXPERIMENTAL_ADD_EMISSION_TO_DIFFUSE diffuse0 += ss_ptr->emission_colour[0]; diffuse1 += ss_ptr->emission_colour[1]; diffuse2 += ss_ptr->emission_colour[2]; #endif //EXPERIMENTAL_ADD_EMISSION_TO_DIFFUSE #ifdef EXPERIMENTAL_ADD_SPECULAR_TO_DIFFUSE diffuse0 += ss_ptr->specular_colour[0]; diffuse1 += ss_ptr->specular_colour[1]; diffuse2 += ss_ptr->specular_colour[2]; #endif //EXPERIMENTAL_ADD_SPECULAR_TO_DIFFUSE /* OpenGL caps the maximum RGB value for a colour to 1.0 when it * calculates colours in a scene. If we don't cap the value OpenGL * will do it for us. */ fprintf(fd, " %f %f %f,\n", diffuse0 > 1.0 ? 1.0:diffuse0, diffuse1 > 1.0 ? 1.0:diffuse1, diffuse2 > 1.0 ? 1.0:diffuse2); } } fprintf(fd, " ]\n"); //close diffuseColor array } if (saveAmbient) { fprintf(fd, " ambientColor [\n"); for (i = 0; i < materials_ptr->getNum(); i++) { ss_ptr = ssa_ptr->get(*(materials_ptr->get(i))); /* If we are trying to save all untextured materials then check * if either ptr is NULL */ if ( ( (textureName == NULL)&& ((ss_ptr == NULL)||(ss_ptr->getTextureFilename() == NULL)) )|| /* If we are trying to save all materials that are textured by * a specific texture then check if the texture filename matches */ ( (textureName != NULL)&&(ss_ptr != NULL)&& (ss_ptr->getTextureFilename() != NULL)&& (!strcmp(textureName, ss_ptr->getTextureFilename())) ) ) { fprintf(fd, " %f %f %f,\n", ss_ptr->ambient_colour[0], ss_ptr->ambient_colour[1], ss_ptr->ambient_colour[2]); } fprintf(fd, " ]\n"); //close ambientColor array } } if(saveEmission) { fprintf(fd, " emissiveColor [\n"); for (i = 0; i < materials_ptr->getNum(); i++) { ss_ptr = ssa_ptr->get(*(materials_ptr->get(i))); /* If we are trying to save all untextured materials then check * if either ptr is NULL */ if ( ( (textureName == NULL)&& ((ss_ptr == NULL)||(ss_ptr->getTextureFilename() == NULL)) )|| /* If we are trying to save all materials that are textured by * a specific texture then check if the texture filename matches */ ( (textureName != NULL)&&(ss_ptr != NULL)&& (ss_ptr->getTextureFilename() != NULL)&& (!strcmp(textureName, ss_ptr->getTextureFilename())) ) ) { fprintf(fd, " %f %f %f,\n", ss_ptr->emission_colour[0], ss_ptr->emission_colour[1], ss_ptr->emission_colour[2]); } fprintf(fd, " ]\n"); //close emissionColor array } } if(saveSpecular) { fprintf(fd, " specularColor [\n"); for (i = 0; i < materials_ptr->getNum(); i++) { ss_ptr = ssa_ptr->get(*(materials_ptr->get(i))); /* If we are trying to save all untextured materials then check * if either ptr is NULL */ if ( ( (textureName == NULL)&& ((ss_ptr == NULL)||(ss_ptr->getTextureFilename() == NULL)) )|| /* If we are trying to save all materials that are textured by * a specific texture then check if the texture filename matches */ ( (textureName != NULL)&&(ss_ptr != NULL)&& (ss_ptr->getTextureFilename() != NULL)&& (!strcmp(textureName, ss_ptr->getTextureFilename())) ) ) { fprintf(fd, " %f %f %f,\n", ss_ptr->specular_colour[0], ss_ptr->specular_colour[1], ss_ptr->specular_colour[2]); } fprintf(fd, " ]\n"); //close specularColor array } } fprintf(fd, " }\n"); //close Material node return; } /* The 'main' entry point for saving a model in VRML1.0 */ int ssgSaveVRML1( const char* fname, ssgEntity *ent ) { ssgVertexArray *vertices_ptr; ssgIndexArray *indices_ptr; FILE *fd; ssgSimpleStateArray ssa; ssgTexCoordArray *texcoord_ptr; ssgIndexArray *materials_ptr; bool textured_faces_found, untextured_faces_found, textureFacesAlreadySaved; int i, j, index1, index2, index3; ssgSimpleState *ss_ptr, *ss_ptr2; fd = fopen ( fname, "w" ) ; if ( fd == NULL ) { ulSetError ( UL_WARNING, "ssgSaveVRML1: Failed to open '%s' for writing", fname ); return FALSE ; } vertices_ptr = new ssgVertexArray(); indices_ptr = new ssgIndexArray(); materials_ptr = new ssgIndexArray(); texcoord_ptr = new ssgTexCoordArray(); sgMat4 ident; sgMakeIdentMat4( ident ); ssgAccumVerticesAndFaces( ent, ident, vertices_ptr, indices_ptr, -1.0f, &ssa, materials_ptr, texcoord_ptr); /* The spec requires every file to begin with these characters */ fprintf(fd, "#VRML V1.0 ascii\n\n"); /* Since a VRML file contains only one parent node we must use a * node type that can have several child 'nodes' so we can save * the materials, texture coordinates, vertices, and indices each * as (seperate) child nodes. */ fprintf(fd, "Separator {\n"); /* Save all the individual vertices used in the model. It doesn't * matter if there are duplicates... */ fprintf(fd, " Coordinate3 {\n point [\n"); for (i = 0; i < vertices_ptr->getNum(); i++) { fprintf(fd, " %f %f %f,\n", vertices_ptr->get(i)[0], vertices_ptr->get(i)[1], vertices_ptr->get(i)[2]); } fprintf(fd, " ]\n }\n"); //close point array and //Coordinate3 /* Chcck if the model is textured at all. This test will help us parse * out how to save the model since it may be totally textured, partially * textured, or not textured at all. */ textured_faces_found = false; untextured_faces_found = false; for (i = 0; i < materials_ptr->getNum(); i++) { ss_ptr = ssa.get(*(materials_ptr->get(i))); if ( (ss_ptr != NULL)&&(ss_ptr->getTextureFilename() != NULL) ) { textured_faces_found = true; } else { untextured_faces_found = true; } } if (untextured_faces_found) { /* Save all the material node fields which VRML supports. Note that the * VRML spec discourages complicated uses of the Material Node. We * cannot expect VRML implementations to support the full syntax * of the Material Node including ambient, diffuse, specular, emissive, * shininess, and transparency. We should be always be okay if we just * use diffuse. */ SaveVRML1MaterialNode(fd, materials_ptr, &ssa, NULL, true, false, false, false); /* Save all faces that are not textured in a single IndexedFaceSet node */ fprintf(fd, " IndexedFaceSet {\n coordIndex [\n"); for (i = 0; i < indices_ptr->getNum(); i+=3) { ss_ptr = ssa.get(*(materials_ptr->get(i/3))); /* Make sure this face doesn't have a texture associated with it */ if ( (ss_ptr == NULL)||(ss_ptr->getTextureFilename() == NULL) ) { index1 = *indices_ptr->get(i); index2 = *indices_ptr->get(i+1); index3 = *indices_ptr->get(i+2); /* Check for index overflow since PLIB stores it as a short */ if ( (index1 < 0)||(index2 < 0)||(index3 < 0) ) { printf("Save error: index overflow, value won't fit in 16bits.\n"); } else { fprintf(fd, " %d, %d, %d, -1,\n", index1, index2, index3); } } } fprintf(fd, " ]\n }\n"); //close coordIndex array and //IndexedFaceSet } if (textured_faces_found) { /* Save all texture coordinates (per-vertex) for all the textures in * the model. It doesn't matter if there is one texture or more than * one since we will specify which texture to use with the coordinates * before saving the portion of the indexed face set which uses that * texture. */ fprintf(fd, " TextureCoordinate2 {\n point [\n"); for (i = 0; i < texcoord_ptr->getNum(); i++) { /* In VrmlView Pro 3.0 (Linux) textured models appear correct Left-Right * but the texture is reversed Top-Bottom. Enabling the INVERSE_REPEAT * macro fixes the problem for VrmlView. I don't want to enable this until * I figure out where the problem really is!? */ //#define INVERSE_REPEAT(a) (a > 0.0 ? 1.0 - a:a + 1.0) #define INVERSE_REPEAT(a) a fprintf(fd, " %f %f,\n", texcoord_ptr->get(i)[0], INVERSE_REPEAT(texcoord_ptr->get(i)[1])); } fprintf(fd, " ]\n }\n"); /* Now save separate Texture2 and IndexedFaceSet node pairs for each * texture used in the model. Each of the IndexedFaceSet(s) will * reference back to the initial vertices, materials, and texture * coordinates (due to the lack of Seperator nodes in between). * Find the first textured face starting at the i'th face. In this * manner we will find the next texture used in the model and save * all faces that are textured with it. */ for (i = 0; i < indices_ptr->getNum(); i+=3) { ss_ptr = ssa.get(*(materials_ptr->get(i/3))); if ( (ss_ptr != NULL)&&(ss_ptr->getTextureFilename() != NULL) ) { /* We've found the next textured face. Since we save all * faces using a texture when we find the first face using * that texture we must check if the faces for this texture * have already been saved. If we can find a face using * this texture earlier in the list of faces then we know * that it has already been saved. */ textureFacesAlreadySaved = false; for (j = 0; j < i; j+=3) { ss_ptr2 = ssa.get(*(materials_ptr->get(j/3))); if ( (ss_ptr2 != NULL)&& (ss_ptr2->getTextureFilename() != NULL)&& (!strcmp(ss_ptr->getTextureFilename(), ss_ptr2->getTextureFilename())) ) { textureFacesAlreadySaved = true; break; } } if (!textureFacesAlreadySaved) { fprintf(fd, " Texture2 {\n"); fprintf(fd, " filename %s\n", ss_ptr->getTextureFilename()); //TODO: support CLAMP mode as well. fprintf(fd, " wrapS REPEAT\n"); fprintf(fd, " wrapT REPEAT\n"); fprintf(fd, " }\n"); /* Save all the materials needed by this following indexed face * set. This will save all materials that have the same texture * filename specified below. */ SaveVRML1MaterialNode(fd, materials_ptr, &ssa, ss_ptr->getTextureFilename(), true, false, false, false); fprintf(fd, " IndexedFaceSet {\n coordIndex [\n"); for (j = i; j < indices_ptr->getNum(); j+=3) { /* Save each face which is textured by the Texture2 node defined * above. */ ss_ptr2 = ssa.get(*(materials_ptr->get(j/3))); if ( (ss_ptr2 != NULL)&& (ss_ptr2->getTextureFilename() != NULL)&& (!strcmp(ss_ptr->getTextureFilename(), ss_ptr2->getTextureFilename())) ) { index1 = *indices_ptr->get(j); index2 = *indices_ptr->get(j+1); index3 = *indices_ptr->get(j+2); /* Check for index overflow since PLIB stores it as a * short */ if ( (index1 < 0)||(index2 < 0)||(index3 < 0) ) { printf("Save error: index overflow, value " "won't fit in 16bits.\n"); } else { fprintf(fd, " %d, %d, %d, -1,\n", index1, index2, index3); } } } fprintf(fd, " ]\n }\n"); //close coordIndex array and //IndexedFaceSet } } } } fprintf(fd, "}\n"); //close Seperator fclose( fd ) ; delete vertices_ptr; delete indices_ptr; delete materials_ptr; delete texcoord_ptr; return TRUE; } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- Makefile.am 2001/10/03 10:21:10 1.30 +++ Makefile.am 2002/01/17 16:14:22 1.31 @@ -18,7 +18,7 @@ ssgLoadOBJ.cxx ssgSaveOBJ.cxx ssgVtxArray.cxx ssgLoadMD2.cxx \ ssgLoadMDL.cxx ssgLoadX.cxx ssgSaveX.cxx ssgLoaderWriterStuff.cxx \ ssgLoadFLT.cxx ssgLoadM.cxx ssgSaveM.cxx ssgLoadStrip.cxx \ - ssgLoadOFF.cxx ssgSaveOFF.cxx ssgSaveQHI.cxx ssgLoadVRML1.cxx \ + ssgLoadOFF.cxx ssgSaveOFF.cxx ssgSaveQHI.cxx ssgLoadVRML1.cxx ssgSaveVRML1.cxx\ ssgLoaderWriterStuff.h ssgMSFSPalette.h ssg3ds.h ssgLoadMDL.h \ ssgSave3ds.cxx ssgAxisTransform.cxx ssgLoadATG.cxx ssgSaveATG.cxx\ ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- ssg.cxx 2001/12/17 05:09:09 1.44 +++ ssg.cxx 2002/01/17 16:14:22 1.45 @@ -136,7 +136,7 @@ ssgAddModelFormat ( ".off" , ssgLoadOFF , ssgSaveOFF ) ; ssgAddModelFormat ( ".atg" , ssgLoadATG , ssgSaveATG ) ; ssgAddModelFormat ( ".qhi" , NULL , ssgSaveQHI ) ; - ssgAddModelFormat ( ".wrl", ssgLoadVRML1 , NULL ) ; + ssgAddModelFormat ( ".wrl", ssgLoadVRML1, ssgSaveVRML1 ) ; ssgAddModelFormat ( ".iv", ssgLoadIV , NULL ) ; Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.128 retrieving revision 1.129 diff -u -d -r1.128 -r1.129 --- ssg.h 2001/12/17 04:52:30 1.128 +++ ssg.h 2002/01/17 16:14:23 1.129 @@ -2609,6 +2609,7 @@ int ssgSaveQHI ( const char *fname, ssgEntity *ent ) ; int ssgSave3ds ( const char *fname, ssgEntity *ent ) ; int ssgSaveATG ( const char *fname, ssgEntity *ent ) ; +int ssgSaveVRML1( const char *fname, ssgEntity *ent ) ; ssgEntity *ssgLoad ( const char *fname, const ssgLoaderOptions *options = NULL ) ; |
From: Wolfram K. <wol...@us...> - 2002-01-17 16:13:26
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv8721 Modified Files: ssg.dsp Log Message: Adding ssgSaveVRML1 Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- ssg.dsp 2001/12/19 19:27:18 1.35 +++ ssg.dsp 2002/01/17 16:13:21 1.36 @@ -342,6 +342,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgSaveVRML1.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgSaveX.cxx # End Source File # Begin Source File |
From: Wolfram K. <wol...@us...> - 2002-01-17 15:47:08
|
Update of /cvsroot/plib/plib/doc/ssg In directory usw-pr-cvs1:/tmp/cvs-serv685 Modified Files: non_class.html Log Message: The hookfunctions have been wrapped in the ssgLoaderOptions. Minor format descriptions added. Index: non_class.html =================================================================== RCS file: /cvsroot/plib/plib/doc/ssg/non_class.html,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- non_class.html 2001/10/27 05:34:47 1.25 +++ non_class.html 2002/01/17 15:47:04 1.26 @@ -187,21 +187,21 @@ <li> ssgLoadOBJ - Wavefront, works well <li> ssgLoadTRI - simple Tri format from "Andy Colbournes Editor". <li> ssgLoadX - Microsofts DirectX-Format. Most features work. -<li> ssgLoadOFF - ??? +<li> ssgLoadOFF - Geomview's OFF <li> ssgLoadM - ??? -<li> ssgLoadATG - ??? -<li> ssgLoadStrip - ??? +<li> ssgLoadATG - Ascii TerraGear. Used by Flight Gear Flight Sim. +<li> ssgLoadStrip - The format of a stripifier. </ul> <pre> typedef ssgBranch *(*ssgHookFunc)(char *) ; - - ssgEntity *ssgLoad ( char *fname, ssgHookFunc hookfunc = NULL ) ; - ssgEntity *ssgLoadSSG ( char *fname, ssgHookFunc hookfunc = NULL ) ; - ssgEntity *ssgLoadAC ( char *fname, ssgHookFunc hookfunc = NULL ) ; - ssgEntity *ssgLoad3ds ( char *fname, ssgHookFunc hookfunc = NULL ) ; + ssgEntity *ssgLoad ( const char *fname, const ssgLoaderOptions *options = NULL ) ; + + ssgEntity *ssgLoadSSG ( const char *fname, const ssgLoaderOptions *options = NULL ) ; + ssgEntity *ssgLoadAC ( const char *fname, const ssgLoaderOptions *options = NULL ) ; + ssgEntity *ssgLoad3ds ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ...etc... </pre> @@ -241,6 +241,19 @@ </pre> You can only supply one path. If you need additional features, use the function <code>ulFindFile</code> (for more see util-library-doc). + +The last three functions simply set values in the _ssgCurrentOptions +(type ssgLoaderOptions), for example: + +<pre> +inline void ssgModelPath ( const char *path ) +{ + _ssgCurrentOptions -> setModelDir ( path ) ; +} +</pre> + +For more on ssgLoaderOptions see also the next page of this doc. + <p> Some loaders for file formats that use texture formats not |
From: Sebastian U. <ud...@us...> - 2002-01-16 19:55:55
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv2905 Modified Files: puLargeInput.cxx Log Message: John F. Fay: Fixed a bug that caused text to jump around when selecting a line Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- puLargeInput.cxx 2002/01/16 19:40:18 1.28 +++ puLargeInput.cxx 2002/01/16 19:55:51 1.29 @@ -239,25 +239,32 @@ select_end_position = e ; char *lin_ptr = ( bottom_slider ? getText () : getWrappedText () ) ; char *text_start = lin_ptr ; - int line_count = 0 ; - while ( lin_ptr && ( lin_ptr <= text_start + select_start_position ) ) // Count the lines - { - line_count++ ; - lin_ptr = strchr ( lin_ptr+1, '\n' ) ; - } if ( num_lines > lines_in_window ) { - if ( line_count < num_lines - lines_in_window ) + int select_start_line = 0 ; + while ( lin_ptr && ( lin_ptr <= text_start + select_start_position ) ) // Count the lines { - top_line_in_window = line_count ; - right_slider->setValue ( 1.0f - (float)line_count / (float)( num_lines - lines_in_window ) ) ; + select_start_line++ ; + lin_ptr = strchr ( lin_ptr+1, '\n' ) ; } - else + + int select_end_line = select_start_line ; + while ( lin_ptr && ( lin_ptr <= text_start + select_end_position ) ) // Count the lines { - top_line_in_window = num_lines - lines_in_window ; - right_slider->setValue ( 0.0f ) ; + select_end_line++ ; + lin_ptr = strchr ( lin_ptr+1, '\n' ) ; } + + if ( select_end_line > top_line_in_window + lines_in_window ) + top_line_in_window = select_end_line - lines_in_window - 1 ; + + if ( select_start_line < top_line_in_window ) + top_line_in_window = select_start_line - 1 ; + + if ( top_line_in_window < 0 ) top_line_in_window = 0 ; + + right_slider->setValue ( 1.0f - (float)top_line_in_window / (float)( num_lines - lines_in_window ) ) ; } puPostRefresh () ; |
From: Sebastian U. <ud...@us...> - 2002-01-16 19:40:21
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv29832 Modified Files: puLargeInput.cxx Log Message: John F. Fay: Fixed a bug that caused text to jump around when selecting a line Index: puLargeInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puLargeInput.cxx,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- puLargeInput.cxx 2001/12/21 14:27:13 1.27 +++ puLargeInput.cxx 2002/01/16 19:40:18 1.28 @@ -242,7 +242,7 @@ int line_count = 0 ; while ( lin_ptr && ( lin_ptr <= text_start + select_start_position ) ) // Count the lines { - line_count ++ ; + line_count++ ; lin_ptr = strchr ( lin_ptr+1, '\n' ) ; } @@ -271,7 +271,7 @@ if ( select_start_position > 0 ) - select_start_position ++ ; + select_start_position++ ; select_end_position = int ( strchr ( temp_text + select_end_position, '\n' ) + 1 - temp_text ) ; if ( select_end_position == 1 ) select_end_position = strlen ( temp_text ) ; @@ -659,7 +659,7 @@ else if ( line_count > end_lin ) // Have gone beyond window, end process end_of_line = NULL ; - line_count ++ ; + line_count++ ; } // while ( end_of_line ) } // if ( val ) |
From: Sebastian U. <ud...@us...> - 2002-01-16 19:27:44
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv26052 Modified Files: puFileSelector.cxx Log Message: John F. Fay: Make slider move file list up / down one file at a time; Misc. fix Index: puFileSelector.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puFileSelector.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- puFileSelector.cxx 2002/01/07 22:57:48 1.16 +++ puFileSelector.cxx 2002/01/16 19:27:42 1.17 @@ -368,7 +368,6 @@ frame = new puFrame ( 0, 0, w, h ); slider = new puSlider (w-30,40+20*arrows,h-70-40*arrows,TRUE,20); - slider->setDelta(0.1f); slider->setValue(1.0f); slider->setSliderFraction (0.2f) ; slider->setCBMode( PUSLIDER_DELTA ); @@ -594,12 +593,15 @@ ulCloseDir ( dirp ) ; num_files = ifile ; + if ( num_files > 5 ) + slider -> setDelta ( 0.5f / num_files ) ; + else + slider -> setDelta ( 0.1f ) ; if ( num_files == 0 ) { ulSetError ( UL_WARNING, "PUI:puFileSelector - no entries in directory '%s'?!", dir ) ; - num_files = 0 ; return; } |
From: Sebastian U. <ud...@us...> - 2002-01-16 18:58:34
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv17687 Modified Files: puInput.cxx Log Message: John F. Fay: Changed some declarations; Echo text value in int / float values Index: puInput.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInput.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- puInput.cxx 2001/12/09 17:39:45 1.20 +++ puInput.cxx 2002/01/16 18:58:30 1.21 @@ -276,8 +276,8 @@ int puInput::checkKey ( int key, int /* updown */ ) { - extern void puSetPasteBuffer ( char *ch ) ; - extern char *puGetPasteBuffer () ; + extern void puSetPasteBuffer ( char *ch ) ; + extern char *puGetPasteBuffer ( void ) ; if ( ! isAcceptingInput() || ! isActive () || ! isVisible () || ( window != puGetWindow () ) ) return FALSE ; @@ -394,7 +394,7 @@ break ; } - /* setValue ( getStringValue() ) ; */ + setValue ( getStringValue () ) ; } normalize_cursors () ; |
From: Sebastian U. <ud...@us...> - 2002-01-16 17:56:47
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv26740 Modified Files: pu.h Log Message: John F. Fay: Misc. changes Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- pu.h 2002/01/07 22:44:51 1.93 +++ pu.h 2002/01/16 17:56:43 1.94 @@ -581,8 +581,8 @@ puObject *prev ; /* Instead, use the setNextObject and setPrevObject methods. */ - puBox *getBBox ( void ) const { return (puBox *) (& bbox) ; } - puBox *getABox ( void ) const { return (puBox *) (& abox) ; } + puBox *getBBox ( void ) const { return (puBox *) &bbox ; } + puBox *getABox ( void ) const { return (puBox *) &abox ; } void getAbsolutePosition ( int *x, int *y ) const ; @@ -863,7 +863,7 @@ } void setFloating ( int value ) { floating = value ; } - int getFloating ( void ) const { return floating ; } + int getFloating ( void ) const { return floating ; } void setChildStyle ( int childs, int which, int recursive = FALSE ) ; void setChildBorderThickness ( int childs, int t, int recursive = FALSE ) ; @@ -1043,7 +1043,7 @@ { type |= PUCLASS_SLIDER ; slider_fraction = 0.1f ; - getValue ( & last_cb_value ) ; + getValue ( & last_cb_value ) ; // was last_cb_value = -1.0f ; vert = vertical ; cb_delta = 0.1f ; cb_mode = PUSLIDER_ALWAYS ; @@ -1061,7 +1061,7 @@ { type |= PUCLASS_SLIDER ; slider_fraction = 0.1f ; - getValue ( & last_cb_value ) ; + getValue ( & last_cb_value ) ; // was last_cb_value = -1.0f ; vert = vertical ; cb_delta = 0.1f ; cb_mode = PUSLIDER_ALWAYS ; @@ -1171,8 +1171,8 @@ freeze_ends = TRUE ; } - int getFreezeEnds ( void ) const { return freeze_ends ; } - void setFreezeEnds ( int val ) { freeze_ends = val ; puPostRefresh () ; } + int getFreezeEnds ( void ) const { return freeze_ends ; } + void setFreezeEnds ( int val ) { freeze_ends = val ; puPostRefresh () ; } } ; @@ -1396,9 +1396,9 @@ if ( down_cb ) (*down_cb)(this) ; } - void enableInput ( void ) { input_disabled = FALSE ; } - void disableInput ( void ) { input_disabled = TRUE ; } - int inputDisabled ( void ) const { return input_disabled ; } + void enableInput ( void ) { input_disabled = FALSE ; } + void disableInput ( void ) { input_disabled = TRUE ; } + int inputDisabled ( void ) const { return input_disabled ; } } ; @@ -1653,9 +1653,9 @@ if ( down_cb ) (*down_cb)(this) ; } - void enableInput ( void ) { input_disabled = FALSE ; } - void disableInput ( void ) { input_disabled = TRUE ; } - int inputDisabled ( void ) const { return input_disabled ; } + void enableInput ( void ) { input_disabled = FALSE ; } + void disableInput ( void ) { input_disabled = TRUE ; } + int inputDisabled ( void ) const { return input_disabled ; } void setText ( const char *l ) ; char *getText ( void ) const { return text ; } |
From: Sebastian U. <ud...@us...> - 2002-01-16 17:53:38
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv25534 Modified Files: pu.cxx Log Message: John F. Fay: Added missing "void"s to some function definitions / declarations Index: pu.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.cxx,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- pu.cxx 2001/12/21 14:27:36 1.43 +++ pu.cxx 2002/01/16 17:53:34 1.44 @@ -114,7 +114,7 @@ } ; -static int glIsValidContext () +static int glIsValidContext ( void ) { #if defined(CONSOLE) return true ; @@ -217,7 +217,7 @@ } -static void puCleanUpJunk () +static void puCleanUpJunk ( void ) { /* Step through the linked list of objects to delete, removing them. */ while ( objects_to_delete != NULL ) @@ -283,7 +283,7 @@ glDisable ( GL_CULL_FACE ) ; if ( ! openGLSize ) - glViewport ( 0, 0, w, h ) ; + glViewport ( 0, 0, w, h ) ; glMatrixMode ( GL_PROJECTION ) ; glPushMatrix () ; @@ -371,8 +371,8 @@ int x_offset, y_offset ; active -> getAbsolutePosition ( &x_offset, &y_offset ) ; - x_offset -= active -> getABox () -> min[0] ; - y_offset -= active -> getABox () -> min[1] ; + x_offset -= active -> getABox () -> min [0] ; + y_offset -= active -> getABox () -> min [1] ; if ( ! active -> isHit ( pu_mouse_x - x_offset, pu_mouse_y - y_offset ) ) { @@ -464,7 +464,7 @@ strcpy ( input_paste_buffer, ch ) ; } -char *puGetPasteBuffer () { return input_paste_buffer ; } +char *puGetPasteBuffer ( void ) { return input_paste_buffer ; } int puNeedRefresh ( void ) { return puRefresh ; } void puPostRefresh ( void ) { puRefresh = TRUE ; } |
From: <ud...@us...> - 2002-01-16 16:45:18
|
This is a test. - Sebastian |
From: Sebastian U. <ud...@us...> - 2002-01-16 16:37:40
|
Update of /cvsroot/plib/plib In directory usw-pr-cvs1:/tmp/cvs-serv4730 Removed Files: testfile Log Message: --- testfile DELETED --- |
From: Sebastian U. <ud...@ha...> - 2002-01-16 16:34:51
|
This is a test. - Sebastian |