Changeset 8122 in orxonox.OLD for branches/osx/src
- Timestamp:
- Jun 2, 2006, 5:46:11 PM (19 years ago)
- Location:
- branches/osx/src
- Files:
-
- 9 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 -
branches/osx/src/lib/shell/shell_buffer.cc
r7762 r8122 66 66 va_list arguments; 67 67 va_start(arguments, line); 68 69 68 69 static OrxThread::Mutex ShellBuffer__bufferMutex; 70 70 71 71 OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex); -
branches/osx/src/lib/sound/ogg_player.cc
r7737 r8122 31 31 32 32 #include "debug.h" 33 34 #ifdef HAVE_SDL_SDL_H 35 36 #include <SDL/SDL.h> 37 #include <SDL/SDL_endian.h> 38 39 #else 40 41 #include <SDL.h> 42 #include <SDL_endian.h> 43 44 #endif 33 45 34 46 namespace OrxSound … … 151 163 bool OggPlayer::play() 152 164 { 153 if (!(this->state & OggPlayer::FileOpened))165 /*if (!(this->state & OggPlayer::FileOpened)) 154 166 return false; 155 167 … … 161 173 if (this->musicThreadID == NULL) 162 174 return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL); 163 return true; 175 return true;*/ 164 176 } 165 177 … … 374 386 if(size == 0) 375 387 return false; 376 388 /*#ifdef SDL_BIG_ENDIAN 389 int cnt = wavLength/2; 390 Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer; 391 for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts ) 392 *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts ); 393 #endif*/ 377 394 alBufferData(buffer, format, pcm, size, vorbisInfo->rate); 378 395 if (DEBUG_LEVEL >= 3) -
branches/osx/src/lib/sound/sound_buffer.cc
r7460 r8122 22 22 #include "sdlincl.h" 23 23 #include <cassert> 24 24 #ifdef HAVE_SDL_SDL_H 25 #include <SDL/SDL.h> 26 #include <SDL/SDL_endian.h> 27 #else 28 #include <SDL.h> 29 #include <SDL_endian.h> 30 #endif 25 31 namespace OrxSound 26 32 { … … 67 73 return false; 68 74 } 69 70 alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), wavBuffer, wavLength, wavSpec.freq); 75 #ifdef SDL_BIG_ENDIAN 76 if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) ) { 77 int cnt = wavLength/2; 78 Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer; 79 for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts ) 80 *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts ); 81 } 82 #endif 83 alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), 84 wavBuffer, wavLength, wavSpec.freq); 85 71 86 SDL_FreeWAV(wavBuffer); 72 87 if (SoundEngine::checkError("Could not load Wave file", __LINE__)) -
branches/osx/src/lib/sound/sound_source.cc
r7729 r8122 153 153 if (DEBUG_LEVEL >= 3) 154 154 SoundEngine::checkError("Play Source", __LINE__); 155 155 156 } 156 157 -
branches/osx/src/util/signal_handler.cc
r7791 r8122 46 46 void SignalHandler::catchSignal( int sig ) 47 47 { 48 sig handler_t handler = signal( sig, SignalHandler::sigHandler );48 sig_t handler = signal( sig, SignalHandler::sigHandler ); 49 49 50 50 assert( handler != SIG_ERR ); … … 59 59 void SignalHandler::sigHandler( int sig ) 60 60 { 61 61 62 std::string sigName = "UNKNOWN"; 62 63 63 64 switch ( sig ) 64 65 { … … 83 84 if ( pid == 0 ) 84 85 { 85 getInstance()->dontCatch(); 86 86 getInstance()->dontCatch(); 87 87 sleep(2); 88 89 88 90 89 return; -
branches/osx/src/util/signal_handler.h
r7791 r8122 11 11 12 12 13 13 #define GDB_BT_FILE "orxonox.backtrace" 14 14 enum GdbRunType{ 15 15 GDB_RUN_WRITE_TO_FILE = 1, … … 24 24 { 25 25 int signal; 26 sig handler_t handler;26 sig_t handler; 27 27 }; 28 28
Note: See TracChangeset
for help on using the changeset viewer.