mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:10:45 +02:00
cleanup and moving things around
This commit is contained in:
parent
3b85805048
commit
48164c9399
3 changed files with 21 additions and 30 deletions
|
@ -669,8 +669,7 @@ void EntityTree::update() {
|
|||
// 1) stationary things that are not changing - most models
|
||||
// 2) mortal things - these are stationary but have a lifetime - then need to be checked,
|
||||
// can be touched linearly, and won't change the tree
|
||||
// 2) changing things - like things animating they can be touched linearly and they don't change the tree
|
||||
// 3) moving things - these need to scan the tree and update accordingly
|
||||
// 2) moving/changing things - like things animating they can be touched linearly and they don't change the tree
|
||||
// finally - all things that need to be deleted, can be handled on a single delete pass.
|
||||
//
|
||||
// TODO: theoretically we could combine the move and delete tree passes...
|
||||
|
|
|
@ -149,8 +149,8 @@ bool PhysicsEngine::addEntity(CustomMotionState* motionState) {
|
|||
motionState->applyVelocities();
|
||||
break;
|
||||
}
|
||||
case MOTION_TYPE_STATIC:
|
||||
default: {
|
||||
// MOTION_TYPE_STATIC
|
||||
body = new btRigidBody(mass, motionState, shape, inertia);
|
||||
body->setCollisionFlags(btCollisionObject::CF_STATIC_OBJECT);
|
||||
body->updateInertiaTensor();
|
||||
|
@ -166,6 +166,22 @@ bool PhysicsEngine::addEntity(CustomMotionState* motionState) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PhysicsEngine::removeEntity(CustomMotionState* motionState) {
|
||||
assert(motionState);
|
||||
btRigidBody* body = motionState->_body;
|
||||
if (body) {
|
||||
const btCollisionShape* shape = body->getCollisionShape();
|
||||
ShapeInfo info;
|
||||
info.collectInfo(shape);
|
||||
_dynamicsWorld->removeRigidBody(body);
|
||||
_shapeManager.releaseShape(info);
|
||||
delete body;
|
||||
motionState->_body = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PhysicsEngine::updateEntityMotionType(CustomMotionState* motionState) {
|
||||
btRigidBody* body = motionState->_body;
|
||||
if (!body) {
|
||||
|
@ -216,28 +232,6 @@ bool PhysicsEngine::updateEntityMotionType(CustomMotionState* motionState) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool PhysicsEngine::removeEntity(CustomMotionState* motionState) {
|
||||
assert(motionState);
|
||||
btRigidBody* body = motionState->_body;
|
||||
if (body) {
|
||||
const btCollisionShape* shape = body->getCollisionShape();
|
||||
ShapeInfo info;
|
||||
info.collectInfo(shape);
|
||||
_dynamicsWorld->removeRigidBody(body);
|
||||
_shapeManager.releaseShape(info);
|
||||
delete body;
|
||||
motionState->_body = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PhysicsEngine::updateEntityMotionType(CustomMotionState* motionState, MotionType type) {
|
||||
// TODO: implement this
|
||||
assert(motionState);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PhysicsEngine::updateEntityMassProperties(CustomMotionState* motionState, float mass, const glm::vec3& inertiaEigenValues) {
|
||||
// TODO: implement this
|
||||
assert(motionState);
|
||||
|
|
|
@ -63,15 +63,13 @@ public:
|
|||
/// \return true if Entity added
|
||||
bool addEntity(CustomMotionState* motionState);
|
||||
|
||||
/// \param motionState pointer to Entity's MotionState
|
||||
/// \return true if entity updated
|
||||
bool updateEntityMotionType(CustomMotionState* motionState);
|
||||
|
||||
/// \param motionState pointer to Entity's MotionState
|
||||
/// \return true if Entity removed
|
||||
bool removeEntity(CustomMotionState* motionState);
|
||||
|
||||
bool updateEntityMotionType(CustomMotionState* motionState, MotionType type);
|
||||
/// \param motionState pointer to Entity's MotionState
|
||||
/// \return true if entity updated
|
||||
bool updateEntityMotionType(CustomMotionState* motionState);
|
||||
|
||||
bool updateEntityMassProperties(CustomMotionState* motionState, float mass, const glm::vec3& inertiaEigenValues);
|
||||
|
||||
|
|
Loading…
Reference in a new issue