mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
namechange updateObjectEasy()-->updateBodyEasy()
This commit is contained in:
parent
72deb2e49b
commit
31e5758422
5 changed files with 10 additions and 9 deletions
|
@ -138,7 +138,7 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityMotionState::updateObjectEasy(uint32_t flags, uint32_t step) {
|
void EntityMotionState::updateBodyEasy(uint32_t flags, uint32_t step) {
|
||||||
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY | EntityItem::DIRTY_PHYSICS_NO_WAKE)) {
|
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY | EntityItem::DIRTY_PHYSICS_NO_WAKE)) {
|
||||||
if (flags & EntityItem::DIRTY_POSITION) {
|
if (flags & EntityItem::DIRTY_POSITION) {
|
||||||
_sentPosition = getObjectPosition() - ObjectMotionState::getWorldOffset();
|
_sentPosition = getObjectPosition() - ObjectMotionState::getWorldOffset();
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
virtual void setWorldTransform(const btTransform& worldTrans);
|
virtual void setWorldTransform(const btTransform& worldTrans);
|
||||||
|
|
||||||
// these relay incoming values to the RigidBody
|
// these relay incoming values to the RigidBody
|
||||||
virtual void updateObjectEasy(uint32_t flags, uint32_t step);
|
virtual void updateBodyEasy(uint32_t flags, uint32_t step);
|
||||||
virtual void updateBodyMaterialProperties();
|
virtual void updateBodyMaterialProperties();
|
||||||
virtual void updateBodyVelocities();
|
virtual void updateBodyVelocities();
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@ public:
|
||||||
void resetMeasuredBodyAcceleration();
|
void resetMeasuredBodyAcceleration();
|
||||||
|
|
||||||
// An EASY update does not require the object to be removed and then reinserted into the PhysicsEngine
|
// An EASY update does not require the object to be removed and then reinserted into the PhysicsEngine
|
||||||
virtual void updateObjectEasy(uint32_t flags, uint32_t frame) = 0;
|
virtual void updateBodyEasy(uint32_t flags, uint32_t frame) = 0;
|
||||||
|
|
||||||
virtual void updateBodyMaterialProperties() = 0;
|
virtual void updateBodyMaterialProperties() = 0;
|
||||||
virtual void updateBodyVelocities() = 0;
|
virtual void updateBodyVelocities() = 0;
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,9 @@ void PhysicsEngine::relayIncomingChangesToSimulation() {
|
||||||
if (flags & HARD_DIRTY_PHYSICS_FLAGS) {
|
if (flags & HARD_DIRTY_PHYSICS_FLAGS) {
|
||||||
// a HARD update requires the body be pulled out of physics engine, changed, then reinserted
|
// a HARD update requires the body be pulled out of physics engine, changed, then reinserted
|
||||||
// but it also handles all EASY changes
|
// but it also handles all EASY changes
|
||||||
bool success = updateObjectHard(body, motionState, flags);
|
bool success = updateBodyHard(body, motionState, flags);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
// NOTE: since updateObjectHard() failed we know that motionState has been removed
|
// NOTE: since updateBodyHard() failed we know that motionState has been removed
|
||||||
// from simulation and body has been deleted. Depending on what else has changed
|
// from simulation and body has been deleted. Depending on what else has changed
|
||||||
// we might need to remove motionState altogether...
|
// we might need to remove motionState altogether...
|
||||||
if (flags & EntityItem::DIRTY_VELOCITY) {
|
if (flags & EntityItem::DIRTY_VELOCITY) {
|
||||||
|
@ -195,7 +195,7 @@ void PhysicsEngine::relayIncomingChangesToSimulation() {
|
||||||
} else if (flags) {
|
} else if (flags) {
|
||||||
// an EASY update does NOT require that the body be pulled out of physics engine
|
// an EASY update does NOT require that the body be pulled out of physics engine
|
||||||
// hence the MotionState has all the knowledge and authority to perform the update.
|
// hence the MotionState has all the knowledge and authority to perform the update.
|
||||||
motionState->updateObjectEasy(flags, _numSubsteps);
|
motionState->updateBodyEasy(flags, _numSubsteps);
|
||||||
}
|
}
|
||||||
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY)) {
|
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY)) {
|
||||||
motionState->resetMeasuredBodyAcceleration();
|
motionState->resetMeasuredBodyAcceleration();
|
||||||
|
@ -608,7 +608,7 @@ void PhysicsEngine::removeObjectFromBullet(ObjectMotionState* motionState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// private
|
// private
|
||||||
bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags) {
|
bool PhysicsEngine::updateBodyHard(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags) {
|
||||||
MotionType newType = motionState->computeObjectMotionType();
|
MotionType newType = motionState->computeObjectMotionType();
|
||||||
|
|
||||||
// pull body out of physics engine
|
// pull body out of physics engine
|
||||||
|
@ -653,7 +653,7 @@ bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
|
||||||
}
|
}
|
||||||
bool easyUpdate = flags & EASY_DIRTY_PHYSICS_FLAGS;
|
bool easyUpdate = flags & EASY_DIRTY_PHYSICS_FLAGS;
|
||||||
if (easyUpdate) {
|
if (easyUpdate) {
|
||||||
motionState->updateObjectEasy(flags, _numSubsteps);
|
motionState->updateBodyEasy(flags, _numSubsteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the motion parameters
|
// update the motion parameters
|
||||||
|
|
|
@ -100,7 +100,7 @@ private:
|
||||||
void doOwnershipInfection(const btCollisionObject* objectA, const btCollisionObject* objectB);
|
void doOwnershipInfection(const btCollisionObject* objectA, const btCollisionObject* objectB);
|
||||||
|
|
||||||
// return 'true' of update was successful
|
// return 'true' of update was successful
|
||||||
bool updateObjectHard(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
|
bool updateBodyHard(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
|
||||||
void updateObjectEasy(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
|
void updateObjectEasy(btRigidBody* body, ObjectMotionState* motionState, uint32_t flags);
|
||||||
|
|
||||||
btClock _clock;
|
btClock _clock;
|
||||||
|
|
Loading…
Reference in a new issue