Changeset 10073 for code/branches/presentationFS14/src
- Timestamp:
- May 22, 2014, 2:49:16 PM (11 years ago)
- Location:
- code/branches/presentationFS14
- Files:
-
- 28 edited
- 8 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationFS14
- Property svn:mergeinfo changed
/code/branches/modularships (added) merged: 9994-9997,10001-10003,10007,10011,10019,10023,10029,10033,10036,10052-10055,10058,10067-10068,10071
- Property svn:mergeinfo changed
-
code/branches/presentationFS14/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
r8393 r10073 21 21 #include "LinearMath/btAabbUtil2.h" 22 22 #include "btManifoldResult.h" 23 #include <iostream> 23 24 24 25 btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped) … … 115 116 void ProcessChildShape(btCollisionShape* childShape,int index) 116 117 { 117 btAssert(index>=0); 118 // std::cout << "PCS: " << childShape << std::endl; // FIXME: (noep) remove DEBUG 119 btAssert(index>=0); 118 120 btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape()); 119 121 btAssert(index<compoundShape->getNumChildShapes()); -
code/branches/presentationFS14/src/modules/weapons/projectiles/BasicProjectile.cc
r9667 r10073 78 78 @see Pawn.h 79 79 */ 80 bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint )80 bool BasicProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs) 81 81 { 82 82 if (!this->bDestroy_ && GameMode::isMaster()) … … 96 96 if (victim) 97 97 { 98 victim->hit(this->getShooter(), contactPoint, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());98 victim->hit(this->getShooter(), contactPoint, cs, this->getDamage(), this->getHealthDamage(), this->getShieldDamage()); 99 99 victim->startReloadCountdown(); 100 100 } … … 141 141 } 142 142 143 143 144 /** 144 145 @brief -
code/branches/presentationFS14/src/modules/weapons/projectiles/BasicProjectile.h
r9667 r10073 119 119 120 120 protected: 121 bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint );121 bool processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs); 122 122 void destroyCheck(void); 123 123 -
code/branches/presentationFS14/src/modules/weapons/projectiles/Projectile.cc
r9667 r10073 88 88 } 89 89 90 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)90 bool Projectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 91 91 { 92 return this->processCollision(otherObject, contactPoint );92 return this->processCollision(otherObject, contactPoint, cs); 93 93 } 94 94 -
code/branches/presentationFS14/src/modules/weapons/projectiles/Projectile.h
r9667 r10073 64 64 65 65 virtual void tick(float dt); 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 67 67 68 68 private: -
code/branches/presentationFS14/src/modules/weapons/projectiles/Rocket.cc
r9667 r10073 191 191 } 192 192 193 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)194 { 195 return this->processCollision(otherObject, contactPoint );193 bool Rocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 194 { 195 return this->processCollision(otherObject, contactPoint, cs); 196 196 } 197 197 -
code/branches/presentationFS14/src/modules/weapons/projectiles/Rocket.h
r9667 r10073 64 64 virtual void tick(float dt); //!< Defines which actions the Rocket has to take in each tick. 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 67 67 virtual void destroyObject(void); 68 68 void destructionEffect(); -
code/branches/presentationFS14/src/modules/weapons/projectiles/SimpleRocket.cc
r9667 r10073 172 172 } 173 173 174 bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)175 { 176 return this->processCollision(otherObject, contactPoint );174 bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 175 { 176 return this->processCollision(otherObject, contactPoint, cs); 177 177 } 178 178 -
code/branches/presentationFS14/src/modules/weapons/projectiles/SimpleRocket.h
r9667 r10073 64 64 virtual void tick(float dt); 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 67 67 68 68 void disableFire(); //!< Method to disable the fire and stop all acceleration -
code/branches/presentationFS14/src/orxonox/CMakeLists.txt
r9348 r10073 31 31 PawnManager.cc 32 32 PlayerManager.cc 33 ShipPartManager.cc 33 34 Radar.cc 34 35 # Test.cc -
code/branches/presentationFS14/src/orxonox/OrxonoxPrereqs.h
r9348 r10073 142 142 143 143 // items 144 class ShipPart; 145 class PartDestructionEvent; 144 146 class Engine; 145 147 class Item; … … 189 191 class Pawn; 190 192 class SpaceShip; 193 class ModularSpaceShip; 191 194 class Spectator; 192 195 class TeamBaseMatchBase; -
code/branches/presentationFS14/src/orxonox/Scene.cc
r9667 r10073 349 349 SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer()); 350 350 351 // get the CollisionShape pointers 352 const btCollisionShape* cs0 = colObj0->getCollisionShape(); 353 const btCollisionShape* cs1 = colObj1->getCollisionShape(); 354 351 355 // false means that bullet will assume we didn't modify the contact 352 356 bool modified = false; 353 357 if (object0->isCollisionCallbackActive()) 354 modified |= object0->collidesAgainst(object1, c p);358 modified |= object0->collidesAgainst(object1, cs1, cp); 355 359 if (object1->isCollisionCallbackActive()) 356 modified |= object1->collidesAgainst(object0, c p);360 modified |= object1->collidesAgainst(object0, cs0, cp); 357 361 358 362 return modified; -
code/branches/presentationFS14/src/orxonox/Scene.h
r9667 r10073 143 143 int index0, const btCollisionObject* colObj1, int partId1, int index1); 144 144 145 static bool customCollisionCallback(btManifoldPoint& cp, const btCollisionObject* colObj0, int partId0, 146 int index0, const btCollisionObject* colObj1, int partId1, int index1); 147 145 148 // Bullet objects 146 149 btDiscreteDynamicsWorld* physicalWorld_; -
code/branches/presentationFS14/src/orxonox/collisionshapes/CollisionShape.h
r9667 r10073 170 170 void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape. 171 171 172 inline unsigned int getParentID() 173 { return this->parentID_; } 174 175 inline CompoundCollisionShape* getParent() 176 { return this->parent_; } 177 172 178 protected: 173 179 virtual void updateParent(); // Updates the CompoundCollisionShape the CollisionShape belongs to, after the CollisionShape has changed. -
code/branches/presentationFS14/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r9667 r10073 39 39 #include "core/XMLPort.h" 40 40 #include "tools/BulletConversions.h" 41 42 #include "collisionshapes/WorldEntityCollisionShape.h" 41 43 42 44 namespace orxonox … … 118 120 this->updatePublicShape(); 119 121 } 122 123 // If the shape to be attached is not a CompoundCollisionShape (thus an actual physical shape) & this is a WorldEntity's CollisionShape, 124 // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to. 125 if (!orxonox_cast<CompoundCollisionShape*>(shape) && orxonox_cast<WorldEntityCollisionShape*>(this)) 126 shape->getCollisionShape()->setUserPointer(orxonox_cast<WorldEntityCollisionShape*>(this)->getWorldEntityOwner()); 120 127 } 121 128 … … 297 304 this->updatePublicShape();*/ 298 305 } 306 307 int CompoundCollisionShape::getNumChildShapes() 308 { 309 return this->compoundShape_->getNumChildShapes(); 310 } 299 311 } -
code/branches/presentationFS14/src/orxonox/collisionshapes/CompoundCollisionShape.h
r9667 r10073 71 71 72 72 virtual void changedScale(); 73 int getNumChildShapes(); 74 75 inline std::map<CollisionShape*, btCollisionShape*> getShapesMap() 76 { 77 return attachedShapes_; 78 } 73 79 74 80 private: -
code/branches/presentationFS14/src/orxonox/controllers/NewHumanController.cc
r9939 r10073 220 220 if (!controlPaused_ ) 221 221 { 222 if (this->getControllableEntity() && ( this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))222 if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket")))) 223 223 this->showOverlays(); 224 224 else if (this->getControllableEntity() && this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer"))) … … 498 498 this->controlMode_ = 0; 499 499 this->centerCursor(); 500 if (this->getControllableEntity() && ( this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))500 if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket")))) 501 501 { 502 502 this->showOverlays_ = true; -
code/branches/presentationFS14/src/orxonox/items/CMakeLists.txt
r5781 r10073 3 3 Engine.cc 4 4 MultiStateEngine.cc 5 ShipPart.cc 6 PartDestructionEvent.cc 5 7 ) -
code/branches/presentationFS14/src/orxonox/worldentities/MovableEntity.cc
r9667 r10073 72 72 } 73 73 74 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)74 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 75 75 { 76 76 if (GameMode::isMaster() && enableCollisionDamage_) … … 80 80 { 81 81 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length(); 82 victim->hit(0, contactPoint, damage);82 victim->hit(0, contactPoint, ownCollisionShape, damage); 83 83 } 84 84 } … … 86 86 return false; 87 87 } 88 89 88 90 89 void MovableEntity::registerVariables() -
code/branches/presentationFS14/src/orxonox/worldentities/MovableEntity.h
r9667 r10073 47 47 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 50 50 51 51 using WorldEntity::setPosition; -
code/branches/presentationFS14/src/orxonox/worldentities/StaticEntity.cc
r9667 r10073 34 34 #include "util/OrxAssert.h" 35 35 #include "core/CoreIncludes.h" 36 #include "worldentities/BigExplosion.h" 36 37 37 38 namespace orxonox … … 115 116 worldTrans.setRotation(btQuaternion(node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z, node_->getOrientation().w)); 116 117 } 118 117 119 } -
code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.cc
r10072 r10073 46 46 #include "Scene.h" 47 47 #include "collisionshapes/WorldEntityCollisionShape.h" 48 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 48 49 49 50 namespace orxonox -
code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h
r9667 r10073 72 72 { 73 73 friend class Scene; 74 friend class ModularSpaceShip; 74 75 75 76 public: … … 206 207 207 208 void notifyChildPropsChanged(); 209 210 inline int getNumAttachedObj() 211 { return this->children_.size(); } 208 212 209 213 protected: … … 374 378 Condition is that enableCollisionCallback() was called. 375 379 */ 376 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)380 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 377 381 { return false; } /* With false, Bullet assumes no modification to the collision objects. */ 378 382 … … 405 409 */ 406 410 virtual bool isCollisionTypeLegal(CollisionType type) const = 0; 411 412 inline virtual WorldEntityCollisionShape* getWorldEntityCollisionShape() 413 { return this->collisionShape_; } 407 414 408 415 btRigidBody* physicalBody_; //!< Bullet rigid body. Everything physical is applied to this instance. -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/CMakeLists.txt
r7163 r10073 4 4 Pawn.cc 5 5 SpaceShip.cc 6 ModularSpaceShip.cc 6 7 TeamBaseMatchBase.cc 7 8 Destroyer.cc -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/Pawn.cc
r9950 r10073 50 50 #include "controllers/FormationController.h" 51 51 52 #include "collisionshapes/WorldEntityCollisionShape.h" 53 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 54 #include <BulletCollision/CollisionShapes/btCompoundShape.h> 55 #include "graphics/Model.h" 56 57 52 58 namespace orxonox 53 59 { … … 244 250 } 245 251 246 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 247 { 252 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 253 { 254 //FIXME: (noep) remove debug 255 //orxout() << "damage(): Collision detected on " << this->getName() << ", btCS*: " << cs << endl; 256 257 //int collisionShapeIndex = this->isMyCollisionShape(cs); 258 //orxout() << collisionShapeIndex << endl; 259 248 260 // Applies multiplier given by the DamageBoost Pickup. 249 261 if (originator) … … 279 291 280 292 */ 281 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)293 void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage) 282 294 { 283 295 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 284 296 { 285 this->damage(damage, healthdamage, shielddamage, originator );297 this->damage(damage, healthdamage, shielddamage, originator, cs); 286 298 this->setVelocity(this->getVelocity() + force); 287 299 } 288 300 } 289 301 290 291 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) 302 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage) 292 303 { 293 304 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 294 305 { 295 this->damage(damage, healthdamage, shielddamage, originator );306 this->damage(damage, healthdamage, shielddamage, originator, cs); 296 307 297 308 if ( this->getController() ) … … 561 572 562 573 574 int Pawn::isMyCollisionShape(const btCollisionShape* cs) 575 { 576 // This entities WECS 577 WorldEntityCollisionShape* ownWECS = this->getWorldEntityCollisionShape(); 578 579 // e.g. "Box 4: Searching for CS 0x1ad49200" 580 orxout() << this->getName() << ": Searching for btCS* " << cs << endl; 581 // e.g. "Box 4 is WorldEntityCollisionShape 0x126dd060" 582 orxout() << " " << this->getName() << " is WorldEntityCollisionShape* " << ownWECS << endl; 583 // e.g. "Box 4 is WorldEntity 0x126dd060" 584 orxout() << " " << this->getName() << " is WorldEntity* " << this << endl; 585 // e.g. "Box 4 is objectID 943" 586 orxout() << " " << this->getName() << " is objectID " << this->getObjectID() << endl; 587 588 // List all attached Objects 589 orxout() << " " << this->getName() << " has the following Objects attached:" << endl; 590 for (int i=0; i<50; i++) 591 { 592 if (this->getAttachedObject(i)==NULL) 593 break; 594 orxout() << " " << i << ": " << this->getAttachedObject(i) << " (" << this->getAttachedObject(i)->getName() << ")"; 595 if(!orxonox_cast<Model*>(this->getAttachedObject(i))) 596 orxout() << " (SE)"; 597 orxout() << endl; 598 } 599 600 601 // print child shapes of this WECS 602 printBtChildShapes((btCompoundShape*)(ownWECS->getCollisionShape()), 2, 0); 603 604 int temp = entityOfCollisionShape(cs); 605 if (temp==0) 606 orxout() << this->getName() << " has been hit on it's main body." << endl; 607 else 608 orxout() << this->getName() << " has been hit on the attached entity no. " << temp << endl; 609 610 // end 611 return -1; 612 } 613 614 void Pawn::printBtChildShapes(btCompoundShape* cs, int indent, int subshape) 615 { 616 // e.g. " Childshape 1 (WECS 0x126dc8c0) has 2 childshapes:" 617 printSpaces(indent); orxout() << "Childshape " << subshape << " (btCS* " << cs << ") has " << cs->getNumChildShapes() << " childshapes:" << endl; 618 619 for (int i=0; i < cs->getNumChildShapes(); i++) 620 { 621 printSpaces(indent+2); orxout() << "- " << i << " - - -" << endl; 622 623 // For each childshape, print: (as long as it's not another CompoundCollisionShape) 624 if (!orxonox_cast<btCompoundShape*>(cs->getChildShape(i))) 625 { 626 // pointer to the btCollisionShape 627 printSpaces(indent+2); orxout() << "btCollisionShape*: " << cs->getChildShape(i) << endl; 628 629 // pointer to the btCollisionShape 630 printSpaces(indent+2); orxout() << "m_userPointer*: " << cs->getChildShape(i)->getUserPointer() << " (name_: " << ((BaseObject*)(cs->getChildShape(i)->getUserPointer()))->getName() << ")" << endl; 631 } 632 633 // if the childshape is a CompoundCollisionShape, print its children. 634 if (cs->getChildShape(i)->isCompound()) 635 printBtChildShapes((btCompoundShape*)(cs->getChildShape(i)), indent+2, i); 636 637 } 638 } 639 640 int Pawn::entityOfCollisionShape(const btCollisionShape* cs) 641 { 642 btCompoundShape* ownBtCS = (btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()); 643 644 return -1; 645 } 646 647 void Pawn::printSpaces(int num) 648 { 649 for(int i=0; i<num; i++) 650 orxout() << " "; 651 } 563 652 } -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/Pawn.h
r9948 r10073 126 126 //virtual void hit(Pawn* originator, const Vector3& force, float damage); 127 127 //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); 128 virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);129 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);128 virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); 129 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); 130 130 131 131 virtual void kill(); … … 196 196 197 197 //virtual void damage(float damage, Pawn* originator = 0); 198 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL );198 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL); 199 199 200 200 bool bAlive_; … … 229 229 unsigned int numexplosionchunks_; 230 230 231 virtual int isMyCollisionShape(const btCollisionShape* cs); // FIXME: (noep) remove debug 232 void printBtChildShapes(btCompoundShape* cs, int indent, int subshape); // FIXME: (noep) remove debug 233 void printSpaces(int num); // FIXME: (noep) remove debug 234 int entityOfCollisionShape(const btCollisionShape* cs); 235 231 236 private: 232 237 void registerVariables(); -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/SpaceShip.h
r9667 r10073 270 270 float stallSpeed_; //!< The forward speed where no more lift is added. 271 271 272 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip. 273 272 274 private: 273 275 void registerVariables(); … … 284 286 void backupCamera(); // Save the original position and orientation of the camera. 285 287 void resetCamera(); // Reset the camera to its original position. 286 287 std::vector<Engine*> engineList_; //!< The list of all Engines mounted on this SpaceShip.288 288 289 289 Timer timer_; //!< Timer for the cooldown duration.
Note: See TracChangeset
for help on using the changeset viewer.