[Plib-cvs] plib/src/ssg ssg.h,1.159,1.160 ssgBranch.cxx,1.22,1.23 ssgLeaf.cxx,1.20,1.21
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2002-12-04 20:15:26
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv20760/plib/src/ssg Modified Files: ssg.h ssgBranch.cxx ssgLeaf.cxx Log Message: Added some simple static statistics gathering. Hence ssgEntity::getStats returns number of branches, leaves, triangles and vertices. Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.159 retrieving revision 1.160 diff -u -d -r1.159 -r1.160 --- ssg.h 30 Nov 2002 00:41:49 -0000 1.159 +++ ssg.h 4 Dec 2002 20:15:21 -0000 1.160 @@ -1172,6 +1172,7 @@ virtual void hot ( sgVec3 s, sgMat4 m, int test_needed ) = 0 ; virtual void los ( sgVec3 s, sgMat4 m, int test_needed ) = 0 ; virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ; + virtual void getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_vertices ) = 0 ; virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; } ; @@ -1262,6 +1263,7 @@ virtual void recalcBSphere () = 0 ; virtual const char *getTypeName(void) ; virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ; + virtual void getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_vertices ) ; virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; @@ -1606,6 +1608,7 @@ virtual void hot ( sgVec3 s, sgMat4 m, int test_needed ) ; virtual void los ( sgVec3 s, sgMat4 m, int test_needed ) ; virtual void print ( FILE *fd = stderr, char *indent = "", int how_much = 2 ) ; + virtual void getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_vertices ) ; virtual int load ( FILE *fd ) ; virtual int save ( FILE *fd ) ; virtual void recalcBSphere () ; Index: ssgBranch.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgBranch.cxx,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- ssgBranch.cxx 26 Oct 2002 19:19:25 -0000 1.22 +++ ssgBranch.cxx 4 Dec 2002 20:15:22 -0000 1.23 @@ -155,6 +155,28 @@ } +void ssgBranch::getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_verts ) +{ + int nb, nl, nt, nv ; + + *num_branches = 1 ; /* this! */ + *num_leaves = 0 ; + *num_tris = 0 ; + *num_verts = 0 ; + + for ( int i = 0 ; i < getNumKids () ; i++ ) + { + ssgEntity *e = getKid ( i ) ; + + e -> getStats ( & nb, & nl, & nt, & nv ) ; + *num_branches += nb ; + *num_leaves += nl ; + *num_tris += nt ; + *num_verts += nv ; + } +} + + ssgEntity *ssgBranch::getByName ( char *match ) { if ( getName() != NULL && strcmp ( getName(), match ) == 0 ) Index: ssgLeaf.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLeaf.cxx,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ssgLeaf.cxx 2 Sep 2002 06:05:48 -0000 1.20 +++ ssgLeaf.cxx 4 Dec 2002 20:15:22 -0000 1.21 @@ -156,6 +156,17 @@ } +void ssgLeaf::getStats ( int *num_branches, int *num_leaves, int *num_tris, int *num_verts ) +{ + int nb, nl, nt, nv ; + + *num_branches = 0 ; + *num_leaves = 1 ; /* this! */ + *num_tris = getNumTriangles () ; + *num_verts = getNumVertices () ; +} + + void ssgLeaf::print ( FILE *fd, char *indent, int how_much ) { if ( how_much == 0 ) |