plib-cvs Mailing List for PLIB (Page 53)
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: Sebastian U. <ud...@us...> - 2002-06-10 19:17:01
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv13615 Modified Files: pu.h puValue.cxx Log Message: Made conversion of string values into integers more intelligent Index: pu.h =================================================================== RCS file: /cvsroot/plib/plib/src/pui/pu.h,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- pu.h 11 May 2002 14:49:31 -0000 1.104 +++ pu.h 10 Jun 2002 19:16:55 -0000 1.105 @@ -541,21 +541,7 @@ puPostRefresh () ; } - void setValue ( const char *s ) - { - if ( s == NULL ) - s = "" ; - - copy_stringval ( s ) ; - - if ( convert == TRUE ) - { - *getIntegerp () = (int) strtol ( s, NULL, 0 ) ; - *getFloaterp () = (float) strtod ( s, NULL ) ; - } - - puPostRefresh () ; - } + void setValue ( const char *s ) ; void getValue ( int *i ) { re_eval () ; *i = *getIntegerp () ; } void getValue ( float *f ) { re_eval () ; *f = *getFloaterp () ; } Index: puValue.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puValue.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- puValue.cxx 4 Jun 2002 22:21:19 -0000 1.16 +++ puValue.cxx 10 Jun 2002 19:16:55 -0000 1.17 @@ -24,6 +24,24 @@ #include "puLocal.h" +static int strtoint ( const char *str ) +{ + while ( isspace ( *str ) != 0 ) + str++ ; + + if ( *str == '\0') + return 0 ; + else if ( ulStrNEqual ( str, "0x", 2 ) == TRUE ) + return (int) strtol ( str + 2, NULL, 16 ) ; /* try hexadecimal */ + else if ( ulStrNEqual ( str, "0o", 2 ) == TRUE ) + return (int) strtol ( str + 2, NULL, 8 ) ; /* try octal */ + else if ( ulStrNEqual ( str, "0b", 2 ) == TRUE ) + return (int) strtol ( str + 2, NULL, 2 ) ; /* try binary */ + else + return (int) strtol ( str, NULL, 10 ) ; /* try decimal */ +} + + void puValue::re_eval ( void ) { if ( convert == FALSE ) @@ -37,7 +55,7 @@ Needed for puInput / puLargeInput: Do not modify the string value unless necessary */ - if ( *res_integer != strtol ( string, NULL, 0 ) ) + if ( *res_integer != strtoint ( string ) ) sprintf ( string, "%d", *res_integer ) ; puPostRefresh () ; @@ -57,7 +75,7 @@ } else if ( res_string != NULL ) { - integer = (int) strtol ( res_string, NULL, 0 ) ; + integer = strtoint ( res_string ) ; floater = (float) strtod ( res_string, NULL ) ; puPostRefresh () ; } @@ -95,6 +113,22 @@ memcpy ( string, str, str_len + 1 ) ; } +} + +void puValue::setValue ( const char *s ) +{ + if ( s == NULL ) + s = "" ; + + copy_stringval ( s ) ; + + if ( convert == TRUE ) + { + *getIntegerp () = strtoint ( s ) ; + *getFloaterp () = (float) strtod ( s, NULL ) ; + } + + puPostRefresh () ; } |
From: Sebastian U. <ud...@us...> - 2002-06-10 18:39:41
|
Update of /cvsroot/plib/plib/src/pui In directory usw-pr-cvs1:/tmp/cvs-serv1541 Modified Files: puTriSlider.cxx Log Message: James Jones: Fixed puTriSlider / "freeze_ends == TRUE" behaviour Index: puTriSlider.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puTriSlider.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- puTriSlider.cxx 10 Nov 2001 13:37:38 -0000 1.17 +++ puTriSlider.cxx 10 Jun 2002 18:39:37 -0000 1.18 @@ -124,8 +124,10 @@ if ( getFreezeEnds() ) // Cannot move end sliders, must move middle one { - setValue ( new_value ) ; - setActiveButton ( 2 ) ; + setActiveButton ( 2 ) ; + setValue ( new_value ) ; /* Ensure that the middle slider can't move beyond the barriers - JCJ 10 Jun 2002 */ + if ( new_value < getCurrentMin() ) setValue ( getCurrentMin() ) ; + if ( new_value > getCurrentMax() ) setValue ( getCurrentMax() ) ; } else { @@ -196,3 +198,4 @@ } } } + |
From: M?rten Str?m. <str...@us...> - 2002-06-10 16:56:05
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv30112 Modified Files: ssgOptimiser.cxx Log Message: David Megginson: Patch for AC3D smoothing. Index: ssgOptimiser.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgOptimiser.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- ssgOptimiser.cxx 3 Apr 2002 13:55:16 -0000 1.25 +++ ssgOptimiser.cxx 10 Jun 2002 16:56:00 -0000 1.26 @@ -303,16 +303,22 @@ for ( i = 0 ; i < tnum ; i++ ) { sgVec3 tmp ; + short j ; sgMakeNormal ( tmp, vlist [ tlist [ i*3+ 0 ] ] -> vertex, vlist [ tlist [ i*3+ 1 ] ] -> vertex, vlist [ tlist [ i*3+ 2 ] ] -> vertex ) ; - - sgAddVec3 ( vlist [ tlist [ i*3+ 0 ] ] -> normal, tmp ) ; - sgAddVec3 ( vlist [ tlist [ i*3+ 1 ] ] -> normal, tmp ) ; - sgAddVec3 ( vlist [ tlist [ i*3+ 2 ] ] -> normal, tmp ) ; + + for ( j = 0; j < vnum; j++ ) { + if (sgEqualVec3(vlist[j]->vertex, vlist[tlist[i*3+0]]->vertex)) + sgAddVec3(vlist[j]->normal, tmp); + if (sgEqualVec3(vlist[j]->vertex, vlist[tlist[i*3+1]]->vertex)) + sgAddVec3(vlist[j]->normal, tmp); + if (sgEqualVec3(vlist[j]->vertex, vlist[tlist[i*3+2]]->vertex)) + sgAddVec3(vlist[j]->normal, tmp); + } } - + for ( i = 0 ; i < vnum ; i++ ) if ( sgScalarProductVec2 ( vlist[i]->normal, vlist[i]->normal ) < 0.001 ) sgSetVec3 ( vlist[i]->normal, 0.0f, 0.0f, 1.0f ) ; |
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv20888 Modified Files: ssgLoad3ds.cxx ssgLoadAC.cxx ssgLoadATG.cxx ssgLoadFLT.cxx ssgLoadIV.cxx ssgLoadMD2.cxx ssgLoadOFF.cxx ssgLoadVRML1.cxx ssgLoadX.cxx Log Message: Cleanups in loader code Index: ssgLoad3ds.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoad3ds.cxx,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ssgLoad3ds.cxx 24 Mar 2002 15:11:36 -0000 1.33 +++ ssgLoad3ds.cxx 10 Jun 2002 16:34:29 -0000 1.34 @@ -75,7 +75,7 @@ #endif #ifdef DEBUG -char debug_indent[256]; +static char debug_indent[256]; #endif /* this is the minimum value of the dot product for Index: ssgLoadAC.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadAC.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ssgLoadAC.cxx 10 Jun 2002 14:15:13 -0000 1.26 +++ ssgLoadAC.cxx 10 Jun 2002 16:34:29 -0000 1.27 @@ -52,27 +52,27 @@ static sgVec2 texrep ; static sgVec2 texoff ; -int do_material ( char *s ) ; -int do_object ( char *s ) ; -int do_name ( char *s ) ; -int do_data ( char *s ) ; -int do_texture ( char *s ) ; -int do_texrep ( char *s ) ; -int do_texoff ( char *s ) ; -int do_rot ( char *s ) ; [...261 lines suppressed...] -int do_refs ( char *s ) +static int do_refs ( char *s ) { int nrefs = strtol ( s, NULL, 0 ) ; char buffer [ 1024 ] ; @@ -591,7 +591,7 @@ return PARSE_POP ; } -int do_kids ( char *s ) +static int do_kids ( char *s ) { last_num_kids = strtol ( s, NULL, 0 ) ; @@ -686,5 +686,4 @@ return current_branch ; } - Index: ssgLoadATG.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadATG.cxx,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ssgLoadATG.cxx 23 Mar 2002 15:06:45 -0000 1.15 +++ ssgLoadATG.cxx 10 Jun 2002 16:34:30 -0000 1.16 @@ -124,7 +124,7 @@ static char * _current_usemtl = NULL, * _last_usemtl = NULL; static int _current_material_index = -1; -double _ssg_gbs_x = 0.0, _ssg_gbs_y = 0.0, _ssg_gbs_z = 1.0, _ssg_gbs_r = 0.0; +static double _ssg_gbs_x = 0.0, _ssg_gbs_y = 0.0, _ssg_gbs_z = 1.0, _ssg_gbs_r = 0.0; void ssgGetValuesFromLastATGFile(double *x, double *y, double *z, double *r) // These values are the values from the "# gbs" line from the last loaded Index: ssgLoadFLT.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadFLT.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- ssgLoadFLT.cxx 27 Feb 2002 20:05:11 -0000 1.29 +++ ssgLoadFLT.cxx 10 Jun 2002 16:34:30 -0000 1.30 @@ -339,7 +339,7 @@ typedef int (*sfunc)(const void *key1, const void *key2); -struct snode *splay(struct snode *t, const void *key, sfunc comp) +static struct snode *splay(struct snode *t, const void *key, sfunc comp) { struct snode N, *l, *r, *y; Index: ssgLoadIV.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadIV.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgLoadIV.cxx 18 Dec 2001 16:35:59 -0000 1.7 +++ ssgLoadIV.cxx 10 Jun 2002 16:34:32 -0000 1.8 @@ -44,7 +44,7 @@ static bool iv_parseIndexedFaceSet( ssgBranch *parentBranch, _traversalState *parentData, char *defName ); static bool iv_parseTexture2( ssgBranch *parentBranch, _traversalState *currentData, char *defName ); -_parseTag ivTags [] = +static _parseTag ivTags [] = { { "Separator", iv_parseSeparator }, { "Switch", iv_parseSwitch }, @@ -329,7 +329,7 @@ return TRUE; } -bool iv_parseTexture2( ssgBranch *parentBranch, _traversalState *currentData, char *defName ) +static bool iv_parseTexture2( ssgBranch *parentBranch, _traversalState *currentData, char *defName ) { char *token; char *fileName = NULL; bool wrapU = FALSE, wrapV = FALSE; Index: ssgLoadMD2.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMD2.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ssgLoadMD2.cxx 8 May 2002 22:40:10 -0000 1.12 +++ ssgLoadMD2.cxx 10 Jun 2002 16:34:32 -0000 1.13 @@ -104,7 +104,7 @@ */ -int seq_frames[] = { +static int seq_frames[] = { 40, 6, 8, @@ -197,12 +197,12 @@ static t_model header; -void read_header() +static void read_header() { fread(&header, sizeof(t_model), 1, loader_fd); } -void read_frames(int offset) +static void read_frames(int offset) { fseek(loader_fd, offset, SEEK_SET); @@ -217,7 +217,7 @@ } } -void read_uvcoords(int offset) +static void read_uvcoords(int offset) { fseek(loader_fd, offset, SEEK_SET); @@ -225,7 +225,7 @@ fread(uvs, sizeof(t_tcoord), header.numTexCoords, loader_fd); } -void read_triangles(int offset) +static void read_triangles(int offset) { fseek(loader_fd, offset, SEEK_SET); @@ -233,7 +233,7 @@ fread(triangles, sizeof(t_triangle), header.numTriangles, loader_fd); } -void read_skins(int offset) +static void read_skins(int offset) { fseek(loader_fd, offset, SEEK_SET); char buffer[64]; @@ -251,7 +251,7 @@ strcpy(skins[i], start); } } -void read_glcommands(int offset) +static void read_glcommands(int offset) { fseek(loader_fd, offset, SEEK_SET); } @@ -261,7 +261,7 @@ * they can share UVs properly * Right now, it does this really naively, (it dups them all) */ -ssgEntity * convert_to_ssg() +static ssgEntity * convert_to_ssg() { sgVec3 vert; sgVec2 uv; Index: ssgLoadOFF.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadOFF.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ssgLoadOFF.cxx 10 Jun 2002 14:15:14 -0000 1.9 +++ ssgLoadOFF.cxx 10 Jun 2002 16:34:32 -0000 1.10 @@ -44,7 +44,7 @@ #define u32 unsigned int -int _ssgLoadTranslucent=TRUE; +static int _ssgLoadTranslucent=TRUE; extern sgVec4 currentDiffuse; @@ -117,7 +117,7 @@ #define MAX_NO_VERTICES_PER_FACE 1000 -class ssgLoaderWriterMesh theMesh; +static class ssgLoaderWriterMesh theMesh; Index: ssgLoadVRML1.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadVRML1.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgLoadVRML1.cxx 18 Dec 2001 16:35:59 -0000 1.7 +++ ssgLoadVRML1.cxx 10 Jun 2002 16:34:32 -0000 1.8 @@ -59,7 +59,7 @@ static bool vrml1_parseIndexedFaceSet( ssgBranch *parentBranch, _traversalState *currentData, char *defName ); static bool vrml1_parseTexture2( ssgBranch *parentBranch, _traversalState *currentData, char *defName ); -_parseTag vrmlTags [] = +static _parseTag vrmlTags [] = { { "Separator", vrml1_parseSeparator }, { "Switch", vrml1_parseSwitch }, Index: ssgLoadX.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadX.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ssgLoadX.cxx 10 Jun 2002 14:15:14 -0000 1.17 +++ ssgLoadX.cxx 10 Jun 2002 16:34:32 -0000 1.18 @@ -36,7 +36,7 @@ typedef int HandlerFunctionType(const char *sName, const char *firstToken); -char *globEmpty=""; +static char *globEmpty=""; static ssgBranch *curr_branch_; @@ -105,7 +105,7 @@ } } [...86 lines suppressed...] u32 i, nFaceIndexes, nMaterialsRead = 0, nMaterials; @@ -481,7 +481,7 @@ } -int HandleMesh(const char * /* sName */, const char *firstToken) +static int HandleMesh(const char * /* sName */, const char *firstToken) { u32 i, j, nNoOfVertices, nNoOfVerticesForThisFace, nNoOfFaces; int iVertex, aiVertices[MAX_NO_VERTICES_PER_FACE]; @@ -580,7 +580,7 @@ return TRUE; } -static int TwoCharsToInt(char char1, char char2) +inline int TwoCharsToInt(char char1, char char2) { return ((int)(char1-'0'))*256+char2-'0'; } |
From: Sebastian U. <ud...@us...> - 2002-06-10 16:08:34
|
Update of /cvsroot/plib/plib/src/util In directory usw-pr-cvs1:/tmp/cvs-serv10696 Modified Files: ul.h ulList.cxx Log Message: Ensure that ulList 'next' member variable gets initialized (thanks to Cameron Moore and Franz Melchior) Index: ul.h =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.h,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- ul.h 21 Apr 2002 03:52:27 -0000 1.43 +++ ul.h 10 Jun 2002 16:08:31 -0000 1.44 @@ -663,7 +663,7 @@ void *getEntity ( unsigned int n ) { - next = n ; + next = n + 1 ; return ( n >= total ) ? (void *) NULL : entity_list [ n ] ; } @@ -685,7 +685,7 @@ replaceEntity ( searchForEntity ( old_entity ), new_entity ) ; } - void *getNextEntity (void) { return getEntity ( next+1 ) ; } + void *getNextEntity (void) { return getEntity ( next ) ; } int getNumEntities (void) const { return total ; } int searchForEntity ( void *entity ) const ; Index: ulList.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/util/ulList.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ulList.cxx 3 Mar 2002 14:17:16 -0000 1.3 +++ ulList.cxx 10 Jun 2002 16:08:31 -0000 1.4 @@ -34,6 +34,7 @@ ulList::ulList ( int init ) { total = 0 ; + next = 0 ; entity_list = new void * [ limit = (init <= 0) ? 1 : init ] ; } |
From: Sebastian U. <ud...@us...> - 2002-06-10 16:07:16
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv10121 Modified Files: ssg.h ssgList.cxx Log Message: Ensure that ssgList 'next' member variable gets initialized (thanks to Cameron Moore and Franz Melchior) Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.137 retrieving revision 1.138 diff -u -d -r1.137 -r1.138 --- ssg.h 10 Jun 2002 14:15:13 -0000 1.137 +++ ssg.h 10 Jun 2002 16:07:13 -0000 1.138 @@ -210,7 +210,7 @@ ssgEntity *getEntity ( unsigned int n ) { - next = n ; + next = n + 1 ; return ( n >= total ) ? (ssgEntity *) NULL : entity_list [ n ] ; } @@ -232,7 +232,7 @@ } int getNumEntities (void) { return total ; } - ssgEntity *getNextEntity (void) { return getEntity ( next+1 ) ; } + ssgEntity *getNextEntity (void) { return getEntity ( next ) ; } int searchForEntity ( ssgEntity *entity ) ; } ; Index: ssgList.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgList.cxx,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ssgList.cxx 7 Nov 2001 23:51:09 -0000 1.6 +++ ssgList.cxx 10 Jun 2002 16:07:13 -0000 1.7 @@ -27,6 +27,7 @@ ssgList::ssgList ( int init ) { total = 0 ; + next = 0 ; entity_list = new ssgEntity * [ limit = (init <= 0) ? 1 : init ] ; } |
From: Sebastian U. <ud...@us...> - 2002-06-10 14:15:18
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv1997 Modified Files: ssg.cxx ssg.h ssgLoadAC.cxx ssgLoadASE.cxx ssgLoadBMP.cxx ssgLoadDXF.cxx ssgLoadMDL.cxx ssgLoadOBJ.cxx ssgLoadOFF.cxx ssgLoadVRML.h ssgLoadX.cxx ssgTween.cxx ssgTweenController.cxx Log Message: Solved some compiler warnings Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- ssg.cxx 9 Jun 2002 15:30:39 -0000 1.52 +++ ssg.cxx 10 Jun 2002 14:15:13 -0000 1.53 @@ -70,7 +70,7 @@ int ssgGetFrameCounter () { return _ssgFrameCounter ; } void ssgSetFrameCounter ( int fc ) { _ssgFrameCounter = fc ; } -char *ssgGetVersion () +const char *ssgGetVersion () { #ifdef VERSION return VERSION ; @@ -300,35 +300,35 @@ } -char *ssgAxisTransform::getTypeName (void) { return "ssgAxisTransform" ; } -char *ssgBase ::getTypeName (void) { return "ssgBase" ; } -char *ssgTexture ::getTypeName (void) { return "ssgTexture" ; } -char *ssgState ::getTypeName (void) { return "ssgState" ; } -char *ssgSimpleState ::getTypeName (void) { return "ssgSimpleState" ; } -char *ssgStateSelector::getTypeName (void) { return "ssgStateSelector" ; } -char *ssgEntity ::getTypeName (void) { return "ssgEntity" ; } -char *ssgLeaf ::getTypeName (void) { return "ssgLeaf" ; } -char *ssgVTable ::getTypeName (void) { return "ssgVTable" ; } -char *ssgVtxTable ::getTypeName (void) { return "ssgVtxTable" ; } -char *ssgVtxArray ::getTypeName (void) { return "ssgVtxArray" ; } -char *ssgBranch ::getTypeName (void) { return "ssgBranch" ; } -char *ssgSelector ::getTypeName (void) { return "ssgSelector" ; } -char *ssgRangeSelector::getTypeName (void) { return "ssgRangeSelector" ; } -char *ssgTimedSelector::getTypeName (void) { return "ssgTimedSelector" ; } -char *ssgBaseTransform::getTypeName (void) { return "ssgBaseTransform" ; } -char *ssgTransform ::getTypeName (void) { return "ssgTransform" ; } -char *ssgTexTrans ::getTypeName (void) { return "ssgTexTrans" ; } -char *ssgCutout ::getTypeName (void) { return "ssgCutout" ; } -char *ssgRoot ::getTypeName (void) { return "ssgRoot" ; } +const char *ssgAxisTransform::getTypeName (void) { return "ssgAxisTransform" ; } +const char *ssgBase ::getTypeName (void) { return "ssgBase" ; } +const char *ssgTexture ::getTypeName (void) { return "ssgTexture" ; } +const char *ssgState ::getTypeName (void) { return "ssgState" ; } +const char *ssgSimpleState ::getTypeName (void) { return "ssgSimpleState" ; } +const char *ssgStateSelector::getTypeName (void) { return "ssgStateSelector" ; } +const char *ssgEntity ::getTypeName (void) { return "ssgEntity" ; } +const char *ssgLeaf ::getTypeName (void) { return "ssgLeaf" ; } +const char *ssgVTable ::getTypeName (void) { return "ssgVTable" ; } +const char *ssgVtxTable ::getTypeName (void) { return "ssgVtxTable" ; } +const char *ssgVtxArray ::getTypeName (void) { return "ssgVtxArray" ; } +const char *ssgBranch ::getTypeName (void) { return "ssgBranch" ; } +const char *ssgSelector ::getTypeName (void) { return "ssgSelector" ; } +const char *ssgRangeSelector::getTypeName (void) { return "ssgRangeSelector" ; } +const char *ssgTimedSelector::getTypeName (void) { return "ssgTimedSelector" ; } +const char *ssgBaseTransform::getTypeName (void) { return "ssgBaseTransform" ; } +const char *ssgTransform ::getTypeName (void) { return "ssgTransform" ; } +const char *ssgTexTrans ::getTypeName (void) { return "ssgTexTrans" ; } +const char *ssgCutout ::getTypeName (void) { return "ssgCutout" ; } +const char *ssgRoot ::getTypeName (void) { return "ssgRoot" ; } -char *ssgSimpleList ::getTypeName (void) { return "ssgSimpleList" ; } -char *ssgColourArray ::getTypeName (void) { return "ssgColourArray" ; } -char *ssgIndexArray ::getTypeName (void) { return "ssgIndexArray" ; } -char *ssgTransformArray::getTypeName (void) { return "ssgTransformArray" ; } -char *ssgTexCoordArray::getTypeName (void) { return "ssgTexCoordArray" ; } -char *ssgVertexArray ::getTypeName (void) { return "ssgVertexArray" ; } -char *ssgNormalArray ::getTypeName (void) { return "ssgNormalArray" ; } -char *ssgInterleavedArray::getTypeName (void) { return "ssgInterleavedArray"; } +const char *ssgSimpleList ::getTypeName (void) { return "ssgSimpleList" ; } +const char *ssgColourArray ::getTypeName (void) { return "ssgColourArray" ; } +const char *ssgIndexArray ::getTypeName (void) { return "ssgIndexArray" ; } +const char *ssgTransformArray::getTypeName (void) { return "ssgTransformArray" ; } +const char *ssgTexCoordArray::getTypeName (void) { return "ssgTexCoordArray" ; } +const char *ssgVertexArray ::getTypeName (void) { return "ssgVertexArray" ; } +const char *ssgNormalArray ::getTypeName (void) { return "ssgNormalArray" ; } +const char *ssgInterleavedArray::getTypeName (void) { return "ssgInterleavedArray"; } Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.136 retrieving revision 1.137 diff -u -d -r1.136 -r1.137 --- ssg.h 9 Jun 2002 15:30:39 -0000 1.136 +++ ssg.h 10 Jun 2002 14:15:13 -0000 1.137 @@ -300,7 +300,7 @@ /* Type checking mechanism */ - virtual char *getTypeName(void) ; + virtual const char *getTypeName(void) ; int getType (void) { return type ; } int isA ( int ty ) { return getType() == ty ; } @@ -456,7 +456,7 @@ virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ; virtual int load ( FILE *fd ) ; [...247 lines suppressed...] virtual int save ( FILE *fd ) ; virtual void cull ( sgFrustum *f, sgMat4 m, int test_needed ) ; @@ -2045,7 +2045,7 @@ virtual ssgBase *clone ( int clone_flags = 0 ) ; ssgRoot (void) ; virtual ~ssgRoot (void) ; - virtual char *getTypeName(void) ; + virtual const char *getTypeName(void) ; virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; } ; @@ -2703,7 +2703,7 @@ char *ssgShowStats () ; void ssgDelete ( ssgBranch *br ) ; -char *ssgGetVersion () ; +const char *ssgGetVersion () ; void ssgSetLoadOFFTranslucent ( int i ); Index: ssgLoadAC.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadAC.cxx,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- ssgLoadAC.cxx 3 Apr 2002 11:31:07 -0000 1.25 +++ ssgLoadAC.cxx 10 Jun 2002 14:15:13 -0000 1.26 @@ -79,7 +79,7 @@ struct Tag { - char *token ; + const char *token ; int (*func) ( char *s ) ; } ; Index: ssgLoadASE.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadASE.cxx,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- ssgLoadASE.cxx 23 Mar 2002 15:06:45 -0000 1.42 +++ ssgLoadASE.cxx 10 Jun 2002 14:15:13 -0000 1.43 @@ -165,7 +165,7 @@ }; -enum { MAX_MATERIALS = 1000 }; +#define MAX_MATERIALS 1000 static aseMaterial** materials ; static u32 num_materials ; @@ -738,7 +738,7 @@ } else if (!strcmp(token,"*MESH_VERTEXNORMAL")) { - int nverts = mesh -> num_verts; + //int nverts = mesh -> num_verts; if ( mesh_face_normal_index >= mesh -> num_faces ) parser.error("bad mesh_face_normal_index #"); Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ssgLoadBMP.cxx 10 Jun 2002 13:11:32 -0000 1.14 +++ ssgLoadBMP.cxx 10 Jun 2002 14:15:14 -0000 1.15 @@ -47,7 +47,7 @@ (( *x << 24 ) & 0xFF000000 ) ; } -static void swab_int_array ( int *x, int leng ) +/*static void swab_int_array ( int *x, int leng ) { if ( ! isSwapped ) return ; @@ -60,7 +60,7 @@ (( *x << 24 ) & 0xFF000000 ) ; x++ ; } -} +}*/ static unsigned char readByte () Index: ssgLoadDXF.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadDXF.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ssgLoadDXF.cxx 28 Feb 2002 07:54:23 -0000 1.24 +++ ssgLoadDXF.cxx 10 Jun 2002 14:15:14 -0000 1.25 @@ -358,11 +358,11 @@ } -static void copy_vert ( dxfVert& dst, const dxfVert& src ) +/*static void copy_vert ( dxfVert& dst, const dxfVert& src ) { dst.color_index = src.color_index ; sgCopyVec3 ( dst.pos, src.pos ) ; -} +}*/ static void add_tri ( const dxfVert* p, const dxfVert* q, const dxfVert* r ) { Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- ssgLoadMDL.cxx 9 Jun 2002 15:30:39 -0000 1.39 +++ ssgLoadMDL.cxx 10 Jun 2002 14:15:14 -0000 1.40 @@ -98,9 +98,9 @@ static int curr_var_; static bool has_normals_, vtx_dirty_, tex_vtx_dirty_; -static bool join_children_, override_normals_; +//static bool join_children_, override_normals_; -static char *tex_fmt_; +//static char *tex_fmt_; //=========================================================================== Index: ssgLoadOBJ.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadOBJ.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ssgLoadOBJ.cxx 7 Nov 2001 23:51:10 -0000 1.20 +++ ssgLoadOBJ.cxx 10 Jun 2002 14:15:14 -0000 1.21 @@ -154,7 +154,7 @@ return st ; } -static int leqi ( char* string1, char* string2 ) +static int leqi ( const char* string1, const char* string2 ) //LEQI compares two strings for equality, disregarding case. { int i; Index: ssgLoadOFF.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadOFF.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ssgLoadOFF.cxx 7 Nov 2001 23:51:10 -0000 1.8 +++ ssgLoadOFF.cxx 10 Jun 2002 14:15:14 -0000 1.9 @@ -73,7 +73,7 @@ static _ssgParser parser; static ssgBranch* top_branch; -static int Ascii2Int(int &retVal, const char *token, const char* name ) +/*static int Ascii2Int(int &retVal, const char *token, const char* name ) // returns TRUE on success { char *endptr; @@ -84,7 +84,7 @@ { parser.error("The field %s should contain an integer number but contains %s",name, token) ; return FALSE; } -} +}*/ static int Ascii2UInt(unsigned int &retVal, const char *token, const char* name ) // returns TRUE on success Index: ssgLoadVRML.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadVRML.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ssgLoadVRML.h 18 Dec 2001 16:35:59 -0000 1.9 +++ ssgLoadVRML.h 10 Jun 2002 14:15:14 -0000 1.10 @@ -125,7 +125,7 @@ // tags for functions which may actually modify the scene graph struct _parseTag { - char *token ; + const char *token ; bool (*func) ( ssgBranch *parentBranch, _traversalState *parentData, char *defName ) ; } ; Index: ssgLoadX.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadX.cxx,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ssgLoadX.cxx 7 Nov 2001 23:51:10 -0000 1.16 +++ ssgLoadX.cxx 10 Jun 2002 14:15:14 -0000 1.17 @@ -42,7 +42,7 @@ struct EntityType { - char * sName; + const char * sName; HandlerFunctionType *HandleEntity; int bMayBeIgnored; } ; Index: ssgTween.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgTween.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgTween.cxx 19 Jan 2002 20:37:21 -0000 1.7 +++ ssgTween.cxx 10 Jun 2002 14:15:14 -0000 1.8 @@ -28,7 +28,7 @@ static float current_tween_state = 0.0f ; -char *ssgTween::getTypeName (void) { return "ssgTween" ; } +const char *ssgTween::getTypeName (void) { return "ssgTween" ; } float _ssgGetCurrentTweenState () { return current_tween_state ; } Index: ssgTweenController.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgTweenController.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ssgTweenController.cxx 19 Jan 2002 20:37:21 -0000 1.3 +++ ssgTweenController.cxx 10 Jun 2002 14:15:14 -0000 1.4 @@ -25,7 +25,7 @@ #include "ssgLocal.h" -char *ssgTweenController::getTypeName (void) { return "ssgTweenController" ; } +const char *ssgTweenController::getTypeName (void) { return "ssgTweenController" ; } void ssgTweenController::copy_from ( ssgTweenController *src, int clone_flags ) { |
From: Sebastian U. <ud...@us...> - 2002-06-10 13:11:36
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv8657 Modified Files: ssgLoadBMP.cxx Log Message: Jonathan Polley: Fixed compiling problem under MSVC Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- ssgLoadBMP.cxx 9 Jun 2002 11:29:54 -0000 1.13 +++ ssgLoadBMP.cxx 10 Jun 2002 13:11:32 -0000 1.14 @@ -264,9 +264,11 @@ if ( bpp == 8 ) { + int i ; + // check for diffrent alpha values in the bitmap // assume blending if that's the case - for ( int i = 1 ; i < w * h ; i++ ) { + for ( i = 1 ; i < w * h ; i++ ) { if (pal[data[i]].a != pal[data[i-1]].a) { isOpaque = FALSE ; break; @@ -280,7 +282,7 @@ image = new GLubyte [ w * h * z ] ; - for ( int i = 0 ; i < w * h ; i++ ) + for ( i = 0 ; i < w * h ; i++ ) switch ( z ) { case 1 : image [ i ] = pal[data[i]].r ; break ; |
From: Steve B. <sj...@us...> - 2002-06-10 05:42:37
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv19464/plib/doc/sg Modified Files: index.html Added Files: triangle_params.png Log Message: Added a diagram to the documentation and new functions for Angle/Side/Side and Side/Side/Angle. --- NEW FILE: triangle_params.png --- (This appears to be a binary file; contents omitted.) Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- index.html 10 Jun 2002 03:46:52 -0000 1.11 +++ index.html 10 Jun 2002 05:42:33 -0000 1.12 @@ -184,12 +184,25 @@ sides and included angle, find length of remaining side")... nope - neither do I. That's why these functions are useful. <p> +<TABLE> +<TR> +<TD> NOTE: <ul> <li> SSS = Three sides. <li> SAS = Two sides and the angle between them. <li> ASA = Two angles and the side between them. +<li> SAA = One side and two angles that don't include it. +<li> ASS = Two sides and one angle that's not between them. +<li> lenA, lenB, lenC = The lengths of sides A, B and C. +<li> angA, angB, angC = The angles opposite sides A, B and C. </ul> +</TD> +<TD> +<center><IMG SRC="triangle_params.png"></center> +</TD> +</TR> +</TABLE> <pre> void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, @@ -198,29 +211,35 @@ SGfloat *angA, SGfloat *lenB, SGfloat *angC ) ; void sgTriangleSolver_ASAtoSAS ( SGfloat angA, SGfloat lenB, SGfloat angC, SGfloat *lenA, SGfloat *angB, SGfloat *lenC ) ; +void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + SGfloat *lenC, SGfloat *angA, SGfloat *angC ) ; +void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, + SGfloat *angC, SGfloat *lenB, SGfloat *lenC ) ; </pre> -Imagine an arbitary triangle with sides of length 'lenA', 'lenB', 'lenC' -and angles 'angA', 'angB' and 'angC' where angA is opposite the side of -length lenA - and so on. -<p> These functions take three parameters which are a mixture of lengths and angles -for an arbitary triangle. They return the missing three lengths -or angles. In all cases of 'funny' triangles -(zero angles, zero lengths, impossible triangles), the package comes -up with one plausible result - or all zeroes. If one or more of the -results are not needed, pass a NULL pointer for the result and the -package can avoid doing the unnecessary trig. +for an arbitary triangle. They return the missing three parameters. +In all cases of 'degenerate' triangles (eg zero angles, zero lengths), the +package comes up with a plausible result - although it may not be a unique +solution. This should be robust and more roundoff-error-tolerant than +producing an error return. +<p> +Impossible triangles will produce all-zero results. +<p> +If one or more of the results are not needed, pass a NULL pointer for it +and the package can avoid doing the unnecessary trig and perhaps run a +little faster. <pre> SGfloat sgTriangleSolver_ASAtoArea ( SGfloat angA, SGfloat lenB, SGfloat angC ) ; SGfloat sgTriangleSolver_SAStoArea ( SGfloat lenA, SGfloat angB, SGfloat lenC ) ; SGfloat sgTriangleSolver_SSStoArea ( SGfloat lenA, SGfloat lenB, SGfloat lenC ) ; +SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB ) ; +SGfloat sgTriangleSolver_SAAtoArea ( SGfloat lenA, SGfloat angB, SGfloat angA ) ; </pre> -These compute the area of a triangle from three sides, two angles and -included side or two sides and included angle - impossible triangles -return areas of zero. +These compute the area of a triangle from three parameters. Impossible +triangles (eg lenA > lenB+lenC) return zero areas. <H3>sgCoord</H3> This simple structure contains two members - each of type 'sgVec3' - the first is 'xyz', the second 'hpr' - and together, |
From: Steve B. <sj...@us...> - 2002-06-10 05:42:37
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv19464/plib/src/sg Modified Files: sg.cxx sg.h Log Message: Added a diagram to the documentation and new functions for Angle/Side/Side and Side/Side/Angle. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- sg.cxx 10 Jun 2002 03:46:52 -0000 1.30 +++ sg.cxx 10 Jun 2002 05:42:33 -0000 1.31 @@ -1735,6 +1735,24 @@ } +SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB ) +{ + SGfloat lenC ; + + sgTriangleSolver_ASStoSAA ( angB, lenA, lenB, &lenC, NULL, NULL ) ; + + return sgTriangleSolver_SAStoArea ( lenA, angB, lenC ) ; +} + +SGfloat sgTriangleSolver_SAAtoArea ( SGfloat lenA, SGfloat angB, SGfloat angA ) +{ + SGfloat lenC ; + + sgTriangleSolver_SAAtoASS ( lenA, angB, angA, NULL, NULL, &lenC ) ; + + return sgTriangleSolver_SAStoArea ( lenA, angB, lenC ) ; +} + void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, SGfloat *angA, SGfloat *angB, SGfloat *angC ) { @@ -1835,4 +1853,37 @@ if ( lenC ) *lenC = lenB * sgSin(angC) / sinB ; } } + +void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + SGfloat *lenC, SGfloat *angA, SGfloat *angC ) +{ + /* Sine law */ + + SGfloat aa = (lenB == SG_ZERO ) ? SG_ZERO : sgASin (lenA * sgSin(angB)/lenB) ; + + if ( angA ) *angA = aa ; + + /* Find the missing angle */ + + SGfloat cc = SG_180 - aa - angB ; + + if ( angC ) *angC = cc ; + + /* Use SAStoASA to get the last length */ + + sgTriangleSolver_SAStoASA ( lenA, cc, lenB, NULL, lenC, NULL ) ; +} + +void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, + SGfloat *angC, SGfloat *lenB, SGfloat *lenC ) +{ + /* Find the missing angle */ + + SGfloat cc = SG_180 - angB - angA ; + + if ( angC ) *angC = cc ; + + sgTriangleSolver_ASAtoSAS ( cc, lenA, angB, lenB, NULL, lenC ) ; +} + Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- sg.h 10 Jun 2002 03:46:52 -0000 1.32 +++ sg.h 10 Jun 2002 05:42:34 -0000 1.33 @@ -2571,22 +2571,36 @@ SGfloat sgTriangleSolver_ASAtoArea ( SGfloat angA, SGfloat lenB, SGfloat angC ); SGfloat sgTriangleSolver_SAStoArea ( SGfloat lenA, SGfloat angB, SGfloat lenC ); SGfloat sgTriangleSolver_SSStoArea ( SGfloat lenA, SGfloat lenB, SGfloat lenC ); +SGfloat sgTriangleSolver_ASStoArea ( SGfloat angB, SGfloat lenA, SGfloat lenB ); +SGfloat sgTriangleSolver_SAAtoArea ( SGfloat lenA, SGfloat angB, SGfloat angA ); + void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, SGfloat *angA, SGfloat *angB, SGfloat *angC ) ; void sgTriangleSolver_SAStoASA ( SGfloat lenA, SGfloat angB, SGfloat lenC, SGfloat *angA, SGfloat *lenB, SGfloat *angC ) ; void sgTriangleSolver_ASAtoSAS ( SGfloat angA, SGfloat lenB, SGfloat angC, SGfloat *lenA, SGfloat *angB, SGfloat *lenC ) ; +void sgTriangleSolver_ASStoSAA ( SGfloat angB, SGfloat lenA, SGfloat lenB, + SGfloat *lenC, SGfloat *angA, SGfloat *angC ) ;void sgTriangleSolver_SAAtoASS ( SGfloat lenA, SGfloat angB, SGfloat angA, + SGfloat *angC, SGfloat *lenB, SGfloat *lenC ) ; + SGDfloat sgdTriangleSolver_ASAtoArea(SGDfloat angA,SGDfloat lenB,SGDfloat angC); SGDfloat sgdTriangleSolver_SAStoArea(SGDfloat lenA,SGDfloat angB,SGDfloat lenC); SGDfloat sgdTriangleSolver_SSStoArea(SGDfloat lenA,SGDfloat lenB,SGDfloat lenC); +SGDfloat sgdTriangleSolver_ASStoArea(SGDfloat angB,SGDfloat lenA,SGDfloat lenB); +SGDfloat sgdTriangleSolver_SAAtoArea(SGDfloat lenA,SGDfloat angB,SGDfloat angA); + void sgdTriangleSolver_SSStoAAA(SGDfloat lenA,SGDfloat lenB, SGDfloat lenC, SGDfloat *angA,SGDfloat *angB,SGDfloat *angC ) ; void sgdTriangleSolver_SAStoASA(SGDfloat lenA,SGDfloat angB,SGDfloat lenC, SGDfloat *angA,SGDfloat *lenB,SGDfloat *angC ) ; void sgdTriangleSolver_ASAtoSAS(SGDfloat angA,SGDfloat lenB,SGDfloat angC, SGDfloat *lenA,SGDfloat *angB,SGDfloat *lenC ) ; +void sgdTriangleSolver_ASStoSAA(SGDfloat angB,SGDfloat lenA,SGDfloat lenB, + SGDfloat *lenC,SGDfloat *angA,SGDfloat *angC ) ; +void sgdTriangleSolver_SAAtoASS(SGDfloat lenA,SGDfloat angB,SGDfloat angA, + SGDfloat *angC,SGDfloat *lenB,SGDfloat *lenC ) ; #endif |
From: Steve B. <sj...@us...> - 2002-06-10 03:46:56
|
Update of /cvsroot/plib/plib/src/sg In directory usw-pr-cvs1:/tmp/cvs-serv28169/plib/src/sg Modified Files: sg.cxx sg.h Log Message: Added sgTriangleSolver functions. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- sg.cxx 12 Apr 2002 14:49:26 -0000 1.29 +++ sg.cxx 10 Jun 2002 03:46:52 -0000 1.30 @@ -24,6 +24,38 @@ #include "sg.h" +/* Type-casted sqrt and sin/cos/tan/asin/acos/atan2 ARGUMENTS IN DEGREES */ + +inline SGDfloat sgdASin ( SGDfloat s ) + { return (SGDfloat) asin ( s ) * SGD_RADIANS_TO_DEGREES ; } +inline SGDfloat sgdACos ( SGDfloat s ) + { return (SGDfloat) acos ( s ) * SGD_RADIANS_TO_DEGREES ; } +inline SGDfloat sgdATan ( SGDfloat s ) + { return (SGDfloat) atan ( s ) * SGD_RADIANS_TO_DEGREES ; } [...316 lines suppressed...] + SGfloat bb = SG_180 - angA - angC ; + + if ( angB ) *angB = bb ; + + /* Use Sine Rule */ + + SGfloat sinB = sgSin ( bb ) ; + + if ( sinB == SG_ZERO ) + { + if ( lenA ) *lenA = lenB / SG_TWO ; /* One valid interpretation */ + if ( lenC ) *lenC = lenB / SG_TWO ; + } + else + { + if ( lenA ) *lenA = lenB * sgSin(angA) / sinB ; + if ( lenC ) *lenC = lenB * sgSin(angC) / sinB ; + } +} + Index: sg.h =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.h,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- sg.h 25 Jan 2002 16:28:00 -0000 1.31 +++ sg.h 10 Jun 2002 03:46:52 -0000 1.32 @@ -36,6 +36,8 @@ #define SG_TWO 2.0f #define SG_THREE 3.0f #define SG_45 45.0f +#define SG_60 60.0f +#define SG_90 90.0f #define SG_180 180.0f #define SG_MAX FLT_MAX @@ -1310,9 +1312,12 @@ #define SGD_TWO 2.0 #define SGD_THREE 3.0 #define SGD_45 45.0 +#define SGD_60 60.0 +#define SGD_90 90.0 #define SGD_180 180.0 #define SGD_MAX DBL_MAX + #define SGD_X 0 #define SGD_Y 1 #define SGD_Z 2 @@ -2541,18 +2546,47 @@ */ int sgdIsectPlanePlane ( sgdVec3 point, sgdVec3 dir, - sgdVec4 plane1, sgdVec4 plane2 ) ; + sgdVec4 plane1, sgdVec4 plane2 ) ; int sgdIsectInfLinePlane ( sgdVec3 dst, - sgdVec3 l_org, sgdVec3 l_vec, - sgdVec4 plane ) ; + sgdVec3 l_org, sgdVec3 l_vec, + sgdVec4 plane ) ; int sgdIsectInfLineInfLine ( sgdVec3 dst, - sgdVec3 l1_org, sgdVec3 l1_vec, - sgdVec3 l2_org, sgdVec3 l2_vec ) ; + sgdVec3 l1_org, sgdVec3 l1_vec, + sgdVec3 l2_org, sgdVec3 l2_vec ) ; SGDfloat sgdIsectLinesegPlane ( sgdVec3 dst, - sgdVec3 v1, sgdVec3 v2, - sgdVec4 plane ) ; + sgdVec3 v1, sgdVec3 v2, + sgdVec4 plane ) ; bool sgdPointInTriangle ( sgdVec3 point, sgdVec3 tri[3] ); + +/* + TRIANGLE SOLVERS - These work for any triangle. + + SSS == Side-lengths for all three sides. + SAS == Side-lengths for two sides - plus the angle between them. + ASA == Two angles plus the length of the Side between them. + Area == The area of the triangle. +*/ + +SGfloat sgTriangleSolver_ASAtoArea ( SGfloat angA, SGfloat lenB, SGfloat angC ); +SGfloat sgTriangleSolver_SAStoArea ( SGfloat lenA, SGfloat angB, SGfloat lenC ); +SGfloat sgTriangleSolver_SSStoArea ( SGfloat lenA, SGfloat lenB, SGfloat lenC ); +void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, + SGfloat *angA, SGfloat *angB, SGfloat *angC ) ; +void sgTriangleSolver_SAStoASA ( SGfloat lenA, SGfloat angB, SGfloat lenC, + SGfloat *angA, SGfloat *lenB, SGfloat *angC ) ; +void sgTriangleSolver_ASAtoSAS ( SGfloat angA, SGfloat lenB, SGfloat angC, + SGfloat *lenA, SGfloat *angB, SGfloat *lenC ) ; + +SGDfloat sgdTriangleSolver_ASAtoArea(SGDfloat angA,SGDfloat lenB,SGDfloat angC); +SGDfloat sgdTriangleSolver_SAStoArea(SGDfloat lenA,SGDfloat angB,SGDfloat lenC); +SGDfloat sgdTriangleSolver_SSStoArea(SGDfloat lenA,SGDfloat lenB,SGDfloat lenC); +void sgdTriangleSolver_SSStoAAA(SGDfloat lenA,SGDfloat lenB, SGDfloat lenC, + SGDfloat *angA,SGDfloat *angB,SGDfloat *angC ) ; +void sgdTriangleSolver_SAStoASA(SGDfloat lenA,SGDfloat angB,SGDfloat lenC, + SGDfloat *angA,SGDfloat *lenB,SGDfloat *angC ) ; +void sgdTriangleSolver_ASAtoSAS(SGDfloat angA,SGDfloat lenB,SGDfloat angC, + SGDfloat *lenA,SGDfloat *angB,SGDfloat *lenC ) ; #endif |
From: Steve B. <sj...@us...> - 2002-06-10 03:46:56
|
Update of /cvsroot/plib/plib/doc/sg In directory usw-pr-cvs1:/tmp/cvs-serv28169/plib/doc/sg Modified Files: index.html Log Message: Added sgTriangleSolver functions. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/sg/index.html,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- index.html 24 Mar 2002 01:57:13 -0000 1.10 +++ index.html 10 Jun 2002 03:46:52 -0000 1.11 @@ -179,6 +179,48 @@ For example, you can extract the sgVec3 that represents the translation part of an sgMat4 by just using mat[3] anywhere where an sgMat3 would be appropriate. +<H3>sgTriangleSolver functions</H3> +Remember all those high-school trig problems (eg "Given two +sides and included angle, find length of remaining side")... +nope - neither do I. That's why these functions are useful. +<p> +NOTE: +<ul> +<li> SSS = Three sides. +<li> SAS = Two sides and the angle between them. +<li> ASA = Two angles and the side between them. +</ul> +<pre> + +void sgTriangleSolver_SSStoAAA ( SGfloat lenA, SGfloat lenB, SGfloat lenC, + SGfloat *angA, SGfloat *angB, SGfloat *angC ) ; +void sgTriangleSolver_SAStoASA ( SGfloat lenA, SGfloat angB, SGfloat lenC, + SGfloat *angA, SGfloat *lenB, SGfloat *angC ) ; +void sgTriangleSolver_ASAtoSAS ( SGfloat angA, SGfloat lenB, SGfloat angC, + SGfloat *lenA, SGfloat *angB, SGfloat *lenC ) ; + +</pre> +Imagine an arbitary triangle with sides of length 'lenA', 'lenB', 'lenC' +and angles 'angA', 'angB' and 'angC' where angA is opposite the side of +length lenA - and so on. +<p> +These functions take three parameters which are a mixture of lengths and angles +for an arbitary triangle. They return the missing three lengths +or angles. In all cases of 'funny' triangles +(zero angles, zero lengths, impossible triangles), the package comes +up with one plausible result - or all zeroes. If one or more of the +results are not needed, pass a NULL pointer for the result and the +package can avoid doing the unnecessary trig. +<pre> + +SGfloat sgTriangleSolver_ASAtoArea ( SGfloat angA, SGfloat lenB, SGfloat angC ) ; +SGfloat sgTriangleSolver_SAStoArea ( SGfloat lenA, SGfloat angB, SGfloat lenC ) ; +SGfloat sgTriangleSolver_SSStoArea ( SGfloat lenA, SGfloat lenB, SGfloat lenC ) ; + +</pre> +These compute the area of a triangle from three sides, two angles and +included side or two sides and included angle - impossible triangles +return areas of zero. <H3>sgCoord</H3> This simple structure contains two members - each of type 'sgVec3' - the first is 'xyz', the second 'hpr' - and together, |
From: Sebastian U. <ud...@us...> - 2002-06-09 15:30:42
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv677 Modified Files: ssg.cxx ssg.h ssgLoadBGL.cxx ssgLoadMDL.cxx ssgLoadMDL.h Log Message: Minor changes Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- ssg.cxx 9 Jun 2002 11:25:48 -0000 1.51 +++ ssg.cxx 9 Jun 2002 15:30:39 -0000 1.52 @@ -172,7 +172,7 @@ ssgAddTextureFormat ( ".bw" , ssgLoadSGI ) ; #endif -#ifdef SSG_LOAD_MDL_SUPPORTED || SSG_LOAD_BGL_SUPPORTED || SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED +#if defined(SSG_LOAD_MDL_SUPPORTED) || defined(SSG_LOAD_BGL_SUPPORTED) || defined(SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED) ssgAddTextureFormat ( ".0af" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".1af" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".2af" , ssgLoadMDLTexture ) ; Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.135 retrieving revision 1.136 diff -u -d -r1.135 -r1.136 --- ssg.h 9 Jun 2002 11:25:48 -0000 1.135 +++ ssg.h 9 Jun 2002 15:30:39 -0000 1.136 @@ -878,7 +878,7 @@ } } - virtual void setTexture ( char *fname, + virtual void setTexture ( const char *fname, int _wrapu = TRUE, int _wrapv = TRUE, int _mipmap = TRUE ) { mipmap = _mipmap ; Index: ssgLoadBGL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBGL.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ssgLoadBGL.cxx 9 Jun 2002 11:29:54 -0000 1.3 +++ ssgLoadBGL.cxx 9 Jun 2002 15:30:39 -0000 1.4 @@ -113,9 +113,9 @@ static ssgTexCoordArray *tex_coords_; // Current part (index array) -static ssgLeaf *curr_part_=0; +static ssgLeaf *curr_part_; static ssgBranch *model_; -static ssgTransform *curr_branch_=0; +static ssgTransform *curr_branch_; // Moving parts static ssgBranch *ailerons_grp_, *elevator_grp_, *rudder_grp_; @@ -140,12 +140,12 @@ static bool has_normals_; -static bool join_children_, override_normals_; +//static bool join_children_, override_normals_; -static char *tex_fmt_; +//static char *tex_fmt_; // john .... static bool poly_from_line; -unsigned short poly_from_line_numverts; +static unsigned short poly_from_line_numverts; //john ........ static ssgTransform *building = NULL; @@ -190,7 +190,7 @@ //=========================================================================== -int getVariableValue(int var, int *val) +static int getVariableValue(int var, int *val) { for (int i=0; vardef[i].var != 0; i++){ if (vardef[i].var == var ) { @@ -203,7 +203,7 @@ //=========================================================================== -static void initLoader() +/*static void initLoader() { join_children_ = true; override_normals_ = true; @@ -212,7 +212,7 @@ #ifdef EXPERIMENTAL_CULL_FACE_CODE curr_cull_face_ = false ; #endif -} +}*/ //=========================================================================== Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ssgLoadMDL.cxx 9 Jun 2002 11:29:54 -0000 1.38 +++ ssgLoadMDL.cxx 9 Jun 2002 15:30:39 -0000 1.39 @@ -104,7 +104,7 @@ //=========================================================================== -static void initLoader() +/*static void initLoader() { start_idx_ = 0; join_children_ = true; @@ -114,7 +114,7 @@ #ifdef EXPERIMENTAL_CULL_FACE_CODE curr_cull_face_ = false ; #endif -} +}*/ //=========================================================================== Index: ssgLoadMDL.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgLoadMDL.h 9 Jun 2002 11:29:54 -0000 1.7 +++ ssgLoadMDL.h 9 Jun 2002 15:30:39 -0000 1.8 @@ -232,7 +232,7 @@ struct _ssgBGLOpCode { unsigned short opcode; - char *name; + const char *name; int size; /* size includes opcode (2 bytes) -1 indicates that special treatment is needed to find the size */ |
From: Sebastian U. <ud...@us...> - 2002-06-09 14:49:29
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv23954 Modified Files: ssg.dsp Log Message: Stick to alphabetical order Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- ssg.dsp 9 Jun 2002 14:43:09 -0000 1.40 +++ ssg.dsp 9 Jun 2002 14:49:25 -0000 1.41 @@ -186,6 +186,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgLoadBGL.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgLoadBMP.cxx # End Source File # Begin Source File @@ -214,19 +218,15 @@ # End Source File # Begin Source File -SOURCE=.\ssgLoadmd2.cxx -# End Source File -# Begin Source File - -SOURCE=.\ssgLoadMDL.cxx +SOURCE=.\ssgLoadMD2.cxx # End Source File # Begin Source File -SOURCE=.\ssgLoadBGL.cxx +SOURCE=.\ssgLoadMDL_BGLTexture.cxx # End Source File # Begin Source File -SOURCE=.\ssgLoadMDL_BGLTexture.cxx +SOURCE=.\ssgLoadMDL.cxx # End Source File # Begin Source File |
From: Sebastian U. <ud...@us...> - 2002-06-09 14:43:12
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv22299 Modified Files: ssg.dsp Log Message: Converted to CRLF line endings again Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- ssg.dsp 9 Jun 2002 11:25:48 -0000 1.39 +++ ssg.dsp 9 Jun 2002 14:43:09 -0000 1.40 @@ -1,420 +1,420 @@ -# Microsoft Developer Studio Project File - Name="ssg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=ssg - 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 "ssg.mak". [...809 lines suppressed...] +SOURCE=.\ssgTween.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgTweenController.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVTable.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVtxArray.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVtxTable.cxx +# End Source File +# End Target +# End Project |
From: J?rgen M. <j_m...@us...> - 2002-06-09 11:29:57
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv9372/src/ssg Modified Files: ssgDList.cxx ssgLoadBMP.cxx ssgLoadMDL.cxx ssgLoadMDL.h ssgconf.h Added Files: ssgLoadMDL_BGLTexture.cxx ssgLoadBGL.cxx Log Message: BGL Loader added; should complie now under MSVC Index: ssgDList.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgDList.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ssgDList.cxx 8 Jun 2002 22:49:07 -0000 1.9 +++ ssgDList.cxx 9 Jun 2002 11:29:54 -0000 1.10 @@ -125,7 +125,8 @@ } ; -#define MAX_DLIST 4096 +#define MAX_DLIST 8192 +//4096 //2048 static int next_dlist = 0 ; Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ssgLoadBMP.cxx 8 Jun 2002 22:49:08 -0000 1.12 +++ ssgLoadBMP.cxx 9 Jun 2002 11:29:54 -0000 1.13 @@ -123,6 +123,8 @@ bool ssgLoadBMP ( const char *fname, ssgTextureInfo* info ) { int w, h, bpp ; + int index=0; + bool old_format = false; RGBA pal [ 256 ] ; BMPHeader bmphdr ; @@ -133,9 +135,25 @@ if ( ( curr_image_fd = fopen ( curr_image_fname, "rb" ) ) == NULL ) { - perror ( "ssgLoadTexture" ) ; - ulSetError ( UL_WARNING, "ssgLoadTexture: Failed to open '%s' for reading.", curr_image_fname ) ; - return false ; + char *p = strrchr(curr_image_fname,'_'); + if (p != 0) { + *p = '\0'; + p++; + index = atoi (p); + old_format = true; + if ( ( curr_image_fd = fopen(curr_image_fname, "rb")) == NULL) { + perror ( "ssgLoadTexture" ) ; + ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s' for reading.", curr_image_fname ); + return false ; + } + p--; + *p = '_'; + } + else { + perror ( "ssgLoadTexture" ) ; + ulSetError( UL_WARNING, "ssgLoadTexture: Failed to open '%s' for reading.", curr_image_fname ); + return false ; + } } /* @@ -210,7 +228,10 @@ /* According to BMP specs, this fourth value is not really alpha value but just a filler byte, so it is ignored for now. */ pal[i].a = readByte () ; - //if ( pal[i].a != 255 ) isOpaque = FALSE ; + if (old_format == true) { + pal[i].a = (i<index)?0:255; + + } if ( pal[i].r != pal[i].g || pal[i].g != pal[i].b ) isMonochrome = FALSE ; @@ -243,6 +264,15 @@ if ( bpp == 8 ) { + // check for diffrent alpha values in the bitmap + // assume blending if that's the case + for ( int i = 1 ; i < w * h ; i++ ) { + if (pal[data[i]].a != pal[data[i-1]].a) { + isOpaque = FALSE ; + break; + } + } + if ( isMonochrome ) z = isOpaque ? 1 : 2 ; else @@ -309,7 +339,7 @@ info -> width = w ; info -> height = h ; info -> depth = z ; - info -> alpha = ( z == 4 ) ; + info -> alpha = ( isOpaque == FALSE ) ; } return ssgMakeMipMaps ( image, w, h, z ) ; Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- ssgLoadMDL.cxx 8 Jun 2002 22:49:08 -0000 1.37 +++ ssgLoadMDL.cxx 9 Jun 2002 11:29:54 -0000 1.38 @@ -42,7 +42,6 @@ #ifdef SSG_LOAD_MDL_SUPPORTED #include "ssgLoadMDL.h" -#include "ssgMSFSPalette.h" #define DEF_SHININESS 50 @@ -1477,65 +1476,11 @@ delete curr_norm_; DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); - - return model_; -} -// This really simple (raw paletted) format is used by older MSFS for textures -bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) -{ - FILE *tfile; - if ( (tfile = fopen(fname, "rb")) == NULL) { - ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.", fname ); - return false ; - } - - fseek(tfile, 0, SEEK_END); - unsigned long file_length = ftell(tfile); - - if (file_length != 65536) { - // this is not a MSFS-formatted texture, so it's probably a BMP - fclose(tfile); - return ssgLoadBMP( fname, info ); - } else { - fseek(tfile, 0, SEEK_SET); - - unsigned char *texels = new unsigned char[256 * 256 * 4]; - int c = 0; - for (int y = 0; y < 256; y++) { - for (int x = 0; x < 256; x++) { - unsigned char b; - fread(&b, 1, 1, tfile); - texels[c++] = fsTexPalette[b*4 ]; - texels[c++] = fsTexPalette[b*4 + 1]; - texels[c++] = fsTexPalette[b*4 + 2]; - texels[c++] = fsTexPalette[b*4 + 3]; - } - } - - fclose(tfile); - - if ( info != NULL ) - { - info -> width = 256 ; - info -> height = 256 ; - info -> depth = 4 ; - info -> alpha = FALSE ; //?? - } - - return ssgMakeMipMaps ( texels, 256, 256, 4 ) ; - } + return model_; } - #else - - -ssgEntity *ssgLoadMDL(const char *fname, const ssgLoaderOptions *options) -{ - return NULL ; -} - bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) { Index: ssgLoadMDL.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ssgLoadMDL.h 8 Jun 2002 22:49:08 -0000 1.6 +++ ssgLoadMDL.h 9 Jun 2002 11:29:54 -0000 1.7 @@ -240,262 +240,262 @@ }; static const _ssgBGLOpCode opcodes[] = { - { 0x00, "BGL_EOF" , 2 }, - { 0x01, "OBSOLETE 0x01" , 2 }, - { 0x02, "BGL_NOOP" , 2 }, - { 0x03, "BGL_CASE" , -1 }, - { 0x04, "RESERVED 0x04" , 2 }, - { 0x05, "BGL_SURFACE" , 2 }, - { 0x06, "BGL_SPNT" , 8 }, - { 0x07, "BGL_CPNT" , 8 }, [...487 lines suppressed...] + { 0xef, "UNKNOWN 0xEF" , -1 }, + { 0xf0, "UNKNOWN 0xF0" , -1 }, + { 0xf1, "UNKNOWN 0xF1" , -1 }, + { 0xf2, "UNKNOWN 0xF2" , -1 }, + { 0xf3, "UNKNOWN 0xF3" , -1 }, + { 0xf4, "UNKNOWN 0xF4" , -1 }, + { 0xf5, "UNKNOWN 0xF5" , -1 }, + { 0xf6, "UNKNOWN 0xF6" , -1 }, + { 0xf7, "UNKNOWN 0xF7" , -1 }, + { 0xf8, "UNKNOWN 0xF8" , -1 }, + { 0xf9, "UNKNOWN 0xF9" , -1 }, + { 0xfa, "UNKNOWN 0xFA" , -1 }, + { 0xfb, "UNKNOWN 0xFB" , -1 }, + { 0xfc, "UNKNOWN 0xFC" , -1 }, + { 0xfd, "UNKNOWN 0xFD" , -1 }, + { 0xfe, "UNKNOWN 0xFE" , -1 }, + { 0xff, "UNKNOWN 0xFF" , -1 } }; //=========================================================================== Index: ssgconf.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgconf.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgconf.h 8 Jun 2002 22:49:08 -0000 1.7 +++ ssgconf.h 9 Jun 2002 11:29:54 -0000 1.8 @@ -49,5 +49,6 @@ #define SSG_LOAD_TGA_SUPPORTED #define SSG_LOAD_BMP_SUPPORTED #define SSG_LOAD_MDL_SUPPORTED - +#define SSG_LOAD_BGL_SUPPORTED +#define SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED #endif |
From: J?rgen M. <j_m...@us...> - 2002-06-09 11:25:50
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv8560/src/ssg Modified Files: Makefile.am ssg.cxx ssg.dsp ssg.h Log Message: BGL loader added; should complie on MSVC Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- Makefile.am 17 Jan 2002 16:14:22 -0000 1.31 +++ Makefile.am 9 Jun 2002 11:25:47 -0000 1.32 @@ -21,7 +21,7 @@ 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 + ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h ssgLoadBGL.cxx ssgLoadMDL_BGLTexture.cxx INCLUDES = -I$(top_srcdir)/src/sg INCLUDES += -I$(top_srcdir)/src/util Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- ssg.cxx 8 Jun 2002 22:49:07 -0000 1.50 +++ ssg.cxx 9 Jun 2002 11:25:48 -0000 1.51 @@ -148,6 +148,10 @@ ssgAddModelFormat ( ".mdl", ssgLoadMDL , NULL ) ; #endif +#ifdef SSG_LOAD_BGL_SUPPORTED + ssgAddModelFormat ( ".bgl", ssgLoadBGL , NULL ) ; +#endif + #ifdef SSG_LOAD_TGA_SUPPORTED ssgAddTextureFormat ( ".tga" , ssgLoadTGA ) ; #endif @@ -168,7 +172,7 @@ ssgAddTextureFormat ( ".bw" , ssgLoadSGI ) ; #endif -#ifdef SSG_LOAD_MDL_SUPPORTED +#ifdef SSG_LOAD_MDL_SUPPORTED || SSG_LOAD_BGL_SUPPORTED || SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED ssgAddTextureFormat ( ".0af" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".1af" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".2af" , ssgLoadMDLTexture ) ; @@ -190,6 +194,9 @@ ssgAddTextureFormat ( ".iaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".jaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".kaf" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".pat" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".r8" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".naz" , ssgLoadMDLTexture ) ; #endif } Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- ssg.dsp 8 Jun 2002 22:49:07 -0000 1.38 +++ ssg.dsp 9 Jun 2002 11:25:48 -0000 1.39 @@ -1,412 +1,420 @@ -# Microsoft Developer Studio Project File - Name="ssg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=ssg - 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 "ssg.mak". [...801 lines suppressed...] +SOURCE=.\ssgTween.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgTweenController.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVTable.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVtxArray.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVtxTable.cxx +# End Source File +# End Target +# End Project Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.134 retrieving revision 1.135 diff -u -d -r1.134 -r1.135 --- ssg.h 8 Jun 2002 22:49:07 -0000 1.134 +++ ssg.h 9 Jun 2002 11:25:48 -0000 1.135 @@ -2627,7 +2627,7 @@ ssgEntity *ssgLoadOBJ ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMD2 ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMDL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; -//ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; +ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadX ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadFLT ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadM ( const char *fname, const ssgLoaderOptions *options = NULL ) ; |
From: Sebastian U. <ud...@us...> - 2002-06-08 22:49:10
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv19589 Modified Files: ssg.cxx ssg.dsp ssg.h ssgDList.cxx ssgLoadBMP.cxx ssgLoadMDL.cxx ssgLoadMDL.h ssgconf.h Removed Files: ssgLoadBGL.cxx ssgLoadMDL_BGLTexture.cxx Log Message: Removed BGL loader until some issues are solved Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- ssg.cxx 7 Jun 2002 23:11:38 -0000 1.49 +++ ssg.cxx 8 Jun 2002 22:49:07 -0000 1.50 @@ -146,7 +146,6 @@ #ifdef SSG_LOAD_MDL_SUPPORTED ssgAddModelFormat ( ".mdl", ssgLoadMDL , NULL ) ; - ssgAddModelFormat ( ".bgl", ssgLoadBGL , NULL ) ; #endif #ifdef SSG_LOAD_TGA_SUPPORTED @@ -191,9 +190,6 @@ ssgAddTextureFormat ( ".iaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".jaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".kaf" , ssgLoadMDLTexture ) ; - ssgAddTextureFormat ( ".pat" , ssgLoadMDLTexture ) ; - ssgAddTextureFormat ( ".r8" , ssgLoadMDLTexture ) ; - ssgAddTextureFormat ( ".naz" , ssgLoadMDLTexture ) ; #endif } Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- ssg.dsp 7 Jun 2002 23:11:38 -0000 1.37 +++ ssg.dsp 8 Jun 2002 22:49:07 -0000 1.38 @@ -186,10 +186,6 @@ # End Source File # Begin Source File -SOURCE=.\ssgLoadBGL.cxx -# End Source File -# Begin Source File - SOURCE=.\ssgLoadBMP.cxx # End Source File # Begin Source File @@ -219,10 +215,6 @@ # Begin Source File SOURCE=.\ssgLoadmd2.cxx -# End Source File -# Begin Source File - -SOURCE=.\ssgLoadMDL_BGLTexture.cxx # End Source File # Begin Source File Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.133 retrieving revision 1.134 diff -u -d -r1.133 -r1.134 --- ssg.h 7 Jun 2002 23:11:38 -0000 1.133 +++ ssg.h 8 Jun 2002 22:49:07 -0000 1.134 @@ -2627,7 +2627,7 @@ ssgEntity *ssgLoadOBJ ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMD2 ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMDL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; -ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; +//ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadX ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadFLT ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadM ( const char *fname, const ssgLoaderOptions *options = NULL ) ; Index: ssgDList.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgDList.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ssgDList.cxx 7 Jun 2002 23:11:38 -0000 1.8 +++ ssgDList.cxx 8 Jun 2002 22:49:07 -0000 1.9 @@ -125,8 +125,7 @@ } ; -#define MAX_DLIST 8192 -//4096 +#define MAX_DLIST 4096 //2048 static int next_dlist = 0 ; Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ssgLoadBMP.cxx 7 Jun 2002 23:19:22 -0000 1.11 +++ ssgLoadBMP.cxx 8 Jun 2002 22:49:08 -0000 1.12 @@ -25,7 +25,6 @@ #include "ssgLocal.h" #ifdef SSG_LOAD_BMP_SUPPORTED -//#define PRINT_BMP_HEADER_DEBUG static FILE *curr_image_fd ; static char curr_image_fname [ 512 ] ; @@ -124,8 +123,6 @@ bool ssgLoadBMP ( const char *fname, ssgTextureInfo* info ) { int w, h, bpp ; [...65 lines suppressed...] @@ -275,10 +243,6 @@ if ( bpp == 8 ) { - for ( int i = 1 ; i < w * h ; i++ ) { - if (pal[data[i]].a != pal[data[i-1]].a) isOpaque = FALSE ; - } - if ( isMonochrome ) z = isOpaque ? 1 : 2 ; else @@ -345,7 +309,7 @@ info -> width = w ; info -> height = h ; info -> depth = z ; - info -> alpha = ( isOpaque == FALSE ) ; + info -> alpha = ( z == 4 ) ; } return ssgMakeMipMaps ( image, w, h, z ) ; Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ssgLoadMDL.cxx 7 Jun 2002 23:11:38 -0000 1.36 +++ ssgLoadMDL.cxx 8 Jun 2002 22:49:08 -0000 1.37 @@ -42,6 +42,7 @@ #ifdef SSG_LOAD_MDL_SUPPORTED #include "ssgLoadMDL.h" +#include "ssgMSFSPalette.h" #define DEF_SHININESS 50 @@ -1476,10 +1477,56 @@ delete curr_norm_; DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); - + return model_; } +// This really simple (raw paletted) format is used by older MSFS for textures +bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) +{ + FILE *tfile; + if ( (tfile = fopen(fname, "rb")) == NULL) { + ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.", fname ); + return false ; + } + + fseek(tfile, 0, SEEK_END); + unsigned long file_length = ftell(tfile); + + if (file_length != 65536) { + // this is not a MSFS-formatted texture, so it's probably a BMP + fclose(tfile); + return ssgLoadBMP( fname, info ); + } else { + fseek(tfile, 0, SEEK_SET); + + unsigned char *texels = new unsigned char[256 * 256 * 4]; + int c = 0; + for (int y = 0; y < 256; y++) { + for (int x = 0; x < 256; x++) { + unsigned char b; + fread(&b, 1, 1, tfile); + texels[c++] = fsTexPalette[b*4 ]; + texels[c++] = fsTexPalette[b*4 + 1]; + texels[c++] = fsTexPalette[b*4 + 2]; + texels[c++] = fsTexPalette[b*4 + 3]; + } + } + + fclose(tfile); + + if ( info != NULL ) + { + info -> width = 256 ; + info -> height = 256 ; + info -> depth = 4 ; + info -> alpha = FALSE ; //?? + } + + return ssgMakeMipMaps ( texels, 256, 256, 4 ) ; + } +} + #else @@ -1487,6 +1534,14 @@ ssgEntity *ssgLoadMDL(const char *fname, const ssgLoaderOptions *options) { return NULL ; +} + + +bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) +{ + ulSetError ( UL_WARNING, + "ssgLoadTexture: '%s' - MDL support not configured", fname ) ; + return false ; } Index: ssgLoadMDL.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ssgLoadMDL.h 7 Jun 2002 23:11:38 -0000 1.5 +++ ssgLoadMDL.h 8 Jun 2002 22:49:08 -0000 1.6 @@ -245,7 +245,7 @@ { 0x02, "BGL_NOOP" , 2 }, { 0x03, "BGL_CASE" , -1 }, { 0x04, "RESERVED 0x04" , 2 }, - { 0x05, "BGL_SURFACE - Area" , 2 }, + { 0x05, "BGL_SURFACE" , 2 }, { 0x06, "BGL_SPNT" , 8 }, { 0x07, "BGL_CPNT" , 8 }, { 0x08, "BLG_CLOSURE" , 2 }, @@ -274,7 +274,7 @@ { 0x1f, "RESERVED 0x1f" , 4 }, { 0x20, "BGL_FACET_TMAP" , -1 }, { 0x21, "BGL_IFIN3" , 22 }, - { 0x22, "BGL_RETURN - Return" , 2 }, + { 0x22, "BGL_RETURN" , 2 }, { 0x23, "BGL_CALL" , 4 }, { 0x24, "BGL_IFIN1" , 10 }, { 0x25, "BGL_SEPARATION_PLANE" , 14 }, @@ -290,8 +290,8 @@ { 0x2f, "BGL_SCALE" , 32 }, { 0x30, "OBSOLETE 0x30" , 4 }, { 0x31, "BGL_RESROW" , 18 }, - { 0x32, "BGL_ADDOBJ - PerspectiveCall", 4 }, - { 0x33, "BGL_INSTANCE - RotatedCall", 10 }, + { 0x32, "BGL_ADDOBJ" , 4 }, + { 0x33, "BGL_INSTANCE" , 10 }, { 0x34, "BGL_SUPER_SCALE" , 10 }, { 0x35, "BGL_PNTROW" , 16 }, { 0x36, "OBSOLETE 0x36" , -1 }, @@ -358,8 +358,8 @@ { 0x73, "BGL_IFINBOXP" , 16 }, { 0x74, "BGL_ADDCAT" , 6 }, { 0x75, "BGL_ADDMNT" , 4 }, - { 0x76, "BGL_BGL - Perspective", 2 }, - { 0x77, "BGL_SCALE_AGL - RefPoint", 32 }, + { 0x76, "BGL_BGL" , 2 }, + { 0x77, "BGL_SCALE_AGL" , 32 }, { 0x78, "BGL_ROAD_CONTW" , 10 }, { 0x79, "BGL_RIVER_CONTW" , 10 }, { 0x7a, "BGL_GFACET_TMAP" , -1 }, Index: ssgconf.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgconf.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ssgconf.h 7 Jun 2002 23:11:38 -0000 1.6 +++ ssgconf.h 8 Jun 2002 22:49:08 -0000 1.7 @@ -49,7 +49,5 @@ #define SSG_LOAD_TGA_SUPPORTED #define SSG_LOAD_BMP_SUPPORTED #define SSG_LOAD_MDL_SUPPORTED -#define SSG_LOAD_BGL_SUPPORTED -#define SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED #endif --- ssgLoadBGL.cxx DELETED --- --- ssgLoadMDL_BGLTexture.cxx DELETED --- |
From: Sebastian U. <ud...@us...> - 2002-06-08 22:23:42
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv13940 Modified Files: ssgSaveVRML1.cxx Log Message: Use "ulSetError" instead of "printf" Index: ssgSaveVRML1.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgSaveVRML1.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgSaveVRML1.cxx 17 Jan 2002 16:14:23 -0000 1.1 +++ ssgSaveVRML1.cxx 8 Jun 2002 22:23:39 -0000 1.2 @@ -308,7 +308,8 @@ if ( (index1 < 0)||(index2 < 0)||(index3 < 0) ) { - printf("Save error: index overflow, value won't fit in 16bits.\n"); + ulSetError(UL_WARNING, "ssgSaveVRML1: Save error: index overflow, " + "value won't fit in 16bits."); } else { @@ -418,8 +419,8 @@ if ( (index1 < 0)||(index2 < 0)||(index3 < 0) ) { - printf("Save error: index overflow, value " - "won't fit in 16bits.\n"); + ulSetError(UL_WARNING, "ssgSaveVRML1: Save error: index " + "overflow, value won't fit in 16bits."); } else { |
From: Sebastian U. <ud...@us...> - 2002-06-08 00:00:35
|
Update of /cvsroot/plib/plib/demos/exposer/src In directory usw-pr-cvs1:/tmp/cvs-serv5833 Modified Files: load_save.cxx Log Message: Made "msg" parameter of dialog () a const pointer Index: load_save.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/load_save.cxx,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- load_save.cxx 6 Jun 2002 22:09:56 -0000 1.8 +++ load_save.cxx 8 Jun 2002 00:00:32 -0000 1.9 @@ -41,7 +41,7 @@ } -void dialog ( char *msg, float r, float g, float b ) +void dialog ( const char *msg, float r, float g, float b ) { initDialog () ; dialog_button -> setLegend ( msg ) ; |
From: Sebastian U. <ud...@us...> - 2002-06-07 23:57:57
|
Update of /cvsroot/plib/plib/demos/exposer/src In directory usw-pr-cvs1:/tmp/cvs-serv5148a Modified Files: merge_tweens.cxx Log Message: Eliminated potential compiler warning Index: merge_tweens.cxx =================================================================== RCS file: /cvsroot/plib/plib/demos/exposer/src/merge_tweens.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- merge_tweens.cxx 26 Jul 2001 04:30:58 -0000 1.1 +++ merge_tweens.cxx 7 Jun 2002 23:57:54 -0000 1.2 @@ -37,8 +37,9 @@ totalEvents = 0 ; totalTime = 0.0f ; + int i ; - for ( int i = 1 ; i < argc ; i++ ) + for ( i = 1 ; i < argc ; i++ ) { FILE *fd = fopen ( argv[i], "ra" ) ; @@ -94,7 +95,7 @@ float nextTime = 0.0f ; - for ( int i = 1 ; i < argc ; i++ ) + for ( i = 1 ; i < argc ; i++ ) { FILE *fd = fopen ( argv[i], "ra" ) ; |
From: Sebastian U. <ud...@us...> - 2002-06-07 23:19:25
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv29807 Modified Files: ssgLoadBMP.cxx Log Message: Juergen Marquardt: Introduced BGL loader Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ssgLoadBMP.cxx 7 Jun 2002 23:11:38 -0000 1.10 +++ ssgLoadBMP.cxx 7 Jun 2002 23:19:22 -0000 1.11 @@ -25,6 +25,7 @@ #include "ssgLocal.h" #ifdef SSG_LOAD_BMP_SUPPORTED +//#define PRINT_BMP_HEADER_DEBUG static FILE *curr_image_fd ; static char curr_image_fname [ 512 ] ; |
From: Sebastian U. <ud...@us...> - 2002-06-07 23:11:41
|
Update of /cvsroot/plib/plib/src/ssg In directory usw-pr-cvs1:/tmp/cvs-serv27739/src/ssg Modified Files: ssg.cxx ssg.dsp ssg.h ssgDList.cxx ssgLoadBMP.cxx ssgLoadMDL.cxx ssgLoadMDL.h ssgconf.h Added Files: ssgLoadBGL.cxx ssgLoadMDL_BGLTexture.cxx Log Message: Juergen Marquardt: Introduced BGL loader --- NEW FILE: ssgLoadBGL.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 [...2199 lines suppressed...] } // end of bgl "object header opcode" while loop fclose(fp); DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); return model_; } #else ssgEntity *ssgLoadBGL(const char *fname, const ssgLoaderOptions *options) { return NULL ; } #endif --- NEW FILE: ssgLoadMDL_BGLTexture.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: ssgLoadMDL_BGLTexture.cxx,v 1.1 2002/06/07 23:11:38 ude Exp $ */ #include "ssgLocal.h" #include "ssgMSFSPalette.h" #ifdef SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED // This really simple (raw paletted) format is used by older MSFS for textures bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) { FILE *tfile; int index = 0; if ( (tfile = fopen(fname, "rb")) == NULL) { char *p = strrchr(fname,'_'); if (p != 0) { *p = '\0'; p++; index = atoi (p); if ( (tfile = fopen(fname, "rb")) == NULL) { ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.", fname ); return false ; } p--; *p = '_'; } else { ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.", fname ); return false ; } } fseek(tfile, 0, SEEK_END); unsigned long file_length = ftell(tfile); if (file_length != 65536) { // this is not a MSFS-formatted texture, so it's probably a BMP fclose(tfile); return ssgLoadBMP( fname, info ); } else { fseek(tfile, 0, SEEK_SET); unsigned char *texels = new unsigned char[256 * 256 * 4]; int c = 0; for (int y = 0; y < 256; y++) { for (int x = 0; x < 256; x++) { unsigned char b; fread(&b, 1, 1, tfile); texels[c++] = fsTexPalette[b*4 ]; texels[c++] = fsTexPalette[b*4 + 1]; texels[c++] = fsTexPalette[b*4 + 2]; texels[c++] = (b<index)?0:255; } } fclose(tfile); if ( info != NULL ) { info -> width = 256 ; info -> height = 256 ; info -> depth = 4 ; info -> alpha = TRUE ; //?? } return ssgMakeMipMaps ( texels, 256, 256, 4 ) ; } } #else bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) { ulSetError ( UL_WARNING, "ssgLoadTexture: '%s' - MDL/BGL Texture support not configured", fname ) ; return false ; } #endif Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- ssg.cxx 21 Apr 2002 03:53:29 -0000 1.48 +++ ssg.cxx 7 Jun 2002 23:11:38 -0000 1.49 @@ -146,6 +146,7 @@ #ifdef SSG_LOAD_MDL_SUPPORTED ssgAddModelFormat ( ".mdl", ssgLoadMDL , NULL ) ; + ssgAddModelFormat ( ".bgl", ssgLoadBGL , NULL ) ; #endif #ifdef SSG_LOAD_TGA_SUPPORTED @@ -190,6 +191,9 @@ ssgAddTextureFormat ( ".iaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".jaf" , ssgLoadMDLTexture ) ; ssgAddTextureFormat ( ".kaf" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".pat" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".r8" , ssgLoadMDLTexture ) ; + ssgAddTextureFormat ( ".naz" , ssgLoadMDLTexture ) ; #endif } Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ssg.dsp 17 Jan 2002 16:13:21 -0000 1.36 +++ ssg.dsp 7 Jun 2002 23:11:38 -0000 1.37 @@ -186,6 +186,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgLoadBGL.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgLoadBMP.cxx # End Source File # Begin Source File @@ -215,6 +219,10 @@ # Begin Source File SOURCE=.\ssgLoadmd2.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgLoadMDL_BGLTexture.cxx # End Source File # Begin Source File Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.132 retrieving revision 1.133 diff -u -d -r1.132 -r1.133 --- ssg.h 23 Mar 2002 15:06:44 -0000 1.132 +++ ssg.h 7 Jun 2002 23:11:38 -0000 1.133 @@ -2627,7 +2627,7 @@ ssgEntity *ssgLoadOBJ ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMD2 ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadMDL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; -//ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; +ssgEntity *ssgLoadBGL ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadX ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadFLT ( const char *fname, const ssgLoaderOptions *options = NULL ) ; ssgEntity *ssgLoadM ( const char *fname, const ssgLoaderOptions *options = NULL ) ; Index: ssgDList.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgDList.cxx,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ssgDList.cxx 7 Nov 2001 23:51:09 -0000 1.7 +++ ssgDList.cxx 7 Jun 2002 23:11:38 -0000 1.8 @@ -125,7 +125,8 @@ } ; -#define MAX_DLIST 4096 +#define MAX_DLIST 8192 +//4096 //2048 static int next_dlist = 0 ; Index: ssgLoadBMP.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadBMP.cxx,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ssgLoadBMP.cxx 23 Mar 2002 15:06:45 -0000 1.9 +++ ssgLoadBMP.cxx 7 Jun 2002 23:11:38 -0000 1.10 @@ -123,6 +123,8 @@ bool ssgLoadBMP ( const char *fname, ssgTextureInfo* info ) { int w, h, bpp ; + int index=0; + bool old_format = false; RGBA pal [ 256 ] ; BMPHeader bmphdr ; @@ -133,9 +135,25 @@ if ( ( curr_image_fd = fopen ( curr_image_fname, "rb" ) ) == NULL ) { - perror ( "ssgLoadTexture" ) ; - ulSetError ( UL_WARNING, "ssgLoadTexture: Failed to open '%s' for reading.", curr_image_fname ) ; - return false ; + char *p = strrchr(curr_image_fname,'_'); + if (p != 0) { + *p = '\0'; + p++; + index = atoi (p); + old_format = true; + if ( ( curr_image_fd = fopen(curr_image_fname, "rb")) == NULL) { + perror ( "ssgLoadTexture" ) ; + ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s' for reading.", curr_image_fname ); + return false ; + } + p--; + *p = '_'; + } + else { + perror ( "ssgLoadTexture" ) ; + ulSetError( UL_WARNING, "ssgLoadTexture: Failed to open '%s' for reading.", curr_image_fname ); + return false ; + } } /* @@ -172,7 +190,7 @@ bmphdr.YPelsPerMeter = readInt () ; bmphdr.ClrUsed = readInt () ; bmphdr.ClrImportant = readInt () ; - + w = bmphdr.Width ; h = bmphdr.Height ; bpp = bmphdr.Planes * bmphdr.BitCount ; @@ -210,7 +228,20 @@ /* According to BMP specs, this fourth value is not really alpha value but just a filler byte, so it is ignored for now. */ pal[i].a = readByte () ; - //if ( pal[i].a != 255 ) isOpaque = FALSE ; + if (old_format == true) { + pal[i].a = (i<index)?0:255; + + } +/* + if ( (pal[i].r == pal[i].g) && (pal[i].r == pal[i].b) ) { + if (pal[i].r == 0) + pal[i].a = 0; + if (pal[i].r == 0x18) + pal[i].a = 0x18; + isOpaque = FALSE ; + } +*/ +// if ( (i>1) && (pal[i].a != pal[i-1].a) ) isOpaque = FALSE ; if ( pal[i].r != pal[i].g || pal[i].g != pal[i].b ) isMonochrome = FALSE ; @@ -243,6 +274,10 @@ if ( bpp == 8 ) { + for ( int i = 1 ; i < w * h ; i++ ) { + if (pal[data[i]].a != pal[data[i-1]].a) isOpaque = FALSE ; + } + if ( isMonochrome ) z = isOpaque ? 1 : 2 ; else @@ -309,7 +344,7 @@ info -> width = w ; info -> height = h ; info -> depth = z ; - info -> alpha = ( z == 4 ) ; + info -> alpha = ( isOpaque == FALSE ) ; } return ssgMakeMipMaps ( image, w, h, z ) ; Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- ssgLoadMDL.cxx 9 Mar 2002 20:01:47 -0000 1.35 +++ ssgLoadMDL.cxx 7 Jun 2002 23:11:38 -0000 1.36 @@ -42,7 +42,6 @@ #ifdef SSG_LOAD_MDL_SUPPORTED #include "ssgLoadMDL.h" -#include "ssgMSFSPalette.h" #define DEF_SHININESS 50 @@ -1477,54 +1476,8 @@ delete curr_norm_; DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); - - return model_; -} -// This really simple (raw paletted) format is used by older MSFS for textures -bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) -{ - FILE *tfile; - if ( (tfile = fopen(fname, "rb")) == NULL) { - ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.", fname ); - return false ; - } - - fseek(tfile, 0, SEEK_END); - unsigned long file_length = ftell(tfile); - - if (file_length != 65536) { - // this is not a MSFS-formatted texture, so it's probably a BMP - fclose(tfile); - return ssgLoadBMP( fname, info ); - } else { - fseek(tfile, 0, SEEK_SET); - - unsigned char *texels = new unsigned char[256 * 256 * 4]; - int c = 0; - for (int y = 0; y < 256; y++) { - for (int x = 0; x < 256; x++) { - unsigned char b; - fread(&b, 1, 1, tfile); - texels[c++] = fsTexPalette[b*4 ]; - texels[c++] = fsTexPalette[b*4 + 1]; - texels[c++] = fsTexPalette[b*4 + 2]; - texels[c++] = fsTexPalette[b*4 + 3]; - } - } - - fclose(tfile); - - if ( info != NULL ) - { - info -> width = 256 ; - info -> height = 256 ; - info -> depth = 4 ; - info -> alpha = FALSE ; //?? - } - - return ssgMakeMipMaps ( texels, 256, 256, 4 ) ; - } + return model_; } @@ -1534,14 +1487,6 @@ ssgEntity *ssgLoadMDL(const char *fname, const ssgLoaderOptions *options) { return NULL ; -} - - -bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) -{ - ulSetError ( UL_WARNING, - "ssgLoadTexture: '%s' - MDL support not configured", fname ) ; - return false ; } Index: ssgLoadMDL.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ssgLoadMDL.h 7 Nov 2001 23:51:10 -0000 1.4 +++ ssgLoadMDL.h 7 Jun 2002 23:11:38 -0000 1.5 @@ -245,7 +245,7 @@ { 0x02, "BGL_NOOP" , 2 }, { 0x03, "BGL_CASE" , -1 }, { 0x04, "RESERVED 0x04" , 2 }, - { 0x05, "BGL_SURFACE" , 2 }, + { 0x05, "BGL_SURFACE - Area" , 2 }, { 0x06, "BGL_SPNT" , 8 }, { 0x07, "BGL_CPNT" , 8 }, { 0x08, "BLG_CLOSURE" , 2 }, @@ -274,7 +274,7 @@ { 0x1f, "RESERVED 0x1f" , 4 }, { 0x20, "BGL_FACET_TMAP" , -1 }, { 0x21, "BGL_IFIN3" , 22 }, - { 0x22, "BGL_RETURN" , 2 }, + { 0x22, "BGL_RETURN - Return" , 2 }, { 0x23, "BGL_CALL" , 4 }, { 0x24, "BGL_IFIN1" , 10 }, { 0x25, "BGL_SEPARATION_PLANE" , 14 }, @@ -290,8 +290,8 @@ { 0x2f, "BGL_SCALE" , 32 }, { 0x30, "OBSOLETE 0x30" , 4 }, { 0x31, "BGL_RESROW" , 18 }, - { 0x32, "BGL_ADDOBJ" , 4 }, - { 0x33, "BGL_INSTANCE" , 10 }, + { 0x32, "BGL_ADDOBJ - PerspectiveCall", 4 }, + { 0x33, "BGL_INSTANCE - RotatedCall", 10 }, { 0x34, "BGL_SUPER_SCALE" , 10 }, { 0x35, "BGL_PNTROW" , 16 }, { 0x36, "OBSOLETE 0x36" , -1 }, @@ -358,8 +358,8 @@ { 0x73, "BGL_IFINBOXP" , 16 }, { 0x74, "BGL_ADDCAT" , 6 }, { 0x75, "BGL_ADDMNT" , 4 }, - { 0x76, "BGL_BGL" , 2 }, - { 0x77, "BGL_SCALE_AGL" , 32 }, + { 0x76, "BGL_BGL - Perspective", 2 }, + { 0x77, "BGL_SCALE_AGL - RefPoint", 32 }, { 0x78, "BGL_ROAD_CONTW" , 10 }, { 0x79, "BGL_RIVER_CONTW" , 10 }, { 0x7a, "BGL_GFACET_TMAP" , -1 }, Index: ssgconf.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgconf.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ssgconf.h 7 Nov 2001 23:51:10 -0000 1.5 +++ ssgconf.h 7 Jun 2002 23:11:38 -0000 1.6 @@ -49,5 +49,7 @@ #define SSG_LOAD_TGA_SUPPORTED #define SSG_LOAD_BMP_SUPPORTED #define SSG_LOAD_MDL_SUPPORTED +#define SSG_LOAD_BGL_SUPPORTED +#define SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED #endif |
From: Sebastian U. <ud...@us...> - 2002-06-06 23:15:27
|
Update of /cvsroot/plib/plib/demos/ttt3d In directory usw-pr-cvs1:/tmp/cvs-serv20838 Modified Files: TTT3D.dsp Log Message: John F. Fay: Link against the debugable PLIB libraries for the "Debug" target Index: TTT3D.dsp =================================================================== RCS file: /cvsroot/plib/plib/demos/ttt3d/TTT3D.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TTT3D.dsp 23 Jun 2001 19:03:59 -0000 1.4 +++ TTT3D.dsp 6 Jun 2002 23:15:24 -0000 1.5 @@ -74,7 +74,7 @@ # 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 sl.lib fnt.lib pui.lib ssgAux.lib ssg.lib sg.lib ul.lib glut32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /out:"TTT3D.exe" /pdbtype:sept /libpath:"../../" +# 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 sl_d.lib fnt_d.lib pui_d.lib ssgAux_d.lib ssg_d.lib sg_d.lib ul_d.lib glut32.lib opengl32.lib /nologo /subsystem:console /debug /machine:I386 /out:"TTT3D.exe" /pdbtype:sept /libpath:"../../" !ENDIF |
From: Sebastian U. <ud...@us...> - 2002-06-06 23:07:49
|
Update of /cvsroot/plib/plib/examples/src/net/client_server In directory usw-pr-cvs1:/tmp/cvs-serv19297 Modified Files: net_udp_server.dsp Log Message: John F. Fay: Fixed include and library paths for NET examples Index: net_udp_server.dsp =================================================================== RCS file: /cvsroot/plib/plib/examples/src/net/client_server/net_udp_server.dsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- net_udp_server.dsp 6 Jun 2002 23:05:23 -0000 1.2 +++ net_udp_server.dsp 6 Jun 2002 23:07:46 -0000 1.3 @@ -74,7 +74,7 @@ # 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 net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"net_udp_server.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 net_d.lib ul_d.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"net_udp_server.exe" /pdbtype:sept /libpath:"..\..\..\..\..\plib" !ENDIF |