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
9#include <QMutexLocker>9#include <QMutexLocker>
10#include <QtDebug>10#include <QtDebug>
11 11
12#include <glm/gtx/transform.hpp>
13
12#include <SharedUtil.h>14#include <SharedUtil.h>
13 15
14#include <MetavoxelUtil.h>16#include <MetavoxelUtil.h>
@@ -274,6 +276,14 @@ void StaticModelRenderer::init(Spanner* spanner) { · 259 unmodified lines
274}276}
275 277
276void StaticModelRenderer::simulate(float deltaTime) {278void 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);
277 _model->simulate(deltaTime);287 _model->simulate(deltaTime);
278}288}
279 289