Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8293 in orxonox.OLD


Ignore:
Timestamp:
Jun 8, 2006, 11:11:37 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the osX-branche back here
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/osx . -r7763:HEAD

conflicts resolved, and everything is working as expected (or at least i hope so :) )

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/acinclude.m4

    r8061 r8293  
    146146    for _lib_directory in ${QT_COMMON_LIB_DIRECTORIES}
    147147    do
    148       if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore4.a ; then
     148      if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore4.a || \
     149                        test -e ${_lib_directory}/QtCore.framework ; then
    149150        QT_LIB_DIRECTORY=${_lib_directory}
    150151        break
    151       fi
     152          fi
    152153    done
    153154    if test -n ${QT_LIB_DIRECTORY} ; then
     
    205206    fi
    206207
    207     echo "QT_LIBS = ${QT_LIBS}"
    208     echo "QT_CXXFLAGS = ${QT_CXXFLAGS}"
    209     echo "QT_LD_FLAGS = ${QT_LDFLAGS}"
     208    echo "QT_LIBS          = ${QT_LIBS}"
     209    echo "QT_CXXFLAGS      = ${QT_CXXFLAGS}"
     210    echo "QT_LD_FLAGS      = ${QT_LDFLAGS}"
    210211    echo "QT_BIN_DIRECTORY = ${QT_BIN_DIRECTORY}"
    211212
  • trunk/config.h.in

    r8061 r8293  
    2727/* Define to 1 if you have the `m' library (-lm). */
    2828#undef HAVE_LIBM
     29
     30/* Define to 1 if you have the `OpenGL' library (-lOpenGL). */
     31#undef HAVE_LIBOPENGL
    2932
    3033/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
  • trunk/configure.ac

    r8147 r8293  
    436436 *darwin*)
    437437 echo "OS X detected"
    438 
    439438 osX="yes"
    440439
    441  CPPFLAGS="-I/sw/include -I/sw/include ${CPPFLAGS}"
    442  LDFLAGS="$LDFLAGS -L/sw/lib"
     440 QT_PREFIX="$prefix"
     441 CPPFLAGS="-I/$prefix/include $CPPFLAGS -F$prefix/lib -I/opt/local"
     442 LDFLAGS="$LDFLAGS -L$prefix/lib -F$prefix/lib -L/opt/local"
     443 PCK_CONFIG_PATH='/opt/local'
     444
    443445# checking gl header
    444446   AC_CHECK_HEADERS([OpenGL/gl.h] ,,
    445447      [AC_MSG_ERROR([cannot find opengl headers]) ])
    446 # cheking for GLU-header
     448# checking for GLU-header
    447449    AC_CHECK_HEADERS([OpenGL/glu.h] ,,
    448450      [AC_MSG_ERROR([cannot find opengl headers]) ])
    449 
     451        AC_CHECK_LIB( OpenGL, main, , )
    450452   LIBS="$LIBS -framework OpenGL"
    451453
     
    465467   fi
    466468
    467 
     469 LIBS="$LIBS"
    468470   AC_CHECK_HEADERS([OpenAL/al.h] ,,
    469471      [AC_MSG_ERROR([cannot find opengl headers]) ])
     
    475477       SDL_CFLAGS=`sdl-config --cflags`
    476478       SDL_LIBS=`sdl-config --libs`
    477        CXXFL\AGS="$CXXFLAGS $SDL_CFLAGS"
     479       CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
    478480       LIBS="$LIBS $SDL_LIBS"
    479481   AC_CHECK_HEADERS([SDL/SDL.h] ,,
     
    557559# QT #
    558560#----#
    559 AX_CHECK_QT([${QT_PREFIX}], [QtCore QtCore4],, [http://www.trolltech.com])
    560 if test x$have_qt = xno ; then
    561     WITH_QT=no
     561if test x$osX = xyes ; then
     562        PKG_CONFIG_PATH="$prefix"
     563        PKG_CHECK_MODULES( QT, QtOpenGL >= 4.01 QtCore >= 4.01 QtGui >= 4.0.1 )
     564        QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir QtOpenGL QtCore QtGui`
     565#----------#
     566            AC_PATH_PROG([QT_MOC], [moc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
     567              if test x${QT_MOC} = xno ; then
     568                AC_MSG_ERROR([QT MOC not found])
     569              fi
     570        AC_SUBST([QT_MOC])
     571
     572        AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
     573        AC_SUBST([QT_UIC])
     574
     575        AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
     576
     577        AC_SUBST([QT_RCC])     
     578        AC_SUBST( QT_INCLUDE_DIR )
     579        AC_SUBST( QT_CFLAGS )
     580        AC_SUBST( QT_LDFLAGS )
     581        AC_SUBST( QT_LIBS )
     582        echo "QT_LIBS                   = $QT_LIBS"
     583        echo "QT_CFLAGS                 = $QT_CFLAGS"
     584        echo "QT_INCLUDE_DIR    = $QT_INCLUDE_DIR"             
     585else
     586        AX_CHECK_QT([${QT_PREFIX}], [QtCore QtCore4],, [http://www.trolltech.com])
     587        if test x$have_qt = xno ; then
     588                WITH_QT=no
     589        fi
    562590fi
    563591
  • trunk/src/lib/graphics/Makefile.am

    r7810 r8293  
    5656
    5757
    58 SUBDIRS = importer \
    59           spatial_separation
    60 
     58SUBDIRS =       importer \
     59                spatial_separation
    6160EXTRA_DIST =
  • trunk/src/lib/graphics/importer/md2Model.cc

    r7732 r8293  
    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#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 )
     88#else
     89#define BULK_CONV( _ptr, _num )
     90#define BULK_CONV16( _ptr, _num )
     91#endif 
    6992
    7093/********************************************************************************
     
    80103  /* this creates the data container via ressource manager */
    81104  if (!modelFileName.empty())
    82     this->data = (MD2Data*)ResourceManager::getInstance()->load(modelFileName, MD2, RP_GAME, skinFileName, scale);
     105    this->data = (MD2Data*)ResourceManager::getInstance()->load(
     106                        modelFileName, MD2, RP_GAME, skinFileName, scale);
     107                       
     108        //When arriving here it is assumed that everything is in the correct byte order.       
    83109  if( unlikely(this->data == NULL))
    84110    PRINTF(0)("The model was not found, MD2Model Loader finished abnormaly. Update the data-repos\n");
     
    92118  this->setAnim(STAND);
    93119
    94   this->debug();
     120  //this->debug();
    95121
    96122    //write the modelinfo information
     
    99125  this->pModelInfo.numNormals = 0;
    100126  this->pModelInfo.numTexCoor = this->data->numTexCoor;
     127       
    101128  this->pModelInfo.pVertices = (float*)this->data->pVertices;
     129               
    102130  this->pModelInfo.pNormals = NULL;
     131
    103132  this->pModelInfo.pTexCoor = (float*)this->data->pTexCoor;
    104 
     133       
    105134  // triangle conversion
    106135  this->pModelInfo.pTriangles = new sTriangleExt[this->data->numTriangles];
     
    357386void MD2Model::debug()
    358387{
    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");
     388  //PRINTF(0)("\n==========================| MD2Model::debug() |===\n");
     389  PRINTF(0)("=  Model FileName:\t%s\n", this->data->fileName.c_str());
     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
     394  PRINTF(0)("=  Number of Vertices:\t%i\n", this->data->header->numVertices);
     395  PRINTF(0)("=  Number of Frames: \t%i\n", this->data->header->numFrames);
     396  PRINTF(0)("=  Height, Width:\t%i, %i\n", this->data->header->skinHeight, this->data->header->skinWidth);
     397  PRINTF(0)("=  Pointer to the data object: %p\n", this->data);
     398  //PRINTF(0)("===================================================\n\n");
    368399}
    369400
     
    442473  this->header = new MD2Header;
    443474  fread(this->header, 1, sizeof(MD2Header), pFile);
     475        BULK_CONV( this->header, sizeof(MD2Header)/4 );
    444476  /* 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))
     477  if( unlikely( this->header->version != MD2_VERSION) && unlikely( this->header->ident != MD2_IDENT))
    446478    {
    447479      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
     
    449481    }
    450482
    451   this->fileName =fileName;
     483  this->fileName = fileName;
    452484  /* got the data: map it to locals */
    453485  this->numFrames = this->header->numFrames;
     
    468500  fseek(pFile, this->header->offsetFrames, SEEK_SET);
    469501  fread(buffer, this->header->frameSize, this->numFrames, pFile);
     502        //BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );
    470503  /* read opengl commands */
    471504  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
     505
    472506  fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
     507        BULK_CONV( this->pGLCommands, this->numGLCommands );
    473508  /* triangle list */
    474509  fseek(pFile, this->header->offsetTriangles, SEEK_SET);
    475   fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);
     510  fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);       
     511        BULK_CONV16( this->pTriangles, this->numTriangles*sizeof(sTriangle)/2 );
     512
    476513  /*  read in texture coordinates */
    477514  fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
    478515  fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile);
    479 
     516        BULK_CONV16( this->pTexCoor, this->numTexCoor*sizeof(sTexCoor)/2 );
    480517
    481518  for(int i = 0; i < this->numFrames; ++i)
    482519    {
    483520      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 );
    484524      pVertex = this->pVertices + this->numVertices  * i;
    485525      pNormals = this->pLightNormals + this->numVertices * i;
  • trunk/src/lib/graphics/importer/texture.cc

    r8145 r8293  
    2121#include "compiler.h"
    2222
    23 // INCLUDING SDL_Image
    24 #ifdef HAVE_SDL_IMAGE_H
     23#ifdef HAVE_SDL_SDL_H
     24#include <SDL/SDL_image.h>
     25#include <SDL/SDL_endian.h>
     26#include <SDL/SDL_byteorder.h>
     27#else
     28#include <SDL_endian.h>
    2529#include <SDL_image.h>
     30#include <SDL_byteorder.h>
     31#endif
     32#if SDL_BYTEORDER == SDL_BIG_ENDIAN
     33/*
     34 * On the BIG_ENDIAN architecture, the 24 and 32bit bitmaps have
     35 * different masks. If you don't do this distinction properly,
     36 * you will get weird-looking textures.
     37 */
     38Uint32 alphaMask[] = {
     39        0xFF000000,
     40        0x00FF0000,
     41        0x0000FF00,
     42        0x000000FF,
     43};
     44
     45Uint32 opaqueMask[] = {
     46        0x00FF0000,
     47        0x0000FF00,
     48        0x000000FF,
     49        0xFF000000
     50};
    2651#else
    27 #include <SDL/SDL_image.h>
     52/*
     53 * On the LIL_ENDIAN architecture everything is fine and easy. The 24
     54 * and 32bit bitmaps have the same masks.
     55 */
     56Uint32 alphaMask[] = {
     57        0x000000FF,
     58        0x0000FF00,
     59        0x00FF0000,
     60        0xFF000000,
     61};
     62
     63Uint32 *opaqueMask = alphaMask;
     64
    2865#endif
    29 
    3066
    3167TextureData::TextureData()
     
    251287  Uint32 saved_flags;
    252288  Uint8  saved_alpha;
    253 
    254289  hasAlpha = false;
    255290  int pixelDepth = 24;
    256291
     292        Uint32* mask = opaqueMask;
     293       
    257294  /* Save the alpha blending attributes */
    258295  saved_flags = surface->flags&(SDL_SRCALPHA | SDL_RLEACCELOK);
    259296  saved_alpha = surface->format->alpha;
    260   if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA )
     297  if ( saved_flags & SDL_SRCALPHA )
    261298  {
    262299    SDL_SetAlpha(surface, 0, 0);
    263300    hasAlpha = true;
    264301    pixelDepth = 32;
    265   }
    266 
     302                mask = alphaMask;
     303  }
     304               
    267305  retSurface = SDL_CreateRGBSurface(SDL_HWSURFACE,
    268306                                    surface->w, surface->h,
    269307                                    pixelDepth,
    270 #if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
    271                                     0x000000FF,
    272                                     0x0000FF00,
    273                                     0x00FF0000,
    274                                     0xFF000000
    275 #else
    276                                     0xFF000000,
    277                                     0x00FF0000,
    278                                     0x0000FF00,
    279                                     0x000000FF
    280 #endif
    281                                    );
     308                                                                                                                                                mask[0], mask[1], mask[2], mask[3] );
    282309  if ( retSurface == NULL )
    283310    return NULL;
  • trunk/src/lib/graphics/spatial_separation/quadtree.cc

    r5430 r8293  
    2525
    2626using namespace std;
    27 
    2827#define QUADTREE_MATERIAL_COUNT       4
    2928
  • trunk/src/lib/math/vector.h

    r8145 r8293  
    9393  Vector getNormalized() const;
    9494  Vector abs();
     95
    9596  /** @param toVec nears this Vector to... @param t how much to advance (0.0: not at all; 1.0: fully) */
    9697  inline void slerpTo(const Vector& toVec, float t) { *this + (toVec - *this) * t; };
  • trunk/src/lib/sound/ogg_player.cc

    r7849 r8293  
    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
     
    385397    if(size == 0)
    386398      return false;
    387 
     399/*#ifdef SDL_BIG_ENDIAN
     400                        int cnt = wavLength/2;
     401                        Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
     402                        for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
     403                                *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
     404#endif*/
    388405    alBufferData(buffer, format, pcm, size, vorbisInfo->rate);
    389406    if (DEBUG_LEVEL >= 3)
  • trunk/src/lib/sound/sound_buffer.cc

    r7460 r8293  
    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#if SDL_BYTEORDER == 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__))
  • trunk/src/lib/util/file.cc

    r8276 r8293  
    2323#include <fstream>
    2424
    25 #ifdef __unix__
     25#ifdef __unix__ 
    2626#include <unistd.h>
    2727#elif __WIN32__ || _MS_DOS_
    2828#include <dir.h>
    2929#else
    30 #include <direct.h>
     30//#include <direct.h>
    3131#endif
    3232
  • trunk/src/util/signal_handler.cc

    r8228 r8293  
    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 );
     
    6363    (*(it->cb))( it->someData );
    6464  }
     65
     66  std::string sigName = "UNKNOWN";
    6567 
    66   std::string sigName = "UNKNOWN";
    67 
    6868  switch ( sig )
    6969  {
     
    9090  {
    9191    getInstance()->dontCatch();
    92    
    9392    sleep(2);
    9493
  • trunk/src/util/signal_handler.h

    r8228 r8293  
    1010#include <string>
    1111
     12
    1213#define GDB_BT_FILE "orxonox.backtrace"
    13 
    1414enum GdbRunType{
    1515  GDB_RUN_WRITE_TO_FILE = 1,
     
    2525{
    2626  int signal;
    27   sighandler_t handler;
     27  sig_t handler;
    2828};
    2929
Note: See TracChangeset for help on using the changeset viewer.