diff --git a/engine/src/cubos/engine/collisions/broad_phase/plugin.cpp b/engine/src/cubos/engine/collisions/broad_phase/plugin.cpp index 57395ee28..7838c85b5 100644 --- a/engine/src/cubos/engine/collisions/broad_phase/plugin.cpp +++ b/engine/src/cubos/engine/collisions/broad_phase/plugin.cpp @@ -16,7 +16,7 @@ using cubos::core::ecs::Write; using namespace cubos::engine; /// @brief Tracks all new colliders. -void trackNewColliders(Query> query, Write sweepAndPrune) +static void trackNewCollidersSystem(Query> query, Write sweepAndPrune) { for (auto [entity, collider] : query) { @@ -28,7 +28,7 @@ void trackNewColliders(Query> query, Write, Write> query) +static void updateAABBsSystem(Query, Write> query) { for (auto [entity, localToWorld, collider] : query) { @@ -65,7 +65,7 @@ void updateAABBs(Query, Write> query) } /// @brief Updates the sweep markers of all colliders. -void updateMarkers(Query> query, Write sweepAndPrune) +static void updateMarkersSystem(Query> query, Write sweepAndPrune) { // TODO: This is parallelizable. for (glm::length_t axis = 0; axis < 3; axis++) @@ -84,7 +84,7 @@ void updateMarkers(Query> query, Write s } /// @brief Performs a sweep of all colliders. -void sweep(Write sweepAndPrune) +static void sweepSystem(Write sweepAndPrune) { // TODO: This is parallelizable. for (glm::length_t axis = 0; axis < 3; axis++) @@ -131,9 +131,8 @@ BroadPhaseCandidates::CollisionType getCollisionType(bool box, bool capsule) /// /// @details /// TODO: This query is disgusting. We need a way to find if a component is present without reading it. -/// Maybe something like Commands but for reads? -void findPairs(Query, OptRead, Read> query, - Read sweepAndPrune, Write candidates) +static void findPairsSystem(Query, OptRead, Read> query, + Read sweepAndPrune, Write candidates) { candidates->clearCandidates(); @@ -180,20 +179,18 @@ void findPairs(Query, OptRead, void cubos::engine::broadPhaseCollisionsPlugin(Cubos& cubos) { - // FIXME: Is it ok not to add resources from the general plugin? - cubos.addResource(); cubos.addResource(); - cubos.system(trackNewColliders).tagged("cubos.collisions.aabb.setup"); + cubos.system(trackNewCollidersSystem).tagged("cubos.collisions.aabb.setup"); - cubos.system(updateAABBs) + cubos.system(updateAABBsSystem) .tagged("cubos.collisions.aabb.update") .after("cubos.collisions.setup") .after("cubos.collisions.aabb.setup") .after("cubos.transform.update"); - cubos.system(updateMarkers).tagged("cubos.collisions.broad.markers").after("cubos.collisions.aabb.update"); - cubos.system(sweep).tagged("cubos.collisions.broad.sweep").after("cubos.collisions.broad.markers"); - cubos.system(findPairs).tagged("cubos.collisions.broad").after("cubos.collisions.broad.sweep"); -} \ No newline at end of file + cubos.system(updateMarkersSystem).tagged("cubos.collisions.broad.markers").after("cubos.collisions.aabb.update"); + cubos.system(sweepSystem).tagged("cubos.collisions.broad.sweep").after("cubos.collisions.broad.markers"); + cubos.system(findPairsSystem).tagged("cubos.collisions.broad").after("cubos.collisions.broad.sweep"); +} diff --git a/engine/src/cubos/engine/collisions/broad_phase/plugin.hpp b/engine/src/cubos/engine/collisions/broad_phase/plugin.hpp index 7bd0dbae1..42be4d8da 100644 --- a/engine/src/cubos/engine/collisions/broad_phase/plugin.hpp +++ b/engine/src/cubos/engine/collisions/broad_phase/plugin.hpp @@ -18,7 +18,6 @@ namespace cubos::engine /// ## Resources /// - @ref BroadPhaseCandidates - stores broad phase collision data. /// - @ref BroadPhaseSweepAndPrune - stores sweep and prune markers. - /// /// @brief Plugin entry function. /// @param cubos @b CUBOS. main class. diff --git a/engine/src/cubos/engine/collisions/plugin.cpp b/engine/src/cubos/engine/collisions/plugin.cpp index 9be0a37aa..08dbf9912 100644 --- a/engine/src/cubos/engine/collisions/plugin.cpp +++ b/engine/src/cubos/engine/collisions/plugin.cpp @@ -14,7 +14,7 @@ using cubos::core::ecs::Write; using namespace cubos::engine; /// @brief Setups new box colliders. -void setupNewBoxes(Query, Write> query) +static void setupNewBoxesSystem(Query, Write> query) { for (auto [entity, shape, collider] : query) { @@ -33,7 +33,7 @@ void setupNewBoxes(Query, Write> query) } /// @brief Setups new capsule colliders. -void setupNewCapsules(Query, Write> query) +static void setupNewCapsulesSystem(Query, Write> query) { for (auto [entity, shape, collider] : query) { @@ -61,6 +61,6 @@ void cubos::engine::collisionsPlugin(Cubos& cubos) cubos.addComponent(); cubos.addComponent(); - cubos.system(setupNewBoxes).tagged("cubos.collisions.setup"); - cubos.system(setupNewCapsules).tagged("cubos.collisions.setup"); + cubos.system(setupNewBoxesSystem).tagged("cubos.collisions.setup"); + cubos.system(setupNewCapsulesSystem).tagged("cubos.collisions.setup"); }