mirror of
https://github.com/overte-org/overte.git
synced 2025-04-30 00:42:46 +02:00
cleanup names of findModels/findParticles in cube
This commit is contained in:
parent
62b5553a86
commit
c53d99838d
8 changed files with 18 additions and 18 deletions
|
@ -353,21 +353,21 @@ public:
|
||||||
QVector<ModelItem*> _foundModels;
|
QVector<ModelItem*> _foundModels;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ModelTree::findInCubeForUpdateOperation(OctreeElement* element, void* extraData) {
|
bool ModelTree::findInCubeOperation(OctreeElement* element, void* extraData) {
|
||||||
FindModelsInCubeArgs* args = static_cast< FindModelsInCubeArgs*>(extraData);
|
FindModelsInCubeArgs* args = static_cast< FindModelsInCubeArgs*>(extraData);
|
||||||
const AACube& elementCube = element->getAACube();
|
const AACube& elementCube = element->getAACube();
|
||||||
if (elementCube.touches(args->_cube)) {
|
if (elementCube.touches(args->_cube)) {
|
||||||
ModelTreeElement* modelTreeElement = static_cast<ModelTreeElement*>(element);
|
ModelTreeElement* modelTreeElement = static_cast<ModelTreeElement*>(element);
|
||||||
modelTreeElement->getModelsForUpdate(args->_cube, args->_foundModels);
|
modelTreeElement->getModels(args->_cube, args->_foundModels);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelTree::findModelsForUpdate(const AACube& cube, QVector<ModelItem*> foundModels) {
|
void ModelTree::findModels(const AACube& cube, QVector<ModelItem*> foundModels) {
|
||||||
FindModelsInCubeArgs args(cube);
|
FindModelsInCubeArgs args(cube);
|
||||||
lockForRead();
|
lockForRead();
|
||||||
recurseTreeWithOperation(findInCubeForUpdateOperation, &args);
|
recurseTreeWithOperation(findInCubeOperation, &args);
|
||||||
unlock();
|
unlock();
|
||||||
// swap the two lists of model pointers instead of copy
|
// swap the two lists of model pointers instead of copy
|
||||||
foundModels.swap(args._foundModels);
|
foundModels.swap(args._foundModels);
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
/// \param cube the query cube
|
/// \param cube the query cube
|
||||||
/// \param foundModels[out] vector of non-const ModelItem*
|
/// \param foundModels[out] vector of non-const ModelItem*
|
||||||
/// \remark Side effect: any initial contents in models will be lost
|
/// \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 addNewlyCreatedHook(NewlyCreatedModelHook* hook);
|
||||||
void removeNewlyCreatedHook(NewlyCreatedModelHook* hook);
|
void removeNewlyCreatedHook(NewlyCreatedModelHook* hook);
|
||||||
|
@ -97,13 +97,12 @@ private:
|
||||||
static bool findByIDOperation(OctreeElement* element, void* extraData);
|
static bool findByIDOperation(OctreeElement* element, void* extraData);
|
||||||
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
|
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
|
||||||
static bool findAndUpdateModelItemIDOperation(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);
|
void notifyNewlyCreatedModel(const ModelItem& newModel, const SharedNodePointer& senderNode);
|
||||||
|
|
||||||
QReadWriteLock _newlyCreatedHooksLock;
|
QReadWriteLock _newlyCreatedHooksLock;
|
||||||
std::vector<NewlyCreatedModelHook*> _newlyCreatedHooks;
|
QVector<NewlyCreatedModelHook*> _newlyCreatedHooks;
|
||||||
|
|
||||||
|
|
||||||
QReadWriteLock _recentlyDeletedModelsLock;
|
QReadWriteLock _recentlyDeletedModelsLock;
|
||||||
QMultiMap<quint64, uint32_t> _recentlyDeletedModelItemIDs;
|
QMultiMap<quint64, uint32_t> _recentlyDeletedModelItemIDs;
|
||||||
|
|
|
@ -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 modelItr = _modelItems->begin();
|
||||||
QList<ModelItem>::iterator modelEnd = _modelItems->end();
|
QList<ModelItem>::iterator modelEnd = _modelItems->end();
|
||||||
AACube modelCube;
|
AACube modelCube;
|
||||||
|
|
|
@ -135,7 +135,7 @@ public:
|
||||||
/// finds all models that touch a box
|
/// finds all models that touch a box
|
||||||
/// \param box the query box
|
/// \param box the query box
|
||||||
/// \param models[out] vector of non-const ModelItem*
|
/// \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;
|
const ModelItem* getModelWithID(uint32_t id) const;
|
||||||
|
|
||||||
|
|
|
@ -320,21 +320,21 @@ public:
|
||||||
QVector<Particle*> _foundParticles;
|
QVector<Particle*> _foundParticles;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ParticleTree::findInCubeForUpdateOperation(OctreeElement* element, void* extraData) {
|
bool ParticleTree::findInCubeOperation(OctreeElement* element, void* extraData) {
|
||||||
FindParticlesInCubeArgs* args = static_cast< FindParticlesInCubeArgs*>(extraData);
|
FindParticlesInCubeArgs* args = static_cast< FindParticlesInCubeArgs*>(extraData);
|
||||||
const AACube& elementBox = element->getAACube();
|
const AACube& elementBox = element->getAACube();
|
||||||
if (elementBox.touches(args->_cube)) {
|
if (elementBox.touches(args->_cube)) {
|
||||||
ParticleTreeElement* particleTreeElement = static_cast<ParticleTreeElement*>(element);
|
ParticleTreeElement* particleTreeElement = static_cast<ParticleTreeElement*>(element);
|
||||||
particleTreeElement->getParticlesForUpdate(args->_cube, args->_foundParticles);
|
particleTreeElement->getParticles(args->_cube, args->_foundParticles);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleTree::findParticlesForUpdate(const AACube& cube, QVector<Particle*> foundParticles) {
|
void ParticleTree::findParticles(const AACube& cube, QVector<Particle*> foundParticles) {
|
||||||
FindParticlesInCubeArgs args(cube);
|
FindParticlesInCubeArgs args(cube);
|
||||||
lockForRead();
|
lockForRead();
|
||||||
recurseTreeWithOperation(findInCubeForUpdateOperation, &args);
|
recurseTreeWithOperation(findInCubeOperation, &args);
|
||||||
unlock();
|
unlock();
|
||||||
// swap the two lists of particle pointers instead of copy
|
// swap the two lists of particle pointers instead of copy
|
||||||
foundParticles.swap(args._foundParticles);
|
foundParticles.swap(args._foundParticles);
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
/// \param box the query box
|
/// \param box the query box
|
||||||
/// \param foundParticles[out] vector of non-const Particle*
|
/// \param foundParticles[out] vector of non-const Particle*
|
||||||
/// \remark Side effect: any initial contents in particles will be lost
|
/// \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 addNewlyCreatedHook(NewlyCreatedParticleHook* hook);
|
||||||
void removeNewlyCreatedHook(NewlyCreatedParticleHook* hook);
|
void removeNewlyCreatedHook(NewlyCreatedParticleHook* hook);
|
||||||
|
@ -84,7 +84,8 @@ private:
|
||||||
static bool findByIDOperation(OctreeElement* element, void* extraData);
|
static bool findByIDOperation(OctreeElement* element, void* extraData);
|
||||||
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
|
static bool findAndDeleteOperation(OctreeElement* element, void* extraData);
|
||||||
static bool findAndUpdateParticleIDOperation(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);
|
void notifyNewlyCreatedParticle(const Particle& newParticle, const SharedNodePointer& senderNode);
|
||||||
|
|
||||||
|
|
|
@ -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 particleItr = _particles->begin();
|
||||||
QList<Particle>::iterator particleEnd = _particles->end();
|
QList<Particle>::iterator particleEnd = _particles->end();
|
||||||
AACube particleCube;
|
AACube particleCube;
|
||||||
|
|
|
@ -114,7 +114,7 @@ public:
|
||||||
/// finds all particles that touch a box
|
/// finds all particles that touch a box
|
||||||
/// \param box the query box
|
/// \param box the query box
|
||||||
/// \param particles[out] vector of non-const Particle*
|
/// \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;
|
const Particle* getParticleWithID(uint32_t id) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue