From 3defb5612a263d840b3b9c2316ff165d58518aec Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Sat, 11 Jun 2022 15:52:45 +0100 Subject: [PATCH] fix incorrect get/tryGet usage in terrian demo --- fggl/gfx/ogl4/models.cpp | 2 +- fggl/phys/bullet/simulation.cpp | 4 +++- include/fggl/phys/bullet/types.hpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fggl/gfx/ogl4/models.cpp b/fggl/gfx/ogl4/models.cpp index e13e927..6034413 100644 --- a/fggl/gfx/ogl4/models.cpp +++ b/fggl/gfx/ogl4/models.cpp @@ -90,7 +90,7 @@ namespace fggl::gfx::ogl4 { // terrain auto terrain = world.findMatching<data::HeightMap>(); for (auto& renderable : terrain){ - auto currModel = world.get<StaticModel>( renderable ); + auto currModel = world.tryGet<StaticModel>( renderable ); if ( currModel != nullptr ){ continue; } diff --git a/fggl/phys/bullet/simulation.cpp b/fggl/phys/bullet/simulation.cpp index 85cacdd..e2256cc 100644 --- a/fggl/phys/bullet/simulation.cpp +++ b/fggl/phys/bullet/simulation.cpp @@ -73,7 +73,9 @@ namespace fggl::phys::bullet { //syncToECS(); pollCollisions(); - m_world->debugDrawWorld(); + if ( debugDraw ) { + m_world->debugDrawWorld(); + } } inline btCollisionShape* shape_to_bullet(const phys::RigidBody* fgglBody) { diff --git a/include/fggl/phys/bullet/types.hpp b/include/fggl/phys/bullet/types.hpp index 8197759..90219c3 100644 --- a/include/fggl/phys/bullet/types.hpp +++ b/include/fggl/phys/bullet/types.hpp @@ -71,12 +71,12 @@ namespace fggl::phys::bullet { void step() override; void onEntityDeath(ecs::entity_t entity); - std::vector<ContactPoint> scanCollisions(ecs3::entity_t entity) override; ecs3::entity_t raycast(math::vec3 from, math::vec3 to) override; std::vector<ecs3::entity_t> raycastAll(math::vec3 from, math::vec3 to) override; std::vector<ecs3::entity_t> sweep(PhyShape& shape, math::Transform& from, math::Transform& to) override; + bool debugDraw = false; private: ecs3::World* m_ecs; BulletConfiguration m_config; -- GitLab