mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 09:13:10 +02:00
Adding ParticleTreeElement::findParticles(box, QVector<Particles*>)
This commit is contained in:
parent
f6a49c96a7
commit
998b772be4
1 changed files with 15 additions and 1 deletions
|
@ -211,7 +211,21 @@ bool ParticleTreeElement::removeParticleWithID(uint32_t id) {
|
|||
return foundParticle;
|
||||
}
|
||||
|
||||
|
||||
void ParticleTreeElement::findParticles(const AABox& box, QVector<Particle*>& foundParticles) {
|
||||
QList<Particle>::iterator particleItr = _particles->begin();
|
||||
QList<Particle>::iterator particleEnd = _particles->end();
|
||||
AABox particleBox;
|
||||
while(particleItr != particleEnd) {
|
||||
Particle* particle = &(*particleItr);
|
||||
float radius = particle->getRadius();
|
||||
particleBox.setBox(particle->getPosition() - glm::vec3(radius), 2.f * radius);
|
||||
// TODO: replace particleBox-box query with sphere-box
|
||||
if (particleBox.touches(_box)) {
|
||||
foundParticles.push_back(particle);
|
||||
}
|
||||
++particleItr;
|
||||
}
|
||||
}
|
||||
|
||||
int ParticleTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
ReadBitstreamToTreeParams& args) {
|
||||
|
|
Loading…
Reference in a new issue