mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 09:33:49 +02:00
Merge pull request #14712 from AndrewMeadows/shaped-zones-2
case 20597: fix zones using FBX models with non-trivial mesh.modelTransform
This commit is contained in:
commit
b9b21b7f87
1 changed files with 3 additions and 1 deletions
|
@ -205,6 +205,8 @@ bool HFMModel::convexHullContains(const glm::vec3& point) const {
|
|||
|
||||
auto checkEachPrimitive = [=](HFMMesh& mesh, QVector<int> indices, int primitiveSize) -> bool {
|
||||
// Check whether the point is "behind" all the primitives.
|
||||
// But first must transform from model-frame into mesh-frame
|
||||
glm::vec3 transformedPoint = glm::vec3(glm::inverse(mesh.modelTransform) * glm::vec4(point, 1.0f));
|
||||
int verticesSize = mesh.vertices.size();
|
||||
for (int j = 0;
|
||||
j < indices.size() - 2; // -2 in case the vertices aren't the right size -- we access j + 2 below
|
||||
|
@ -212,7 +214,7 @@ bool HFMModel::convexHullContains(const glm::vec3& point) const {
|
|||
if (indices[j] < verticesSize &&
|
||||
indices[j + 1] < verticesSize &&
|
||||
indices[j + 2] < verticesSize &&
|
||||
!isPointBehindTrianglesPlane(point,
|
||||
!isPointBehindTrianglesPlane(transformedPoint,
|
||||
mesh.vertices[indices[j]],
|
||||
mesh.vertices[indices[j + 1]],
|
||||
mesh.vertices[indices[j + 2]])) {
|
||||
|
|
Loading…
Reference in a new issue