scale collision render mesh correctly

This commit is contained in:
Andrew Meadows 2016-08-24 11:21:47 -07:00
parent acaa77b75a
commit 19cd4648ad
3 changed files with 8 additions and 7 deletions

View file

@ -2213,4 +2213,4 @@ void EntityItem::globalizeProperties(EntityItemProperties& properties, const QSt
}
QUuid empty;
properties.setParentID(empty);
}
}

View file

@ -190,10 +190,6 @@ bool CollisionRenderMeshCache::releaseMesh(CollisionRenderMeshCache::Key key) {
}
CollisionMeshMap::const_iterator itr = _meshMap.find(key);
if (itr != _meshMap.end()) {
// we hold at least one reference, and the outer scope also holds at least one
// so we assert that the reference count is not 1
assert((*itr).second.use_count() != 1);
_pendingGarbage.push_back(key);
return true;
}

View file

@ -166,6 +166,11 @@ void Model::updateRenderItems() {
return;
}
glm::vec3 scale = getScale();
if (_collisionGeometry) {
// _collisionGeometry is already scaled
scale = glm::vec3(1.0f);
}
_needsUpdateClusterMatrices = true;
_renderItemsNeedUpdate = false;
@ -173,7 +178,7 @@ void Model::updateRenderItems() {
// the application will ensure only the last lambda is actually invoked.
void* key = (void*)this;
std::weak_ptr<Model> weakSelf = shared_from_this();
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [weakSelf]() {
AbstractViewStateInterface::instance()->pushPostUpdateLambda(key, [weakSelf, scale]() {
// do nothing, if the model has already been destroyed.
auto self = weakSelf.lock();
@ -184,7 +189,7 @@ void Model::updateRenderItems() {
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
Transform modelTransform;
modelTransform.setScale(self->_scale);
modelTransform.setScale(scale);
modelTransform.setTranslation(self->_translation);
modelTransform.setRotation(self->_rotation);