3#include <drivers/jolt-cpp/jolt-imports.hpp>
24 enum class BroadPhaseLayers : std::uint8_t {
39 :
public JPH::BroadPhaseLayerInterface {
50 return (uint32_t)(BroadPhaseLayers::NumLayers);
64 JPH::ObjectLayer p_in_layer)
const override {
65 JPH_ASSERT(p_in_layer < (JPH::ObjectLayer)ObjectLayer::NumLayers);
66 return m_object_to_broadphase[p_in_layer];
69#if defined(JPH_EXTERNAL_PROFILE) || defined(JPH_PROFILE_ENABLED)
78 [[nodiscard]]
const char* GetBroadPhaseLayerName(
79 JPH::BroadPhaseLayer p_in_layer)
const override {
80 switch (p_in_layer.GetValue()) {
81 case (JPH::BroadPhaseLayer::Type)(BroadPhaseLayers::NonMoving):
83 case (JPH::BroadPhaseLayer::Type)(BroadPhaseLayers::Moving):
94 std::vector<JPH::BroadPhaseLayer> m_object_to_broadphase{
95 JPH::BroadPhaseLayer((uint8_t)(BroadPhaseLayers::NonMoving)),
96 JPH::BroadPhaseLayer((uint8_t)(BroadPhaseLayers::Moving))
118 :
public JPH::ObjectVsBroadPhaseLayerFilter {
120 [[nodiscard]]
bool ShouldCollide(
121 JPH::ObjectLayer p_in_layer1,
122 JPH::BroadPhaseLayer p_in_layer2)
const override {
123 switch (p_in_layer1) {
124 case (
int)(ObjectLayer::NonMoving):
125 return p_in_layer2 ==
126 JPH::BroadPhaseLayer((JPH::BroadPhaseLayer::Type)(
127 BroadPhaseLayers::Moving));
128 case (
int)ObjectLayer::Moving:
146 [[nodiscard]]
bool ShouldCollide(
147 JPH::ObjectLayer p_in_object1,
148 JPH::ObjectLayer p_in_object2)
const override {
149 switch (p_in_object1) {
150 case (
int)(ObjectLayer::NonMoving):
151 return p_in_object2 == (int)(ObjectLayer::Moving);
152 case (
int)(ObjectLayer::Moving):
This class is made to control the broadphase layer. Filters can be added to it to create a better and...
Definition jolt_broad_phase.hpp:39
JPH::BroadPhaseLayer GetBroadPhaseLayer(JPH::ObjectLayer p_in_layer) const override
Gives the caller access to the broadphase object. Allowing for some manipulation on how those interac...
Definition jolt_broad_phase.hpp:63
uint32_t GetNumBroadPhaseLayers() const override
Get the Number of layers that exsist in the current context. Static for now.
Definition jolt_broad_phase.hpp:49
This goes into more detailed ways of filtering, where the object collisions may be defined be what th...
Definition jolt_broad_phase.hpp:144
This is used to tell Jolt what can or cannot collide. As of right now the list is static therfore the...
Definition jolt_broad_phase.hpp:118
Types are still be filled out. When this is completed to_jph() can be removed.
Definition jolt_broad_phase.hpp:5
ObjectLayer
This contains a few important comparisons having to do with setting up the oct-trees correctly as wel...
Definition jolt_broad_phase.hpp:18