Showing the changes to interface/src/renderer/Model.cpp (1 of 3 files). Show all
Unified · Split
| @@ -536,6 +536,8 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g · 535 unmodified lines | ||
| 536 | 536 | return intersectedSomething; |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | + qDebug() << "Model::findRayIntersectionAgainstSubMeshes()..."; | |
| 540 | + | |
| 539 | 541 | // extents is the entity relative, scaled, centered extents of the entity |
| 540 | 542 | glm::vec3 position = _translation; |
| 541 | 543 | glm::mat4 rotation = glm::mat4_cast(_rotation); |
| @@ -544,11 +546,14 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g · 2 unmodified lines | ||
| 544 | 546 | glm::mat4 worldToModelMatrix = glm::inverse(modelToWorldMatrix); |
| 545 | 547 | |
| 546 | 548 | Extents modelExtents = getMeshExtents(); // NOTE: unrotated |
| 549 | + qDebug() << " modelExtents:" << modelExtents; | |
| 547 | 550 | |
| 548 | 551 | glm::vec3 dimensions = modelExtents.maximum - modelExtents.minimum; |
| 549 | 552 | glm::vec3 corner = dimensions * -0.5f; // since we're going to do the ray picking in the model frame of reference |
| 550 | 553 | AABox overlayFrameBox(corner, dimensions); |
| 551 | 554 | |
| 555 | + qDebug() << " overlayFrameBox:" << overlayFrameBox; | |
| 556 | + | |
| 552 | 557 | glm::vec3 modelFrameOrigin = glm::vec3(worldToModelMatrix * glm::vec4(origin, 1.0f)); |
| 553 | 558 | glm::vec3 modelFrameDirection = glm::vec3(worldToModelMatrix * glm::vec4(direction, 0.0f)); |
| 554 | 559 | |
| @@ -560,11 +565,13 @@ bool Model::findRayIntersectionAgainstSubMeshes(const glm::vec3& origin, const g · 5 unmodified lines | ||
| 560 | 565 | float distanceToSubMesh; |
| 561 | 566 | BoxFace subMeshFace; |
| 562 | 567 | int subMeshIndex = 0; |
| 568 | + | |
| 563 | 569 | |
| 564 | 570 | // If we hit the models box, then consider the submeshes... |
| 565 | 571 | foreach(const AABox& subMeshBox, _calculatedMeshBoxes) { |
| 566 | 572 | const FBXGeometry& geometry = _geometry->getFBXGeometry(); |
| 567 | 573 | |
| 574 | + qDebug() << "subMeshBox[" << subMeshIndex <<"]:" << subMeshBox; | |
| 568 | 575 | if (subMeshBox.findRayIntersection(origin, direction, distanceToSubMesh, subMeshFace)) { |
| 569 | 576 | if (distanceToSubMesh < bestDistance) { |
| 570 | 577 | bestDistance = distanceToSubMesh; |