mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
diff minimization
This commit is contained in:
parent
8d2c942509
commit
2f47f7c7ba
7 changed files with 18 additions and 37 deletions
|
@ -369,7 +369,6 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
|
||||||
glm::vec3 aaBoxDim = aaBox.getDimensions();
|
glm::vec3 aaBoxDim = aaBox.getDimensions();
|
||||||
aaBoxDim = glm::clamp(aaBoxDim, glm::vec3(FLT_EPSILON), aaBoxDim);
|
aaBoxDim = glm::clamp(aaBoxDim, glm::vec3(FLT_EPSILON), aaBoxDim);
|
||||||
|
|
||||||
// scale = dimensions / aabox
|
|
||||||
glm::vec3 scale = _dimensions / aaBoxDim;
|
glm::vec3 scale = _dimensions / aaBoxDim;
|
||||||
|
|
||||||
// multiply each point by scale before handing the point-set off to the physics engine
|
// multiply each point by scale before handing the point-set off to the physics engine
|
||||||
|
|
|
@ -63,10 +63,6 @@ public:
|
||||||
|
|
||||||
EntityTree* getEntityTree() { return _entityTree; }
|
EntityTree* getEntityTree() { return _entityTree; }
|
||||||
|
|
||||||
/* virtual void reconfigureEntity(EntityItem* entity) { */
|
|
||||||
/* qDebug() << "EntitySimulation::reconfigureEntity"; */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
void entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
||||||
|
|
||||||
|
|
|
@ -315,12 +315,6 @@ void EntityTree::deleteEntities(QSet<EntityItemID> entityIDs, bool force, bool i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTree::reconfigureEntity(EntityItem* entity) {
|
|
||||||
qDebug() << "EntityTree::reconfigureEntity";
|
|
||||||
// _simulation->reconfigureEntity(entity);
|
|
||||||
_simulation->entityChanged(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator) {
|
void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator) {
|
||||||
const RemovedEntities& entities = theOperator.getEntities();
|
const RemovedEntities& entities = theOperator.getEntities();
|
||||||
if (_simulation) {
|
if (_simulation) {
|
||||||
|
|
|
@ -95,8 +95,6 @@ public:
|
||||||
|
|
||||||
void deleteEntity(const EntityItemID& entityID, bool force = false, bool ignoreWarnings = false);
|
void deleteEntity(const EntityItemID& entityID, bool force = false, bool ignoreWarnings = false);
|
||||||
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false, bool ignoreWarnings = false);
|
void deleteEntities(QSet<EntityItemID> entityIDs, bool force = false, bool ignoreWarnings = false);
|
||||||
// void removeEntityFromSimulation(EntityItem* entity);
|
|
||||||
void reconfigureEntity(EntityItem* entity);
|
|
||||||
|
|
||||||
/// \param position point of query in world-frame (meters)
|
/// \param position point of query in world-frame (meters)
|
||||||
/// \param targetRadius radius of query (meters)
|
/// \param targetRadius radius of query (meters)
|
||||||
|
@ -162,7 +160,6 @@ public:
|
||||||
void emitEntityScriptChanging(const EntityItemID& entityItemID);
|
void emitEntityScriptChanging(const EntityItemID& entityItemID);
|
||||||
|
|
||||||
void setSimulation(EntitySimulation* simulation);
|
void setSimulation(EntitySimulation* simulation);
|
||||||
EntitySimulation* getSimulation() { return _simulation; }
|
|
||||||
|
|
||||||
bool wantEditLogging() const { return _wantEditLogging; }
|
bool wantEditLogging() const { return _wantEditLogging; }
|
||||||
void setWantEditLogging(bool value) { _wantEditLogging = value; }
|
void setWantEditLogging(bool value) { _wantEditLogging = value; }
|
||||||
|
|
|
@ -147,7 +147,6 @@ public:
|
||||||
bool hasEntities() const { return _entityItems ? _entityItems->size() > 0 : false; }
|
bool hasEntities() const { return _entityItems ? _entityItems->size() > 0 : false; }
|
||||||
|
|
||||||
void setTree(EntityTree* tree) { _myTree = tree; }
|
void setTree(EntityTree* tree) { _myTree = tree; }
|
||||||
EntityTree* getTree() { return _myTree; }
|
|
||||||
|
|
||||||
bool updateEntity(const EntityItem& entity);
|
bool updateEntity(const EntityItem& entity);
|
||||||
void addEntityItem(EntityItem* entity);
|
void addEntityItem(EntityItem* entity);
|
||||||
|
|
|
@ -62,29 +62,27 @@ void PhysicsEngine::addEntityInternal(EntityItem* entity) {
|
||||||
assert(entity);
|
assert(entity);
|
||||||
void* physicsInfo = entity->getPhysicsInfo();
|
void* physicsInfo = entity->getPhysicsInfo();
|
||||||
if (!physicsInfo) {
|
if (!physicsInfo) {
|
||||||
if (! entity->isReadyToComputeShape()) {
|
if (entity->isReadyToComputeShape()) {
|
||||||
return;
|
ShapeInfo shapeInfo;
|
||||||
}
|
entity->computeShapeInfo(shapeInfo);
|
||||||
ShapeInfo shapeInfo;
|
btCollisionShape* shape = _shapeManager.getShape(shapeInfo);
|
||||||
entity->computeShapeInfo(shapeInfo);
|
if (shape) {
|
||||||
btCollisionShape* shape = _shapeManager.getShape(shapeInfo);
|
EntityMotionState* motionState = new EntityMotionState(entity);
|
||||||
if (shape) {
|
entity->setPhysicsInfo(static_cast<void*>(motionState));
|
||||||
EntityMotionState* motionState = new EntityMotionState(entity);
|
_entityMotionStates.insert(motionState);
|
||||||
entity->setPhysicsInfo(static_cast<void*>(motionState));
|
addObject(shapeInfo, shape, motionState);
|
||||||
_entityMotionStates.insert(motionState);
|
} else if (entity->isMoving()) {
|
||||||
addObject(shapeInfo, shape, motionState);
|
EntityMotionState* motionState = new EntityMotionState(entity);
|
||||||
} else if (entity->isMoving()) {
|
entity->setPhysicsInfo(static_cast<void*>(motionState));
|
||||||
EntityMotionState* motionState = new EntityMotionState(entity);
|
_entityMotionStates.insert(motionState);
|
||||||
entity->setPhysicsInfo(static_cast<void*>(motionState));
|
|
||||||
_entityMotionStates.insert(motionState);
|
|
||||||
|
|
||||||
motionState->setKinematic(true, _numSubsteps);
|
motionState->setKinematic(true, _numSubsteps);
|
||||||
_nonPhysicalKinematicObjects.insert(motionState);
|
_nonPhysicalKinematicObjects.insert(motionState);
|
||||||
// We failed to add the entity to the simulation. Probably because we couldn't create a shape for it.
|
// We failed to add the entity to the simulation. Probably because we couldn't create a shape for it.
|
||||||
//qDebug() << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
|
//qDebug() << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsEngine::removeEntityInternal(EntityItem* entity) {
|
void PhysicsEngine::removeEntityInternal(EntityItem* entity) {
|
||||||
|
|
|
@ -88,8 +88,6 @@ public:
|
||||||
|
|
||||||
void setAvatarData(AvatarData *avatarData);
|
void setAvatarData(AvatarData *avatarData);
|
||||||
|
|
||||||
// virtual void reconfigureEntity(EntityItem* entity);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// \param motionState pointer to Object's MotionState
|
/// \param motionState pointer to Object's MotionState
|
||||||
void removeObjectFromBullet(ObjectMotionState* motionState);
|
void removeObjectFromBullet(ObjectMotionState* motionState);
|
||||||
|
|
Loading…
Reference in a new issue