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)) { }
virtual ~EntitySimulation() { setEntityTree(NULL); }
void lock() {
qDebug() << "LOCKING SIMULATION" << QThread::currentThreadId();
_mutex.lock();
}
void unlock() {
qDebug() << "UNLOCKING SIMULATION" << QThread::currentThreadId();
_mutex.unlock();
}
void lock() { _mutex.lock(); }
void unlock() { _mutex.unlock(); }
/// \param tree pointer to EntityTree which is stored internally
void setEntityTree(EntityTree* tree);

View file

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

View file

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

View file

@ -283,7 +283,6 @@ void PhysicsEngine::stepSimulation() {
// expect the engine to have an avatar (and hence: a character controller)
assert(_avatarData);
qDebug() << "lock0";
lock();
// 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);
_numSubsteps += (uint32_t)numSubsteps;
stepNonPhysicalKinematics(usecTimestampNow());
qDebug() << "unlock0";
unlock();
qDebug() << "unlock0.1";
if (numSubsteps > 0) {
// 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.
_entityTree->lockForWrite();
qDebug() << "lock1";
lock();
qDebug() << "lock1.1";
_dynamicsWorld->synchronizeMotionStates();
qDebug() << "lock1.2";
_avatarData->lockForRead();
qDebug() << "lock1.3";
bool avatarHasPhysicsEnabled = _avatarData->isPhysicsEnabled();
qDebug() << "lock1.4";
_avatarData->unlock();
qDebug() << "lock1.5";
if (avatarHasPhysicsEnabled) {
const btTransform& avatarTransform = _avatarGhostObject->getWorldTransform();
glm::quat rotation = bulletToGLM(avatarTransform.getRotation());
glm::vec3 offset = rotation * _avatarShapeLocalOffset;
qDebug() << "a";
_avatarData->lockForWrite();
_avatarData->setOrientation(rotation);
_avatarData->setPosition(bulletToGLM(avatarTransform.getOrigin()) - offset);
_avatarData->unlock();
}
qDebug() << "unlock1";
unlock();
qDebug() << "unlock1.1";
_avatarData->unlock();
qDebug() << "unlock1.2";
_entityTree->unlock();
qDebug() << "unlock1.3";
computeCollisionEvents();
}
qDebug() << "end";
}
void PhysicsEngine::stepNonPhysicalKinematics(const quint64& now) {