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
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;

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