Changeset 1911

Show
Ignore:
Timestamp:
05/12/00 16:46:14 (9 years ago)
Author:
kevn
Message:

it all compiles now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/juggler_1.0/samples/nav/pfBoxCollider.h

    r1909 r1911  
    3232 */ 
    3333 
    34 #ifndef JUGGLER_PFVOLUME_COLLIDER 
    35 #define JUGGLER_PFVOLUME_COLLIDER 
     34#ifndef JUGGLER_PFBOX_COLLIDER 
     35#define JUGGLER_PFBOX_COLLIDER 
    3636 
    3737#include <collider.h> 
    38 #include <collide.h> 
     38#include <pfTerryBoxCollide.h> 
    3939 
    4040//: Collider class for testing collisions in Performer 
     
    4646//     So there is some coord system conversion that will be 
    4747//     going on here. 
    48 class pfVolumeCollider : public collider 
     48class pfBoxCollider : public collider 
    4949{ 
    5050public: 
    5151   // ARGS: world - The node to start collision with 
    5252   //       it should be the one under the one being used for navigation ( ie. pfNaver) 
    53    pfVolumeCollider(pfNode* world) : terryCollide( 0x1 ) 
     53   pfBoxCollider(pfNode* world) : terryCollide( 0x1 ) 
    5454   { 
    5555      mWorldNode = world; 
     
    6565public: 
    6666   pfNode* mWorldNode;        // The world to collide with 
    67    pfTerryVCollide terryCollide; 
     67   pfTerryBoxCollide terryCollide; 
    6868}; 
    6969 
    7070 
    71 bool pfVolumeCollider::testMove(vjVec3 whereYouAre, vjVec3 delta, vjVec3& correction, bool whereYouAreWithDelta) 
     71bool pfBoxCollider::testMove(vjVec3 whereYouAre, vjVec3 delta, vjVec3& correction, bool whereYouAreWithDelta) 
    7272{ 
    7373   //cout<<"Pos["<<whereYouAre<<"] :|: Vel["<<delta<<"]\n"<<flush; 
     
    9292      vol_radius = 1.0f; 
    9393       
    94    terryCollide.setVolumeRadius( vol_radius );    // Setup collision volume 
     94   terryCollide.setRadius( vol_radius );    // Setup collision volume 
    9595 
    96    if (terryCollide.collideVolume( pf_correction, mWorldNode, pf_new_pos) ) 
     96   if (terryCollide.collide( pf_correction, mWorldNode, pf_new_pos) ) 
    9797   { 
    9898      correction = vjGetVjVec(pf_correction); 
  • trunk/juggler_1.0/samples/nav/pfPogoCollider.h

    r1909 r1911  
    3636 
    3737#include <collider.h> 
    38 #include <collide.h> 
     38#include <pfTerryPogoCollide.h> 
    3939 
    4040//: Collider class for testing collisions in Performer 
     
    4646//     So there is some coord system conversion that will be 
    4747//     going on here. 
    48 class pfRideCollider : public collider 
     48class pfPogoCollider : public collider 
    4949{ 
    5050public: 
    5151   // ARGS: world - The node to start collision with 
    5252   //       it should be the one under the one being used for navigation ( ie. pfNaver) 
    53    pfRideCollider(pfNode* world) 
     53   pfPogoCollider(pfNode* world) 
    5454   { 
    5555      mWorldNode = world; 
     
    6565protected: 
    6666   pfNode* mWorldNode;        // The world to collide with 
    67    pfTerryRCollide terryCollide; 
     67   pfTerryPogoCollide terryCollide; 
    6868}; 
    6969 
    7070 
    71 bool pfRideCollider::testMove(vjVec3 whereYouAre, vjVec3 delta, vjVec3& correction, bool whereYouAreWithDelta) 
     71bool pfPogoCollider::testMove(vjVec3 whereYouAre, vjVec3 delta, vjVec3& correction, bool whereYouAreWithDelta) 
    7272{ 
    7373   pfVec3 pf_cur_pos = vjGetPfVec(whereYouAre); 
     
    8181   float delta_mag = pf_delta.length(); 
    8282   if(delta_mag > height) 
    83       cerr << "ERROR: pfRideCollider: Trying to move faster than the vector is checking.\n"; 
     83      cerr << "ERROR: pfPogoCollider: Trying to move faster than the vector is checking.\n"; 
    8484 
    8585   // This function tests to make sure that for height straight down, there is no collision 
     
    8989   pf_new_pos += pfVec3(0,0,height); 
    9090 
    91    if (terryCollide.collideGround(pf_correction,mWorldNode,0x1,pf_new_pos, height)) 
     91   if (terryCollide.collide( pf_correction, mWorldNode, 0x1, pf_new_pos, height)) 
    9292   { 
    9393      correction = vjGetVjVec(pf_correction); 
  • trunk/juggler_1.0/samples/nav/pfTerryBoxCollide.cxx

    r1909 r1911  
    1 #include "collide.h" 
     1#include "pfTerryBoxCollide.h" 
    22 
    33const int pfTerryBoxCollide::COLLIDE_SEGMENTS( 8 ); 
  • trunk/juggler_1.0/samples/nav/pfTerryBoxCollide.h

    r1909 r1911  
    99#include <iostream.h> 
    1010#include <math.h> 
     11 
     12#include "pfTerryCollide.h" // my base class 
    1113 
    1214/////////////////////////////////////////////////////////////////////////////////// 
  • trunk/juggler_1.0/samples/nav/pfTerryCollide.cxx

    r1909 r1911  
     1#include "pfTerryCollide.h" 
     2 
    13// Set up intersection masks for collision detection using 'mask' as the 
    24// intersection mask. Cache normals and such inside geosets if the geometry 
     
    46void pfTerryCollide::nodeSetup( pfNode *node, int mode, int mask ) 
    57{ 
    6     int fullmode; 
     8   int fullmode; 
    79 
    8     if (mode == COLLIDE_DYNAMIC) 
    9         fullmode = PFTRAV_SELF|PFTRAV_DESCEND|PFTRAV_IS_UNCACHE; 
    10     else 
    11         fullmode = PFTRAV_SELF|PFTRAV_DESCEND|PFTRAV_IS_CACHE; 
    12     node->setTravMask(PFTRAV_ISECT, mask, fullmode, PF_SET); 
     10   if (mode == COLLIDE_DYNAMIC) 
     11      fullmode = PFTRAV_SELF|PFTRAV_DESCEND|PFTRAV_IS_UNCACHE; 
     12   else 
     13      fullmode = PFTRAV_SELF|PFTRAV_DESCEND|PFTRAV_IS_CACHE; 
     14 
     15   node->setTravMask(PFTRAV_ISECT, mask, fullmode, PF_SET); 
    1316} 
  • trunk/juggler_1.0/samples/nav/pfTerryPogoCollide.cxx

    r1910 r1911  
    1 bool pfTerryGroundCollide::collideGround( pfVec3 &bounce, pfNode *objNode, int mask, pfVec3 pos, float length ) 
     1#include "pfTerryPogoCollide.h" 
     2 
     3bool pfTerryPogoCollide::collide( pfVec3 &bounce, pfNode *objNode, int mask, pfVec3 pos, float length ) 
    24{ 
    35    pfHit **hit[1]; 
     
    4143 
    4244 
    43 bool pfTerryGroundCollide::collideGroundAndRide( pfVec3 &bounce, pfVec3 &ridexyz, pfVec3 &ridehpr, pfNode *objNode, int mask, pfVec3 pos, float length ) 
     45bool pfTerryPogoCollide::collideRide( pfVec3 &bounce, pfVec3 &ridexyz, pfVec3 &ridehpr, pfNode *objNode, int mask, pfVec3 pos, float length ) 
    4446{ 
    4547   pfHit** hit[1]; 
  • trunk/juggler_1.0/samples/nav/pfTerryPogoCollide.h

    r1910 r1911  
    1010#include <math.h> 
    1111 
     12#include "pfTerryCollide.h" // my base class 
     13 
    1214/////////////////////////////////////////////////////////////////////////////////// 
    1315// Down vector "Pogostick" (or ground) collision 
    1416///////////////////////////////// 
    1517 
    16 class pfTerryPogostickCollide : public pfTerryCollide 
     18class pfTerryPogoCollide : public pfTerryCollide 
    1719{ 
    1820public: 
  • trunk/juggler_1.0/samples/nav/velocityNav.h

    r1907 r1911  
    3535#include <navigator.h> 
    3636#include <collider.h> 
     37#include <vector> 
    3738#include "StopWatch.h" 
    3839 
     
    8889   { mMode = new_mode; } 
    8990 
    90    void setGravityCollider(collider* val) { mGravCollider = val;} 
    91    void setCorrectingCollider(collider* val) { mCorrectingCollider = val;} 
    92  
     91   //: yes! you can add any number of colliders! 
     92   void addCollider( collider* val ) 
     93   {  
     94      mCollider.push_back( val ); 
     95   } 
     96   
    9397   // query the current speed. 
    9498   float speed() const; 
     
    125129   navMode  mMode; 
    126130   int mTimeHack; 
     131    
     132   std::vector<collider*> mCollider; 
    127133}; 
    128134 
     
    254260    
    255261    
    256    // Begin collision testing::: 
    257    // TODO: collision is limited to 2 colliders for now.  This could easily be expanded. 
    258    // TODONOTE: if you do expand, then you'll need to fix the HACK(!) 
    259     
    260    if ((mGravCollider != NULL) && mGravCollider->testMove( whereYouAre, mcDist2Move, correction)) 
    261    { 
    262       //cout<<"Collide Grav!\n"<<flush; 
    263       mcDist2Move += correction; 
    264       //totalCorrections += correction; 
    265        
    266       // HACK(!) - use the correction vectors to decide how much velocity from gravity to remove 
    267       //        here i'm just zeroing it out. 
    268       mVelocityFromGravityAccumulator.set( 0.0f, 0.0f, 0.0f ); 
    269    }  
    270     
    271    if ((mCorrectingCollider != NULL) && mCorrectingCollider->testMove( whereYouAre, mcDist2Move, correction)) 
    272    { 
    273       //cout<<"Collide Ray!\n"<<flush; 
    274       mcDist2Move += correction; 
    275       //totalCorrections += correction; 
    276    } 
    277     
    278    // End collision testing::: 
     262   //////////////////////////////////////////////////////////// 
     263   // Test for collisions with all registered colliders 
     264   //////////////////////////////////////////////////////////// 
     265   for (int x = 0; x < mCollider.size(); ++x) 
     266   { 
     267      // If collision, then ... 
     268      if (mCollider[x]->testMove( whereYouAre, mcDist2Move, correction )) 
     269      { 
     270         // ... apply the correction. 
     271         mcDist2Move += correction; 
     272         //totalCorrections += correction; 
     273 
     274         // HACK(!) - use the correction vectors to decide how much velocity from gravity to remove 
     275         //        here i'm just zeroing it out... sometimes many times per frame!!! (real bad) 
     276         //    this should really only be affected by the Y component of the correction vector. 
     277         mVelocityFromGravityAccumulator.set( 0.0f, 0.0f, 0.0f ); 
     278      }  
     279   } 
    279280 
    280281    
     
    290291   //mVelocityFromGravityAccumulator += subtractfromGravVel; 
    291292    
     293    
    292294   // the navTranslate() function requires a translation in local coordinates 
    293295   // move the vector back from modelspace to localspace 
    294     
    295296   distanceToMove.xformFull( IcurrentRotation, mcDist2Move ); 
    296297   this->navTranslate( distanceToMove );