reversing some changes

This commit is contained in:
ZappoMan 2014-03-03 17:06:46 -08:00
parent 5c0ec0ff6b
commit 493648b56e
3 changed files with 13 additions and 11 deletions

View file

@ -39,12 +39,13 @@ float boundaryDistanceForRenderLevel(unsigned int renderLevel, float voxelSizeSc
}
Octree::Octree(bool shouldReaverage) :
_rootNode(NULL),
_isDirty(true),
_shouldReaverage(shouldReaverage),
_stopImport(false),
_lock(QReadWriteLock::Recursive) {
_rootNode = NULL;
_isViewing = false;
_lock(),
_isViewing(false)
{
}
Octree::~Octree() {
@ -552,10 +553,7 @@ OctreeElement* Octree::getOctreeElementAt(float x, float y, float z, float s) co
OctreeElement* Octree::getOrCreateChildElementAt(float x, float y, float z, float s) {
lockForWrite();
OctreeElement* result = getRoot()->getOrCreateChildElementAt(x, y, z, s);
unlock();
return result;
return getRoot()->getOrCreateChildElementAt(x, y, z, s);
}

View file

@ -385,7 +385,7 @@ Particle Particle::fromEditPacket(const unsigned char* data, int length, int& pr
} else {
// look up the existing particle
const Particle* existingParticle = tree->findParticleByID(editID);
const Particle* existingParticle = tree->findParticleByID(editID, true);
// copy existing properties before over-writing with new properties
if (existingParticle) {

View file

@ -370,12 +370,16 @@ bool ParticleTree::findByIDOperation(OctreeElement* element, void* extraData) {
}
const Particle* ParticleTree::findParticleByID(uint32_t id) {
const Particle* ParticleTree::findParticleByID(uint32_t id, bool alreadyLocked) {
FindByIDArgs args = { id, false, NULL };
lockForRead();
if (!alreadyLocked) {
lockForRead();
}
recurseTreeWithOperation(findByIDOperation, &args);
unlock();
if (!alreadyLocked) {
unlock();
}
return args.foundParticle;
}