C Wrapper for the Jolt Physics engine.
#c #physics #3d #gamedev #simulation #collision #library #wrapper #cpp
|
hai 1 día | |
---|---|---|
.github | hai 1 ano | |
HelloWorld | hai 2 meses | |
JoltC | hai 1 día | |
JoltCImpl | hai 1 día | |
JoltPhysics @ 0373ec0dd7 | hai 3 meses | |
generate | hai 1 ano | |
.editorconfig | hai 1 ano | |
.gitignore | hai 1 ano | |
.gitmodules | hai 1 ano | |
CMakeLists.txt | hai 4 meses | |
LICENSE-APACHE | hai 1 ano | |
LICENSE-MIT | hai 1 ano | |
README.md | hai 4 meses | |
test-all-flags.sh | hai 1 ano |
C wrapper for Jolt Physics 5.x.
Currently a work in progress. Bindings contain functions that we've needed as part of our game or the Rust bindings we're working on in jolt-rust.
The JoltC
directory contains headers for the C interface that you can bind to.
The JoltCImpl
directory contains the C++ implementation of the C interface and serves as the glue between the C++ and C code.
bindgen
, LuaJIT FFI)Use CMake:
# Configure the build
cmake -B build
# Optionally, you can enable double precision, or make ObjectLayer use 32 bits
# We aim to support most of the configuration of Jolt's C++ API.
cmake -B build -DDOUBLE_PRECISION=ON -DOBJECT_LAYER_BITS=32
# Build
cmake --build build
A port of Jolt's "HelloWorld" example is provided in HelloWorld/main.cpp.
RefTarget
TypesJolt has internal reference counting for a few types along with good documentation about handling them in C++. This interface to Jolt does not have a generic Ref
/RefConst
wrapper, so it's important to be conscious of ref counts when handling these types.
Just like Jolt, this library will return those objects with a reference count of 0. Jolt APIs that accept these types will take ownership of the given value and increment the reference count.
You can use JPC_{type}_AddRef
and JPC_{type}_Release
, where {type}
is the type that directly inherits from RefTarget<{type}>
, to add or release references. For example, for FixedConstraint
, use JPC_Constraint_AddRef
to add a new reference.
Other C wrappers for Jolt Physics include:
The goal of this project is to be a C wrapper around Jolt Physics that is not part of a larger binding project and to eliminate major sources of undefined behavior. It's intended to be useful for any other language-specific bindings, but naturally these bindings were born out of the goal of creating Rust bindings to Jolt Physics.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.