Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10355 in orxonox.OLD


Ignore:
Timestamp:
Jan 24, 2007, 8:48:26 PM (17 years ago)
Author:
bottac
Message:

Here comes the updated version.

Location:
branches/ODE
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/ODE/configure.ac

    r9886 r10355  
    298298  AX_CHECK_REQUIRED_HEADER_LIB([SDL.h SDL/SDL.h], [SDL], [main],,, [http://www.libsdl.org])
    299299
     300
     301
     302#-----#
     303# ODE #
     304#-----#
     305#AX_CHECK_REQUIRED_HEADER_LIB([ode/ode.h],[ode],[main],,,[http://www.ode.org])
     306       
     307
     308# adding the lib to the files to link
     309LIBS="-lode $LIBS"
     310
     311# introduce the optional configure parameter for the path of libXXX.a
     312AC_ARG_WITH(ode,
     313        AC_HELP_STRING(
     314            [--with-ode=prefix],
     315            [try this for the ode-library prefix install directory]
     316          ),
     317          ode_PATHSET=1,
     318          ode_PATHSET=0
     319)
     320
     321# if optional parameter used, extend path flags for compliler and linker
     322                CPPFLAGS="$CPPFLAGS -I$with_ode/include"
     323                CFLAGS="$CFLAGS -I$with_ode/include"
     324                LDFLAGS="$LDFLAGS -L$with_ode/ode/src"
     325
     326# overwrite global variable (used for Makefile generation)
     327AC_SUBST(GLOBALCPPFLAGS, $CPPFLAGS )
     328AC_SUBST(GLOBALLDFLAGS, $LDFLAGS )
     329
     330
     331
     332
    300333    ;;
     334
     335
    301336
    302337###########
     
    375410#--------#
    376411AX_CHECK_REQUIRED_HEADER_LIB([AL/al.h], [OpenAL32], [main],,, [http://www.openal.org])
     412
     413#-----#
     414# ODE #
     415#-----#
     416AX_CHECK_REQUIRED_HEADER_LIB([ode/ode.h],[ode],[main],,,[http://www.ode.org])
     417
    377418
    378419#-----------#
  • branches/ODE/src/lib/collision_detection/cd_engine.cc

    r10033 r10355  
    6868void CDEngine::checkCollisions(ObjectManager::EntityList& list1, ObjectManager::EntityList& list2)
    6969{
     70
     71
    7072  BVTree* tree;
    7173  ObjectManager::EntityList::iterator entity1, entity2, pre1, pre2;
     
    8486        if( likely((*entity2) != this->terrain))
    8587        {
     88         
    8689          PRINTF(5)("checking object %s (%s) against %s (%s)\n",
    87             (*entity1)->getClassCName(), (*entity1)->getCName(), (*entity2)->getClassCName(), (*entity2)->getCName());
     90           (*entity1)->getClassCName(), (*entity1)->getCName(), (*entity2)->getClassCName(), (*entity2)->getCName());
     91          #ifndef WITH_ODE
    8892          tree = (*entity1)->getOBBTree();
    8993          if( likely(tree != NULL) && (*entity2)->getOBBTree() != NULL)
    90             tree->collideWith(*entity1, *entity2);
     94          tree->collideWith(*entity1, *entity2);
     95          #endif
     96                (*entity1)->checkCollision(*entity2);
     97       
     98         
    9199        }
    92100      }
     
    102110{
    103111  std::list<WorldEntity*>::iterator entityIterator;
     112       
     113for( ObjectList<Terrain>::const_iterator bspIterator = Terrain::objectList().begin();
     114       bspIterator != Terrain::objectList().end();
     115       bspIterator++) {
     116   for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
     117      {
     118                PRINTF(5)("Checking %s against: %s\n", ((dynamic_cast<Terrain*>(*bspIterator)))->getCName(),    (*entityIterator)->getClassCName());
     119        (dynamic_cast<Terrain*>(*bspIterator))->checkCollision(*entityIterator);
     120      }
     121 }
     122       
    104123  // for all bsp managers check all entities
    105124  for( ObjectList<BspEntity>::const_iterator bspIterator = BspEntity::objectList().begin();
     
    108127      for(entityIterator = list1.begin(); entityIterator != list1.end(); entityIterator++)
    109128      {
    110 //         PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getName(), (*entityIterator)->getClassCName());
     129       //  PRINTF(0)("Checking: %s a %s\n", (*entityIterator)->getCName(), (*entityIterator)->getClassCName());
    111130        (dynamic_cast<BspEntity*>(*bspIterator)->getBspManager())->checkCollision(*entityIterator);
    112131      }
     132   
    113133  }
     134 
    114135}
    115136
  • branches/ODE/src/lib/collision_reaction/cr_physics_full_walk.cc

    r10013 r10355  
    5353  {}
    5454
    55 
     55 
    5656  /**
    5757   * caluculates and applys the reaction to a specific collision
     
    6060  void CRPhysicsFullWalk::reactToCollision(Collision* collision)
    6161  {
     62        //PRINTF(0)("REACTION..................HEHEHEHEH:-)\n");
    6263
    6364    AABB* box = collision->getEntityA()->getModelAABB();
     
    6667    if( box == NULL)
    6768    {
    68       PRINTF(2)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
     69      PRINTF(0)("this model has no aabb box so there is no correct collision reaction implemented. skipping\n");
    6970      return;
    7071    }
     
    9192      Vector collPos =  collision->getEntityA()->getAbsCoor()  + box->center - ce->getCollisionPosition();
    9293
     94
    9395      // test the 3 axis differently
    9496      switch( ce->getType())
     
    9698          /* collision in the X-AXIS */
    9799        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X:
    98           front = collPos.len() - box->halfLength[0];
     100               
     101        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
     102          front = (collPos- entity->getAbsCoor()).len() - box->halfLength[0];
    99103
    100104          // object is beneath the plane (ground)
    101105          if( front <= 0.0f )
    102106          {
     107                // PRINTF(0)("FRONT");
    103108            Vector dirX = entity->getAbsDirX();
    104109            dirX.y = 0.0f;
     
    116121
    117122        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG:
     123       
     124        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    118125          back = collPos.len() - box->halfLength[0];
    119126
     
    121128          if( back <= 0.0f)
    122129          {
     130        //   PRINTF(0)("FRONT");
    123131            Vector dirX = entity->getAbsDirX();
    124132            dirX.y = 0.0f;
     
    136144
    137145
     146         
     147
     148
    138149          /* collision in the Y-AXIS */
    139150        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG:
    140151          // calulate the height above ground
    141           height = collPos.len() - box->halfLength[1];
    142 
    143 
     152          height =  height = collPos.dot(Vector(0.0,1.0,0.0))  - box->halfLength[1] ; // collPos.len()  - box->halfLength[1];
     153                // PRINTF(0)("HEIGHT : %f \n" , height);
     154       
    144155          // object is beneath the plane (ground)
    145156          //         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
    146           if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
    147           {
    148             entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
     157          if(height < 10.0f )//&& -height < CR_MAX_WALK_HEIGHT)
     158          {
     159               
     160           entity->shiftCoor(Vector(0.0f,-(height -10.0f)  + 0.0001, 0.0f));
     161        //entity->setVelocity(Vector(entity->getVelocity().x, entity->getVelocity().y,entity->getVelocity().z));
     162         //entity->setAbsCoor(Vector(entity->getAbsCoor().x, entity->getLastAbsCoor().y+ 100.0*(entity->getAbsCoor()-entity->getLastAbsCoor()).len(),entity->getAbsCoor().z) );
     163// PRINTF(0)("Geschw. %f\n",(0.0f));
     164// PRINTF(0)("ENTITY:. %s\n",entity->getCName());
     165
    149166            entity->setOnGround(true);
    150167          }
     
    153170          {
    154171            entity->setAbsCoor(entity->getLastAbsCoor());
    155             PRINTF(0)("ground collision: reset pos\n");
     172          //  PRINTF(0)("ground collision: reset pos\n");
    156173          }
    157174          else
     
    166183        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z:
    167184
     185         //PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    168186          right = collPos.len()  - box->halfLength[2];
    169187
     
    187205          // collision in the z-axis
    188206        case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG:
    189 
     207         
     208        // PRINTF(0)("ZZZZZZZZZZ ZZZZZ\n");
    190209          left = collPos.len()  - box->halfLength[2];
    191210
  • branches/ODE/src/lib/graphics/importer/bsp/bsp_file.cc

    r10033 r10355  
    4040#include <vector>
    4141
     42#ifdef WITH_ODE
     43#include <ode/ode.h>
     44#endif
    4245
    4346
     
    330333    this->patchIndexes = new char[7*8*2*4*(this->numPatches+10)];
    331334 // this->patchRowIndexes = new int*[7*4*this->numPatches]; Not needed?
     335    #ifdef WITH_ODE
     336    this->ODE_Geometry = new dTriMeshDataID[this->numPatches*7*7];
     337    #endif
    332338    this->patchTrianglesPerRow = new char[7*4*this->numPatches];
    333339    this->VertexArrayModels  = new VertexArrayModel*[this->numPatches];
     
    728734 * @todo cleanup this function, let the user choose the level of tesselation
    729735 */
    730 
     736#ifdef WITH_ODE
     737uint  Ind [] = {8,0,9,     0,1,9,     9,1,10,   1,2,10,    10,2,11,  2,3,11,   11,3,12,  3,4,12,    12,4,13,  4,5,13,   13,5,14,   5,6,14,   14,6,15,  6,7,15, 
     738                16,8,17,   8,9,17,    17,9,18,  9,10,18,   18,10,19, 10,11,19, 19,11,20, 11,12,20,  20,12,21, 12,13,21, 21,13,22, 13,14,22,  22,14,23, 14,15,23,
     739                24,16,25,  16,17,25,  25,17,26, 17,18,26,  26,18,27, 18,19,27, 27,19,28, 19,20,28,  28,20,29, 20,21,29, 29,21,30, 21,22,30,  30,22,31, 22,23,31,
     740                32,24,33,  24,25,33,  33,25,34, 25,26,34,  34,26,35, 26,27,35, 35,27,36, 27,28,36,  36,28,37, 28,29,37 ,37,29,38, 29,30,38,  38,30,39, 30,31,39,
     741                40,32,41,  32,33,41,  41,33,42, 33,34,42,  42,34,43, 34,35,43, 43,35,44, 35,36,44,  44,36,45, 36,37,45, 45,37,46, 37,38,46,  46,38,47, 38,39,47,
     742                48,40,49,  40,41,49,  49,41,50, 41,42,50,  50,42,51, 42,43,51, 51,43,52, 43,44,52,  52,44,53, 44,45,53, 53,45,54, 45,46,54,  54,46,55, 46,47,55,
     743                56,48,57,  48,49,57,  57,49,58, 49,50,58,  58,50,59, 50,51,59, 59,51,60, 51,52,60,  60,52,61, 52,53,61, 61,53,62, 52,54,62,  62,54,63, 54,55,63, 0 };
     744#endif
    731745
    732746void BspFile::tesselate(int iface)
     
    888902        }
    889903      }
     904
     905        #ifdef WITH_ODE
     906        this->ODE_Geometry[this->patchOffset] = dGeomTriMeshDataCreate();
     907     // Create ODE Triangle Mesh Geometry
     908        dGeomTriMeshDataBuildSingle(this->ODE_Geometry[this->patchOffset], &((((BspVertex*)(this->patchVertice))[level1*level1*this->patchOffset ]).position[0]), sizeof(BspVertex), level1*level1, &(Ind[0]) ,7*14*3, 3* sizeof(uint) );
     909        #endif
    890910
    891911
  • branches/ODE/src/lib/graphics/importer/bsp/bsp_file.h

    r10033 r10355  
    1717  Quake 3 Collision Detection by Nathan Ostgard        http://www.devmaster.net/articles/quake3collision/
    1818*/
     19
     20#define WITH_ODE
     21#ifdef WITH_ODE
     22#include <ode/ode.h>
     23#endif
    1924
    2025#include <vector>
     
    159164  AMat loadMat( char* mat );
    160165  AMat loadAVI(char * mat);
     166
     167  #ifdef WITH_ODE
     168        dTriMeshDataID*    getODE_Geometry(void) {return this->ODE_Geometry;}
     169  #endif
    161170 
    162171
     
    215224 
    216225  ::std::vector<MoviePlayer* > MovieMaterials; //!< Movieplayer Materials
     226
     227  #ifdef WITH_ODE
     228          dTriMeshDataID*   ODE_Geometry; //!< ODE Geometry Data for patches
     229          dGeomID*          ODE_Geom_IDs; //!< IDs of ODE Geometry Data
     230  #endif
     231
    217232};
    218233
  • branches/ODE/src/lib/graphics/importer/bsp/bsp_manager.cc

    r10076 r10355  
    4949#include "collision_tube.h"
    5050
     51#ifdef WITH_ODE
     52        #include<ode/ode.h>
     53#endif
    5154
    5255//CREATE_FACTORY( BspManager, CL_BSP_MODEL);
     
    8891int BspManager::load(const char* fileName, float scale)
    8992{
     93#ifdef WITH_ODE
     94  this->world =  dWorldCreate();
     95  space = dSimpleSpaceCreate(0);
     96 
     97   //!fixme
     98  for (int i=0; i<30; i++) {
     99    contact[i].surface.mode = dContactBounce | dContactSoftCFM;
     100    contact[i].surface.mu = dInfinity;
     101    contact[i].surface.mu2 = 0;
     102    contact[i].surface.bounce = 0.1;
     103    contact[i].surface.bounce_vel = 0.1;
     104    contact[i].surface.soft_cfm = 0.01;
     105  }
     106#endif
    90107  // open a BSP file
     108
    91109
    92110
     
    101119
    102120  this->outputFraction = 1.0f;
     121
     122
     123#ifdef WITH_ODE
     124       
     125  contactgroup = dJointGroupCreate (0);
     126  dWorldSetGravity (world,0,0,-0.5);
     127  dWorldSetCFM (world,1e-5);
     128  this->ODE_Geom_IDs = new dGeomID[this->bspFile->numPatches* 7 *7];
     129
     130  for( int i = 0 ; i < (this->bspFile->numPatches ); i++ )
     131        {
     132                this->ODE_Geom_IDs[i] = dCreateTriMesh(space,(this->bspFile->getODE_Geometry())[i],0 , 0, 0);
     133
     134        }
     135
     136#endif
     137
    103138
    104139  return 0;
     
    124159{
    125160
    126   if(!this->bspFile->MovieMaterials.empty()) {
     161  if(unlikely(!this->bspFile->MovieMaterials.empty())) {
    127162    ::std::vector<MoviePlayer *>::iterator it = this->bspFile->MovieMaterials.begin() ;
    128163    while(it != this->bspFile->MovieMaterials.end()) {
     
    138173const void BspManager::draw()
    139174{
     175
     176// Remove lines below
     177//glShadeModel( GL_SMOOTH );                                                    // Enable Smooth Shading
     178        //glColor( 0.0f, 0.0f, 0.0f, 0.5f );            // Black Background
     179        //glClearDepth( 1.0f );                                                         // Depth Buffer Setup
     180        //glClearStencil( 0 );                                                                  // Stencil Buffer Setup
     181        //glEnable( GL_DEPTH_TEST );                                                    // Enables Depth Testing
     182        //glDepthFunc( GL_LEQUAL );
    140183
    141184  /*
     
    171214  this->lastTex = -1;
    172215  // erase alreadyVisible
    173   for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false;
     216 // for(int i = 0; i < this->bspFile->numFaces; i++) this->alreadyVisible[i] = false;
    174217  float tmp = 0;
    175218  //this->opal.clear();
     
    184227
    185228
    186   this->viewDir=    State::getCamera()->getAbsDirX();
    187   float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
     229 // this->viewDir=    State::getCamera()->getAbsDirX();
     230 // float d = (cam.x*viewDir.x + cam.y*viewDir.y + cam.z * viewDir.z);
    188231
    189232  BspTreeNode*  ActLeaf = this->getLeaf(this->bspFile->root, &ship);
     
    197240
    198241
    199   this->outputStartsOut = true;
    200   this->outputAllSolid = false;
    201   this->outputFraction = 1.0f;
    202 
    203   if ( viscluster < 0  || ((int *)(this->bspFile->header))[35] == 0 )  //!< if (sizeof(Visdata) == 0)
    204   {
    205 
    206 
     242  //this->outputStartsOut = true;
     243  //this->outputAllSolid = false;
     244  //this->outputFraction = 1.0f;
     245
     246  if (unlikely( viscluster < 0  || ((int *)(this->bspFile->header))[35] == 0) )  //!< if (sizeof(Visdata) == 0)
     247  {
    207248
    208249    // Iterate through all Leafs
     
    258299
    259300      if(cluster < 0) continue;
    260       v = ((viscluster *  ( ((int *)this->bspFile->visData)[1]) ) + (cluster / 8));
     301      v = ((viscluster *  ( ((int *)this->bspFile->visData)[1]) ) + (cluster >> 3));
    261302      visSet =((char*) (this->bspFile->visData))[v + 8];
    262303
    263304      // gets bit of visSet
    264       if( ((visSet) & (1 << (cluster &  7))) != 0 ) {
     305      if( ((visSet) & (1 << (cluster &  7))) /* != 0 */) {
    265306
    266307        // Frustum culling
     
    275316        const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist;
    276317
    277         if(dMins < -70.0 && dMaxs < -70.0) {
     318        if(dMins < -0.0 && dMaxs < -0.0) {
    278319          continue;
    279320        }
     
    299340
    300341  while(!this->opal.empty()) {
     342
     343   
    301344    this->draw_face(this->opal.front());
     345    this->alreadyVisible[(int)(this->opal.front())] = false;
    302346    this->opal.pop_front();
    303347  }
    304348  while(!this->trasparent.empty()) {
    305349    this->draw_face(this->trasparent.back());
     350    this->alreadyVisible[(int)(this->trasparent.back())] = false;
    306351    this->trasparent.pop_back();
    307352  }
     
    319364{
    320365  face& curFace =  (this->bspFile->faces)[curface];
     366  if (unlikely(curFace.effect != -1)) return;
    321367  const BspVertex* curVertex = (BspVertex *) this->bspFile->vertice;
    322   int stride = sizeof(BspVertex);  // sizeof(Vertex)
     368  const int stride = sizeof(BspVertex);  // sizeof(Vertex)
    323369  int offset    = curFace.vertex;
    324   if (curFace.effect != -1) return;
     370 
    325371  // PRINTF(0)("BSP Manager: ");
    326372  // PRINTF(0)("BSP Manager: type: %i  \n", curFace.texture);
     
    353399  }
    354400
    355   if(curFace.lm_index < 0) {
     401  if(unlikely(curFace.lm_index < 0)) {
    356402    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    357403    glActiveTextureARB(GL_TEXTURE1_ARB);
     
    375421  glEnableClientState(GL_NORMAL_ARRAY );
    376422  //  glEnableClientState(GL_COLOR_ARRAY);
     423
     424 //TUTU
     425//glShadeModel( GL_SMOOTH );                                                    // Enable Smooth Shading
     426//      glClearColor( 0.0f, 0.0f, 0.0f, 0.5f );         // Black Background
     427//      glClearDepth( 1.0f );                                                           // Depth Buffer Setup
     428//      glClearStencil( 0 );                                                                    // Stencil Buffer Setup
     429//      glEnable( GL_DEPTH_TEST );                                                      // Enables Depth Testing
     430//      glDepthFunc( GL_LEQUAL );
     431 //TUTU
    377432
    378433
     
    449504void BspManager::draw_patch(face* Face)
    450505{
     506  if (Face->effect != -1) return;
    451507  if(this->lastTex != Face->texture) {
    452508    this->bspFile->Materials[Face->texture].mat->select();
    453509    this->lastTex = Face->texture;
    454510  }
    455   if (Face->effect != -1) return;
    456 
    457 
    458   if(Face->lm_index < 0) {
     511 
     512
     513
     514  if(unlikely(Face->lm_index < 0)) {
    459515    glActiveTextureARB(GL_TEXTURE1_ARB);
    460516    glBindTexture(GL_TEXTURE_2D, this->bspFile->whiteLightMap);
     
    9601016{
    9611017
     1018
    9621019  // Init  Collision Detection
    9631020  this->outputStartsOut = true;
     
    9691026  this->checkCollisionY(worldEntity);
    9701027  this->checkCollisionZ(worldEntity);
     1028
     1029
     1030#ifdef WITH_ODE
     1031        // Create the World-Entities BBOX
     1032   AABB* box = worldEntity->getModelAABB();
     1033   dReal  aabbox [6];
     1034
     1035
     1036        if(  box != NULL)
     1037{
     1038       
     1039       
     1040        //PRINTF(0)(" BOX NOT NULL ........... \n");
     1041
     1042        dGeomID RayX =    dCreateRay(this->space,box->halfLength[0] *2.0f);
     1043        dGeomRaySet (RayX, worldEntity->getAbsCoor().x  - box->halfLength[0]  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     1044                  1.0f, 0.0f, 0.0f);
     1045        dGeomID RayY =    dCreateRay(space,box->halfLength[1] *2.0f);
     1046        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y - box->halfLength[1], worldEntity->getAbsCoor().z,
     1047                  0.0f, 1.0f, 0.0f);
     1048        dGeomID RayZ =    dCreateRay(space,box->halfLength[2] *2.0f);
     1049        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z - box->halfLength[2],
     1050                  0.0f, 0.0f, 1.0f);
     1051
     1052        dGeomID RayXPos =    dCreateRay(space,box->halfLength[0]);
     1053        dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     1054                  1.0f, 0.0f, 0.0f);
     1055        dGeomID RayYPos =    dCreateRay(space,box->halfLength[1] );
     1056        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     1057                  0.0f, 1.0f, 0.0f);
     1058        dGeomID RayZPos =    dCreateRay(space,box->halfLength[2] );
     1059        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     1060                  0.0f, 0.0f, 1.0f);
     1061
     1062        dGeomID RayXNeg =    dCreateRay(space,box->halfLength[0] * 1.0f );
     1063        dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     1064                  -1.0f, 0.0f, 0.0f);
     1065        dGeomID RayYNeg =    dCreateRay(space,box->halfLength[1] );
     1066        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y , worldEntity->getAbsCoor().z,
     1067                  0.0f, -1.0f, 0.0f);
     1068        dGeomID RayZNeg =    dCreateRay(space,box->halfLength[2] );
     1069        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z ,
     1070                  0.0f, 0.0f, -1.0f);
     1071
     1072 
     1073        dGeomID BBOX = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*40.0f + BSP_Y_OFFSET*30.0f ,2.0f* box->halfLength[2]);
     1074        dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
     1075        dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     1076
     1077
     1078dGeomID BBOX2 ;
     1079 
     1080   int g;
     1081   bool collision = false;
     1082
     1083   for( int i = 0 ; i < this->bspFile->numPatches  ; i++ )
     1084        { 
     1085                        // dGeomGetAABB (this->bspFile->ODE_Geom_IDs[i],aabbox );
     1086                        // BBOX2 = dCreateBox (space, aabbox[1]-aabbox[0], aabbox[3]-aabbox[2], aabbox[5]-aabbox[4]);
     1087                        //  dGeomSetPosition (BBOX2,(aabbox[1]+ aabbox[0])/2, (aabbox[3]+ aabbox[2])/2, (aabbox[4]+ aabbox[5])/2);
     1088                        // dGeomDestroy(BBOX2);
     1089                         g = 0;
     1090                         if(true || dCollide(this->ODE_Geom_IDs[i],BBOX, 1, &contact[0].geom, sizeof(dContact)) ) {
     1091                                       
     1092                                        if( true || dCollide(this->ODE_Geom_IDs[i],RayX, 1, &contact[0].geom, sizeof(dContact)))  {
     1093                                                if(dCollide(this->ODE_Geom_IDs[i],RayXPos, 1, &contact[0].geom, sizeof(dContact)))  {
     1094                                                          CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(1.0f, 0.0f, 0.0f),
     1095                                                          Vector((float)contact[0].geom.pos[0],(float)contact[0].geom.pos[1],contact[0].geom.pos[2]), true);   
     1096                                                       
     1097                                                }//if           
     1098                                                if(dCollide(this->ODE_Geom_IDs[i],RayXNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     1099                                                          CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG , this->parent, worldEntity, Vector(1.0f, 0.0f, 0.0f),
     1100                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), true);
     1101                                                         
     1102                                                }//if
     1103                                        }//if
     1104                               
     1105                                       
     1106                                        if(dCollide(this->ODE_Geom_IDs[i],RayY, 1, &contact[0].geom, sizeof(dContact)))  {
     1107                                               
     1108                                                // worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     1109                                                //          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     1110
     1111                                                //PRINTF(0)("Ground \n");
     1112                                                if(dCollide(this->ODE_Geom_IDs[i],RayYPos, 1, &contact[0].geom, sizeof(dContact)))  {
     1113                                                          CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     1114                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1] ,contact[0].geom.pos[2]), false);
     1115                                                       
     1116                                                }//if
     1117                                                else if(dCollide(this->ODE_Geom_IDs[i],RayYNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     1118                                                          CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     1119                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     1120                                                       
     1121                                                }//if
     1122                                                else {
     1123
     1124                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     1125                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     1126
     1127                                                }
     1128
     1129                                        }//if
     1130                               
     1131                                        if(true || dCollide(this->ODE_Geom_IDs[i],RayZ, 1, &contact[0].geom, sizeof(dContact)))  {
     1132                                                if(dCollide(this->ODE_Geom_IDs[i],RayZPos, 1, &contact[0].geom, sizeof(dContact)))  {
     1133                                                         CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     1134                                                         Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), true);
     1135                                                       
     1136                                                }//if
     1137                                                if(dCollide(this->ODE_Geom_IDs[i],RayZNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     1138                                                          CoRe::CollisionTube::getInstance()->registerCollisionEvent(CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG , this->parent, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     1139                                                          Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), true);
     1140                                                       
     1141                                                }//if
     1142
     1143
     1144                                        }//if
     1145                       
     1146                        } //if
     1147                } //for
     1148                       
     1149      dGeomDestroy(RayX);
     1150      dGeomDestroy(RayY);
     1151      dGeomDestroy(RayZ);
     1152      dGeomDestroy(RayXPos);
     1153      dGeomDestroy(RayYPos);
     1154      dGeomDestroy(RayZPos);
     1155      dGeomDestroy(RayXNeg);
     1156      dGeomDestroy(RayYNeg);
     1157      dGeomDestroy(RayZNeg);
     1158       
     1159     dGeomDestroy(BBOX);
     1160} // if(bbox != 0)
     1161#endif
    9711162
    9721163
  • branches/ODE/src/lib/graphics/importer/bsp/bsp_manager.h

    r10033 r10355  
    3131#define BSP_Y_OFFSET 40.0f
    3232#define BSP_Z_OFFSET 20.0f
     33
     34#define WITH_ODE
     35
     36#ifdef WITH_ODE
     37        #include <ode/ode.h>
     38#endif
    3339
    3440
     
    136142
    137143  int tgl;
     144
     145
     146  #ifdef WITH_ODE
     147   dWorldID world;
     148   dSpaceID space;
     149   dJointGroupID contactgroup;
     150   dContact contact[300];
     151   dGeomID*          ODE_Geom_IDs; //!< IDs of ODE Geometry Data
     152  #endif
    138153};
    139154
  • branches/ODE/src/world_entities/space_ships/hover.cc

    r10114 r10355  
    3333
    3434#include "debug.h"
     35#include "bsp_entity.h"
     36#include "terrain.h"
     37#include "state.h"
     38#include "camera.h"
    3539
    3640
     
    214218
    215219  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
     220
     221 //this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
     222 this->subscribeReaction(CoRe::CREngine::CR_PHYSICS_FULL_WALK, WorldEntity::staticClassID());
    216223}
    217224
     
    353360
    354361void Hover::draw() const
    355 {
     362{ 
    356363  Vector tmpRot;
    357364  WorldEntity::draw();
     
    401408  glRotatef(this->rotorCycle, 0,1,0);
    402409  this->getModel(5)->draw();
     410
    403411  glPopMatrix ();
     412
     413 glPushMatrix();
     414 glTranslatef (this->getAbsCoor ().x,
     415                  this->getAbsCoor ().y-2.0,
     416                  this->getAbsCoor ().z);
     417
     418/* glBegin(GL_QUADS);
     419        glColor4f(0.9,0.9,0.2,0.33);   
     420        glNormal3f( 0.0f, 1.0f, 0.0f);                                  // Normal Pointing Up
     421                glTexCoord2f(0.0f, 1.0f); glVertex3f(-10.0f, - 2.0f, -1.00f);   // Point 1 (Top)
     422                glTexCoord2f(0.0f, 0.0f); glVertex3f(-10.0f,  -2.0f,  10.0f);   // Point 2 (Top)
     423                glTexCoord2f(1.0f, 0.0f); glVertex3f( 10.0f,  -2.0f,  10.0f);   // Point 3 (Top)
     424                glTexCoord2f(1.0f, 1.0f); glVertex3f( 10.0f,  -2.0f, -10.0f);   // Point 4 (Top)
     425glEnd(); */
     426
     427//this->getModel(0)->draw();
     428 // glMatrixMode(GL_MODELVIEW);
     429       
     430  //  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     431   // glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     432
     433        Vector a = Vector(0.0,0.0,-10.0);
     434
     435 
     436        //      drawDebugCube( &a);
     437   // Experiment
     438       
     439
     440       
     441        glPushAttrib( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT );
     442        glDepthMask(GL_FALSE);
     443//glClear( GL_STENCIL_BUFFER_BIT);
     444        glDisable(GL_TEXTURE_2D);
     445        glActiveTextureARB(GL_TEXTURE0_ARB);
     446        glDisable(GL_TEXTURE_2D);
     447// drawDebugCube( &a);
     448       
     449
     450                //glEnable(GL_CULL_FACE);
     451                glEnable(GL_STENCIL_TEST);
     452                //glEnable(GL_POLYGON_OFFSET_FILL);
     453                //glPolygonOffset(0.0f, 100.0f);
     454        //drawDebugCube( &a);
     455
     456
     457
     458        glDisable( GL_LIGHTING );                                       // Turn Off Lighting
     459        glDepthMask( GL_FALSE );                                        // Turn Off Writing To The Depth-Buffer
     460        //glDepthFunc( GL_LEQUAL );
     461        glEnable( GL_STENCIL_TEST );                                    // Turn On Stencil Buffer Testing
     462        //glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );                // Don't Draw Into The Colour Buffer
     463        //glStencilFunc( GL_ALWAYS, 1, 0xFFFFFFFFL );
     464
     465
     466        glColorMask(0, 0, 0, 0);
     467        glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
     468
     469        // First Pass. Increase Stencil Value In The Shadow
     470       
     471        glFrontFace( GL_CCW );
     472        glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
     473        //doShadowPass( object, lightPosition );
     474        //drawDebugCube(&(State::getCamera()->getAbsCoor()  + State::getCamera()->getAbsDirV()*3.0f) );
     475        drawDebugCube( &a);
     476        this->getModel(0)->draw();
     477        //WorldEntity::draw();
     478       
     479        // Second Pass. Decrease Stencil Value In The Shadow
     480        glFrontFace( GL_CW );
     481        glStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
     482        //doShadowPass( object, lightPosition );
     483        //drawDebugCube(&(State::getCamera()->getAbsCoor() ) );
     484        drawDebugCube( &a);
     485        this->getModel(0)->draw();
     486        //WorldEntity::draw();
     487       
     488        glFrontFace( GL_CCW );
     489
     490        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
     491                glDepthMask(GL_TRUE);
     492
     493
     494                glColor4f( 0.0f, 0.9f, 0.0f, 0.4f );
     495        glDisable(GL_POLYGON_OFFSET_FILL);
     496        glDisable(GL_DEPTH_TEST);
     497                glDisable(GL_CULL_FACE);
     498        //glEnable( GL_BLEND );
     499        //glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
     500        //glStencilFunc( GL_NOTEQUAL, 0, 0xffffffff );
     501        //glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
     502        ////glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
     503       
     504        glPushMatrix();
     505        glLoadIdentity();
     506        glBegin( GL_TRIANGLE_STRIP );
     507                glVertex3f( -1.1f,  1.1f, -5.5f );
     508                glVertex3f( -1.1f, -1.1f, -5.5f );
     509                glVertex3f(  1.1f,  1.1f, -5.5f );
     510                glVertex3f(  1.1f, -1.1f, -5.5f );
     511        glEnd();
     512         glPopMatrix ();
     513       
     514        /*
     515        glPushMatrix();
     516        glLoadIdentity();
     517        glMatrixMode(GL_PROJECTION);
     518        glPushMatrix();
     519        glLoadIdentity();
     520        glOrtho(0, 1, 1, 0, 0, 1);
     521       
     522
     523        glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
     524        glBegin(GL_QUADS);
     525                glVertex2i(0, 0);
     526                glVertex2i(0, 1);
     527                glVertex2i(1, 1);
     528                glVertex2i(1, 0);
     529        glEnd();
     530
     531        glEnable(GL_DEPTH_TEST);
     532
     533        glPopMatrix();
     534        glMatrixMode(GL_MODELVIEW);
     535        */
     536   
     537 glPopAttrib();
     538glPopMatrix ();
    404539}
    405540
     
    441576  }
    442577}
     578
     579 void drawDebugCube(const Vector* cam)
     580{
     581glBegin(GL_QUADS);
     582 // Front Face
     583                glNormal3f( 0.0f, 0.0f, 1.0f);                                  // Normal Pointing Towards Viewer
     584                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 1 (Front)
     585                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 2 (Front)
     586                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Front)
     587                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 4 (Front)
     588                // Back Face
     589                glNormal3f( 0.0f, 0.0f,-1.0f);                                  // Normal Pointing Away From Viewer
     590                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Back)
     591                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 2 (Back)
     592                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 3 (Back)
     593                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 4 (Back)
     594                // Top Face
     595                glNormal3f( 0.0f, 1.0f, 0.0f);                                  // Normal Pointing Up
     596                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 1 (Top)
     597                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 2 (Top)
     598                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Top)
     599                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 4 (Top)
     600                // Bottom Face
     601                glNormal3f( 0.0f,-1.0f, 0.0f);                                  // Normal Pointing Down
     602                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Bottom)
     603                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 2 (Bottom)
     604                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 3 (Bottom)
     605                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 4 (Bottom)
     606                // Right face
     607                glNormal3f( 1.0f, 0.0f, 0.0f);                                  // Normal Pointing Right
     608                glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -10.0f, -1.0f);     // Point 1 (Right)
     609                glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  10.0f, -1.0f);     // Point 2 (Right)
     610                glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  10.0f,  1.0f);     // Point 3 (Right)
     611                glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -10.0f,  1.0f);     // Point 4 (Right)
     612                // Left Face
     613                glNormal3f(-1.0f, 0.0f, 0.0f);                                  // Normal Pointing Left
     614                glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -10.0f, -1.0f);     // Point 1 (Left)
     615                glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -10.0f,  1.0f);     // Point 2 (Left)
     616                glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  10.0f,  1.0f);     // Point 3 (Left)
     617                glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  10.0f, -1.0f);     // Point 4 (Left)
     618        glEnd();                                                                // Done Drawing Quads
     619
     620
     621  glBegin(GL_QUADS);
     622
     623return;
     624  // Bottom Face.  Red, 75% opaque, magnified texture
     625
     626  //glNormal3f( 0.0f, -1.0f, 0.0f); // Needed for lighting
     627 // glColor4f(0.9,0.2,0.2,.75); // Basic polygon color
     628
     629  //glTexCoord2f(0.800f, 0.800f);
     630glVertex3f(cam->x-5.0f, cam->y-100.0f,cam->z -5.0f);
     631 // glTexCoord2f(0.200f, 0.800f);
     632glVertex3f(cam->x+5.0f, cam->y-100.0f,cam->z -5.0f);
     633  //glTexCoord2f(0.200f, 0.200f);
     634glVertex3f(cam->x+ 5.0f,cam->y -100.0f,cam->z +  5.0f);
     635  //glTexCoord2f(0.800f, 0.200f);
     636glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z + 5.0f); //OK
     637
     638
     639  // Top face; offset.  White, 50% opaque.
     640
     641 // glNormal3f( 0.0f, 5.0f, 0.0f);  glColor4f(0.5,0.5,0.5,.5);
     642
     643  //glTexCoord2f(0.005f, 5.995f);
     644glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     645  //glTexCoord2f(0.005f, 0.005f);
     646glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     647  //glTexCoord2f(5.995f, 0.005f);
     648glVertex3f(cam->x+ 5.0f,  cam->y+100.0f,  cam->z +5.0f);
     649  //glTexCoord2f(5.995f, 5.995f);
     650glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f); //OKQUAD_STRI
     651
     652
     653  // Far face.  Green, 50% opaque, non-uniform texture cooridinates.
     654
     655  //glNormal3f( 0.0f, 0.0f,-5.0f);  glColor4f(0.2,0.9,0.2,.5);
     656
     657 // glTexCoord2f(0.995f, 0.005f);
     658glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f);
     659 // glTexCoord2f(2.995f, 2.995f);
     660glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     661 // glTexCoord2f(0.005f, 0.995f);
     662glVertex3f(cam->x+ 5.0f,cam->y+  100.0f, cam->z -5.0f);
     663  //glTexCoord2f(0.005f, 0.005f);
     664glVertex3f( cam->x+5.0f,cam->y -100.0f, cam->z -5.0f);
     665
     666
     667  // Right face.  Blue; 25% opaque
     668
     669 // glNormal3f( 5.0f, 0.0f, 0.0f);  glColor4f(0.2,0.2,0.9,.25);
     670
     671 // glTexCoord2f(0.995f, 0.005f);
     672glVertex3f(cam->x+ 5.0f, cam->y -100.0f, cam->z -5.0f);
     673 // glTexCoord2f(0.995f, 0.995f);
     674glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z -5.0f);
     675 // glTexCoord2f(0.005f, 0.995f);
     676glVertex3f(cam->x+ 5.0f, cam->y+ 100.0f, cam->z + 5.0f);
     677 // glTexCoord2f(0.005f, 0.005f);
     678glVertex3f(cam->x+ 5.0f, cam->y-100.0f,  cam->z +5.0f);
     679
     680
     681  // Front face; offset.  Multi-colored, 50% opaque.
     682
     683 // glNormal3f( 0.0f, 0.0f, 5.0f);
     684
     685//  glColor4f( 0.9f, 0.2f, 0.2f, 0.5f);
     686//  glTexCoord2f( 0.005f, 0.005f);
     687glVertex3f(cam->x-5.0f, cam->y-100.0f,  cam->z +5.0f);
     688//  glColor4f( 0.2f, 0.9f, 0.2f, 0.5f);
     689//  glTexCoord2f( 0.995f, 0.005f);
     690glVertex3f(cam->x+ 5.0f, cam->y-100.0f,  cam->z +5.0f);
     691 // glColor4f( 0.2f, 0.2f, 0.9f, 0.5f);
     692//  glTexCoord2f( 0.995f, 0.995f);
     693glVertex3f( cam->x+5.0f,  cam->y+100.0f,  cam->z +5.0f);
     694//  glColor4f( 0.5f, 0.5f, 0.5f, 0.5f);
     695//  glTexCoord2f( 0.005f, 0.995f); g
     696glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     697
     698
     699  // Left Face; offset.  Yellow, varying levels of opaque.
     700
     701//  glNormal3f(-5.0f, 0.0f, 0.0f);
     702
     703//  glColor4f(0.9,0.9,0.2,0.0);
     704 // glTexCoord2f(0.005f, 0.005f);
     705glVertex3f(cam->x-5.0f, cam->y-100.0f, cam->z -5.0f);
     706  //glColor4f(0.9,0.9,0.2,0.66);
     707// glTexCoord2f(0.995f, 0.005f);
     708glVertex3f(cam->x-5.0f,cam->y -100.0f,  cam->z +5.0f);
     709//  glColor4f(0.9,0.9,0.2,5.0);
     710//  glTexCoord2f(0.995f, 0.995f);
     711glVertex3f(cam->x-5.0f, cam->y+ 100.0f,  cam->z +5.0f);
     712//  glColor4f(0.9,0.9,0.2,0.33);
     713//  glTexCoord2f(0.005f, 0.995f);
     714glVertex3f(cam->x-5.0f, cam->y+ 100.0f, cam->z -5.0f);
     715
     716  glEnd();
     717}
  • branches/ODE/src/world_entities/world_entity.cc

    r10147 r10355  
    1 
     1       
    22
    33/*
     
    4545
    4646#include "projectiles/projectile.h"
     47
     48
     49#include "class_id.h"
     50#include "aabb.h"
     51#include "cr_defs.h"
     52#include "cd_engine.h"
     53#include "collision_tube.h"
     54
     55#include "static_model.h"
     56
     57
     58
     59#ifdef WITH_ODE
     60#include  <ode/ode.h>
     61#endif
    4762
    4863SHELL_COMMAND(model, WorldEntity, loadModel)
     
    283298bool WorldEntity::buildObbTree(int depth)
    284299{
     300
     301#ifdef WITH_ODE
     302        this->world =  dWorldCreate(); // the World will be Static for mor efficiency
     303        this->space = dSimpleSpaceCreate(0); // same for the space
     304        contactgroup = dJointGroupCreate (0);
     305        dWorldSetGravity (world,0,0,-0.5);
     306        dWorldSetCFM (world,1e-5);
     307
     308 
     309if(this->getModel(0)!=0)
     310        {
     311 if(this->getModel(0)->isA( StaticModel::staticClassID() ) )
     312        {
     313
     314
     315
     316        StaticModelData::Pointer   ModelData = ((StaticModel*)this->getModel())->dataPointer();
     317        //ModelData->buildTriangleList();
     318
     319        PRINTF(0)(" Dieses Model hat %i Vertices \n", ModelData->getVertices().size());
     320        PRINTF(0)(" Dieses Model hat %i Dreiecke \n",((ModelData->getTriangles()).size()  ));
     321        this->Ind = new unsigned int [(ModelData->getTriangles()).size()*3];
     322        for(int i = 0 ; i < (ModelData->getTriangles()).size(); i++)
     323                {
     324                        Ind[3*i]    = (ModelData->getTrianglesExt())[i].indexToVertices[0] / 3 ;
     325                        Ind[3*i +1] = (ModelData->getTrianglesExt())[i].indexToVertices[1] / 3;
     326                        Ind[3*i +2] = (ModelData->getTrianglesExt())[i].indexToVertices[2] / 3;
     327               
     328                }
     329       
     330        //((StaticModel*)(this->getModel()))->acquireData(ModelData);
     331        this->ODE_Geometry = dGeomTriMeshDataCreate();
     332        dGeomTriMeshDataBuildSingle(this->ODE_Geometry,&((ModelData->getVertices())[0]), 3*sizeof(float),(ModelData->getVertices().size() /3 )  , &Ind[0] ,((ModelData->getTriangles()).size() *3 ),  3*sizeof(unsigned int) );
     333    // Create ODE-Data here!
     334       
     335
     336        //!fixme
     337        for (int i=0; i<30; i++) {
     338                contact[i].surface.mode = dContactBounce | dContactSoftCFM;
     339                contact[i].surface.mu = dInfinity;
     340                contact[i].surface.mu2 = 0;
     341                contact[i].surface.bounce = 0.1;
     342                contact[i].surface.bounce_vel = 0.1;
     343                contact[i].surface.soft_cfm = 0.01;
     344        }
     345
     346       
     347        this->ODE_Geom_ID = dCreateTriMesh(space,this->ODE_Geometry,0 , 0, 0);
     348
     349               
     350        //CDEngine::getInstance()->setTerrain(this);
     351        //this->loaded = true;
     352        //this->toList(OM_ENVIRON);
     353
     354} else
     355{
     356if(this->getModelAABB() == NULL )
     357{
     358        this->ODE_Geom_ID  = dCreateBox (space, 20.0f, 40.0f  ,20.0f);
     359        //dGeomID BBOX = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*2.0f  ,2.0f* box->halfLength[2]);
     360        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     361        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     362}
     363}
     364
     365
     366if(this->getModelAABB() != NULL )
     367{
     368        AABB* box = this->getModelAABB();
     369        //this->ODE_Geom_ID  = dCreateBox (space, 2.0f, 4.0f  ,2.0f);
     370        this->ODE_Geom_ID = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*2.0f  ,2.0f* box->halfLength[2]);
     371        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     372        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     373}
     374        }
     375
     376else
     377{
     378if(this->getModelAABB() != NULL )
     379{
     380        AABB* box = this->getModelAABB();
     381        //this->ODE_Geom_ID  = dCreateBox (space, 2.0f, 4.0f  ,2.0f);
     382        this->ODE_Geom_ID = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*2.0f  ,2.0f* box->halfLength[2]);
     383        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     384        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     385}
     386
     387if(this->getModelAABB() == NULL )
     388{
     389        this->ODE_Geom_ID  = dCreateBox (space, 20.0f, 40.0f  ,20.0f);
     390        //dGeomID BBOX = dCreateBox (space,box->halfLength[0]*2.0f, box->halfLength[1]*2.0f  ,2.0f* box->halfLength[2]);
     391        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     392        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     393}
     394}
     395
     396
     397
     398#endif
     399
     400
    285401  if( this->obbTree != NULL)
    286402  {
     
    317433    return false;
    318434  }
     435 
    319436  return true;
    320437}
     438
     439
     440
     441void WorldEntity::checkCollision(WorldEntity* worldEntity) {
     442
     443#ifndef WITH_ODE
     444        return;
     445#endif
     446#ifdef WITH_ODE
     447        //if(!this->loaded) return;
     448        //dWorldSetQuickStepNumIterations (this->world, 1);
     449        //dWorldQuickStep (this->world, 0.1);
     450
     451         AABB* box = worldEntity->getModelAABB();
     452   dReal  aabbox [6];
     453
     454if(   (this->getModel(0)!= 0) && (this->getModel(0)->isA( StaticModel::staticClassID())) )  {
     455       
     456        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     457        if(box != NULL )
     458        {
     459        //PRINTF(0)("Do have abb-box! :_)\n");
     460        dGeomID RayX =    dCreateRay(space,box->halfLength[0] *2.0f);
     461        dGeomRaySet (RayX, worldEntity->getAbsCoor().x  - box->halfLength[0]  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     462                  1.0f, 0.0f, 0.0f);
     463        dGeomID RayY =    dCreateRay(space,box->halfLength[1] * 10000.0f);
     464        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y - 5000.0f*box->halfLength[1], worldEntity->getAbsCoor().z,
     465                  0.0f, 1.0f, 0.0f);
     466        dGeomID RayZ =    dCreateRay(space,box->halfLength[2] *2.0f);
     467        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z - box->halfLength[2],
     468                  0.0f, 0.0f, 1.0f);
     469
     470        dGeomID RayXPos =    dCreateRay(space,box->halfLength[0]);
     471        dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     472                  1.0f, 0.0f, 0.0f);
     473        dGeomID RayYPos =    dCreateRay(space,box->halfLength[1] * 1100.0 );
     474        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     475                  0.0f, 1.0f, 0.0f);
     476        dGeomID RayZPos =    dCreateRay(space,box->halfLength[2] );
     477        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     478                  0.0f, 0.0f, 1.0f);
     479
     480        dGeomID RayXNeg =    dCreateRay(space,box->halfLength[0]  );
     481        dGeomRaySet (RayX, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z,
     482                  -1.0f, 0.0f, 0.0f);
     483        dGeomID RayYNeg =    dCreateRay(space, box->halfLength[1] *  1100.0f );
     484        dGeomRaySet (RayY, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y , worldEntity->getAbsCoor().z,
     485                  0.0f, -1.0f, 0.0f);
     486        dGeomID RayZNeg =    dCreateRay(space,box->halfLength[2] );
     487        dGeomRaySet (RayZ, worldEntity->getAbsCoor().x    ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z ,
     488                  0.0f, 0.0f, -1.0f);
     489
     490        //dGeomID BBOX = dCreateBox (space, 2.0f, 4.0f  ,2.0f);
     491        dGeomID BBOX = dCreateBox (space,box->halfLength[0]*0.003f, box->halfLength[1]*500.0f  ,0.0030f* box->halfLength[2]);
     492        dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
     493        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     494
     495       
     496       
     497 
     498
     499   int g;
     500   bool collision = false;
     501
     502 
     503                        // dGeomGetAABB (this->bspFile->ODE_Geom_IDs[i],aabbox );
     504                        // BBOX2 = dCreateBox (space, aabbox[1]-aabbox[0], aabbox[3]-aabbox[2], aabbox[5]-aabbox[4]);
     505                        //  dGeomSetPosition (BBOX2,(aabbox[1]+ aabbox[0])/2, (aabbox[3]+ aabbox[2])/2, (aabbox[4]+ aabbox[5])/2);
     506                        // dGeomDestroy(BBOX2);
     507                         g = 0;
     508                         if( dCollide(this->ODE_Geom_ID,BBOX, 2, &contact[0].geom, sizeof(dContact)) ) {
     509                       
     510                                PRINTF(0)("%s :Collision wit %s at %f , %f , %f : height: %f. \n", this->getCName(),worldEntity->getCName(), contact[0].geom.pos[0],contact[0].geom.pos[1]+2.1,contact[0].geom.pos[2], (worldEntity->getAbsCoorY() - contact[0].geom.pos[1]) );
     511                                for(int i = 0; i <1 ; i++)
     512                                        {
     513                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , worldEntity, this, Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]),  false);
     514                                        }
     515                                       
     516                                if(dCollide(this->ODE_Geom_ID,RayX, 1, &contact[0].geom, sizeof(dContact)))  {
     517                                                if(dCollide(this->ODE_Geom_ID,RayXPos, 1, &contact[0].geom, sizeof(dContact)))  {
     518                                                        // worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this, worldEntity, Vector(1.0f, 0.0f, 0.0f),
     519                                                        // Vector((float)contact[0].geom.pos[0],(float)contact[0].geom.pos[1],contact[0].geom.pos[2]), false); 
     520                                                       
     521                                                }//if           
     522                                                if(dCollide(this->ODE_Geom_ID,RayXNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     523                                                        //  worldEntity->registerCollision(COLLISION_TYPE_AXIS_X_NEG , this, worldEntity, //Vector(1.0f, 0.0f, 0.0f),
     524                                                        // Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     525                                                         
     526                                                }//if
     527                                        }//if
     528                               
     529                        if(this->isA("Terrain")) //ClassList::StringToID)
     530                                        {
     531                                       
     532
     533
     534if(this->isA("Terrain"))
     535{
     536PRINTF(0)("Ich bin ein %s \n",this->getClassCName() );
     537}
     538
     539                                        if( dCollide(this->ODE_Geom_ID,RayY, 1, &contact[0].geom, sizeof(dContact)))  {
     540                                               
     541                                                /*
     542                                                if(false && dCollide(this->ODE_Geom_ID,RayYNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     543                                                        // worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, ,this1.0f, 0.0f),
     544                                                       //  Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     545                                                        CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     546                                                        PRINTF(0)("Kooomische  ................Collision");
     547                                                       
     548                                                }//if
     549                                         if( false && dCollide(this->ODE_Geom_ID,RayYPos, 1, &contact[0].geom, sizeof(dContact)))  {
     550
     551                                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , worldEntity,this,  Vector(0.0f, -1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     552                                                        PRINTF(0)("Kooomische  ................Collision");
     553                                                         // worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     554                                                         //Vector(contact[0].geom.pos[0],contact[0].geom.pos[1] ,contact[0].geom.pos[2]), false);
     555                                                       
     556                                                }//if
     557                                                else { */
     558
     559                                                //CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     560                                                        PRINTF(0)("Kooomische  ................Collision");
     561
     562                                                //worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(0.0f, 1.0f, 0.0f),
     563                                                 //       Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     564
     565                                                //}
     566
     567                                        }//if
     568                               
     569                                        if(dCollide(this->ODE_Geom_ID,RayZ, 1, &contact[0].geom, sizeof(dContact)))  {
     570                                                if(dCollide(this->ODE_Geom_ID,RayZPos, 1, &contact[0].geom, sizeof(dContact)))  {
     571                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     572                                                        PRINTF(0)("Kooomische  ................Collision");
     573                                                //        worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     574                                                  //       Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     575                                                       
     576                                                }//if
     577                                                if(dCollide(this->ODE_Geom_ID,RayZNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     578                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     579                                                        PRINTF(0)("Kooomische  ................Collision");
     580                                                        //  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z_NEG , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     581                                                         // Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     582                                                       
     583                                                }//if
     584                       
     585                                               
     586                                                if(dCollide(this->ODE_Geom_ID,RayXPos, 1, &contact[0].geom, sizeof(dContact)))  {
     587                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     588                                                        PRINTF(0)("Kooomische  ................Collision");
     589                                                //        worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     590                                                  //       Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     591                                                       
     592                                                }//if
     593                                                if(dCollide(this->ODE_Geom_ID,RayXNeg, 1, &contact[0].geom, sizeof(dContact)))  {
     594                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG , worldEntity,this,  Vector(0.0f, 1.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     595                                                        PRINTF(0)("Kooomische  ................Collision");
     596                                                        //  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z_NEG , this, worldEntity, Vector(0.0f, 0.0f, 1.0f),
     597                                                         // Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     598                                                       
     599                                                }//if
     600
     601
     602                                        }//if
     603                                }//if
     604                       
     605                        } //if
     606               
     607                       
     608      dGeomDestroy(RayX);
     609      dGeomDestroy(RayY);
     610      dGeomDestroy(RayZ);
     611      dGeomDestroy(RayXPos);
     612      dGeomDestroy(RayYPos);
     613      dGeomDestroy(RayZPos);
     614      dGeomDestroy(RayXNeg);
     615      dGeomDestroy(RayYNeg);
     616      dGeomDestroy(RayZNeg);
     617       
     618     dGeomDestroy(BBOX);
     619} // if(bbox != 0)
     620
     621if(box == NULL)
     622{
     623        dGeomID BBOX = dCreateBox (space, 20.0f, 40.0f  ,20.0f);
     624        dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
     625        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     626        if(dCollide(this->ODE_Geom_ID,BBOX, 1, &contact[0].geom, sizeof(dContact)))
     627                                                {
     628                                                       
     629                                                PRINTF(0)("Collision wit %s at %f , %f , %f . \n", worldEntity->getCName(), contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2] );     
     630
     631                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , this, worldEntity, Vector(1.0f, 0.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     632                                                }
     633        dGeomDestroy(BBOX);
     634}
     635}
     636else {
     637        dGeomSetPosition (this->ODE_Geom_ID, this->getAbsCoor().x  ,this->getAbsCoor().y, this->getAbsCoor().z);
     638        //if(box != NULL )
     639        dGeomID BBOX = dCreateBox (space, 10.0f, 40.0f  ,10.0f);
     640        dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x  ,worldEntity->getAbsCoor().y, worldEntity->getAbsCoor().z);
     641        //dGeomSetPosition (BBOX, worldEntity->getAbsCoor().x + box->center.x ,worldEntity->getAbsCoor().y+box->center.y, worldEntity->getAbsCoor().z+box->center.z);
     642        if(dCollide(this->ODE_Geom_ID,BBOX, 1, &contact[0].geom, sizeof(dContact)))
     643                                                {
     644                                                       
     645                                                PRINTF(5)("Collision wit %s at %f , %f , %f . \n", worldEntity->getCName(), contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2] );
     646
     647                                                CoRe::CollisionTube::getInstance()->registerCollisionEvent( CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG , worldEntity, this, Vector(1.0f, 0.0f, 0.0f), Vector(contact[0].geom.pos[0],contact[0].geom.pos[1],contact[0].geom.pos[2]), false);
     648                                                }
     649        dGeomDestroy(BBOX);
     650
     651}
     652
     653#endif
     654 
     655}
     656
    321657
    322658
  • branches/ODE/src/world_entities/world_entity.h

    r10147 r10355  
    2222#include <vector>
    2323
     24#ifdef WITH_ODE
     25#include  <ode/ode.h>
     26#endif
    2427
    2528// FORWARD DECLARATION
     
    7679  /* --- Collision Detection Block  --- */
    7780  bool buildObbTree(int depth);
     81  void checkCollision(WorldEntity* worldEntity);
     82
    7883  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    7984  virtual void collidesWithGround(const Vector& location);
     
    230235  int                     healthMax_handle;
    231236
     237  unsigned int*       Ind;
     238
     239
     240   #ifdef WITH_ODE     
     241  dTriMeshDataID   ODE_Geometry; //!< ODE Geometry Data of the static model
     242  dGeomID          ODE_Geom_ID; //!< ID of ODE Geometry Data
     243  dWorldID world;
     244  dSpaceID space;
     245  dJointGroupID contactgroup;
     246  dContact contact[300];
     247  #endif
    232248
    233249
Note: See TracChangeset for help on using the changeset viewer.