[Plib-cvs] plib/src/ssg ssgStatistics.cxx,NONE,1.1 Makefile.am,1.44,1.45 ssg.h,1.167,1.168 ssgLocal.
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-02-02 01:37:14
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12104/plib/src/ssg Modified Files: Makefile.am ssg.h ssgLocal.h ssgVTable.cxx ssgVtxArray.cxx ssgVtxTable.cxx Added Files: ssgStatistics.cxx Log Message: Added ssgStatistics. Fixed bug in sgIsect.cxx that could cause div0 error. --- NEW FILE: ssgStatistics.cxx --- #include "ssgLocal.h" ssgStatistics _ssgCurrStatistics ; void ssgStatistics::reset () { vertex_count = leaf_count = 0 ; } ssgStatistics *ssgGetLatestStatistics () { return & _ssgCurrStatistics ; } Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- Makefile.am 12 Jan 2004 23:57:41 -0000 1.44 +++ Makefile.am 2 Feb 2004 01:35:15 -0000 1.45 @@ -26,7 +26,7 @@ ssgLoadMDL.h ssgSave3ds.cxx ssgAxisTransform.cxx ssgLoadATG.cxx \ ssgSaveFLT.cxx ssgSaveATG.cxx ssgLoadIV.cxx ssgLoad.cxx ssgLoadVRML.h \ ssgLoadMDL_BGLTexture.cxx ssgLoadXPlaneObj.cxx ssgSaveASC.cxx \ - ssgVertSplitter.h ssgVertSplitter.cxx + ssgVertSplitter.h ssgVertSplitter.cxx ssgStatistics.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.167 retrieving revision 1.168 diff -u -d -r1.167 -r1.168 --- ssg.h 25 Jan 2004 16:52:19 -0000 1.167 +++ ssg.h 2 Feb 2004 01:35:15 -0000 1.168 @@ -2783,6 +2783,28 @@ bool ssgConvertTexture( char * fname_output, char * fname_input ) ; +class ssgStatistics +{ + int vertex_count ; + int leaf_count ; + +public: + + void reset () ; + + void bumpVertexCount ( int i ) { vertex_count += i ; } + void bumpLeafCount ( int i ) { leaf_count += i ; } + + int getVertexCount () { return vertex_count ; } + int getLeafCount () { return leaf_count ; } + + ssgStatistics () + { + reset () ; + } +} ; + +ssgStatistics *ssgGetLatestStatistics () ; /* scene walkers */ Index: ssgLocal.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLocal.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ssgLocal.h 4 Nov 2002 05:11:22 -0000 1.22 +++ ssgLocal.h 2 Feb 2004 01:35:15 -0000 1.23 @@ -128,3 +128,7 @@ */ int _ssgSaveObject ( FILE * , ssgBase * ) ; int _ssgLoadObject ( FILE * , ssgBase ** , int type_mask = 0 ) ; + +extern ssgStatistics _ssgCurrStatistics ; + + Index: ssgVTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVTable.cxx,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- ssgVTable.cxx 14 Dec 2003 14:49:36 -0000 1.19 +++ ssgVTable.cxx 2 Feb 2004 01:35:15 -0000 1.20 @@ -370,6 +370,9 @@ void ssgVTable::draw_geometry () { + _ssgCurrStatistics . bumpVertexCount ( num_vertices ) ; + _ssgCurrStatistics . bumpLeafCount ( 1 ) ; + if ( indexed ) { glBegin ( gltype ) ; Index: ssgVtxArray.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxArray.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ssgVtxArray.cxx 29 Jan 2004 21:28:41 -0000 1.26 +++ ssgVtxArray.cxx 2 Feb 2004 01:35:15 -0000 1.27 @@ -186,79 +186,79 @@ // this removes any vertices (including normal, TexCoords and colour) // that are not referenced by the index array { - - bool doNormals = FALSE, doTexCoords = FALSE, doColours = FALSE; - - assert(vertices); - if(!indices) - { ulSetError( UL_WARNING, "indices == NULL\n"); - return; - } [...254 lines suppressed...] return ; @@ -407,14 +396,13 @@ void ssgVtxArray::print ( FILE *fd, char *indent, int how_much ) { - char in [ 100 ] ; + char in [ 100 ] ; - if ( how_much == 0 ) - return; // dont print anything + if ( how_much == 0 ) + return; // dont print anything sprintf ( in, "%s ", indent ); - - // wk: Why were these 2 lines commented out?: + ssgVtxTable::print ( fd, indent, how_much ) ; indices -> print ( fd, in, how_much ) ; } Index: ssgVtxTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxTable.cxx,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- ssgVtxTable.cxx 14 Dec 2003 14:52:01 -0000 1.33 +++ ssgVtxTable.cxx 2 Feb 2004 01:35:15 -0000 1.34 @@ -625,6 +625,9 @@ glEnableClientState ( GL_VERTEX_ARRAY ) ; glVertexPointer ( 3, GL_FLOAT, 0, vertices->get(0) ) ; + _ssgCurrStatistics . bumpVertexCount ( num_vertices ) ; + _ssgCurrStatistics . bumpLeafCount ( 1 ) ; + glDrawArrays ( gltype, 0, num_vertices ) ; glPopClientAttrib () ; |