mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 16:02:58 +02:00
Fix export entities by region
This commit is contained in:
parent
e784d7c400
commit
d6250d4c5a
1 changed files with 6 additions and 3 deletions
|
@ -3049,17 +3049,20 @@ bool Application::exportEntities(const QString& filename, const QVector<EntityIt
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) {
|
bool Application::exportEntities(const QString& filename, float x, float y, float z, float scale) {
|
||||||
glm::vec3 offset(x, y, z);
|
glm::vec3 center(x, y, z);
|
||||||
|
glm::vec3 minCorner = center - vec3(scale);
|
||||||
|
float cubeSize = scale * 2;
|
||||||
|
AACube boundingCube(minCorner, cubeSize);
|
||||||
QVector<EntityItemPointer> entities;
|
QVector<EntityItemPointer> entities;
|
||||||
QVector<EntityItemID> ids;
|
QVector<EntityItemID> ids;
|
||||||
auto entityTree = getEntities()->getTree();
|
auto entityTree = getEntities()->getTree();
|
||||||
entityTree->withReadLock([&] {
|
entityTree->withReadLock([&] {
|
||||||
entityTree->findEntities(AACube(offset, scale), entities);
|
entityTree->findEntities(boundingCube, entities);
|
||||||
foreach(EntityItemPointer entity, entities) {
|
foreach(EntityItemPointer entity, entities) {
|
||||||
ids << entity->getEntityItemID();
|
ids << entity->getEntityItemID();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return exportEntities(filename, ids, &offset);
|
return exportEntities(filename, ids, ¢er);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::loadSettings() {
|
void Application::loadSettings() {
|
||||||
|
|
Loading…
Reference in a new issue