mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 01:24:36 +02:00
Fix recalculateMeshBoxes being called outside of mutex
This commit is contained in:
parent
587bf78826
commit
1734d5e584
1 changed files with 5 additions and 5 deletions
|
@ -545,11 +545,6 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
|
||||||
// we can use the AABox's ray intersection by mapping our origin and direction into the model frame
|
// we can use the AABox's ray intersection by mapping our origin and direction into the model frame
|
||||||
// and testing intersection there.
|
// and testing intersection there.
|
||||||
if (modelFrameBox.findRayIntersection(modelFrameOrigin, modelFrameDirection, distance, face)) {
|
if (modelFrameBox.findRayIntersection(modelFrameOrigin, modelFrameDirection, distance, face)) {
|
||||||
|
|
||||||
if (!_calculatedMeshBoxesValid) {
|
|
||||||
recalculateMeshBoxes(pickAgainstTriangles);
|
|
||||||
}
|
|
||||||
|
|
||||||
float bestDistance = std::numeric_limits<float>::max();
|
float bestDistance = std::numeric_limits<float>::max();
|
||||||
|
|
||||||
float distanceToSubMesh;
|
float distanceToSubMesh;
|
||||||
|
@ -560,6 +555,11 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g
|
||||||
|
|
||||||
// If we hit the models box, then consider the submeshes...
|
// If we hit the models box, then consider the submeshes...
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
|
|
||||||
|
if (!_calculatedMeshBoxesValid) {
|
||||||
|
recalculateMeshBoxes(pickAgainstTriangles);
|
||||||
|
}
|
||||||
|
|
||||||
foreach(const AABox& subMeshBox, _calculatedMeshBoxes) {
|
foreach(const AABox& subMeshBox, _calculatedMeshBoxes) {
|
||||||
|
|
||||||
if (subMeshBox.findRayIntersection(origin, direction, distanceToSubMesh, subMeshFace)) {
|
if (subMeshBox.findRayIntersection(origin, direction, distanceToSubMesh, subMeshFace)) {
|
||||||
|
|
Loading…
Reference in a new issue