Re: [Plib-devel] How many triangles in a leaf?
Brought to you by:
sjbaker
From: Fay J. F Dr C. U. 46 S. <joh...@eg...> - 2007-06-19 16:02:38
|
Paolo, SSG is not my forte, but here is my reaction. (1) I don't think we want to keep the limitation on the number of vertices. We will need a method that returns unsigned int rather than short. (2) We definitely do not want to break existing applications that are expecting a "short *" argument type. (3) I don't think we want two functions of the same name, one public and one private, with different argument types. Something I don't know (my C++ is a little rusty) is whether applications will be able to distinguish between two public functions ssgVtxTable::getTriangle( int n, short *v1, short *v2, short *v3) and ssgVtxTable::getTriangle( int n, unsigned int *v1, unsigned int *v2, unsigned int *v3) Since the arguments are pointers, I think C++ can make the distinction. If this is the case, I would suggest that we add a new public function with "unsigned int *" arguments and that we deprecate the present function. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294=20 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of Paolo Leoncini Sent: Tuesday, June 19, 2007 3:31 AM To: pli...@li... Subject: [Plib-devel] How many triangles in a leaf? Dear Plib friends, I'd faced again (see my post on the list "Large geometry objects and crash in ssgLOS" on 2005-11-24) with the unclear limit on the number of primitives the IndexArray can index. Even if we accept filling the VertexArray with no more than sizeof(short) vertices, the problem is that we can't index more than sizeof(short)/3 triangles per ssgVtxTable (and derived leaf types), and it only arises when doing LOS or other queries on the geometry. Look at the code in ssgVtxArray.cxx: void ssgVtxArray::getTriangle ( int n, short *v1, short *v2, short *v3 ) { short vv1, vv2, vv3 ; ssgVtxTable::getTriangle ( n, &vv1, &vv2, &vv3 ) ; *v1 =3D *( indices -> get ( vv1 ) ) ; *v2 =3D *( indices -> get ( vv2 ) ) ; *v3 =3D *( indices -> get ( vv3 ) ) ; } ssgIndexArray::get would take unsigned int argument type, but it is fed with the results from ssgVtxTable::getTriangle, which does return short indices. Thus, by summarizing: max number of triangles in LOS-compatible ssgVtxTable and ssgVtxArray: 10922. For overcoming the limit we could either - leave such limitaion for ssgVtxTable, yet making ssgVtxArray::getTriangle independent of the ssgVtxTable::getTriangle call; Or - change the return type for ssgVtxTable::getTriangle indices to unsigned int; Or even - introduce a private method ssgVtxTable::getTriangle( int n, unsigned int *v1, unsigned int *v2, unsigned int *v3 ), and call this from both the official ssgVtxTable::getTriangle ( int n, short *v1, short *v2, short *v3 ) and from the ssgVtxArray::getTriangle above. Waiting for reactions - Paolo ------------------------------------------------------------------------ - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel |