Showing the changes to libraries/render-utils/src/Model.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1289,6 +1289,8 @@ void Model::scaleToFit() { · 1288 unmodified lines | |||
| 1289 | // size is our "target size in world space" | 1289 | // size is our "target size in world space" |
| 1290 | // we need to set our model scale so that the extents of the mesh, fit in a box that size... | 1290 | // we need to set our model scale so that the extents of the mesh, fit in a box that size... |
| 1291 | glm::vec3 meshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum; | 1291 | glm::vec3 meshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum; |
| 1292 | const glm::vec3 MIN_MESH_DIMENSIONS { 1.0e-6f }; // one micrometer | ||
| 1293 | meshDimensions = glm::max(meshDimensions, MIN_MESH_DIMENSIONS); | ||
| 1292 | glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions; | 1294 | glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions; |
| 1293 | setScaleInternal(rescaleDimensions); | 1295 | setScaleInternal(rescaleDimensions); |
| 1294 | _scaledToFit = true; | 1296 | _scaledToFit = true; |