plib-cvs Mailing List for PLIB (Page 16)
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: Eric L. <smo...@us...> - 2004-01-20 22:12:18
|
Update of /cvsroot/plib/plib/src/sg In directory sc8-pr-cvs1:/tmp/cvs-serv15955 Modified Files: sg.cxx Log Message: Bug fix to function: SGfloat sgDistSquaredToLineVec3(constsgLine3, const sgVec3) Fix is based on diff provided by John Fay. Index: sg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/sg/sg.cxx,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- sg.cxx 12 Nov 2003 12:39:16 -0000 1.40 +++ sg.cxx 20 Jan 2004 22:12:15 -0000 1.41 @@ -848,9 +848,11 @@ SGfloat sgDistSquaredToLineVec3 ( const sgLine3 line, const sgVec3 pnt ) { sgVec3 r ; sgSubVec3 ( r, pnt, line.point_on_line ) ; + + float projectedDistance = sgScalarProductVec3(r,line.direction_vector); return sgScalarProductVec3 ( r, r ) - - sgScalarProductVec3 ( r, line.direction_vector ) ; + projectedDistance * projectedDistance; } |
From: Wolfram K. <wol...@us...> - 2004-01-17 21:50:28
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv11546 Modified Files: ssgBranch.cxx Log Message: For the merging of hierarchy nodes after reading *.mdl files: maxVertices implemented. Index: ssgBranch.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgBranch.cxx,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- ssgBranch.cxx 13 Dec 2003 22:19:04 -0000 1.24 +++ ssgBranch.cxx 17 Jan 2004 21:50:25 -0000 1.25 @@ -389,6 +389,7 @@ // #define VERBOSE int maxTriangles = 100; // Thats a nice value for handling MDL files for BoB. // You might want to assign another value, possibly -1 before calling mergeHNodes +int maxVertices = 195; // see maxTriangles @@ -507,6 +508,7 @@ // now: l1 = kid at i1, l2 = kid at i1+delta if ( (l1->getState() == l2->getState()) && ((maxTriangles < 0) || (l1->getNumTriangles()+l2->getNumTriangles()<maxTriangles )) && + ((maxVertices < 0) || (l1->getNumVertices()+l2->getNumVertices()<maxVertices )) && (0 == strcmp(l1->getPrintableName(), l2->getPrintableName())) ) { @@ -611,7 +613,8 @@ // a) Both have the same state // b) the same name // c) the result would not have more than maxTriangles triangles (if maxTriangles is negative, this is not checked). -// d) both are of type GL_TRIANGLE_FAN or GL_TRIANGLES +// d) the result would not have more than maxVertices vertices (if maxVertices is negative, this is not checked). +// e) both are of type GL_TRIANGLE_FAN or GL_TRIANGLES { |
From: Eric L. <smo...@us...> - 2004-01-16 23:16:30
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv2002/src/ssg Modified Files: ssg.dsp Log Message: Updating ssg.dsp to include the new vertsplit files. Thanks to John Fay for the new dsp file. Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- ssg.dsp 14 Dec 2003 15:08:27 -0000 1.46 +++ ssg.dsp 16 Jan 2004 23:16:22 -0000 1.47 @@ -1,440 +1,448 @@ -# 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". [...857 lines suppressed...] +SOURCE=.\ssgVertSplitter.cxx +# End Source File +# Begin Source File + +SOURCE=.\ssgVertSplitter.h +# 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: Curtis O. <cu...@us...> - 2004-01-13 14:35:57
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv19813 Modified Files: ssgVertSplitter.cxx Log Message: #include'ing <plib/sg.h> references the system installed version which could be from a different version of plib if the user is upgrading. It also causes a strange dependency problem when doing a make install from a read only build tree. plib/sg.h gets installed first so when the make install hits this file, it thinks it needs to be rebuilt which it can't do on a read only file system, and shouldn't have to do anyway. Switching this to #include "sg.h" should be better all around. Index: ssgVertSplitter.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVertSplitter.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ssgVertSplitter.cxx 13 Jan 2004 13:41:48 -0000 1.1 +++ ssgVertSplitter.cxx 13 Jan 2004 14:35:53 -0000 1.2 @@ -16,7 +16,7 @@ #include "ssgVertSplitter.h" #include <math.h> -#include <plib/sg.h> +#include "sg.h" // //////////////////////////////////////////////////////////////////////// |
From: Eric L. <smo...@us...> - 2004-01-13 13:41:51
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv8787 Added Files: ssgVertSplitter.cxx Log Message: Andy Ross's vertex splitter --- NEW FILE: ssgVertSplitter.cxx --- //////////////////////////////////////////////////////////////////////// // // Copyright 2003, Andrew Ross // // Walk through an indexed triangle list, splitting vertices that // share "sharp" edges, and calculate normals for the resulting mesh. // // This code should really live inside the OptVertexList class in // ssgOptimizer.cxx, whose data model is almost 1:1 compatible with // the indexed triangle representation here. It is a separate file // because it comes from separate code that Andy Ross wrote for a // different project, and this was the cleanest way to do the port. // //////////////////////////////////////////////////////////////////////// #include "ssgVertSplitter.h" #include <math.h> #include <plib/sg.h> [...308 lines suppressed...] if(_geomVerts[i] != i) sgCopyVec3(norm(i), norm(_geomVerts[i])); // Now, if necessary, duplicate the vertices that got "condensed" // earlier by creating a new vertex and cloning the normal. expandDuplicates(); #if 0 static int allOrig = 0; static int allFinal = 0; allOrig += _origVerts; allFinal += _nVerts; fprintf(stderr, "%d -> %d (%d/%d)\n", _origVerts, _nVerts, allOrig, allFinal); #endif delete[] vCounts; delete[] vtspace; delete[] vTris; delete[] newNorms; } |
From: Eric L. <smo...@us...> - 2004-01-13 13:41:12
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv8689 Added Files: ssgVertSplitter.h Log Message: Andy Ross's vertex splitter --- NEW FILE: ssgVertSplitter.h --- //////////////////////////////////////////////////////////////////////// // // Copyright 2003, Andrew Ross // // Walk through an indexed triangle list, splitting vertices that // share "sharp" edges, and calculate normals for the resulting mesh. // // This code should really live inside the OptVertexList class in // ssgOptimizer.cxx, whose data model is almost 1:1 compatible with // the indexed triangle representation here. It is a separate file // because it comes from separate code that Andy Ross wrote for a // different project, and this was the cleanest way to do the port. // //////////////////////////////////////////////////////////////////////// #ifndef _SSGA_VERTSPLITTER_H #define _SSGA_VERTSPLITTER_H class ssgVertSplitter { public: ssgVertSplitter(int nVerts, int nTris); virtual ~ssgVertSplitter(); void setSharpAngle(float deg); float* vert(int i) { return _verts + 3*i; } float* norm(int i) { return _norms + 3*i; } // Initialize a triangle. The vertex indices might change. void setTri(int tidx, int va, int vb, int vc); // Grab the new/different indices post-split int* getTri(int t); // Number of new vertices (indices start after the original list) int newVerts() { return _nextNewVert; } // Original vertex associated with a given "new" vertex int origVert(int i); void splitAndCalcNormals(); private: struct Tri { int verts[3]; int oVerts[3]; bool degenerate; }; void condenseGeometry(); void expandDuplicates(); int findTriWithVert(int fidx, int vidx, int* tris, int ntris); int nextTri(int fidx, int vidx, int* tris, int ntris); int prevTri(int fidx, int vidx, int* tris, int ntris); static void fixVidx(Tri* t, int oldIdx, int newIdx); float _threshold; int _origVerts; int _vertsAlloced; int _nVerts; float* _verts; float* _norms; int _nTris; Tri* _tris; float* _triNorms; int* _newVertMap; int _nextNewVert; int* _geomVerts; void DUMP(); }; #endif // _SSGA_VERTSPLITTER_H |
From: Eric L. <smo...@us...> - 2004-01-12 23:57:44
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv29077/src/ssg Modified Files: Makefile.am ssgOptimiser.cxx Log Message: Andy Ross's vertex splitter Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- Makefile.am 12 Dec 2003 17:23:48 -0000 1.43 +++ Makefile.am 12 Jan 2004 23:57:41 -0000 1.44 @@ -25,7 +25,8 @@ ssgSaveVRML1.cxx ssgLoaderWriterStuff.h ssgMSFSPalette.h ssg3ds.h \ 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 + ssgLoadMDL_BGLTexture.cxx ssgLoadXPlaneObj.cxx ssgSaveASC.cxx \ + ssgVertSplitter.h ssgVertSplitter.cxx INCLUDES = -I$(top_srcdir)/src/sg -I$(top_srcdir)/src/util Index: ssgOptimiser.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgOptimiser.cxx,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ssgOptimiser.cxx 15 Oct 2003 20:15:07 -0000 1.32 +++ ssgOptimiser.cxx 12 Jan 2004 23:57:41 -0000 1.33 @@ -24,6 +24,8 @@ #include "ssgLocal.h" +#include <ssgVertSplitter.h> + static float optimise_vtol [3] = { 0.001f, /* DISTANCE_SLOP = One millimeter */ @@ -66,6 +68,15 @@ counter = 1 ; } [...100 lines suppressed...] + for (i = 0 ; i < tnum ; i++ ) { + short* oldtri = tlist + 3 * i ; + int* newtri = vs.getTri ( i ) ; + for ( j = 0 ; j < 3 ; j++ ) { + oldtri [ j ] = newtri [ j ] ; + vlist[ newtri [ j ] ] -> bump (); + } + } } short OptVertexList::find ( sgVec3 v, sgVec2 t, sgVec4 c, int tex_frac ) @@ -675,7 +709,7 @@ GLenum thisType = ((ssgVtxTable *)k)->getPrimitiveType (); if ((thisType != GL_POINTS) && (thisType != GL_LINES) && (thisType != GL_LINE_STRIP) && (thisType != GL_LINE_LOOP)) - { list . add ( (ssgVtxTable *) k ) ; + { list . add ( (ssgVtxTable *) k ) ; b_ent -> removeKid ( k ) ; k = b_ent -> getKid ( 0 ) ; } |
From: Wolfram K. <wol...@us...> - 2004-01-11 23:14:41
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv581 Modified Files: ssgLoadMDL.cxx Log Message: "export" no of LoDs. Also, no of LoDs was too small by one. Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- ssgLoadMDL.cxx 13 Dec 2003 23:09:16 -0000 1.51 +++ ssgLoadMDL.cxx 11 Jan 2004 23:14:38 -0000 1.52 @@ -614,6 +614,7 @@ // wk : It's not completely clear to me whether the following two functions can not be merged; Oh well. // CreateAndAddLeaf1 is called then faces are created and then CreateAndAddLeaf2 is called + static void CreateAndAddLeaf1(GLenum ty, ssgTexCoordArray *tex_coords_P, bool use_texture) { curr_index_ = new ssgIndexArray(); @@ -1757,6 +1758,10 @@ } } + +// kludge: global +int g_noLoDs =1; + ssgEntity *ssgLoadMDL(const char *fname, const ssgLoaderOptions *options) { ssgSetCurrentOptions ( (ssgLoaderOptions*)options ) ; @@ -1857,7 +1862,8 @@ last_idx_ = 0; curr_var_ = 0; stack_depth_ = 0; - noLoDs = 0; + noLoDs = 1; // if there is no "branch" and no "++noLoDs" is called, we have 1 LoD. + // If there is one branch, we have 2, etc. curr_lod = 0; sgMakeIdentMat4(curr_matrix_); @@ -1879,9 +1885,10 @@ #endif // :-((( delete curr_vtx_; delete curr_norm_; - - DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); + + DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); printf("NoLoDs = %d\n", (int)noLoDs); + g_noLoDs = noLoDs; return model_; } |
From: James J. <pu...@us...> - 2003-12-16 23:16:07
|
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1:/tmp/cvs-serv31268 Modified Files: puInterface.cxx Log Message: The variable "currLiveInterface" is initialized to -1 when the stack is empty. When the first live interface gets put onto the stack, "currLiveInterface" is incremented to zero. Thus when we are popping the last live interface, the value of "currLiveInterface" should be zero instead of one. This change fixes the problem. (John Fay) Index: puInterface.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puInterface.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- puInterface.cxx 7 Feb 2003 15:02:50 -0000 1.18 +++ puInterface.cxx 16 Dec 2003 23:16:04 -0000 1.19 @@ -42,7 +42,7 @@ void puPopLiveInterface ( puInterface *in ) { - if ( currLiveInterface <= 0 ) + if ( currLiveInterface < 0 ) { ulSetError ( UL_WARNING, "PUI: Live puInterface stack is empty!\n" ) ; return; |
From: James J. <pu...@us...> - 2003-12-16 23:14:21
|
Update of /cvsroot/plib/plib/src/pui In directory sc8-pr-cvs1:/tmp/cvs-serv30803 Modified Files: puGroup.cxx Log Message: Remove puRemoveGroup added in version 1.26, and explain the stack in a comment (John Fay) Index: puGroup.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/pui/puGroup.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- puGroup.cxx 12 Nov 2003 19:02:03 -0000 1.26 +++ puGroup.cxx 16 Dec 2003 23:14:18 -0000 1.27 @@ -29,6 +29,12 @@ #define PUSTACK_MAX 100 + /* + This is a stack of groups that are currently being filled with other widgets. + A group is pushed onto the stack when it is created and it is popped off the + stack when its "close" function is called. + */ + static int currGroup = -1 ; static puGroup *groupStack [ PUSTACK_MAX ] ; @@ -49,28 +55,6 @@ ulSetError ( UL_WARNING, "PUI: puGroup stack is empty!" ) ; } -void puRemoveGroup ( puGroup *gr ) -{ - int index = currGroup ; - while ( index >= 0 ) - { - if ( groupStack [ index ] == gr ) - { - int jndx ; - for ( jndx = index; jndx < currGroup - 1; jndx ++ ) - groupStack [ jndx ] = groupStack [ jndx + 1 ] ; - - currGroup -- ; - return ; - } - - index -- ; - } - - ulSetError ( UL_WARNING, "PUI: Trying to remove invalid puGroup from puGroup stack!" ) ; -} - - int puNoGroup ( void ) { return currGroup < 0 ; @@ -373,8 +357,6 @@ puGroup::~puGroup () { void puCleanUpJunk ( void ) ; - - puRemoveGroup ( this ) ; puObject *bo = getLastChild () ; |
From: Wolfram K. <wol...@us...> - 2003-12-16 22:32:46
|
Update of /cvsroot/plib/plib/src/util In directory sc8-pr-cvs1:/tmp/cvs-serv22447 Modified Files: ul.cxx Log Message: ulMakePath did not use ulIsAbsolutePath and on Windos indeed incorrectly saw absolute paths as relative ones, handling them incorrectly. Index: ul.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.cxx,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ul.cxx 7 Feb 2003 15:25:44 -0000 1.32 +++ ul.cxx 16 Dec 2003 22:32:43 -0000 1.33 @@ -183,7 +183,7 @@ { if ( fname ) { - if ( fname [ 0 ] != '\0' && fname [ 0 ] != '/' && + if ( !ulIsAbsolutePathName (fname) && dir != NULL && dir[0] != '\0' ) { strcpy ( path, dir ) ; |
From: Wolfram K. <wol...@us...> - 2003-12-14 15:08:30
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv15916/ssg Modified Files: ssg.dsp Log Message: ssgLoadPCX added. Index: ssg.dsp =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.dsp,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- ssg.dsp 25 Aug 2003 12:53:16 -0000 1.45 +++ ssg.dsp 14 Dec 2003 15:08:27 -0000 1.46 @@ -246,6 +246,10 @@ # End Source File # Begin Source File +SOURCE=.\ssgLoadPCX.cxx +# End Source File +# Begin Source File + SOURCE=.\ssgLoadPNG.cxx # End Source File # Begin Source File |
From: Wolfram K. <wol...@us...> - 2003-12-14 14:58:44
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv13980/ssg Modified Files: ssgSaveASC.cxx Log Message: Implemented material (texture) handling. Optionally save only some nodes. The texturecoordinates suddenly need an "U" and "V" before them for unknown reasons. Index: ssgSaveASC.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgSaveASC.cxx,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ssgSaveASC.cxx 26 Jul 2003 11:58:44 -0000 1.2 +++ ssgSaveASC.cxx 14 Dec 2003 14:58:40 -0000 1.3 @@ -67,6 +67,43 @@ Vertex list: */ fprintf ( save_fd, "Vertex list:\n"); + const char *material = "PALGREY27"; + ssgState *s = vt->getState(); + if (s) + if(s->isAKindOf(ssgTypeSimpleState())) + { + + ssgTexture * t = ((ssgSimpleState *)s)->getTexture(); + if(t) [...72 lines suppressed...] else if ( e -> isAKindOf ( ssgTypeVtxTable() ) ) - { - ssgVtxTable *vt = (ssgVtxTable *) e ; - save_vtx_table ( vt ) ; - } + { int bSaveIt = TRUE; + if(bUseSpare) + if( 1 != e->getSpare() ) + bSaveIt = FALSE; + + if ( bSaveIt ) + { + ssgVtxTable *vt = (ssgVtxTable *) e ; + save_vtx_table ( vt ) ; + } + } } |
From: Wolfram K. <wol...@us...> - 2003-12-14 14:52:04
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv12971/ssg Modified Files: ssgVtxTable.cxx Log Message: Added function getAs_ssgVtxArray Index: ssgVtxTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxTable.cxx,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- ssgVtxTable.cxx 12 Dec 2003 18:21:59 -0000 1.32 +++ ssgVtxTable.cxx 14 Dec 2003 14:52:01 -0000 1.33 @@ -780,6 +780,36 @@ } +ssgVtxArray *ssgVtxTable::getAs_ssgVtxArray() +{ + + ssgIndexArray *indices = new ssgIndexArray (); + int i, no = 0; + switch ( getPrimitiveType () ) + { + case GL_POLYGON : + case GL_TRIANGLE_FAN : + case GL_TRIANGLE_STRIP : + no = getNumTriangles() + 2 ; + break; + + case GL_TRIANGLES : + no = getNumTriangles() * 3 ; + } + for(i=0;i<no;i++) + indices ->add(i); + + + ssgState * state = getState(); + char * name = getName(); + ssgVtxArray * s = new ssgVtxArray ( getGLtype(), + vertices, normals, texcoords, colours, indices); + s->setName(name); + s->setState(state); + return s; +} + + void ssgVtxTable::isect_triangles ( sgSphere *s, sgMat4 m, int test_needed ) { int nt = getNumTriangles () ; |
From: Wolfram K. <wol...@us...> - 2003-12-14 14:49:39
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv12642/ssg Modified Files: ssgVTable.cxx Log Message: The last function I added should go into ssgVtxTable, not in here. Fixed. Index: ssgVTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVTable.cxx,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ssgVTable.cxx 13 Dec 2003 22:40:10 -0000 1.18 +++ ssgVTable.cxx 14 Dec 2003 14:49:36 -0000 1.19 @@ -559,38 +559,6 @@ } } - - -ssgVtxArray *ssgVtxTable::getAs_ssgVtxArray() -{ - - ssgIndexArray *indices = new ssgIndexArray (); - int i, no = 0; - switch ( getPrimitiveType () ) - { - case GL_POLYGON : - case GL_TRIANGLE_FAN : - case GL_TRIANGLE_STRIP : - no = getNumTriangles() + 2 ; - break; - - case GL_TRIANGLES : - no = getNumTriangles() * 3 ; - } - for(i=0;i<no;i++) - indices ->add(i); - - - ssgState * state = getState(); - char * name = getName(); - ssgVtxArray * s = new ssgVtxArray ( getGLtype(), - vertices, normals, texcoords, colours, indices); - s->setName(name); - s->setState(state); - return s; -} - - void ssgVTable::isect_triangles ( sgSphere *s, sgMat4 m, int test_needed ) { int nt = getNumTriangles () ; |
From: Wolfram K. <wol...@us...> - 2003-12-14 10:50:20
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv16461 Modified Files: ssg.h Log Message: mergeHNodes: New function that merges hierarchy nodes that are "compatible" (same texture, name etc) getAs_ssgVtxArray and addIndex: Two small "utility" functions I needed for my new features. Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.165 retrieving revision 1.166 diff -u -d -r1.165 -r1.166 --- ssg.h 12 Dec 2003 17:40:21 -0000 1.165 +++ ssg.h 13 Dec 2003 21:22:42 -0000 1.166 @@ -1472,6 +1472,8 @@ return (getNumColours()<=0) ? _ssgColourWhite : colours->get(i);} + ssgVtxArray *getAs_ssgVtxArray (); + virtual ~ssgVtxTable (void) ; virtual const char *getTypeName(void) ; @@ -1562,6 +1564,7 @@ virtual void pick ( int baseName ) ; void setIndices ( ssgIndexArray *il ) ; + void addIndex ( short i) { indices->add(i); } int getNumIndices () { return indices -> getNum () ; } @@ -1617,6 +1620,8 @@ void removeAllKids (void) ; void replaceKid ( int n, ssgEntity *new_entity ) ; void replaceKid ( ssgEntity *old_entity, ssgEntity *new_entity ) ; + + void mergeHNodes(); virtual ssgEntity *getByName ( char *match ) ; virtual ssgEntity *getByPath ( char *path ) ; |
From: Wolfram K. <wol...@us...> - 2003-12-14 09:48:54
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv10457 Modified Files: ssgLoadMDL.cxx Log Message: "RIFF" is now also handled when it appears at an arbitrary poosition in the file. Red herring "RIFF"s are ignored. Implemented opcode AE/AF for matrix transforms. Trying to handle the strange size of some models. Minor fixes. More debug output. Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- ssgLoadMDL.cxx 8 Dec 2003 18:07:04 -0000 1.50 +++ ssgLoadMDL.cxx 13 Dec 2003 23:09:16 -0000 1.51 @@ -1464,9 +1464,9 @@ for (int i = 0; i < count; i++) { - TheVertexList[i].p[0] = ulEndianReadLittleFloat(fp) / 1E6; - TheVertexList[i].p[1] = ulEndianReadLittleFloat(fp) / 1E6; - TheVertexList[i].p[2] = ulEndianReadLittleFloat(fp) / 1E6; + TheVertexList[i].p[0] = ulEndianReadLittleFloat(fp); // / 1E6; + TheVertexList[i].p[1] = ulEndianReadLittleFloat(fp); // / 1E6; + TheVertexList[i].p[2] = ulEndianReadLittleFloat(fp); // / 1E6; TheVertexList[i].n[0] = ulEndianReadLittleFloat(fp); TheVertexList[i].n[1] = ulEndianReadLittleFloat(fp); [...156 lines suppressed...] + printf("found a good RIFF header at address %lx\n", addr); + FindBGLBeginRIFF(fp); + break; // breaks the while(!feof(fp)) + } + } + } + } + } if(feof(fp)) { @@ -1795,7 +1877,7 @@ #ifdef DEBUG fclose(wkfp); #endif - delete curr_vtx_; +// :-((( delete curr_vtx_; delete curr_norm_; DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); |
From: Wolfram K. <wol...@us...> - 2003-12-14 08:40:15
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv12641 Modified Files: ssgBranch.cxx Log Message: mergeHNodes: New function that merges hierarchy nodes that are "compatible" (same texture, name etc) For more information, see the comment at the definition. Index: ssgBranch.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgBranch.cxx,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- ssgBranch.cxx 4 Dec 2002 20:15:22 -0000 1.23 +++ ssgBranch.cxx 13 Dec 2003 22:19:04 -0000 1.24 @@ -383,4 +383,249 @@ return TRUE ; } +// ----------------------- code by W.K for merging hierarchy nodes ------------------------------ + + +// #define VERBOSE +int maxTriangles = 100; // Thats a nice value for handling MDL files for BoB. + // You might want to assign another value, possibly -1 before calling mergeHNodes + + [...218 lines suppressed...] +// b) the same name +// c) the result would not have more than maxTriangles triangles (if maxTriangles is negative, this is not checked). +// d) both are of type GL_TRIANGLE_FAN or GL_TRIANGLES +{ + + +int deltas[] = { 1 ,2 ,1 ,3 ,2 ,1 ,2 ,4 ,2 ,1 ,5 ,1 ,2 ,6 ,2 ,1 ,2 ,7 ,2 ,1 ,2 ,1 ,8 ,1 ,2 ,1 ,2 ,9 ,2 ,1 ,2 ,1, + 10 ,1 ,2 ,1 ,2 ,11 ,1 ,12 ,1 ,2 ,13 ,1 ,2 ,14 ,2 ,1 ,1 ,15 ,1 ,16 ,1 ,17 ,2 ,1 ,18 ,1 ,22 ,2 ,25 , + 2 ,1 ,30 ,2 ,1 ,2 ,1 ,13 ,2 ,1 ,2 ,1 }; + noOfMergedNodes = 0; + for(int i=0; i < sizeof(deltas)/sizeof(int); i++) + { + recursiveMergeHNodes ( this, deltas[i] ); +#ifdef VERBOSE + printf("############################################### ^%d\n". deltas[i]); +#endif + } + printf("%d nodes were merged!\n", noOfMergedNodes); +} |
From: Wolfram K. <wol...@us...> - 2003-12-14 08:37:52
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv28291 Modified Files: ssgVTable.cxx Log Message: Implemented aux. function "ssgVtxTable::getAs_ssgVtxArray" Index: ssgVTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVTable.cxx,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ssgVTable.cxx 10 Nov 2002 17:12:13 -0000 1.17 +++ ssgVTable.cxx 13 Dec 2003 22:40:10 -0000 1.18 @@ -559,6 +559,38 @@ } } + + +ssgVtxArray *ssgVtxTable::getAs_ssgVtxArray() +{ + + ssgIndexArray *indices = new ssgIndexArray (); + int i, no = 0; + switch ( getPrimitiveType () ) + { + case GL_POLYGON : + case GL_TRIANGLE_FAN : + case GL_TRIANGLE_STRIP : + no = getNumTriangles() + 2 ; + break; + + case GL_TRIANGLES : + no = getNumTriangles() * 3 ; + } + for(i=0;i<no;i++) + indices ->add(i); + + + ssgState * state = getState(); + char * name = getName(); + ssgVtxArray * s = new ssgVtxArray ( getGLtype(), + vertices, normals, texcoords, colours, indices); + s->setName(name); + s->setState(state); + return s; +} + + void ssgVTable::isect_triangles ( sgSphere *s, sgMat4 m, int test_needed ) { int nt = getNumTriangles () ; |
From: Wolfram K. <wol...@us...> - 2003-12-12 18:23:58
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv12155 Modified Files: ssgconf.h Log Message: #define SSG_LOAD_PCX_SUPPORTED Index: ssgconf.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgconf.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ssgconf.h 27 Sep 2002 15:45:06 -0000 1.11 +++ ssgconf.h 12 Dec 2003 18:23:55 -0000 1.12 @@ -51,4 +51,5 @@ #define SSG_LOAD_MDL_SUPPORTED #define SSG_LOAD_MDL_BGL_TEXTURE_SUPPORTED #define SSG_LOAD_XPL_SUPPORTED +#define SSG_LOAD_PCX_SUPPORTED #endif |
From: Wolfram K. <wol...@us...> - 2003-12-12 18:22:03
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv11831 Modified Files: ssgVtxTable.cxx Log Message: Implemented compare functions Index: ssgVtxTable.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgVtxTable.cxx,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- ssgVtxTable.cxx 10 Nov 2002 17:12:13 -0000 1.31 +++ ssgVtxTable.cxx 12 Dec 2003 18:21:59 -0000 1.32 @@ -26,6 +26,106 @@ #define HL_DELTA 0.04f +int ssgSimpleList::compare(ssgSimpleList *other, int print_result) +{ + int result = TRUE; + if (total !=other->total ) + { result = FALSE; + if(print_result) + printf("ERROR: total \n"); + } [...102 lines suppressed...] sgVec4 plane ; @@ -621,7 +721,7 @@ for ( int i = 0 ; i < nt ; i++ ) { - short v1, v2, v3 ; + short v1, v2, v3 ; sgVec3 vv1, vv2, vv3 ; sgVec4 plane ; @@ -688,7 +788,7 @@ for ( int i = 0 ; i < nt ; i++ ) { - short v1, v2, v3 ; + short v1, v2, v3 ; sgVec3 vv1, vv2, vv3 ; sgVec4 plane ; |
From: Wolfram K. <wol...@us...> - 2003-12-12 17:40:24
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv3963 Modified Files: ssg.h Log Message: Loading of PCX textures. compare functions for ssgSimpleList and ssgVtxTable. Index: ssg.h =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.h,v retrieving revision 1.164 retrieving revision 1.165 diff -u -d -r1.164 -r1.165 --- ssg.h 7 Oct 2003 03:00:11 -0000 1.164 +++ ssg.h 12 Dec 2003 17:40:21 -0000 1.165 @@ -446,6 +446,7 @@ limit = total = 0 ; } + int compare(ssgSimpleList *other, int print_result=TRUE); int getSizeOf (void) { return size_of ; } int getNum (void) { return total ; } @@ -683,6 +684,7 @@ bool ssgLoadBMP ( const char *fname, ssgTextureInfo* info ) ; bool ssgLoadTGA ( const char *fname, ssgTextureInfo* info ) ; bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) ; + bool ssgLoadPCX ( const char *fname, ssgTextureInfo* info ) ; void ssgAddTextureFormat ( const char* extension, bool (*) (const char*, ssgTextureInfo* info) ) ; @@ -1415,6 +1417,7 @@ ssgColourArray *colours ; public: + int compare(ssgVtxTable *other, int print_result=TRUE); virtual ssgBase *clone ( int clone_flags = 0 ) ; ssgVtxTable () ; @@ -2697,6 +2700,7 @@ int ssgSaveATG ( const char *fname, ssgEntity *ent ) ; int ssgSaveVRML1( const char *fname, ssgEntity *ent ) ; int ssgSaveASC ( const char *fname, ssgEntity *ent ) ; +int ssgSavePOV ( const char *fname, ssgEntity *ent ) ; ssgEntity *ssgLoad ( const char *fname, const ssgLoaderOptions *options = NULL ) ; |
From: Wolfram K. <wol...@us...> - 2003-12-12 17:23:54
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv1075 Modified Files: Makefile.am ssg.cxx Added Files: pcx.h ssgLoadPCX.cxx Log Message: Loading of PCX textures --- NEW FILE: pcx.h --- // Loading of the PCX texture file format // // This file is used for both PLIB and for BoB. // // Written by Wolfram Kuss in december 2003 // // This file is published as public domain struct pcxHeaderType { char manufacturer; // always 10 char version; // usually 5 char encoding; // 1 = RLE char bitsPerPixel; // number of bits to represent a pixel short x, y; // upper left coordinates short xmax, ymax; short hDPI, vDPI; // DPI char egaPalette[48]; // obsolete char reserved; // unused, always 0 char nColorPlanes; // number of color planes. not implemented yet? short bytesPerLine; // bytes per scan line. not implemented yet? todo kludge short paletteInfo; // colored or grey scale. not implemented yet? short hScreenSize, cScreenSize; char padding[54]; // reserved, always 0 }; #define READ_BYTE (buffer[0]); buffer++; #define READ_SHORT ((((unsigned long)buffer[0])<<8) + buffer[1]); buffer += 2; #define READ_LONG ((((unsigned long)buffer[0])<<24) + (((unsigned long)buffer[1])<<16) + (((unsigned long)buffer[2])<<8) + buffer[3]); buffer += 4; // It is bad style to have a function inside a header file, but this way there is only one file // I need to "synchronise" between PLIB and BoB. static int ReadPCXBody(UByte*& buffer, pcxHeaderType *ppcxHeader, UByte * pBody) // returns TRUE on success. // reads from buffer (which will normally just hold the file contents, but in memory, // writes to pBody, which must have been allocated { unsigned short x,y; if ((ppcxHeader->bitsPerPixel != 8) // unsupported pcx || (ppcxHeader->encoding>1) // invalid PCX // || (pcxHeader.nColorPlanes != 1) // unsupported pcx || (ppcxHeader->manufacturer != 10)) // invalid pcx return (FALSE); unsigned short width = ppcxHeader->xmax-ppcxHeader->x+1; x=0; y=0; // upper left coordinates for(;;) { UByte color = READ_BYTE; if ((color &0xC0) != 0xC0) // uncompressed? { if (x >= width) { x=0; y++; // next line if(y > ppcxHeader->ymax-ppcxHeader->y) break; } *pBody++ = color; x++; } else { UByte counter, length = color & 0x3F; // number of times next byte repeated color = READ_BYTE; for (counter=0; counter<length; counter++) { if (x >= width) { x=0; y++; // next line if(y > ppcxHeader->ymax-ppcxHeader->y) break; } x++; *pBody++ = color; } if(y > ppcxHeader->ymax-ppcxHeader->y) break; } } return TRUE; } --- NEW FILE: ssgLoadPCX.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 [...90 lines suppressed...] texels[c++] = buffer[b*3 + 2]; texels[c++] = 255; //(b<index)?0:255; } } delete [] pBodyorig; delete [] bufferorig; return ssgMakeMipMaps ( texels, width, height, 4 ) ; } #else bool ssgLoadPCX ( const char *fname, ssgTextureInfo* info ) { ulSetError ( UL_WARNING, "ssgLoadTexture: '%s' - PCX texture support not configured", fname ) ; return false ; } #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/Makefile.am,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- Makefile.am 2 Aug 2003 18:36:55 -0000 1.42 +++ Makefile.am 12 Dec 2003 17:23:48 -0000 1.43 @@ -2,7 +2,7 @@ lib_LIBRARIES = libplibssg.a -include_HEADERS = ssg.h ssgconf.h ssgMSFSPalette.h ssgKeyFlier.h +include_HEADERS = ssg.h ssgconf.h ssgMSFSPalette.h ssgKeyFlier.h pcx.h libplibssg_a_SOURCES = ssg.cxx ssgAnimation.cxx ssgBase.cxx \ ssgBaseTransform.cxx ssgBranch.cxx ssgContext.cxx ssgCutout.cxx \ @@ -14,7 +14,7 @@ ssgTexTrans.cxx ssgTexture.cxx ssgTransform.cxx \ ssgStateSelector.cxx ssgRangeSelector.cxx ssgLoadTexture.cxx \ ssgLoadBMP.cxx ssgLoadSGI.cxx ssgLoadPNG.cxx ssgLoadTGA.cxx \ - ssgInvisible.cxx ssgLoadSSG.cxx ssgVTable.cxx \ + ssgLoadPCX.cxx ssgInvisible.cxx ssgLoadSSG.cxx ssgVTable.cxx \ ssgSimpleList.cxx ssgVtxTable.cxx ssgIO.cxx ssgLoad3ds.cxx \ ssgSaveASE.cxx ssgLoadASE.cxx ssgParser.cxx ssgParser.h \ ssgLoadDXF.cxx ssgSaveDXF.cxx ssgLoadTRI.cxx ssgSaveTRI.cxx \ Index: ssg.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssg.cxx,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- ssg.cxx 26 Jul 2003 09:50:41 -0000 1.64 +++ ssg.cxx 12 Dec 2003 17:23:51 -0000 1.65 @@ -163,6 +163,10 @@ ssgAddTextureFormat ( ".png" , ssgLoadPNG ) ; #endif +#ifdef SSG_LOAD_PCX_SUPPORTED + ssgAddTextureFormat ( ".pcx" , ssgLoadPCX ) ; +#endif + #ifdef SSG_LOAD_SGI_SUPPORTED ssgAddTextureFormat ( ".rgb" , ssgLoadSGI ) ; ssgAddTextureFormat ( ".rgba" , ssgLoadSGI ) ; |
From: Wolfram K. <wol...@us...> - 2003-12-08 18:07:07
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv26429 Modified Files: ssgLoadMDL.cxx Log Message: Fixing compile problem (on Linux?) reported by Melchior FRANZ. Thanks! Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- ssgLoadMDL.cxx 8 Dec 2003 08:22:12 -0000 1.49 +++ ssgLoadMDL.cxx 8 Dec 2003 18:07:04 -0000 1.50 @@ -1644,7 +1644,7 @@ //=========================================================================== #define MYMAKEFOURCC(a, b, c, d) \ - ((unsigned long)(a) | ((unsigned long)(BYTE)(b) << 8) | \ + ((unsigned long)(a) | ((unsigned long)(b) << 8) | \ ((unsigned long)(c) << 16) | ((unsigned long)(d) << 24 )) static unsigned long l1 = MYMAKEFOURCC('R', 'I', 'F', 'F'); |
From: Wolfram K. <wol...@us...> - 2003-12-08 08:22:16
|
Update of /cvsroot/plib/plib/src/ssg In directory sc8-pr-cvs1:/tmp/cvs-serv20767 Modified Files: ssgLoadMDL.cxx Log Message: Implemented the most important commands for CFS2 and FS2k2 files (includign "functionality"). Split off some functions for better readability Index: ssgLoadMDL.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/ssg/ssgLoadMDL.cxx,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- ssgLoadMDL.cxx 6 Dec 2003 18:25:38 -0000 1.48 +++ ssgLoadMDL.cxx 8 Dec 2003 08:22:12 -0000 1.49 @@ -256,6 +256,21 @@ } //=========================================================================== +// for new lists, especially vertex list: + +struct oneVertex { + sgVec3 p, n; // point position, normal + sgVec2 tc; // texture coords +}; + +struct oneVertex *TheVertexList; // array. Kludge: only one allowed [...697 lines suppressed...] #ifdef DEBUG - fclose(wkfp); + fclose(wkfp); #endif - delete curr_vtx_; - delete curr_norm_; - - DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); - printf("NoLoDs = %d\n", (int)noLoDs); + delete curr_vtx_; + delete curr_norm_; + + DEBUGPRINT("\n" << vertex_array_->getNum() << " vertices\n"); + printf("NoLoDs = %d\n", (int)noLoDs); - return model_; + return model_; } #else |