From b04fefe8ee0086bc1404c06b8351ecb4e942f151 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Thu, 9 Jan 2025 13:27:16 -0500 Subject: deprecate cmake + fixes --- editor/CMakeLists.txt | 17 ----------------- editor/editor.cpp | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 editor/CMakeLists.txt (limited to 'editor') 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(rayResult.m_collisionObject->getUserPointer()); + } - BtDynamicsWorld->rayTest(rayOrigin, rayDestination, rayResult); - if (rayResult.hasHit()) { - hoveredEntity = reinterpret_cast(rayResult.m_collisionObject->getUserPointer()); } } -- cgit v1.2.3