History

Compute the mesh extents for geometry and use them to set the spanner bounds.

Andrzej Kapolka committed 12 years ago

Commit 71843901 parent 4dea4b56 files · +118 −10Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 6 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+10−0
@@ -9,6 +9,8 @@ · 8 unmodified lines
99 #include <QMutexLocker>
1010 #include <QtDebug>
1111
12+#include <glm/gtx/transform.hpp>
13+
1214 #include <SharedUtil.h>
1315
1416 #include <MetavoxelUtil.h>
@@ -274,6 +276,14 @@ void StaticModelRenderer::init(Spanner* spanner) { · 259 unmodified lines
274276 }
275277
276278 void StaticModelRenderer::simulate(float deltaTime) {
279+ // update the bounds
280+ Box bounds;
281+ if (_model->isActive()) {
282+ const Extents& extents = _model->getGeometry()->getFBXGeometry().meshExtents;
283+ bounds = Box(extents.minimum, extents.maximum);
284+ }
285+ static_cast<StaticModel*>(parent())->setBounds(glm::translate(_model->getTranslation()) *
286+ glm::mat4_cast(_model->getRotation()) * glm::scale(_model->getScale()) * bounds);
277287 _model->simulate(deltaTime);
278288 }
279289