more merge madness, calculate 2nd PhysicsEngine hash with qChecksum if url is set

This commit is contained in:
Seth Alves 2015-03-13 18:43:24 -07:00
parent d749b350eb
commit 87cc710efc
6 changed files with 10 additions and 80 deletions

View file

@ -59,75 +59,6 @@ void PhysicsEngine::updateEntitiesInternal(const quint64& now) {
}
}
// void PhysicsEngine::addEntityInternal(EntityItem* entity) {
// qDebug() << "\n\nPhysicsEngine::addEntityInternal for " << entity->getID().toString()
// << "thread-id" << QThread::currentThreadId();
// assert(entity);
// void* physicsInfo = entity->getPhysicsInfo();
// if (!physicsInfo) {
// qDebug() << " has no physicsInfo";
// lockBusyForRead();
// bool busyContains = _busyComputingShape.contains(entity->getID());
// unlockBusy();
// if (!busyContains) {
// qDebug() << " calling isReadyToComputeShape";
// lockBusyForWrite();
// _busyComputingShape[entity->getID()] = true;
// unlockBusy();
// connect(entity, SIGNAL(entityShapeReady(QUuid)), this, SLOT(entityShapeReady(QUuid)));
// entity->isReadyToComputeShape();
// } else {
// lockBusyForRead();
// bool entityIsBusy = _busyComputingShape[entity->getID()];
// unlockBusy();
// if (entityIsBusy) {
// qDebug() << " still getting ready to compute shape";
// entity->getReadyToComputeShape(); // XXX remove this once connect is working
// } else {
// qDebug() << " it's ready to compute shape";
// ShapeInfo shapeInfo;
// entity->computeShapeInfo(shapeInfo);
// btCollisionShape* shape = _shapeManager.getShape(shapeInfo);
// if (shape) {
// qDebug() << " found a shape";
// EntityMotionState* motionState = new EntityMotionState(entity);
// entity->setPhysicsInfo(static_cast<void*>(motionState));
// _entityMotionStates.insert(motionState);
// addObject(shapeInfo, shape, motionState);
// } else if (entity->isMoving()) {
// qDebug() << " is moving";
// EntityMotionState* motionState = new EntityMotionState(entity);
// entity->setPhysicsInfo(static_cast<void*>(motionState));
// _entityMotionStates.insert(motionState);
// motionState->setKinematic(true, _numSubsteps);
// _nonPhysicalKinematicObjects.insert(motionState);
// // 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";
// } else {
// qDebug() << " no shape and not moving";
// }
// qDebug() << " removing from _busyComputingShape:" << entity->getID();
// lockBusyForWrite();
// _busyComputingShape.remove(entity->getID());
// unlockBusy();
// }
// }
// } else {
// qDebug() << " already has physicsInfo";
// }
// qDebug() << " done with PhysicsEngine::addEntityInternal";
// }
void PhysicsEngine::addEntityInternal(EntityItem* entity) {
// qDebug() << "\n\nPhysicsEngine::addEntityInternal for " << entity->getID().toString()
// << "thread-id" << QThread::currentThreadId();

View file

@ -15,7 +15,6 @@
#include <stdint.h>
#include <QSet>
#include <QReadWriteLock>
#include <btBulletDynamicsCommon.h>
#include <BulletCollision/CollisionDispatch/btGhostObject.h>
//#include <BulletCollision/CollisionShapes/btCapsuleShape.h>
@ -91,9 +90,6 @@ public:
void setAvatarData(AvatarData *avatarData);
// public slots:
// void entityShapeReady(QUuid entityId);
private:
/// \param motionState pointer to Object's MotionState
void removeObjectFromBullet(ObjectMotionState* motionState);

View file

@ -59,13 +59,13 @@ void ShapeInfoUtil::collectInfoFromShape(const btCollisionShape* shape, ShapeInf
case SHAPE_TYPE_BOX: {
const btBoxShape* boxShape = static_cast<const btBoxShape*>(shape);
info.setBox(bulletToGLM(boxShape->getHalfExtentsWithMargin()));
break;
}
break;
case SHAPE_TYPE_SPHERE: {
const btSphereShape* sphereShape = static_cast<const btSphereShape*>(shape);
info.setSphere(sphereShape->getRadius());
break;
}
break;
case SHAPE_TYPE_CONVEX_HULL: {
const btConvexHullShape* convexHullShape = static_cast<const btConvexHullShape*>(shape);
const int numPoints = convexHullShape->getNumPoints();
@ -76,12 +76,12 @@ void ShapeInfoUtil::collectInfoFromShape(const btCollisionShape* shape, ShapeInf
points << point;
}
info.setConvexHull(points);
break;
}
break;
default: {
info.clear();
break;
}
break;
}
} else {
info.clear();

View file

@ -24,6 +24,7 @@
#include <gpu/GLBackend.h>
#include <PathUtils.h>
#include <PerfStat.h>
#include "PhysicsEntity.h"
#include <ShapeCollider.h>
#include <SphereShape.h>
#include <ViewFrustum.h>
@ -33,8 +34,6 @@
#include "DeferredLightingEffect.h"
#include "GlowEffect.h"
#include "Model.h"
#include "PhysicsEntity.h"
#include "model_vert.h"
#include "model_shadow_vert.h"

View file

@ -24,6 +24,7 @@
#include <GeometryUtil.h>
#include <gpu/Stream.h>
#include <gpu/Batch.h>
#include "PhysicsEntity.h"
#include <Transform.h>
#include "AnimationHandle.h"
@ -31,7 +32,6 @@
#include "JointState.h"
#include "ProgramObject.h"
#include "TextureCache.h"
#include "PhysicsEntity.h"
class AbstractViewStateInterface;
class QScriptEngine;

View file

@ -169,6 +169,10 @@ const DoubleHashKey& ShapeInfo::getHash() const {
hash = (hash << 16) | (hash >> 16);
}
}
} else {
QByteArray baUrl = url.toLocal8Bit();
const char *cUrl = baUrl.data();
hash = qChecksum(cUrl, baUrl.count());
}
thisPtr->_doubleHashKey.setHash2(hash);
} else {