mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-06 01:13:10 +02:00
avoid nan in Model::_scale
This commit is contained in:
parent
0d8169bd35
commit
72ac35c6f7
2 changed files with 3 additions and 1 deletions
|
@ -1289,6 +1289,8 @@ void Model::scaleToFit() {
|
||||||
// size is our "target size in world space"
|
// size is our "target size in world space"
|
||||||
// we need to set our model scale so that the extents of the mesh, fit in a box that size...
|
// we need to set our model scale so that the extents of the mesh, fit in a box that size...
|
||||||
glm::vec3 meshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum;
|
glm::vec3 meshDimensions = modelMeshExtents.maximum - modelMeshExtents.minimum;
|
||||||
|
const glm::vec3 MIN_MESH_DIMENSIONS { 1.0e-6f }; // one micrometer
|
||||||
|
meshDimensions = glm::max(meshDimensions, MIN_MESH_DIMENSIONS);
|
||||||
glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions;
|
glm::vec3 rescaleDimensions = _scaleToFitDimensions / meshDimensions;
|
||||||
setScaleInternal(rescaleDimensions);
|
setScaleInternal(rescaleDimensions);
|
||||||
_scaledToFit = true;
|
_scaledToFit = true;
|
||||||
|
|
|
@ -397,7 +397,7 @@ protected:
|
||||||
|
|
||||||
glm::vec3 _translation; // this is the translation in world coordinates to the model's registration point
|
glm::vec3 _translation; // this is the translation in world coordinates to the model's registration point
|
||||||
glm::quat _rotation;
|
glm::quat _rotation;
|
||||||
glm::vec3 _scale;
|
glm::vec3 _scale { 1.0f };
|
||||||
|
|
||||||
glm::vec3 _overrideTranslation;
|
glm::vec3 _overrideTranslation;
|
||||||
glm::quat _overrideRotation;
|
glm::quat _overrideRotation;
|
||||||
|
|
Loading…
Reference in a new issue