Changeset 8122 in orxonox.OLD for branches/osx/src/lib/graphics
- Timestamp:
- Jun 2, 2006, 5:46:11 PM (19 years ago)
- Location:
- branches/osx/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/osx/src/lib/graphics/importer/md2Model.cc
r7732 r8122 14 14 15 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_IMPORTER 16 16 #include "config.h" 17 #ifdef HAVE_SDL_SDL_H 18 #include <SDL/SDL.h> 19 #include <SDL/SDL_endian.h> 20 #else 21 #include <SDL.h> 22 #include <SDL_endian.h> 23 #endif 17 24 #include "md2Model.h" 18 25 #include "material.h" … … 20 27 #include "debug.h" 21 28 #include "util/loading/resource_manager.h" 22 23 29 24 30 using namespace std; … … 67 73 68 74 75 #ifdef SDL_LIL_ENDIAN 76 #define BULK_CONV( _ptr, _num ) do { \ 77 int _cnt = _num;\ 78 int* _iptr = (int*)_ptr;\ 79 for( int _l = 0; _l<_cnt; ++_l )\ 80 _iptr[_l] = SDL_SwapLE32( _iptr[_l] );\ 81 } while( 0 ) 82 #else 83 #define BULK_CONV( _ptr, _num ) 84 #endif 69 85 70 86 /******************************************************************************** … … 80 96 /* this creates the data container via ressource manager */ 81 97 if (!modelFileName.empty()) 82 this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale); 98 this->data = (MD2Data*)ResourceManager::getInstance()->load( 99 modelFileName, MD2, RP_GAME, skinFileName, scale); 100 101 //When arriving here it is assumed that everything is in the correct byte order. 83 102 if( unlikely(this->data == NULL)) 84 103 PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n"); … … 99 118 this->pModelInfo.numNormals = 0; 100 119 this->pModelInfo.numTexCoor = this->data->numTexCoor; 120 101 121 this->pModelInfo.pVertices = (float*)this->data->pVertices; 122 102 123 this->pModelInfo.pNormals = NULL; 124 103 125 this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor; 104 126 105 127 // triangle conversion 106 128 this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles]; … … 357 379 void MD2Model::debug() 358 380 { 359 PRINT(0)("\n==========================| MD2Model::debug() |===\n");360 PRINT (0)("= Model FileName:\t%s\n", this->data->fileName.c_str());361 PRINT (0)("= Skin FileName:\t%s\n", this->data->skinFileName.c_str());362 PRINT (0)("= Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size363 PRINT (0)("= Number of Vertices:\t%i\n", this->data->header->numVertices);364 PRINT (0)("= Number of Frames: \t%i\n", this->data->header->numFrames);365 PRINT (0)("= Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);366 PRINT (0)("= Pointer to the data object: %p\n", this->data);367 PRINT(0)("===================================================\n\n");381 //PRINTF(0)("\n==========================| MD2Model::debug() |===\n"); 382 PRINTF(0)("= Model FileName:\t%s\n", this->data->fileName.c_str()); 383 PRINTF(0)("= Skin FileName:\t%s\n", this->data->skinFileName.c_str()); 384 PRINTF(0)("= Size in Memory:\t%i Bytes\n", this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size 385 PRINTF(0)("= Number of Vertices:\t%i\n", this->data->header->numVertices); 386 PRINTF(0)("= Number of Frames: \t%i\n", this->data->header->numFrames); 387 PRINTF(0)("= Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth); 388 PRINTF(0)("= Pointer to the data object: %p\n", this->data); 389 //PRINTF(0)("===================================================\n\n"); 368 390 } 369 391 … … 442 464 this->header = new MD2Header; 443 465 fread(this->header, 1, sizeof(MD2Header), pFile); 466 BULK_CONV( this->header, sizeof(MD2Header)/4 ); 444 467 /* check for the header version: make sure its a md2 file :) */ 445 if( unlikely( this->header->version != MD2_VERSION) && unlikely(this->header->ident != MD2_IDENT))468 if( unlikely( this->header->version != MD2_VERSION) && unlikely( this->header->ident != MD2_IDENT)) 446 469 { 447 470 PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str()); … … 449 472 } 450 473 451 this->fileName = fileName;474 this->fileName = fileName; 452 475 /* got the data: map it to locals */ 453 476 this->numFrames = this->header->numFrames; … … 468 491 fseek(pFile, this->header->offsetFrames, SEEK_SET); 469 492 fread(buffer, this->header->frameSize, this->numFrames, pFile); 493 BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 ); 470 494 /* read opengl commands */ 471 495 fseek(pFile, this->header->offsetGlCommands, SEEK_SET); 496 472 497 fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile); 498 BULK_CONV( this->pGLCommands, this->numGLCommands ); 473 499 /* triangle list */ 474 500 fseek(pFile, this->header->offsetTriangles, SEEK_SET); 475 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 501 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 502 BULK_CONV( this->pTriangles, this->numTriangles*(sizeof(sTriangle)/4) ); 503 476 504 /* read in texture coordinates */ 477 505 fseek(pFile, this->header->offsetTexCoords, SEEK_SET); 478 506 fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile); 479 507 BULK_CONV( this->pTexCoor, this->numTexCoor*(sizeof(sTexCoor)/4) ); 480 508 481 509 for(int i = 0; i < this->numFrames; ++i) -
branches/osx/src/lib/graphics/importer/texture.cc
r7751 r8122 207 207 surface->w, surface->h, 208 208 pixelDepth, 209 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */209 //#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 210 210 0x000000FF, 211 211 0x0000FF00, 212 212 0x00FF0000, 213 213 0xFF000000 214 #else 215 0xFF000000,214 /*#else*/ 215 /*0xFF000000, 216 216 0x00FF0000, 217 217 0x0000FF00, 218 0x000000FF 219 #endif 218 0x000000FF*/ 219 /*#endif*/ 220 220 ); 221 221 if ( retSurface == NULL ) -
branches/osx/src/lib/graphics/spatial_separation/quadtree.cc
r5430 r8122 25 25 26 26 using namespace std; 27 28 27 #define QUADTREE_MATERIAL_COUNT 4 29 28
Note: See TracChangeset
for help on using the changeset viewer.