mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-02 09:18:47 +02:00
Fix blendshapes on planar meshes
This commit is contained in:
parent
128745ef36
commit
5d02e0fe28
1 changed files with 8 additions and 6 deletions
|
@ -1610,12 +1610,14 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add epsilon to mesh extents to compensate for planar meshes
|
// Mesh extents must be at least minimum entity size, in particular for blendshapes to work on planar meshes.
|
||||||
mesh.meshExtents.minimum -= glm::vec3(EPSILON, EPSILON, EPSILON);
|
const float ENTITY_ITEM_MIN_DIMENSION = 0.001f;
|
||||||
mesh.meshExtents.maximum += glm::vec3(EPSILON, EPSILON, EPSILON);
|
auto delta = glm::max(glm::vec3(ENTITY_ITEM_MIN_DIMENSION) - mesh.meshExtents.size(), glm::vec3(0.0f)) / 2.0f;
|
||||||
hfmModel.meshExtents.minimum -= glm::vec3(EPSILON, EPSILON, EPSILON);
|
mesh.meshExtents.minimum -= delta;
|
||||||
hfmModel.meshExtents.maximum += glm::vec3(EPSILON, EPSILON, EPSILON);
|
mesh.meshExtents.maximum += delta;
|
||||||
|
hfmModel.meshExtents.minimum -= delta;
|
||||||
|
hfmModel.meshExtents.maximum += delta;
|
||||||
|
|
||||||
mesh.meshIndex = hfmModel.meshes.size();
|
mesh.meshIndex = hfmModel.meshes.size();
|
||||||
}
|
}
|
||||||
++nodecount;
|
++nodecount;
|
||||||
|
|
Loading…
Reference in a new issue