Changeset 8468 in orxonox.OLD for branches/bsp_model/src/lib
- Timestamp:
- Jun 15, 2006, 2:57:44 PM (18 years ago)
- Location:
- branches/bsp_model/src/lib/graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/graphics_engine.cc
r8322 r8468 66 66 67 67 this->bDisplayFPS = false; 68 this->bAntialiasing = true;68 this->bAntialiasing = false; 69 69 this->minFPS = 9999; 70 70 this->maxFPS = 0; -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8456 r8468 50 50 BspManager::BspManager(WorldEntity* parent) 51 51 { 52 this->outputStartsOut = true; 53 this->outputAllSolid = false; 54 this->outputFraction = 1.0f; 52 55 53 this->parent = parent; 56 54 /*// open a BSP file … … 595 593 float startFraction = -1.0f; 596 594 float endFraction = 1.0f; 597 bool startsOut = false; 598 bool endsOut = false; 599 600 Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor(); 601 Vector inputEnd = State::getCameraTargetNode()->getAbsCoor(); 595 bool startsOut = false; 596 bool endsOut = false; 597 598 // Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor(); 599 // Vector inputEnd = State::getCameraTargetNode()->getAbsCoor(); 600 601 for (int i = 0; i < curBrush->n_brushsides; i++) { 602 brushside& curBrushSide = this->bspFile->brushSides[curBrush->brushside + i] ; 603 plane& curPlane = this->bspFile->planes[curBrushSide.plane] ; 604 605 startDistance = inputStart.x * curPlane.x + inputStart.y * curPlane.y+ inputStart.z * curPlane.z - curPlane.d; 606 endDistance = inputEnd.x * curPlane.x +inputEnd.y * curPlane.y +inputEnd.z * curPlane.z -curPlane.d; 607 608 if (startDistance > 0) 609 startsOut = true; 610 if (endDistance > 0) 611 endsOut = true; 612 613 // make sure the trace isn't completely on one side of the brush 614 if (startDistance > 0 && endDistance > 0) { // both are in front of the plane, its outside of this brush 615 return; 616 } 617 if (startDistance <= 0 && endDistance <= 0) { // both are behind this plane, it will get clipped by another one 618 continue; 619 } 620 621 // MMM... BEEFY 622 if (startDistance > endDistance) { // line is entering into the brush 623 float fraction = (startDistance - EPSILON) / (startDistance - endDistance); // * 624 if (fraction > startFraction) 625 startFraction = fraction; 626 // store plane 627 this->collPlane = &curPlane; 628 629 } else { // line is leaving the brush 630 float fraction = (startDistance + EPSILON) / (startDistance - endDistance); // * 631 if (fraction < endFraction) 632 endFraction = fraction; 633 // store plane 634 this->collPlane = & curPlane; 635 636 } 637 638 } 639 if (startsOut == false) { 640 this->outputStartsOut = false; 641 if (endsOut == false) 642 this->outputAllSolid = true; 643 return; 644 } 645 646 if (startFraction < endFraction) { 647 if (startFraction > -1.0f && startFraction < outputFraction) { 648 if (startFraction < 0) 649 startFraction = 0; 650 this->outputFraction = startFraction; 651 } 652 } 653 654 } 655 656 void BspManager::checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd) 657 { 658 float EPSILON = 0.000001; 659 float startDistance; 660 float endDistance; 661 662 float startFraction = -1.0f; 663 float endFraction = 1.0f; 664 bool startsOut = false; 665 bool endsOut = false; 666 667 //Vector inputStart = State::getCameraTargetNode()->getLastAbsCoor(); 668 //Vector inputEnd = State::getCameraTargetNode()->getAbsCoor(); 602 669 603 670 for (int i = 0; i < curBrush->n_brushsides; i++) { … … 870 937 void BspManager::checkCollision(WorldEntity* worldEntity) 871 938 { 872 Vector position = worldEntity->getLastAbsCoor(); 939 940 this->outputStartsOut = true; 941 this->outputAllSolid = false; 942 this->outputFraction = 1.0f; 943 944 Vector position = worldEntity->getAbsCoor(); 873 945 874 946 … … 877 949 878 950 Vector upDir = worldEntity->getAbsDirY(); 879 Vector dest = position; 951 upDir.x = 0.0; 952 upDir.y = 1.0; 953 upDir.z = 0.0; 954 Vector dest; 880 955 /* 881 956 dest.x += forwardDir.x; … … 884 959 */ 885 960 886 dest = worldEntity->getAbsCoor() ;961 dest = worldEntity->getAbsCoor() - upDir*40.0; 887 962 Vector out = dest; 888 963 … … 901 976 902 977 float height = 40; 903 this->outputAllSolid = false; 904 978 979 this->inputStart = position; 980 this->inputEnd = dest; 905 981 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 906 982 907 983 PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction); 984 PRINTF(0)("checking collision!! Pos.Coords: %f , %f , %f\n", position.x , position.y, position.z); 985 PRINTF(0)("checking collision!! Dest.Coords: %f , %f , %f\n", dest.x , dest.y, dest.z); 908 986 // position1.debug(); 909 987 -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.h
r8317 r8468 77 77 void checkBrushRay(brush* curBrush); 78 78 void checkBrushRayN(brush* curBrush); 79 void checkBrushRayN(brush* curBrush, Vector& inputStart, Vector& inputEnd); 80 79 81 void drawDebugCube(Vector* cam); 80 82 bool isAlreadyVisible(int Face); … … 94 96 bool outputAllSolid; 95 97 float outputFraction; 98 Vector inputStart; 99 Vector inputEnd; 100 96 101 Vector traceMins; //!< Mins of current bbox 97 102 Vector traceMaxs; //!< Maxs of current bbox
Note: See TracChangeset
for help on using the changeset viewer.