mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 12:52:52 +02:00
reversing some changes
This commit is contained in:
parent
493648b56e
commit
d01090afbc
3 changed files with 5 additions and 5 deletions
|
@ -459,6 +459,7 @@ bool ParticleTree::pruneOperation(OctreeElement* element, void* extraData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleTree::update() {
|
void ParticleTree::update() {
|
||||||
|
lockForWrite();
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
|
|
||||||
ParticleTreeUpdateArgs args = { };
|
ParticleTreeUpdateArgs args = { };
|
||||||
|
@ -473,9 +474,7 @@ void ParticleTree::update() {
|
||||||
AABox treeBounds = getRoot()->getAABox();
|
AABox treeBounds = getRoot()->getAABox();
|
||||||
|
|
||||||
if (!shouldDie && treeBounds.contains(args._movingParticles[i].getPosition())) {
|
if (!shouldDie && treeBounds.contains(args._movingParticles[i].getPosition())) {
|
||||||
lockForWrite();
|
|
||||||
storeParticle(args._movingParticles[i]);
|
storeParticle(args._movingParticles[i]);
|
||||||
unlock();
|
|
||||||
} else {
|
} else {
|
||||||
uint32_t particleID = args._movingParticles[i].getID();
|
uint32_t particleID = args._movingParticles[i].getID();
|
||||||
quint64 deletedAt = usecTimestampNow();
|
quint64 deletedAt = usecTimestampNow();
|
||||||
|
@ -486,7 +485,6 @@ void ParticleTree::update() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// prune the tree...
|
// prune the tree...
|
||||||
lockForWrite();
|
|
||||||
recurseTreeWithOperation(pruneOperation, NULL);
|
recurseTreeWithOperation(pruneOperation, NULL);
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
void addParticle(const ParticleID& particleID, const ParticleProperties& properties);
|
void addParticle(const ParticleID& particleID, const ParticleProperties& properties);
|
||||||
void deleteParticle(const ParticleID& particleID);
|
void deleteParticle(const ParticleID& particleID);
|
||||||
const Particle* findClosestParticle(glm::vec3 position, float targetRadius);
|
const Particle* findClosestParticle(glm::vec3 position, float targetRadius);
|
||||||
const Particle* findParticleByID(uint32_t id);
|
const Particle* findParticleByID(uint32_t id, bool alreadyLocked = false);
|
||||||
|
|
||||||
/// finds all particles that touch a sphere
|
/// finds all particles that touch a sphere
|
||||||
/// \param center the center of the sphere
|
/// \param center the center of the sphere
|
||||||
|
|
|
@ -33,7 +33,9 @@ ParticleID ParticlesScriptingInterface::addParticle(const ParticleProperties& pr
|
||||||
|
|
||||||
// If we have a local particle tree set, then also update it.
|
// If we have a local particle tree set, then also update it.
|
||||||
if (_particleTree) {
|
if (_particleTree) {
|
||||||
|
_particleTree->lockForWrite();
|
||||||
_particleTree->addParticle(id, properties);
|
_particleTree->addParticle(id, properties);
|
||||||
|
_particleTree->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
@ -64,7 +66,7 @@ ParticleProperties ParticlesScriptingInterface::getParticleProperties(ParticleID
|
||||||
}
|
}
|
||||||
if (_particleTree) {
|
if (_particleTree) {
|
||||||
_particleTree->lockForRead();
|
_particleTree->lockForRead();
|
||||||
const Particle* particle = _particleTree->findParticleByID(identity.id);
|
const Particle* particle = _particleTree->findParticleByID(identity.id, true);
|
||||||
if (particle) {
|
if (particle) {
|
||||||
results.copyFromParticle(*particle);
|
results.copyFromParticle(*particle);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue