Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8714 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer


Ignore:
Timestamp:
Jun 22, 2006, 1:40:09 PM (18 years ago)
Author:
bottac
Message:

Ground walk

Location:
branches/bsp_model/src/lib/graphics/importer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8699 r8714  
    4141#include "world_entity.h"
    4242
    43 #include "aabb.h"
    44 
    4543#include "util/loading/load_param.h"
    4644#include "util/loading/factory.h"
     
    842840        this->checkBrushRayN(&curBrush);
    843841      if(curBrush.n_brushsides <=0) this->outputAllSolid = true;
    844     }
     842    }
     843   
    845844    return;
    846845  }
     
    909908
    910909}
     910
     911float BspManager::checkPatchAltitude(BspTreeNode* node)
     912{
     913  leaf& curLeaf = this->bspFile->leaves[node->leafIndex];
     914  for(int i = 0; i < curLeaf.n_leaffaces ; i++)
     915  {
     916   
     917  }
     918  return 10.0f;
     919}
     920
    911921void BspManager::checkCollisionBox(void)
    912922{
     
    944954  this->outputFraction = 1.0f;
    945955
    946   AABB* box = worldEntity->getModelAABB();
    947 
    948 
    949   Vector forwardDir;
    950   Vector upDir;
     956
     957
     958
     959  Vector forwardDir = worldEntity->getAbsDirX();
     960
     961
     962  Vector upDir = worldEntity->getAbsDirY();
     963  upDir.x = 0.0;
     964  upDir.y = 1.0;
     965  upDir.z = 0.0;
    951966  Vector dest;
    952   Vector position;
    953   Vector out;
    954   float height;
    955 
    956   if( box != NULL)
    957   {
    958     forwardDir = worldEntity->getAbsDirX();
    959     forwardDir = forwardDir * box->halfLength[0];
    960 
    961     upDir = Vector(0,1,0) * box->halfLength[1];
    962 
    963     position = worldEntity->getAbsCoor() + box->center + box->axis[1] * box->halfLength[1];
    964     dest     = worldEntity->getAbsCoor() + box->center - box->axis[1] * box->halfLength[1];
    965     out      = dest;
    966 
    967     height = box->halfLength[1];
    968   }
    969   else
    970   {
    971     forwardDir = worldEntity->getAbsDirX();
    972     forwardDir = forwardDir * 8.0f;
    973 
    974     upDir = worldEntity->getAbsDirY();
    975     upDir.x = 0.0;
    976     upDir.y = 1.0;
    977     upDir.z = 0.0;
    978     dest;
    979 
    980     position = worldEntity->getAbsCoor() + upDir*5.0f;
    981     dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    982     out = dest;
    983 
    984     height = 40;
    985   }
     967  /*
     968  dest.x  += forwardDir.x;
     969  dest.y  += forwardDir.y;
     970  dest.z  += forwardDir.z;
     971  */
     972  Vector position = worldEntity->getAbsCoor() + upDir*10.0f ;
     973  dest = worldEntity->getAbsCoor() - upDir*40.0f; //
     974  Vector out = dest;
    986975
    987976
     
    989978
    990979  bool collision = false;
    991   Vector position1 = position + Vector(0.0,0.1,0.0);
    992   Vector position2 = position + Vector(0.0,0.2,0.0);
    993   Vector dest1 = position1 + forwardDir;
     980  Vector position1 = position; // + Vector(0.0,0.6,0.0);
     981  Vector position2 = position + Vector(0.0,1.0,0.0);
     982  Vector dest1 = position + forwardDir*4.0f;
    994983  Vector dest2 = position2 + forwardDir;
    995 //   dest = position - Vector(0.0, 40.0,0.0);
     984  dest = position - Vector(0.0, 40.0,0.0);
    996985  Vector out1;
    997986  Vector out2;
    998987
    999988
    1000 
     989  float height = 40;
    1001990
    1002991  this->inputStart =  position;
    1003992  this->inputEnd =   dest;
    1004993  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
     994 
     995
    1005996
    1006997//   PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction);
    1007998//   PRINTF(0)("checking collision!! Pos.Coords: %f , %f , %f\n", position.x , position.y, position.z);
    1008999//   PRINTF(0)("checking collision!! Dest.Coords: %f , %f , %f\n", dest.x , dest.y, dest.z);
     1000
    10091001//   position1.debug();
    10101002
     
    10521044
    10531045  }
     1046 
     1047  plane* testPlane = this->collPlane;
     1048 
     1049  this->outputStartsOut = true;
     1050  this->outputAllSolid = false;
     1051  this->outputFraction = 1.0f;
     1052  this->inputStart =  position;
     1053  this->inputEnd =   dest1;
     1054  this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest1 );
     1055  out.x = this->outputFraction;
     1056  out.z = this->outputFraction;
     1057 
     1058  /*
     1059  out.x = position1.x + (dest.x -position1.x) * this->outputFraction;
     1060 
     1061  out.z = position1.z + (dest.z -position1.z) * this->outputFraction;
     1062  */
     1063 
     1064 
    10541065  // Return the normal here: Normal's stored in this->collPlane;
    10551066  if( collision) {
    10561067    PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    1057     worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
    1058   }
    1059   else  worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 1.0, 0.0), dest);
     1068    worldEntity->registerCollision(this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out);
     1069  }
     1070  else  worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest);
    10601071
    10611072}
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.h

    r8490 r8714  
    7373  void  checkCollisionRay(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
    7474  void  checkCollisionRayN(BspTreeNode * node,float startFraction, float endFraction, Vector* start, Vector* end);
    75   void TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
     75  void  TraceBox( Vector& inputStart, Vector& inputEnd,Vector& inputMins, Vector& inputMaxs );
    7676  void  checkCollisionBox(void);
    7777  void  checkBrushRay(brush* curBrush);
    7878  void  checkBrushRayN(brush* curBrush);
    79   void   checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
     79  void  checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd);
     80  float  checkPatchAltitude(BspTreeNode* node); //! To be implemented...
    8081
    8182  void drawDebugCube(Vector* cam);
Note: See TracChangeset for help on using the changeset viewer.