Changeset 8030 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- May 31, 2006, 3:22:23 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r7833 r8030 52 52 53 53 54 55 56 54 this->drawDebugCube(&this->out); 55 this->out1 = this->out; 56 this->out2 = this->out; 57 if(this->collPlane != NULL) 58 { 59 this->out1.x += this->collPlane->x*5.0; 60 this->out1.y += this->collPlane->y*5.0; 61 this->out1.z += this->collPlane->z*5.0; 62 63 this->out2.x += this->collPlane->x*10.0; 64 this->out2.y += this->collPlane->y*10.0; 65 this->out2.z += this->collPlane->z*10.0; 66 } 67 this->drawDebugCube(&this->out1); 68 this->drawDebugCube(&this->out2); 69 57 70 // Draw Debug Terrain 58 71 /* … … 98 111 this->checkCollisionRay(this->root,0.0f,1.0f, &(State::getCameraTargetNode()->getLastAbsCoor()), &this->cam); 99 112 100 if(this->outputFraction != 1.0f || this->outputAllSolid ) this->drawDebugCube(&this->cam);113 //if(this->outputFraction != 1.0f || this->outputAllSolid ) this->drawDebugCube(&this->cam); 101 114 102 115 if ( viscluster < 0 || ((int *)(this->bspFile->header))[35] == 0 ) //!< if (sizeof(Visdata) == 0) … … 117 130 118 131 Vector dir; 119 dir.x = State::getCameraNode()->getAbsDir Z().x;120 dir.y = State::getCameraNode()->getAbsDir Z().y;121 dir.z = State::getCameraNode()->getAbsDir Z().z;132 dir.x = State::getCameraNode()->getAbsDirX().x; 133 dir.y = State::getCameraNode()->getAbsDirX().y; 134 dir.z = State::getCameraNode()->getAbsDirX().z; 122 135 float dist = dir.x*this->cam.x +dir.y*this->cam.y +dir.z*this->cam.z; 123 136 //if(dist < 0) dist = -dist; … … 125 138 const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist ; 126 139 127 if(dMins < -1 .0 && dMaxs < -1.0) {128 //continue;140 if(dMins < -150.0 && dMaxs < -150.0) { 141 continue; 129 142 } 130 143 if( (this->cam - Vector(curLeaf.mins[0],curLeaf.mins[1], curLeaf.mins[2])).len() > 3000 && (this->cam - Vector(curLeaf.maxs[0],curLeaf.maxs[1], curLeaf.maxs[2])).len() > 3000) { 131 //continue;144 continue; 132 145 } 133 146 … … 179 192 const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist; 180 193 181 if(dMins < - 30.0 && dMaxs < -30.0) {194 if(dMins < -100.0 && dMaxs < - 100.0) { 182 195 continue; 183 196 } … … 466 479 if (fraction > startFraction) 467 480 startFraction = fraction; 481 // store plane 482 this->collPlane = &curPlane; 483 468 484 } else { // line is leaving the brush 469 485 float fraction = (startDistance + EPSILON) / (startDistance - endDistance); // * 470 486 if (fraction < endFraction) 471 487 endFraction = fraction; 488 // store plane 489 this->collPlane = & curPlane; 490 472 491 } 473 492 … … 484 503 if (startFraction < 0) 485 504 startFraction = 0; 486 this->outputFraction = startFraction; 505 this->outputFraction = startFraction; 487 506 } 488 507 } … … 587 606 void BspManager::checkCollision(WorldEntity* worldEntity) 588 607 { 589 608 // return; 609 590 610 Vector position = worldEntity->getAbsCoor(); 591 611 592 612 593 613 Vector forwardDir = worldEntity->getAbsDirX(); 594 forwardDir.x = 10*forwardDir.x;595 forwardDir.y = 10*forwardDir.y;596 forwardDir.z = 10*forwardDir.z;614 forwardDir.x =2.0*forwardDir.x; 615 forwardDir.y =2.0*forwardDir.y; 616 forwardDir.z =2.0*forwardDir.z; 597 617 598 618 Vector upDir = worldEntity->getAbsDirY(); … … 643 663 out.y = position.y + (dest.y -position.y) * this->outputFraction; 644 664 out.z = position.z + (dest.z -position.z) * this->outputFraction; 665 666 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 667 this->out = out; 668 this->out1 = out1; 669 this->out2 = out2; 670 //this->drawDebugCube(&out1); 671 //this->drawDebugCube(&out2); 672 673 //this->drawDebugCube(&out3); 645 674 646 675 } 647 676 648 if(collision) worldEntity->collidesWithGround(out,out1,out2);677 // if(collision) worldEntity->collidesWithGround(out,out1,out2); 649 678 650 679 }
Note: See TracChangeset
for help on using the changeset viewer.