clean up debugging spew

This commit is contained in:
Seth Alves 2015-03-16 16:44:29 -07:00
parent 08cb13640c
commit b76103edb0
4 changed files with 8 additions and 46 deletions

View file

@ -38,14 +38,8 @@ public:
EntitySimulation() : _mutex(QMutex::Recursive), _entityTree(NULL), _nextExpiry(quint64(-1)) { } EntitySimulation() : _mutex(QMutex::Recursive), _entityTree(NULL), _nextExpiry(quint64(-1)) { }
virtual ~EntitySimulation() { setEntityTree(NULL); } virtual ~EntitySimulation() { setEntityTree(NULL); }
void lock() { void lock() { _mutex.lock(); }
qDebug() << "LOCKING SIMULATION" << QThread::currentThreadId(); void unlock() { _mutex.unlock(); }
_mutex.lock();
}
void unlock() {
qDebug() << "UNLOCKING SIMULATION" << QThread::currentThreadId();
_mutex.unlock();
}
/// \param tree pointer to EntityTree which is stored internally /// \param tree pointer to EntityTree which is stored internally
void setEntityTree(EntityTree* tree); void setEntityTree(EntityTree* tree);

View file

@ -427,6 +427,7 @@ bool ModelEntityItem::isReadyToComputeShape() {
} }
if (_collisionNetworkGeometry.isNull()) { if (_collisionNetworkGeometry.isNull()) {
_collisionNetworkGeometry = _collisionNetworkGeometry =
DependencyManager::get<GeometryCache>()->getGeometry(_collisionModelURL, QUrl(), false); DependencyManager::get<GeometryCache>()->getGeometry(_collisionModelURL, QUrl(), false);

View file

@ -287,26 +287,11 @@ public:
void setDirtyBit() { _isDirty = true; } void setDirtyBit() { _isDirty = true; }
// Octree does not currently handle its own locking, caller must use these to lock/unlock // Octree does not currently handle its own locking, caller must use these to lock/unlock
void lockForRead() { void lockForRead() { _lock.lockForRead(); }
qDebug() << "READ LOCKING OCTREE" << QThread::currentThreadId(); bool tryLockForRead() { return _lock.tryLockForRead(); }
_lock.lockForRead(); void lockForWrite() { _lock.lockForWrite(); }
} bool tryLockForWrite() { return _lock.tryLockForWrite(); }
bool tryLockForRead() { void unlock() { _lock.unlock(); }
qDebug() << "TRY READ LOCKING OCTREE" << QThread::currentThreadId();
return _lock.tryLockForRead();
}
void lockForWrite() {
qDebug() << "WRITE LOCKING OCTREE" << QThread::currentThreadId();
_lock.lockForWrite();
}
bool tryLockForWrite() {
qDebug() << "TRY WRITE LOCKING OCTREE" << QThread::currentThreadId();
return _lock.tryLockForWrite();
}
void unlock() {
qDebug() << "UNLOCKING OCTREE" << QThread::currentThreadId();
_lock.unlock();
}
// output hints from the encode process // output hints from the encode process
typedef enum { typedef enum {
Lock, Lock,

View file

@ -283,7 +283,6 @@ void PhysicsEngine::stepSimulation() {
// expect the engine to have an avatar (and hence: a character controller) // expect the engine to have an avatar (and hence: a character controller)
assert(_avatarData); assert(_avatarData);
qDebug() << "lock0";
lock(); lock();
// NOTE: the grand order of operations is: // NOTE: the grand order of operations is:
@ -315,9 +314,7 @@ void PhysicsEngine::stepSimulation() {
int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP); int numSubsteps = _dynamicsWorld->stepSimulation(timeStep, MAX_NUM_SUBSTEPS, PHYSICS_ENGINE_FIXED_SUBSTEP);
_numSubsteps += (uint32_t)numSubsteps; _numSubsteps += (uint32_t)numSubsteps;
stepNonPhysicalKinematics(usecTimestampNow()); stepNonPhysicalKinematics(usecTimestampNow());
qDebug() << "unlock0";
unlock(); unlock();
qDebug() << "unlock0.1";
if (numSubsteps > 0) { if (numSubsteps > 0) {
// This is step (3) which is done outside of stepSimulation() so we can lock _entityTree. // This is step (3) which is done outside of stepSimulation() so we can lock _entityTree.
@ -330,43 +327,28 @@ void PhysicsEngine::stepSimulation() {
// TODO: untangle these lock sequences. // TODO: untangle these lock sequences.
_entityTree->lockForWrite(); _entityTree->lockForWrite();
qDebug() << "lock1";
lock(); lock();
qDebug() << "lock1.1";
_dynamicsWorld->synchronizeMotionStates(); _dynamicsWorld->synchronizeMotionStates();
qDebug() << "lock1.2";
_avatarData->lockForRead(); _avatarData->lockForRead();
qDebug() << "lock1.3";
bool avatarHasPhysicsEnabled = _avatarData->isPhysicsEnabled(); bool avatarHasPhysicsEnabled = _avatarData->isPhysicsEnabled();
qDebug() << "lock1.4";
_avatarData->unlock(); _avatarData->unlock();
qDebug() << "lock1.5";
if (avatarHasPhysicsEnabled) { if (avatarHasPhysicsEnabled) {
const btTransform& avatarTransform = _avatarGhostObject->getWorldTransform(); const btTransform& avatarTransform = _avatarGhostObject->getWorldTransform();
glm::quat rotation = bulletToGLM(avatarTransform.getRotation()); glm::quat rotation = bulletToGLM(avatarTransform.getRotation());
glm::vec3 offset = rotation * _avatarShapeLocalOffset; glm::vec3 offset = rotation * _avatarShapeLocalOffset;
qDebug() << "a";
_avatarData->lockForWrite(); _avatarData->lockForWrite();
_avatarData->setOrientation(rotation); _avatarData->setOrientation(rotation);
_avatarData->setPosition(bulletToGLM(avatarTransform.getOrigin()) - offset); _avatarData->setPosition(bulletToGLM(avatarTransform.getOrigin()) - offset);
_avatarData->unlock(); _avatarData->unlock();
} }
qDebug() << "unlock1";
unlock(); unlock();
qDebug() << "unlock1.1";
_avatarData->unlock(); _avatarData->unlock();
qDebug() << "unlock1.2";
_entityTree->unlock(); _entityTree->unlock();
qDebug() << "unlock1.3";
computeCollisionEvents(); computeCollisionEvents();
} }
qDebug() << "end";
} }
void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) { void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) {