Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8715 in orxonox.OLD for branches/terrain


Ignore:
Timestamp:
Jun 22, 2006, 1:51:50 PM (18 years ago)
Author:
ponder
Message:
  • Added special checks for macosx to acinclude.m4 and configure.ac. This sucks
  • Reapplied the endianness checks to the md2_model file. They got lost during the merge operation.
  • Tried to do the collision detection for the ground. But somehow it doesn't work. Perhaps an offset will do.
Location:
branches/terrain
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/terrain/acinclude.m4

    r8523 r8715  
    105105      `ls -dr /usr/local/qt*/include   2>/dev/null`
    106106      `ls -dr /opt/qt*/include         2>/dev/null`
     107      `ls -dr /opt/local/include       2>/dev/null`
    107108      `ls -dr /Developer/qt*/include   2>/dev/null`
    108109      `ls -dr /c/Qt/*/include          2>/dev/null`
     
    115116      `ls -dr /usr/local/qt*/lib       2>/dev/null`
    116117      `ls -dr /opt/qt*/lib             2>/dev/null`
     118      `ls -dr /opt/local/lib               2>/dev/null`
    117119      `ls -dr /Developer/qt*/lib       2>/dev/null`
    118120      `ls -dr /c/Qt/*/lib              2>/dev/null`
     
    125127      `ls -dr /usr/local/qt*/bin       2>/dev/null`
    126128      `ls -dr /opt/qt*/bin             2>/dev/null`
     129      `ls -dr /opt/local/bin                  2>/dev/null`
    127130      `ls -dr /Developer/qt*/bin       2>/dev/null`
    128131      `ls -dr /c/Qt/*/bin              2>/dev/null`
     
    175178    QT_LIBS=""
    176179    QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}"
    177     LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
    178 
     180         if test x$osX = xyes ; then
     181                LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY}"
     182         else
     183        LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
     184         fi
    179185    CACHED_CPPFLAG=${CPPFLAGS}
    180186    CACHED_LDFLAGS=${LDFLAGS}
     
    190196    done
    191197
    192     if [test "x$_lib_check" = "xyes"] ; then
    193          QT_LIBS="${QT_LIBS} -l$_found_lib"
    194          AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
    195          AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
    196          AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
    197 
    198          $3
     198    if [test "x$_lib_check" = "xyes" || test "x$osX" = "xyes"] ; then
     199                        if [test x$osX = xyes] ; then
     200# kraus: Need to add a check here. For the moment this just works fine...
     201                                QT_LIBS="${QT_LIBS} -framework QtCore -framework QtGui -framework QtOpenGL"
     202                                QT_LD_FLAGS="${QT_LD_FLAGS} -L${QT_LIB_DIRECTORY}"
     203                        else
     204                QT_LIBS="${QT_LIBS} -l$_found_lib"
     205                AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
     206                AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
     207                AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
     208
     209                $3
     210                        fi
    199211    else
    200212         echo "------------------"
     
    205217         exit -1
    206218    fi
    207 
     219         echo "configuration for qt: "
    208220    echo "QT_LIBS          = ${QT_LIBS}"
    209221    echo "QT_CXXFLAGS      = ${QT_CXXFLAGS}"
     
    251263dnl Check for Lua.
    252264
    253 LUA_INCLUDE_DIRECTORY="/usr/include"
     265LUA_INCLUDE_DIRECTORY="/$prefix/include"
    254266LUA_COMMON_INCLUDE_DIRECTORIES="
    255267      `ls -dr $1                       2>/dev/null`
     
    259271      `ls -dr /usr/local/include/lua   2>/dev/null`
    260272      `ls -dr /opt/lua*/include        2>/dev/null`
     273      `ls -dr /opt/local/include       2>/dev/null`
    261274      `ls -dr /Developer/lua*/include  2>/dev/null`
    262275    "
     
    276289    fi
    277290
    278 
     291if [ test x$osX = xyes ] ; then
     292        LUA_COMMON_LIB_DIRECTORIES="
     293        `ls -dr $1                    2>/dev/null`
     294      /usr/lib
     295      `ls -dr /usr/lib/lua*        2>/dev/null`
     296      `ls -dr /usr/local/lib/lua   2>/dev/null`
     297      `ls -dr /opt/lua*/lib        2>/dev/null`
     298      `ls -dr /opt/local/lib       2>/dev/null`
     299      `ls -dr /Developer/lua*/lib  2>/dev/null`
     300         "
     301  for _lua_lib_directory in ${LUA_COMMON_LIB_DIRECTORIES}
     302    do
     303      if test -e ${_lua_lib_directory}/liblua.a  || test -e ${_lua_lib_directory}/liblua.dylib ; then
     304        LUA_LIB_DIRECTORY=${_lua_lib_directory}
     305        LDFLAGS="${LDFLAGS} -L${LUA_LIB_DIRECTORY} -llua"
     306        break
     307      fi
     308  done 
     309else
    279310AC_CHECK_LIB([dl], [dlopen])
    280311AX_CHECK_REQUIRED_HEADER_LIB([lua.h], [lua lua50], [lua_open],,,)
     
    288319#       [AX_GET_INSTALL_NECESSARY_LIB([http://www.lua.org/ftp], [lua-5.0.tar.gz], [lua-5.0], [extern_libs/], [include/*.h lib/*.a])
    289320#       LUA_LIBS="-llualib -llua"  LUA_INCLUDES="-I$(top_build_dir)/extern_libs" ], [http://www.lua.org])
    290 
     321fi
    291322AC_SUBST([LUA_LIBS])
    292323AC_SUBST([LUA_INCLUDES])
  • branches/terrain/configure.ac

    r8523 r8715  
    564564#       QT_INCLUDE_DIR=`$PKG_CONFIG --variable=includedir QtOpenGL QtCore QtGui`
    565565#----------#
    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"
    585 else
     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"
     585#else
    586586        AX_CHECK_QT([${QT_PREFIX}], [QtCore QtCore4],, [http://www.trolltech.com])
    587587        if test x$have_qt = xno ; then
     
    622622# FIXME: Replace `main' with a function in `-lm':
    623623 AC_CHECK_LIB([m], [main])
    624  AX_CHECK_REQUIRED_HEADER_LIB([zlib.h], [z], [zlibVersion],,, [http://www.zlib.net])
    625 
     624if test x$osX = xyes ; then
     625        AC_CHECK_LIB( [z], [main], [LIBS="$LIBS -lz"] )
     626else
     627        AX_CHECK_REQUIRED_HEADER_LIB([zlib.h], [z], [zlibVersion],,, [http://www.zlib.net])
     628fi
    626629# Checks for header files.
    627630AC_HEADER_STDC
     
    632635
    633636# Checks for library functions.
    634 AC_FUNC_MALLOC
    635 AC_CHECK_FUNCS([bzero sqrt])
    636 
     637if test x$osX != xyes ; then
     638        AC_FUNC_MALLOC
     639        AC_CHECK_FUNCS([bzero sqrt])
     640fi
    637641######################
    638642## OUTPUT CONFIGURE ##
  • branches/terrain/src/lib/collision_detection/cd_engine.cc

    r8490 r8715  
    2424#include "model.h"
    2525#include "world_entity.h"
    26 #include "terrain.h"
     26#include "terrain_entity.h"
    2727// #include "player.h"
    2828
     
    104104  std::list<WorldEntity*>::iterator entityIterator;
    105105  const std::list<BaseObject*>* bspList = ClassList::getList(CL_BSP_ENTITY);
    106   if( bspList == NULL)
    107     return;
     106  if( bspList != NULL) {
    108107
    109   // for all bsp managers check all entities
    110   for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
    111       for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
    112       {
    113 //         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
    114         (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
     108        // for all bsp managers check all entities
     109        for( bspIterator = bspList->begin(); bspIterator != bspList->end(); bspIterator++) {
     110        for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
     111        {
     112//               PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassName());
     113                (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
     114        }
     115        }
     116        }
     117        const std::list<BaseObject*>* tl = ClassList::getList( CL_TERRAIN );
     118  std::list<BaseObject*>::const_iterator ti;   
     119        if ( tl == NULL )
     120                return;
     121        for ( ti = tl->begin(); ti != tl->end(); ++ti ) {
     122                        TerrainEntity* terrain = dynamic_cast<TerrainEntity*>( *ti );
     123      for( entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++ )
     124                {
     125                                const Vector& pos = (*entityIterator)->getAbsCoor();
     126                               
     127                                float height = terrain->getHeight( pos.x, pos.z );
     128                                printf( "pos.y-height: %f\n", pos.y-height );
     129                                if ( height > pos.y ) {
     130                                        (*entityIterator)->setAbsCoor( pos.x, height, pos.z );
     131                                }
    115132      }
    116   }
     133        }
    117134}
    118135
  • branches/terrain/src/lib/graphics/effects/volfog_effect.cc

    r8523 r8715  
    3030//#include <GL/glext.h> //OpenGL Extensions
    3131//#include <GL/glxext.h> // GLX Extensions
    32 
     32#ifndef __APPLE__
    3333#ifndef GL_EXT_fog_coord
    3434#define GL_EXT_fog_coord 1
     
    4545PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = 0;
    4646PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = 0;
    47 
     47#endif
    4848
    4949using namespace std;
  • branches/terrain/src/lib/graphics/graphics_engine.cc

    r8697 r8715  
    298298  }
    299299
    300   glEnable(GL_CULL_FACE);
    301   glCullFace(GL_FRONT);
     300
    302301}
    303302
  • branches/terrain/src/lib/graphics/importer/Makefile.am

    r8697 r8715  
    3838                           md3/md3_data.cc \
    3939                           md3/md3_tag.cc \
    40                            \ 
     40                           \
    4141                           terrain/terrain.cc \
    4242                           terrain/terrain_quad.cc \
  • branches/terrain/src/lib/graphics/importer/md2/md2Model.cc

    r8490 r8715  
    1717#include "md2Model.h"
    1818#include "material.h"
    19 
     19#include "config.h"
     20#ifdef HAVE_SDL_SDL_H
     21#include <SDL/SDL.h>
     22#include <SDL/SDL_endian.h>
     23#else
     24#include <SDL.h>
     25#include <SDL_endian.h>
     26#endif
    2027#include "debug.h"
    2128#include "util/loading/resource_manager.h"
     
    6673  };
    6774
    68 
     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/********************************************************************************
     
    442465  this->header = new MD2Header;
    443466  fread(this->header, 1, sizeof(MD2Header), pFile);
     467        BULK_CONV( this->header, sizeof(MD2Header)/4 );
    444468  /* 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))
     469  if( unlikely( this->header->version != MD2_VERSION) && unlikely( this->header->ident != MD2_IDENT))
    446470    {
    447471      PRINTF(1)("Couldn't load file %s: invalid file format: stop loading\n", fileName.c_str());
     
    449473    }
    450474
    451   this->fileName =fileName;
     475  this->fileName = fileName;
    452476  /* got the data: map it to locals */
    453477  this->numFrames = this->header->numFrames;
     
    468492  fseek(pFile, this->header->offsetFrames, SEEK_SET);
    469493  fread(buffer, this->header->frameSize, this->numFrames, pFile);
     494        //BULK_CONV( buffer, this->header->frameSize*this->numFrames*sizeof(char)/4 );
    470495  /* read opengl commands */
    471496  fseek(pFile, this->header->offsetGlCommands, SEEK_SET);
     497
    472498  fread(this->pGLCommands, sizeof(int), this->numGLCommands, pFile);
     499        BULK_CONV( this->pGLCommands, this->numGLCommands );
    473500  /* triangle list */
    474501  fseek(pFile, this->header->offsetTriangles, SEEK_SET);
    475   fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);
     502  fread(this->pTriangles, sizeof(sTriangle), this->numTriangles, pFile);       
     503        BULK_CONV16( this->pTriangles, this->numTriangles*sizeof(sTriangle)/2 );
     504
    476505  /*  read in texture coordinates */
    477506  fseek(pFile, this->header->offsetTexCoords, SEEK_SET);
    478507  fread(this->pTexCoor, sizeof(sTexCoor), this->numTexCoor, pFile);
    479 
     508        BULK_CONV16( this->pTexCoor, this->numTexCoor*sizeof(sTexCoor)/2 );
    480509
    481510  for(int i = 0; i < this->numFrames; ++i)
    482511    {
    483512      frame = (sFrame*)(buffer + this->header->frameSize * i);
     513                        //Convert the translate and scale Vec3D if needed.
     514                        BULK_CONV( frame, 6 );
     515                        BULK_CONV( frame->pVertices, 3 );
    484516      pVertex = this->pVertices + this->numVertices  * i;
    485517      pNormals = this->pLightNormals + this->numVertices * i;
Note: See TracChangeset for help on using the changeset viewer.