Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8122 in orxonox.OLD for branches/osx


Ignore:
Timestamp:
Jun 2, 2006, 5:46:11 PM (19 years ago)
Author:
ponder
Message:

Md2loader seems to work

Location:
branches/osx
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/osx/config.h.in

    r7753 r8122  
    3636/* Define to 1 if you have the `m' library (-lm). */
    3737#undef HAVE_LIBM
     38
     39/* Define to 1 if you have the `OpenGL' library (-lOpenGL). */
     40#undef HAVE_LIBOPENGL
    3841
    3942/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
  • branches/osx/configure.ac

    r7791 r8122  
    434434 osX="yes"
    435435 QT_PREFIX="$prefix"
    436  CPPFLAGS="-I/$prefix/include $CPPFLAGS -F$prefix/lib"
    437  LDFLAGS="$LDFLAGS -L$prefix/lib -F$prefix/lib"
     436 CPPFLAGS="-I/$prefix/include $CPPFLAGS -F$prefix/lib -I/opt/local"
     437 LDFLAGS="$LDFLAGS -L$prefix/lib -F$prefix/lib -L/opt/local"
    438438 PCK_CONFIG_PATH='/opt/local'
    439439# checking gl header
     
    443443    AC_CHECK_HEADERS([OpenGL/glu.h] ,,
    444444      [AC_MSG_ERROR([cannot find opengl headers]) ])
    445 
     445        AC_CHECK_LIB( OpenGL, main, , )
    446446   LIBS="$LIBS -framework OpenGL"
    447447
     
    565565# QT #
    566566#----#
    567 if test `uname` = "Darwin" ; then
     567if test x$osX = xyes ; then
    568568        PKG_CONFIG_PATH="$prefix"
    569569        PKG_CHECK_MODULES( QT, QtOpenGL >= 4.01 QtCore >= 4.01 QtGui >= 4.0.1 )
  • branches/osx/src/lib/graphics/importer/md2Model.cc

    r7732 r8122  
    1414
    1515#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
    1724#include "md2Model.h"
    1825#include "material.h"
     
    2027#include "debug.h"
    2128#include "util/loading/resource_manager.h"
    22 
    2329
    2430using namespace std;
     
    6773
    6874
     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 
    6985
    7086/********************************************************************************
     
    8096  /* this creates the data container via ressource manager */
    8197  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.       
    83102  if( unlikely(this->data == NULL))
    84103    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
     
    99118  this->pModelInfo.numNormals = 0;
    100119  this->pModelInfo.numTexCoor = this->data->numTexCoor;
     120       
    101121  this->pModelInfo.pVertices = (float*)this->data->pVertices;
     122               
    102123  this->pModelInfo.pNormals = NULL;
     124
    103125  this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor;
    104 
     126       
    105127  // triangle conversion
    106128  this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
     
    357379void MD2Model::debug()
    358380{
    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 size
    363   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");
    368390}
    369391
     
    442464  this->header = new MD2Header;
    443465  fread(this->header, 1, sizeof(MD2Header), pFile);
     466        BULK_CONV( this->header, sizeof(MD2Header)/4 );
    444467  /* 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))
    446469    {
    447470      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
     
    449472    }
    450473
    451   this->fileName =fileName;
     474  this->fileName = fileName;
    452475  /* got the data: map it to locals */
    453476  this->numFrames = this->header->numFrames;
     
    468491  fseek(pFile, this->header->offsetFrames, SEEK_SET);
    469492  fread(buffer, this->header->frameSize, this->numFrames, pFile);
     493        BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );
    470494  /* read opengl commands */
    471495  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
     496
    472497  fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
     498        BULK_CONV( this->pGLCommands, this->numGLCommands );
    473499  /* triangle list */
    474500  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
    476504  /*  read in texture coordinates */
    477505  fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
    478506  fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile);
    479 
     507        BULK_CONV( this->pTexCoor, this->numTexCoor*(sizeof(sTexCoor)/4) );
    480508
    481509  for(int i = 0; i < this->numFrames; ++i)
  • branches/osx/src/lib/graphics/importer/texture.cc

    r7751 r8122  
    207207                                    surface->w, surface->h,
    208208                                    pixelDepth,
    209 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
     209//#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
    210210                                    0x000000FF,
    211211                                    0x0000FF00,
    212212                                    0x00FF0000,
    213213                                    0xFF000000
    214 #else
    215                                     0xFF000000,
     214/*#else*/
     215                                    /*0xFF000000,
    216216                                    0x00FF0000,
    217217                                    0x0000FF00,
    218                                     0x000000FF
    219 #endif
     218                                    0x000000FF*/
     219/*#endif*/
    220220                                   );
    221221  if ( retSurface == NULL )
  • branches/osx/src/lib/graphics/spatial_separation/quadtree.cc

    r5430 r8122  
    2525
    2626using namespace std;
    27 
    2827#define QUADTREE_MATERIAL_COUNT       4
    2928
  • branches/osx/src/lib/shell/shell_buffer.cc

    r7762 r8122  
    6666    va_list arguments;
    6767    va_start(arguments, line);
    68 
    69     static OrxThread::Mutex ShellBuffer__bufferMutex;
     68   
     69                static OrxThread::Mutex ShellBuffer__bufferMutex;
    7070
    7171    OrxThread::MutexLock bufferLock(&ShellBuffer__bufferMutex);
  • branches/osx/src/lib/sound/ogg_player.cc

    r7737 r8122  
    3131
    3232#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
    3345
    3446namespace OrxSound
     
    151163  bool OggPlayer::play()
    152164  {
    153     if (!(this->state & OggPlayer::FileOpened))
     165    /*if (!(this->state & OggPlayer::FileOpened))
    154166      return false;
    155167
     
    161173    if (this->musicThreadID == NULL)
    162174      return ((this->musicThreadID = SDL_CreateThread(OggPlayer::musicThread, (void*)this)) != NULL);
    163     return true;
     175    return true;*/
    164176  }
    165177
     
    374386    if(size == 0)
    375387      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*/
    377394    alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
    378395    if (DEBUG_LEVEL >= 3)
  • branches/osx/src/lib/sound/sound_buffer.cc

    r7460 r8122  
    2222#include "sdlincl.h"
    2323#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
    2531namespace OrxSound
    2632{
     
    6773      return false;
    6874    }
    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                       
    7186    SDL_FreeWAV(wavBuffer);
    7287    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
  • branches/osx/src/lib/sound/sound_source.cc

    r7729 r8122  
    153153    if (DEBUG_LEVEL >= 3)
    154154      SoundEngine::checkError("Play Source", __LINE__);
     155               
    155156  }
    156157
  • branches/osx/src/util/signal_handler.cc

    r7791 r8122  
    4646void SignalHandler::catchSignal( int sig )
    4747{
    48   sighandler_t handler = signal( sig, SignalHandler::sigHandler );
     48  sig_t handler = signal( sig, SignalHandler::sigHandler );
    4949
    5050  assert( handler != SIG_ERR );
     
    5959void SignalHandler::sigHandler( int sig )
    6060{
     61
    6162  std::string sigName = "UNKNOWN";
    62 
     63 
    6364  switch ( sig )
    6465  {
     
    8384  if ( pid == 0 )
    8485  {
    85     getInstance()->dontCatch();
    86 
     86        getInstance()->dontCatch();     
    8787    sleep(2);
    88 
    8988
    9089    return;
  • branches/osx/src/util/signal_handler.h

    r7791 r8122  
    1111
    1212
    13 
     13#define GDB_BT_FILE "orxonox.backtrace"
    1414enum GdbRunType{
    1515  GDB_RUN_WRITE_TO_FILE = 1,
     
    2424{
    2525  int signal;
    26   sighandler_t handler;
     26  sig_t handler;
    2727};
    2828
Note: See TracChangeset for help on using the changeset viewer.