mirror of
https://github.com/lubosz/overte.git
synced 2025-08-28 12:06:24 +02:00
namechange
This commit is contained in:
parent
534bfa5983
commit
4208380d1c
3 changed files with 16 additions and 10 deletions
|
@ -71,6 +71,7 @@ ObjectMotionState::ObjectMotionState(btCollisionShape* shape) :
|
|||
}
|
||||
|
||||
ObjectMotionState::~ObjectMotionState() {
|
||||
// adebug TODO: move shape release out of PhysicsEngine and into into the ObjectMotionState dtor
|
||||
assert(!_body);
|
||||
assert(!_shape);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,8 @@ void PhysicsEngine::init() {
|
|||
}
|
||||
}
|
||||
|
||||
void PhysicsEngine::addObject(ObjectMotionState* motionState) {
|
||||
// private
|
||||
void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
|
||||
assert(motionState);
|
||||
|
||||
btVector3 inertia(0.0f, 0.0f, 0.0f);
|
||||
|
@ -144,7 +145,8 @@ void PhysicsEngine::addObject(ObjectMotionState* motionState) {
|
|||
motionState->clearIncomingDirtyFlags();
|
||||
}
|
||||
|
||||
void PhysicsEngine::removeObject(ObjectMotionState* object) {
|
||||
// private
|
||||
void PhysicsEngine::removeObjectFromDynamicsWorld(ObjectMotionState* object) {
|
||||
// wake up anything touching this object
|
||||
bump(object);
|
||||
removeContacts(object);
|
||||
|
@ -156,13 +158,14 @@ void PhysicsEngine::removeObject(ObjectMotionState* object) {
|
|||
|
||||
void PhysicsEngine::deleteObjects(const VectorOfMotionStates& objects) {
|
||||
for (auto object : objects) {
|
||||
removeObject(object);
|
||||
removeObjectFromDynamicsWorld(object);
|
||||
|
||||
// NOTE: setRigidBody() modifies body->m_userPointer so we should clear the MotionState's body BEFORE deleting it.
|
||||
btRigidBody* body = object->getRigidBody();
|
||||
object->setRigidBody(nullptr);
|
||||
body->setMotionState(nullptr);
|
||||
delete body;
|
||||
// adebug TODO: move this into ObjectMotionState dtor
|
||||
object->releaseShape();
|
||||
delete object;
|
||||
}
|
||||
|
@ -172,12 +175,13 @@ void PhysicsEngine::deleteObjects(const VectorOfMotionStates& objects) {
|
|||
void PhysicsEngine::deleteObjects(const SetOfMotionStates& objects) {
|
||||
for (auto object : objects) {
|
||||
btRigidBody* body = object->getRigidBody();
|
||||
removeObject(object);
|
||||
removeObjectFromDynamicsWorld(object);
|
||||
|
||||
// NOTE: setRigidBody() modifies body->m_userPointer so we should clear the MotionState's body BEFORE deleting it.
|
||||
object->setRigidBody(nullptr);
|
||||
body->setMotionState(nullptr);
|
||||
delete body;
|
||||
// adebug TODO: move this into ObjectMotionState dtor
|
||||
object->releaseShape();
|
||||
delete object;
|
||||
}
|
||||
|
@ -185,7 +189,7 @@ void PhysicsEngine::deleteObjects(const SetOfMotionStates& objects) {
|
|||
|
||||
void PhysicsEngine::addObjects(const VectorOfMotionStates& objects) {
|
||||
for (auto object : objects) {
|
||||
addObject(object);
|
||||
addObjectToDynamicsWorld(object);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,8 +215,8 @@ VectorOfMotionStates PhysicsEngine::changeObjects(const VectorOfMotionStates& ob
|
|||
}
|
||||
|
||||
void PhysicsEngine::reinsertObject(ObjectMotionState* object) {
|
||||
removeObject(object);
|
||||
addObject(object);
|
||||
removeObjectFromDynamicsWorld(object);
|
||||
addObjectToDynamicsWorld(object);
|
||||
}
|
||||
|
||||
void PhysicsEngine::removeContacts(ObjectMotionState* motionState) {
|
||||
|
|
|
@ -54,11 +54,9 @@ public:
|
|||
void setSessionUUID(const QUuid& sessionID) { _sessionID = sessionID; }
|
||||
const QUuid& getSessionID() const { return _sessionID; }
|
||||
|
||||
void addObject(ObjectMotionState* motionState);
|
||||
void removeObject(ObjectMotionState* motionState);
|
||||
|
||||
void deleteObjects(const VectorOfMotionStates& objects);
|
||||
void deleteObjects(const SetOfMotionStates& objects); // only called during teardown
|
||||
|
||||
void addObjects(const VectorOfMotionStates& objects);
|
||||
VectorOfMotionStates changeObjects(const VectorOfMotionStates& objects);
|
||||
void reinsertObject(ObjectMotionState* object);
|
||||
|
@ -100,6 +98,9 @@ public:
|
|||
void forEachAction(std::function<void(EntityActionPointer)> actor);
|
||||
|
||||
private:
|
||||
void addObjectToDynamicsWorld(ObjectMotionState* motionState);
|
||||
void removeObjectFromDynamicsWorld(ObjectMotionState* motionState);
|
||||
|
||||
void removeContacts(ObjectMotionState* motionState);
|
||||
|
||||
void doOwnershipInfection(const btCollisionObject* objectA, const btCollisionObject* objectB);
|
||||
|
|
Loading…
Reference in a new issue