cleanup names of findModels/findParticles in cube

This commit is contained in:
ZappoMan 2014-06-13 10:37:31 -07:00
parent 62b5553a86
commit c53d99838d
8 changed files with 18 additions and 18 deletions

View file

@ -353,21 +353,21 @@ public:
QVector<ModelItem*> _foundModels;
};
bool ModelTree::findInCubeForUpdateOperation(OctreeElement* element, void* extraData) {
bool ModelTree::findInCubeOperation(OctreeElement* element, void* extraData) {
FindModelsInCubeArgs* args = static_cast< FindModelsInCubeArgs*>(extraData);
const AACube& elementCube = element->getAACube();
if (elementCube.touches(args->_cube)) {
ModelTreeElement* modelTreeElement = static_cast<ModelTreeElement*>(element);
modelTreeElement->getModelsForUpdate(args->_cube, args->_foundModels);
modelTreeElement->getModels(args->_cube, args->_foundModels);
return true;
}
return false;
}
void ModelTree::findModelsForUpdate(const AACube& cube, QVector<ModelItem*> foundModels) {
void ModelTree::findModels(const AACube& cube, QVector<ModelItem*> foundModels) {
FindModelsInCubeArgs args(cube);
lockForRead();
recurseTreeWithOperation(findInCubeForUpdateOperation, &args);
recurseTreeWithOperation(findInCubeOperation, &args);
unlock();
// swap the two lists of model pointers instead of copy
foundModels.swap(args._foundModels);

View file

@ -67,7 +67,7 @@ public:
/// \param cube the query cube
/// \param foundModels[out] vector of non-const ModelItem*
/// \remark Side effect: any initial contents in models will be lost
void findModelsForUpdate(const AACube& cube, QVector<ModelItem*> foundModels);
void findModels(const AACube& cube, QVector<ModelItem*> foundModels);
void addNewlyCreatedHook(NewlyCreatedModelHook* hook);
void removeNewlyCreatedHook(NewlyCreatedModelHook* hook);
@ -97,13 +97,12 @@ private:
static bool findByIDOperation(OctreeElement* element, void* extraData);
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
static bool findAndUpdateModelItemIDOperation(OctreeElement* element, void* extraData);
static bool findInCubeForUpdateOperation(OctreeElement* element, void* extraData);
static bool findInCubeOperation(OctreeElement* element, void* extraData);
void notifyNewlyCreatedModel(const ModelItem& newModel, const SharedNodePointer& senderNode);
QReadWriteLock _newlyCreatedHooksLock;
std::vector<NewlyCreatedModelHook*> _newlyCreatedHooks;
QVector<NewlyCreatedModelHook*> _newlyCreatedHooks;
QReadWriteLock _recentlyDeletedModelsLock;
QMultiMap<quint64, uint32_t> _recentlyDeletedModelItemIDs;

View file

@ -468,7 +468,7 @@ void ModelTreeElement::getModels(const glm::vec3& searchPosition, float searchRa
}
}
void ModelTreeElement::getModelsForUpdate(const AACube& box, QVector<ModelItem*>& foundModels) {
void ModelTreeElement::getModels(const AACube& box, QVector<ModelItem*>& foundModels) {
QList<ModelItem>::iterator modelItr = _modelItems->begin();
QList<ModelItem>::iterator modelEnd = _modelItems->end();
AACube modelCube;

View file

@ -135,7 +135,7 @@ public:
/// finds all models that touch a box
/// \param box the query box
/// \param models[out] vector of non-const ModelItem*
void getModelsForUpdate(const AACube& box, QVector<ModelItem*>& foundModels);
void getModels(const AACube& box, QVector<ModelItem*>& foundModels);
const ModelItem* getModelWithID(uint32_t id) const;

View file

@ -320,21 +320,21 @@ public:
QVector<Particle*> _foundParticles;
};
bool ParticleTree::findInCubeForUpdateOperation(OctreeElement* element, void* extraData) {
bool ParticleTree::findInCubeOperation(OctreeElement* element, void* extraData) {
FindParticlesInCubeArgs* args = static_cast< FindParticlesInCubeArgs*>(extraData);
const AACube& elementBox = element->getAACube();
if (elementBox.touches(args->_cube)) {
ParticleTreeElement* particleTreeElement = static_cast<ParticleTreeElement*>(element);
particleTreeElement->getParticlesForUpdate(args->_cube, args->_foundParticles);
particleTreeElement->getParticles(args->_cube, args->_foundParticles);
return true;
}
return false;
}
void ParticleTree::findParticlesForUpdate(const AACube& cube, QVector<Particle*> foundParticles) {
void ParticleTree::findParticles(const AACube& cube, QVector<Particle*> foundParticles) {
FindParticlesInCubeArgs args(cube);
lockForRead();
recurseTreeWithOperation(findInCubeForUpdateOperation, &args);
recurseTreeWithOperation(findInCubeOperation, &args);
unlock();
// swap the two lists of particle pointers instead of copy
foundParticles.swap(args._foundParticles);

View file

@ -60,7 +60,7 @@ public:
/// \param box the query box
/// \param foundParticles[out] vector of non-const Particle*
/// \remark Side effect: any initial contents in particles will be lost
void findParticlesForUpdate(const AACube& box, QVector<Particle*> foundParticles);
void findParticles(const AACube& box, QVector<Particle*> foundParticles);
void addNewlyCreatedHook(NewlyCreatedParticleHook* hook);
void removeNewlyCreatedHook(NewlyCreatedParticleHook* hook);
@ -84,7 +84,8 @@ private:
static bool findByIDOperation(OctreeElement* element, void* extraData);
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
static bool findAndUpdateParticleIDOperation(OctreeElement* element, void* extraData);
static bool findInCubeForUpdateOperation(OctreeElement* element, void* extraData);
static bool findInCubeOperation(OctreeElement* element, void* extraData);
void notifyNewlyCreatedParticle(const Particle& newParticle, const SharedNodePointer& senderNode);

View file

@ -245,7 +245,7 @@ void ParticleTreeElement::getParticles(const glm::vec3& searchPosition, float se
}
}
void ParticleTreeElement::getParticlesForUpdate(const AACube& box, QVector<Particle*>& foundParticles) {
void ParticleTreeElement::getParticles(const AACube& box, QVector<Particle*>& foundParticles) {
QList<Particle>::iterator particleItr = _particles->begin();
QList<Particle>::iterator particleEnd = _particles->end();
AACube particleCube;

View file

@ -114,7 +114,7 @@ public:
/// finds all particles that touch a box
/// \param box the query box
/// \param particles[out] vector of non-const Particle*
void getParticlesForUpdate(const AACube& box, QVector<Particle*>& foundParticles);
void getParticles(const AACube& box, QVector<Particle*>& foundParticles);
const Particle* getParticleWithID(uint32_t id) const;