Changeset 7958 in orxonox.OLD for branches/cr
- Timestamp:
- May 29, 2006, 5:32:42 PM (19 years ago)
- Location:
- branches/cr/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cr/src/lib/collision_detection/obb_tree_node.cc
r7957 r7958 523 523 nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement); 524 524 } 525 526 527 528 /* check if left node overlaps */529 // if( this->nodeLeft != NULL )530 // {531 // PRINTF(5)("Checking OBB %i vs %i: ", this->nodeLeft->getIndex(), treeNode->getIndex());532 // if( this->overlapTest(this->nodeLeft->bvElement, treeNode->bvElement, nodeA, nodeB))533 // {534 // this->nodeLeft->collideWith(treeNode->nodeLeft, nodeA, nodeB);535 // this->nodeLeft->collideWith(treeNode->nodeRight, nodeA, nodeB);536 // }537 // }538 539 /* check if right node overlaps */540 // if( likely( this->nodeRight != NULL))541 // {542 // PRINTF(5)("Checking OBB %i vs %i: ", this->nodeRight->getIndex(), treeNode->getIndex());543 // if(this->overlapTest(this->nodeRight->bvElement, treeNode->bvElement, nodeA, nodeB))544 // {545 // this->nodeRight->collideWith(treeNode->nodeLeft, nodeA, nodeB);546 // this->nodeRight->collideWith(treeNode->nodeRight, nodeA, nodeB);547 // }548 // }549 550 /* so there is a collision and this is the last box in the tree (i.e. leaf) */551 // if( unlikely((this->nodeRight == NULL || this->nodeLeft == NULL) ||552 // (treeNode->nodeRight == NULL || treeNode->nodeLeft == NULL)) )553 // {554 // nodeA->collidesWith(nodeB, treeNode->bvElement->center);555 // nodeB->collidesWith(nodeA, this->bvElement->center);556 // nodeA->registerCollision(nodeA, nodeB, (BoundingVolume*)this->bvElement, (BoundingVolume*)treeNode->bvElement);557 // }558 525 559 526 } -
branches/cr/src/lib/collision_reaction/cr_engine.cc
r7950 r7958 52 52 53 53 if( this->cachedCollisions.size() != CR_MAX_COLLISIONS) 54 PRINTF(0)("CollisionReaction Error: cache size missmatch: %i of %i\n", this->cachedCollisions.size(), CR_ NUMBER);54 PRINTF(0)("CollisionReaction Error: cache size missmatch: %i of %i\n", this->cachedCollisions.size(), CR_MAX_COLLISIONS); 55 55 56 56 this->reset(); … … 59 59 for(; it < this->cachedCollisions.end(); it++) 60 60 delete *it; 61 62 // while( !this->cachedCollisions.empty())63 // delete this->cachedCollisions.back();64 61 65 62 this->cachedCollisions.clear(); -
branches/cr/src/lib/collision_reaction/cr_engine.h
r7946 r7958 51 51 52 52 /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */ 53 inline Collision* popCollisionObject() { if(!this->cachedCollisions.empty()) { this->cachedCollisions.back(); this->cachedCollisions.pop_back();} else return NULL; }53 inline Collision* popCollisionObject() { if(!this->cachedCollisions.empty()) { return this->cachedCollisions.back(); this->cachedCollisions.pop_back();} else return NULL; } 54 54 /** @param collision: returns the Collision object back to the cache list */ 55 55 inline void pushCollisionObject(Collision* collision) { this->cachedCollisions.push_back(collision); } -
branches/cr/src/world_entities/world_entity.cc
r7957 r7958 256 256 this->collisionHandles[type] = CREngine::getInstance()->subscribeReaction(this, type); 257 257 258 // add the target filter 258 259 va_list itemlist; 259 260 va_start (itemlist, target); … … 261 262 this->collisionHandles[type]->addTarget(va_arg(itemlist, long)); 262 263 va_end(itemlist); 264 265 // now there is at least one collision reaction subsribed 266 this->bReactive = true; 263 267 } 264 268 … … 275 279 CREngine::getInstance()->unsubscribeReaction(this->collisionHandles[type]); 276 280 this->collisionHandles[type] = NULL; 281 282 // 277 283 } 278 284 … … 285 291 for( int i = 0; i < CREngine::CR_NUMBER; i++) 286 292 this->unsubscribeReaction((CREngine::CRType)i); 293 294 this->bReactive = false; 287 295 } 288 296 -
branches/cr/src/world_entities/world_entity.h
r7946 r7958 73 73 void unsubscribeReaction(CREngine::CRType type); 74 74 void unsubscribeReaction(); 75 75 76 bool registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB); 77 /** @return true if there is at least on collision reaction subscribed */ 78 inline bool isReactive() const { return this->bReactive; } 76 79 77 80 … … 140 143 float scaling; //!< the scaling of the model 141 144 CollisionHandle* collisionHandles[CREngine::CR_NUMBER]; //!< the list of the collision reactions 145 bool bReactive; //!< true if there is at least one collision reaction subscibed 142 146 143 147
Note: See TracChangeset
for help on using the changeset viewer.