summaryrefslogtreecommitdiffstats
path: root/src/render/jobs
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-11-10 12:34:27 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-11-16 12:26:47 +0000
commit3beb2c71d47cc7705a6481cb3740fe85ad673bd3 (patch)
tree66487b85ae87d2e3ea418bbdb6e750dfa15a16e6 /src/render/jobs
parentbcd550f41bf8be1fd09f796e648f2b9b4c3fa64e (diff)
UpdateBoundingVolumeJob: slightly updated
Change-Id: Id327e4eb6bd78618a62bc75ef0cdabc8b2111aa7 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/render/jobs')
-rw-r--r--src/render/jobs/updateboundingvolumejob.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/render/jobs/updateboundingvolumejob.cpp b/src/render/jobs/updateboundingvolumejob.cpp
index b31b7e85f..1a46ee2bc 100644
--- a/src/render/jobs/updateboundingvolumejob.cpp
+++ b/src/render/jobs/updateboundingvolumejob.cpp
@@ -56,13 +56,12 @@ void expandWorldBoundingVolume(Qt3DRender::Render::Entity *node)
Q_FOREACH (Entity *c, node->children())
expandWorldBoundingVolume(c);
- // Then traverse to root
+ // Then traverse back from leaf to root
// Initialize parent bounding volume to be equal to that of the first child
- Qt3DRender::Render::Entity *parentNode = node->parent();
- if (parentNode) {
- Qt3DRender::Render::Sphere *parentBoundingVolume = parentNode->worldBoundingVolumeWithChildren();
- Qt3DRender::Render::Sphere *nodeBoundingVolume = node->worldBoundingVolumeWithChildren();
- parentBoundingVolume->expandToContain(*nodeBoundingVolume);
+ if (node->hasChildren()) {
+ Qt3DRender::Render::Sphere *parentBoundingVolume = node->worldBoundingVolumeWithChildren();
+ Q_FOREACH (Entity *c, node->children())
+ parentBoundingVolume->expandToContain(*c->worldBoundingVolumeWithChildren());
}
}