-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89f9165
commit d29738a
Showing
22 changed files
with
557 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef struct TbWorld TbWorld; | ||
|
||
void tb_register_physics_sys(TbWorld *world); | ||
void tb_unregister_physics_sys(TbWorld *world); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include "allocator.h" | ||
|
||
namespace JPH { | ||
class PhysicsSystem; | ||
class TempAllocator; | ||
class JobSystemThreadPool; | ||
} // namespace JPH | ||
|
||
struct ecs_query_t; | ||
namespace flecs { | ||
typedef ecs_query_t query_t; | ||
} // namespace flecs | ||
|
||
class ObjectLayerPairFilterImpl; | ||
class BPLayerInterfaceImpl; | ||
class ObjectVsBroadPhaseLayerFilterImpl; | ||
|
||
struct TbPhysicsSystem { | ||
Allocator std_alloc; | ||
Allocator tmp_alloc; | ||
|
||
JPH::PhysicsSystem *jolt_phys; | ||
JPH::TempAllocator *jolt_tmp_alloc; | ||
JPH::JobSystemThreadPool *jolt_job_sys; | ||
|
||
flecs::query_t *rigidbody_query; | ||
|
||
BPLayerInterfaceImpl *bpl_interface; | ||
ObjectVsBroadPhaseLayerFilterImpl *obp_filter; | ||
ObjectLayerPairFilterImpl *olp_filter; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
|
||
#include <Jolt/Physics/Collision/BroadPhase/BroadPhaseLayer.h> | ||
#include <Jolt/Physics/Collision/ObjectLayer.h> | ||
|
||
// Layer that objects can be in, determines which other objects it can collide | ||
// with Typically you at least want to have 1 layer for moving bodies and 1 | ||
// layer for static bodies, but you can have more layers if you want. E.g. you | ||
// could have a layer for high detail collision (which is not used by the | ||
// physics simulation but only if you do collision testing). | ||
namespace Layers { | ||
static constexpr JPH::ObjectLayer NON_MOVING = 0; | ||
static constexpr JPH::ObjectLayer MOVING = 1; | ||
static constexpr JPH::ObjectLayer NUM_LAYERS = 2; | ||
}; // namespace Layers | ||
|
||
// Each broadphase layer results in a separate bounding volume tree in the | ||
// broad phase. You at least want to have a layer for non-moving and moving | ||
// objects to avoid having to update a tree full of static objects every | ||
// frame. You can have a 1-on-1 mapping between object layers and broadphase | ||
// layers (like in this case) but if you have many object layers you'll be | ||
// creating many broad phase trees, which is not efficient. If you want to | ||
// fine tune your broadphase layers define JPH_TRACK_BROADPHASE_STATS and look | ||
// at the stats reported on the TTY. | ||
namespace BroadPhaseLayers { | ||
static constexpr JPH::BroadPhaseLayer NON_MOVING(0); | ||
static constexpr JPH::BroadPhaseLayer MOVING(1); | ||
static constexpr uint32_t NUM_LAYERS(2); | ||
}; // namespace BroadPhaseLayers | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#define RigidbodyComponentId 0xBAD33333 | ||
#define RigidbodyComponentIdStr "0xBAD33333" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <SDL2/SDL_stdinc.h> | ||
|
||
typedef struct TbWorld TbWorld; | ||
|
||
typedef struct TbRigidbodyComponent { | ||
uint32_t body; // Actually a JPH::BodyId | ||
} TbRigidbodyComponent; | ||
|
||
void tb_register_rigidbody_component(TbWorld *world); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.