update render-land bounds when polyvox moves

This commit is contained in:
Seth Alves 2016-11-16 15:10:43 -08:00
parent d097fa7982
commit a14ff22df3
2 changed files with 24 additions and 8 deletions

View file

@ -1323,14 +1323,14 @@ void RenderablePolyVoxEntityItem::setCollisionPoints(ShapeInfo::PointCollection
// include the registrationPoint in the shape key, because the offset is already
// included in the points and the shapeManager wont know that the shape has changed.
withWriteLock([&] {
QString shapeKey = QString(_voxelData.toBase64()) + "," +
QString::number(_registrationPoint.x) + "," +
QString::number(_registrationPoint.y) + "," +
QString::number(_registrationPoint.z);
_shapeInfo.setParams(SHAPE_TYPE_COMPOUND, collisionModelDimensions, shapeKey);
_shapeInfo.setPointCollection(pointCollection);
_meshDirty = false;
});
QString shapeKey = QString(_voxelData.toBase64()) + "," +
QString::number(_registrationPoint.x) + "," +
QString::number(_registrationPoint.y) + "," +
QString::number(_registrationPoint.z);
_shapeInfo.setParams(SHAPE_TYPE_COMPOUND, collisionModelDimensions, shapeKey);
_shapeInfo.setPointCollection(pointCollection);
_meshDirty = false;
});
}
void RenderablePolyVoxEntityItem::setXNNeighborID(const EntityItemID& xNNeighborID) {
@ -1439,3 +1439,16 @@ void RenderablePolyVoxEntityItem::bonkNeighbors() {
currentZNNeighbor->setVolDataDirty();
}
}
void RenderablePolyVoxEntityItem::locationChanged(bool tellPhysics) {
EntityItem::locationChanged(tellPhysics);
if (!render::Item::isValidID(_myItem)) {
return;
}
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
render::PendingChanges pendingChanges;
pendingChanges.updateItem<PolyVoxPayload>(_myItem, [](PolyVoxPayload& payload) {});
scene->enqueuePendingChanges(pendingChanges);
}

View file

@ -141,6 +141,9 @@ public:
// Transparent polyvox didn't seem to be working so disable for now
bool isTransparent() override { return false; }
protected:
virtual void locationChanged(bool tellPhysics = true) override;
private:
// The PolyVoxEntityItem class has _voxelData which contains dimensions and compressed voxel data. The dimensions
// may not match _voxelVolumeSize.