[Plib-cvs] plib/src/ssg ssg.cxx,1.49,1.50 ssg.dsp,1.37,1.38 ssg.h,1.133,1.134 ssgDList.cxx,1.8,1.9 s
Brought to you by:
sjbaker
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 --- |