Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8334 in orxonox.OLD


Ignore:
Timestamp:
Jun 12, 2006, 11:56:02 PM (18 years ago)
Author:
patrick
Message:

bsp: just a very little cleanup to make it more readable. no change in content

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

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8325 r8334  
    5353void CRPhysicsGroundWalk::reactToCollision(Collision* collision)
    5454{
    55 //   CollisionEvent* ce = collision->getCollisionEvents().front();
    56 //   Vector normal = ce->getGroundNormal();
    57 //   normal.normalize();
    58 //
    59 //   Vector position = ce->getCollisionPosition();
     55  CollisionEvent* ce = collision->getCollisionEvents().front();
     56  Vector normal = ce->getGroundNormal();
     57  normal.normalize();
    6058
     59  // put it back
     60  PRINTF(0)("putting it back to lastPos: \n");
     61  this->lastPosition.debug();
     62  PRINTF(0)("current pos:\n");
     63  collision->getEntityB()->getAbsCoor().debug();
    6164
    62   if( this->lastPosition != collision->getEntityB()->getAbsCoor())
    63   {
    64   // put it back
    65     PRINTF(0)("putting it back to: \n");
    66     this->lastPosition.debug();
    67     this->afterLastPosition.debug();
    68 
    69     collision->getEntityB()->setVelocity(Vector());
    70     collision->getEntityB()->setAbsCoor(this->afterLastPosition);
    71   }
     65  collision->getEntityB()->setVelocity(Vector());
     66  collision->getEntityB()->setAbsCoor(this->lastPosition);
    7267}
    7368
  • branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc

    r8329 r8334  
    103103const void BspManager::tick(float time)
    104104{
    105  
     105
    106106  if(!this->bspFile->MovieMaterials.empty())
    107107  {
     
    109109      while(it != this->bspFile->MovieMaterials.end())
    110110      {
    111          (*it)->tick(time); 
     111         (*it)->tick(time);
    112112        it++;
    113113      }
    114114 //this->bspFile->MovieMaterials.front()->tick(time );
    115  
    116  
    117   }
    118  
     115
     116
     117  }
     118
    119119}
    120120const void BspManager::draw()
     
    319319    if(this->bspFile->Materials[curFace.texture].animated) {
    320320     // glBlendFunc(GL_ZERO,GL_ONE);
    321    
    322    
    323      
     321
     322
     323
    324324      if(this->bspFile->Materials[curFace.texture].aviMat->getStatus() == 2) this->bspFile->Materials[curFace.texture].aviMat->start(0);
    325325      //this->bspFile->Materials[curFace.texture].aviMat->tick(0.005);
     
    328328      glBindTexture(GL_TEXTURE_2D, n );
    329329      this->lastTex = curFace.texture;
    330      
     330
    331331    } else {
    332332      this->bspFile->Materials[curFace.texture].mat->select();
     
    755755
    756756  float EPSILON = 0.000001;
    757   float  endDistance = (end)->x * (node->plane.x) +(end)->y * (node->plane.y) +(end)->z * (node->plane.z)  - node->d;
    758   float  startDistance = (start)->x * (node->plane.x)+ (start)->y * (node->plane.y)+ (start)->z * (node->plane.z)- node->d;
    759 
    760 
    761   if(node->isLeaf) {
     757
     758  float endDistance = end->dot(node->plane) - node->d;
     759  float startDistance = start->dot(node->plane) - node->d;
     760
     761
     762  if( node->isLeaf) {
    762763    leaf& curLeaf = this->bspFile->leaves[node->leafIndex];
    763764    for (int i = 0; i <  curLeaf.n_leafbrushes ; i++) {
     
    812813
    813814    // STEP 3: calculate the middle point for the first side
    814     middleFraction = startFraction +
    815                      (endFraction - startFraction) * fraction1;
    816 
    817     middle.x = start->x + fraction1 * (end->x - start->x);
    818     middle.y = start->y + fraction1 * (end->y - start->y);
    819     middle.z = start->z + fraction1 * (end->z - start->z);
     815    middleFraction = startFraction + (endFraction - startFraction) * fraction1;
     816    middle = (*start) + ((*end) - (*start)) * fraction1;
     817
    820818
    821819    // STEP 4: check the first side
     
    827825
    828826    // STEP 5: calculate the middle point for the second side
    829     middleFraction = startFraction +
    830                      (endFraction - startFraction) * fraction2;
    831 
    832     middle.x = start->x + fraction2 * (end->x - start->x);
    833     middle.y = start->y + fraction2 * (end->y - start->y);
    834     middle.z = start->z + fraction2 * (end->z - start->z);
     827    middleFraction = startFraction + (endFraction - startFraction) * fraction2;
     828    middle = (*start) + ((*end) - (*start)) * fraction2;
    835829
    836830    // STEP 6: check the second side
     
    886880  dest.z  += forwardDir.z;
    887881  */
    888  
     882
    889883  dest = worldEntity->getAbsCoor();
    890884  Vector out = dest;
    891 
    892 
    893 
    894 
    895 
    896 
    897 
    898885
    899886
     
    913900    Vector out1;
    914901    Vector out2;
    915     /*
    916     this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    917     if(this->outputFraction == 1.0f)  out1 = dest;
    918     else {(
    919       collision = true;
    920       out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction;
    921       out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction;
    922       out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction;
    923 
    924     }
    925 
    926     this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
    927     if(this->outputFraction == 1.0f) out2= dest;
    928     else {
    929       collision = true;
    930       out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction;
    931       out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction;
    932       out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction;
    933 
    934     }
    935 
    936     */
     902
    937903
    938904    float height = 40;
     
    940906
    941907    this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    942     if(this->outputFraction == 1.0f)
     908
     909    if( this->outputFraction == 1.0f)
    943910    {
    944911      if(this->outputAllSolid)
    945912      {
     913        PRINTF(0)("this output all solid\n");
    946914        this->collPlane = new plane;
    947915        this->collPlane->x = 1.0f;
     
    949917        this->collPlane->z = 0.0f;
    950918        collision = true;
    951        
    952919      }
    953       else collision = false;
     920      else
     921        collision = false;
     922
     923
    954924      out = dest;
    955      
    956925    }
    957926    else {
    958      
     927
    959928      collision = true;
    960929      out.x = position.x + (dest.x -position.x) * this->outputFraction;
     
    968937      //this->drawDebugCube(&out1);
    969938      //this->drawDebugCube(&out2);
    970 
    971939      //this->drawDebugCube(&out3);
    972 
    973     }
    974 
    975 
    976 
     940    }
    977941    // Return the normal here: Normal's stored in this->collPlane;
    978 
    979942    if(collision ) {
    980943      PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    981944      worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out);
    982945    }
    983       //worldEntity->collidesWithGround(out,out1,out2);
    984 //     registerCollision(WorldEntity* entity, Vector(this->collPlane.x, ), Vector position);
    985 
    986946  }
    987947
Note: See TracChangeset for help on using the changeset viewer.