- Timestamp:
- Jun 5, 2006, 5:27:38 PM (18 years ago)
- Location:
- branches/osx/src/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/osx/src/lib/graphics/importer/md2Model.cc
r8122 r8162 80 80 _iptr[_l] = SDL_SwapLE32( _iptr[_l] );\ 81 81 } while( 0 ) 82 #define BULK_CONV16( _ptr, _num ) do { \ 83 short _cnt = _num;\ 84 short* _iptr = (short*)_ptr;\ 85 for( int _l = 0; _l<_cnt; ++_l )\ 86 _iptr[_l] = SDL_SwapLE16( _iptr[_l] );\ 87 } while( 0 ) 82 88 #else 83 89 #define BULK_CONV( _ptr, _num ) 90 #define BULK_CONV16( _ptr, _num ) 84 91 #endif 85 92 … … 111 118 this->setAnim(STAND); 112 119 113 this->debug();120 //this->debug(); 114 121 115 122 //write the modelinfo information … … 381 388 //PRINTF(0)("\n==========================| MD2Model::debug() |===\n"); 382 389 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 390 PRINTF(0)("= Skin FileName:\t%s\n", 391 this->data->skinFileName.c_str()); 392 PRINTF(0)("= Size in Memory:\t%i Bytes\n", 393 this->data->header->frameSize * this->data->header->numFrames + 64); // 64bytes is the header size 385 394 PRINTF(0)("= Number of Vertices:\t%i\n", this->data->header->numVertices); 386 395 PRINTF(0)("= Number of Frames: \t%i\n", this->data->header->numFrames); … … 491 500 fseek(pFile, this->header->offsetFrames, SEEK_SET); 492 501 fread(buffer, this->header->frameSize, this->numFrames, pFile); 493 BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );502 //BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 ); 494 503 /* read opengl commands */ 495 504 fseek(pFile, this->header->offsetGlCommands, SEEK_SET); … … 500 509 fseek(pFile, this->header->offsetTriangles, SEEK_SET); 501 510 fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile); 502 BULK_CONV ( this->pTriangles, this->numTriangles*(sizeof(sTriangle)/4));511 BULK_CONV16( this->pTriangles, this->numTriangles*sizeof(sTriangle)/2 ); 503 512 504 513 /* read in texture coordinates */ 505 514 fseek(pFile, this->header->offsetTexCoords, SEEK_SET); 506 515 fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile); 507 BULK_CONV ( this->pTexCoor, this->numTexCoor*(sizeof(sTexCoor)/4));516 BULK_CONV16( this->pTexCoor, this->numTexCoor*sizeof(sTexCoor)/2 ); 508 517 509 518 for(int i = 0; i < this->numFrames; ++i) 510 519 { 511 520 frame = (sFrame*)(buffer + this->header->frameSize * i); 521 //Convert the translate and scale Vec3D if needed. 522 BULK_CONV( frame, 6 ); 523 BULK_CONV( frame->pVertices, 3 ); 512 524 pVertex = this->pVertices + this->numVertices * i; 513 525 pNormals = this->pLightNormals + this->numVertices * i; -
branches/osx/src/lib/graphics/importer/texture.cc
r8122 r8162 22 22 #include <math.h> 23 23 24 // INCLUDING SDL_Image 25 #ifdef HAVE_SDL_IMAGE_H 24 #ifdef HAVE_SDL_SDL_H 25 #include <SDL/SDL_image.h> 26 #include <SDL/SDL_endian.h> 27 #include <SDL/SDL_byteorder.h> 28 #else 29 #include <SDL_endian.h> 26 30 #include <SDL_image.h> 31 #include <SDL_byteorder.h> 32 #endif 33 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 34 /* 35 * On the BIG_ENDIAN architecture, the 24 and 32bit bitmaps have 36 * different masks. If you don't do this distinction properly, 37 * you will get weird-looking textures. 38 */ 39 Uint32 alphaMask[] = { 40 0xFF000000, 41 0x00FF0000, 42 0x0000FF00, 43 0x000000FF, 44 }; 45 46 Uint32 opaqueMask[] = { 47 0x00FF0000, 48 0x0000FF00, 49 0x000000FF, 50 0xFF000000 51 }; 27 52 #else 28 #include <SDL/SDL_image.h> 53 /* 54 * On the LIL_ENDIAN architecture everything is fine and easy. The 24 55 * and 32bit bitmaps have the same masks. 56 */ 57 Uint32 alphaMask[] = { 58 0x000000FF, 59 0x0000FF00, 60 0x00FF0000, 61 0xFF000000, 62 }; 63 64 Uint32 opaqueMask[] = alphaMask 65 29 66 #endif 30 31 67 /** 32 68 * @brief Constructor for a Texture … … 190 226 Uint32 saved_flags; 191 227 Uint8 saved_alpha; 192 193 228 hasAlpha = false; 194 229 int pixelDepth = 24; 195 230 231 Uint32* mask = opaqueMask; 232 196 233 /* Save the alpha blending attributes */ 197 234 saved_flags = surface->flags&(SDL_SRCALPHA | SDL_RLEACCELOK); 198 235 saved_alpha = surface->format->alpha; 199 if ( (saved_flags & SDL_SRCALPHA) ==SDL_SRCALPHA )236 if ( saved_flags & SDL_SRCALPHA ) 200 237 { 201 238 SDL_SetAlpha(surface, 0, 0); 202 239 hasAlpha = true; 203 240 pixelDepth = 32; 204 } 205 241 mask = alphaMask; 242 } 243 206 244 retSurface = SDL_CreateRGBSurface(SDL_HWSURFACE, 207 245 surface->w, surface->h, 208 246 pixelDepth, 209 //#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */ 210 0x000000FF, 211 0x0000FF00, 212 0x00FF0000, 213 0xFF000000 214 /*#else*/ 215 /*0xFF000000, 216 0x00FF0000, 217 0x0000FF00, 218 0x000000FF*/ 219 /*#endif*/ 220 ); 247 mask[0], mask[1], mask[2], mask[3] ); 221 248 if ( retSurface == NULL ) 222 249 return NULL; -
branches/osx/src/lib/math/vector.h
r7711 r8162 98 98 Vector getNormalized() const; 99 99 Vector abs(); 100 100 101 /** @param toVec nears this Vector to... @param t how much to advance (0.0: not at all; 1.0: fully) */ 101 102 inline void slerpTo(const Vector& toVec, float t) { *this + (toVec - *this) * t; }; -
branches/osx/src/lib/sound/sound_buffer.cc
r8122 r8162 73 73 return false; 74 74 } 75 #if defSDL_BIG_ENDIAN75 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 76 76 if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) ) { 77 77 int cnt = wavLength/2;
Note: See TracChangeset
for help on using the changeset viewer.