History

avoid nan in Model::_scale

Andrew Meadows committed 7 years ago

Commit 72ac35c1 parent 0d8169b2 files · +3 −1Browse files

Showing the changes to libraries/render-utils/src/Model.cpp (1 of 2 files). Show all

Unified · Split

libraries/render-utils/src/Model.cpp+2−0
@@ -1289,6 +1289,8 @@ void Model::scaleToFit() { · 1288 unmodified lines
12891289 // size is our "target size in world space"
12901290 // we need to set our model scale so that the extents of the mesh, fit in a box that size...
12911291 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);
12921294 glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions;
12931295 setScaleInternal(rescaleDimensions);
12941296 _scaledToFit = true;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t