diff options
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/CMakeLists.txt | 17 | ||||
| -rw-r--r-- | editor/editor.cpp | 23 |
2 files changed, 13 insertions, 27 deletions
diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt deleted file mode 100644 index b1f3d64..0000000 --- a/editor/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -project(pke_editor VERSION 0.0) - -set(PKE_EDITOR_SOURCE_FILES - main.cpp - editor.hpp - editor.cpp -) -add_executable(pke_editor - ${PKE_EDITOR_SOURCE_FILES} -) -target_link_libraries(pke_editor PRIVATE pke) -target_include_directories(pke_editor PRIVATE pke) - -install( - TARGETS pke_editor - RUNTIME DESTINATION bin -) diff --git a/editor/editor.cpp b/editor/editor.cpp index db82fc0..86fae96 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -198,17 +198,20 @@ void PkeEditor_Tick(double delta) { glm::vec3 fromCoords{unproject(glm::vec3(xMousePos, yMousePos, -1.f))}; glm::vec3 toCoords{unproject(glm::vec3(xMousePos, yMousePos, 1.f))}; - btVector3 rayOrigin{}; - btVector3 rayDestination{}; - GlmToBullet(fromCoords, rayOrigin); - GlmToBullet(toCoords, rayDestination); - - btCollisionWorld::ClosestRayResultCallback rayResult{rayOrigin, rayDestination}; - rayResult.m_flags |= btTriangleRaycastCallback::kF_FilterBackfaces; + if (fromCoords.x == fromCoords.x && toCoords.x == toCoords.x) { + btVector3 rayOrigin{}; + btVector3 rayDestination{}; + GlmToBullet(fromCoords, rayOrigin); + GlmToBullet(toCoords, rayDestination); + + btCollisionWorld::ClosestRayResultCallback rayResult{rayOrigin, rayDestination}; + rayResult.m_flags |= btTriangleRaycastCallback::kF_FilterBackfaces; + + BtDynamicsWorld->rayTest(rayOrigin, rayDestination, rayResult); + if (rayResult.hasHit()) { + hoveredEntity = reinterpret_cast<CompInstance *>(rayResult.m_collisionObject->getUserPointer()); + } - BtDynamicsWorld->rayTest(rayOrigin, rayDestination, rayResult); - if (rayResult.hasHit()) { - hoveredEntity = reinterpret_cast<CompInstance *>(rayResult.m_collisionObject->getUserPointer()); } } |
