jolt-ruby 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitmodules +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +228 -0
  5. data/Rakefile +180 -0
  6. data/examples/character_virtual.rb +35 -0
  7. data/examples/falling_sphere.rb +25 -0
  8. data/examples/stagecraft_binding.rb +29 -0
  9. data/ext/jolt_ruby/CMakeLists.txt +42 -0
  10. data/ext/jolt_ruby/character_helper.cpp +44 -0
  11. data/ext/jolt_ruby/constraint_helper.cpp +154 -0
  12. data/ext/jolt_ruby/extconf.rb +56 -0
  13. data/ext/jolt_ruby/helper.cpp +225 -0
  14. data/ext/jolt_ruby/helper.h +103 -0
  15. data/ext/joltc/.github/FUNDING.yml +1 -0
  16. data/ext/joltc/.github/workflows/build.yml +298 -0
  17. data/ext/joltc/.gitignore +272 -0
  18. data/ext/joltc/CMakeLists.txt +431 -0
  19. data/ext/joltc/LICENSE +21 -0
  20. data/ext/joltc/README.md +10 -0
  21. data/ext/joltc/build/cmake_vs2026_arm64.bat +3 -0
  22. data/ext/joltc/build/cmake_vs2026_clang.bat +10 -0
  23. data/ext/joltc/build/cmake_vs2026_x64.bat +3 -0
  24. data/ext/joltc/build/cmake_vs2026_x64_double.bat +3 -0
  25. data/ext/joltc/include/joltc.h +3166 -0
  26. data/ext/joltc/samples/01_HelloWorld/main.cpp +170 -0
  27. data/ext/joltc/samples/CMakeLists.txt +35 -0
  28. data/ext/joltc/src/joltc.c +4 -0
  29. data/ext/joltc/src/joltc.cpp +11812 -0
  30. data/ext/joltc/src/joltc_assert.cpp +271 -0
  31. data/ext/joltc/tests/CMakeLists.txt +77 -0
  32. data/ext/joltc/tests/test_character.cpp +149 -0
  33. data/ext/joltc/tests/test_collision.cpp +146 -0
  34. data/ext/joltc/tests/test_constraints.cpp +353 -0
  35. data/ext/joltc/tests/test_core.cpp +94 -0
  36. data/ext/joltc/tests/test_math.cpp +585 -0
  37. data/ext/joltc/tests/test_physics_system.cpp +465 -0
  38. data/ext/joltc/tests/test_shapes.cpp +789 -0
  39. data/ext/joltc/tests/test_skeleton.cpp +370 -0
  40. data/ext/joltc/tests/test_vehicle.cpp +319 -0
  41. data/generator/generate.rb +237 -0
  42. data/generator/layout_probe.cpp +489 -0
  43. data/generator/verify_layout.rb +32 -0
  44. data/lib/jolt/body.rb +147 -0
  45. data/lib/jolt/body_collection.rb +115 -0
  46. data/lib/jolt/body_dynamics.rb +93 -0
  47. data/lib/jolt/character_virtual.rb +162 -0
  48. data/lib/jolt/constraint.rb +136 -0
  49. data/lib/jolt/constraint_collection.rb +123 -0
  50. data/lib/jolt/contact_events.rb +19 -0
  51. data/lib/jolt/conversions.rb +76 -0
  52. data/lib/jolt/errors.rb +12 -0
  53. data/lib/jolt/fixed_stepper.rb +37 -0
  54. data/lib/jolt/hit.rb +5 -0
  55. data/lib/jolt/layers.rb +182 -0
  56. data/lib/jolt/native/character_functions.rb +16 -0
  57. data/lib/jolt/native/constraint_functions.rb +27 -0
  58. data/lib/jolt/native/core_functions.rb +17 -0
  59. data/lib/jolt/native/generated.rb +1995 -0
  60. data/lib/jolt/native/platform.rb +51 -0
  61. data/lib/jolt/native/query_functions.rb +43 -0
  62. data/lib/jolt/native/types.rb +28 -0
  63. data/lib/jolt/native.rb +94 -0
  64. data/lib/jolt/shape.rb +90 -0
  65. data/lib/jolt/shape_builders.rb +155 -0
  66. data/lib/jolt/system.rb +238 -0
  67. data/lib/jolt/system_characters.rb +25 -0
  68. data/lib/jolt/system_constraints.rb +36 -0
  69. data/lib/jolt/system_contacts.rb +57 -0
  70. data/lib/jolt/system_queries.rb +111 -0
  71. data/lib/jolt/transform.rb +5 -0
  72. data/lib/jolt/version.rb +5 -0
  73. data/lib/jolt.rb +83 -0
  74. data/script/smoke_gem.rb +29 -0
  75. data/script/verify_release.rb +36 -0
  76. metadata +147 -0
@@ -0,0 +1,154 @@
1
+ #include "helper.h"
2
+
3
+ #include <joltc.h>
4
+
5
+ namespace {
6
+
7
+ JPH_Vec3 to_vec3(const float* value) {
8
+ return JPH_Vec3{value[0], value[1], value[2]};
9
+ }
10
+
11
+ JPH_Body* find_body(JPH_PhysicsSystem* system, uint32_t body_id) {
12
+ return const_cast<JPH_Body*>(JPH_PhysicsSystem_GetBodyPtr(system, body_id));
13
+ }
14
+
15
+ JPH_Constraint* add_constraint(JPH_PhysicsSystem* system, JPH_Constraint* constraint) {
16
+ if (!constraint) return nullptr;
17
+
18
+ JPH_PhysicsSystem_AddConstraint(system, constraint);
19
+ return constraint;
20
+ }
21
+
22
+ } // namespace
23
+
24
+ JPH_Constraint* JR_Constraint_CreateFixed(
25
+ JPH_PhysicsSystem* system,
26
+ uint32_t body_a,
27
+ uint32_t body_b,
28
+ const float* anchor) {
29
+ auto* first = find_body(system, body_a);
30
+ auto* second = find_body(system, body_b);
31
+ if (!first || !second) return nullptr;
32
+
33
+ JPH_FixedConstraintSettings settings{};
34
+ JPH_FixedConstraintSettings_Init(&settings);
35
+ settings.space = JPH_ConstraintSpace_WorldSpace;
36
+ if (anchor) {
37
+ settings.autoDetectPoint = false;
38
+ settings.point1 = to_vec3(anchor);
39
+ settings.point2 = settings.point1;
40
+ }
41
+ return add_constraint(
42
+ system,
43
+ reinterpret_cast<JPH_Constraint*>(
44
+ JPH_FixedConstraint_Create(&settings, first, second)));
45
+ }
46
+
47
+ JPH_Constraint* JR_Constraint_CreatePoint(
48
+ JPH_PhysicsSystem* system,
49
+ uint32_t body_a,
50
+ uint32_t body_b,
51
+ const float* anchor) {
52
+ auto* first = find_body(system, body_a);
53
+ auto* second = find_body(system, body_b);
54
+ if (!first || !second || !anchor) return nullptr;
55
+
56
+ JPH_PointConstraintSettings settings{};
57
+ JPH_PointConstraintSettings_Init(&settings);
58
+ settings.space = JPH_ConstraintSpace_WorldSpace;
59
+ settings.point1 = to_vec3(anchor);
60
+ settings.point2 = settings.point1;
61
+ return add_constraint(
62
+ system,
63
+ reinterpret_cast<JPH_Constraint*>(
64
+ JPH_PointConstraint_Create(&settings, first, second)));
65
+ }
66
+
67
+ JPH_Constraint* JR_Constraint_CreateDistance(
68
+ JPH_PhysicsSystem* system,
69
+ uint32_t body_a,
70
+ uint32_t body_b,
71
+ const float* point_a,
72
+ const float* point_b,
73
+ float min_distance,
74
+ float max_distance) {
75
+ auto* first = find_body(system, body_a);
76
+ auto* second = find_body(system, body_b);
77
+ if (!first || !second || !point_a || !point_b) return nullptr;
78
+
79
+ JPH_DistanceConstraintSettings settings{};
80
+ JPH_DistanceConstraintSettings_Init(&settings);
81
+ settings.space = JPH_ConstraintSpace_WorldSpace;
82
+ settings.point1 = to_vec3(point_a);
83
+ settings.point2 = to_vec3(point_b);
84
+ settings.minDistance = min_distance;
85
+ settings.maxDistance = max_distance;
86
+ return add_constraint(
87
+ system,
88
+ reinterpret_cast<JPH_Constraint*>(
89
+ JPH_DistanceConstraint_Create(&settings, first, second)));
90
+ }
91
+
92
+ JPH_Constraint* JR_Constraint_CreateHinge(
93
+ JPH_PhysicsSystem* system,
94
+ uint32_t body_a,
95
+ uint32_t body_b,
96
+ const float* anchor,
97
+ const float* axis,
98
+ const float* normal,
99
+ bool has_limits,
100
+ float min_angle,
101
+ float max_angle) {
102
+ auto* first = find_body(system, body_a);
103
+ auto* second = find_body(system, body_b);
104
+ if (!first || !second || !anchor || !axis || !normal) return nullptr;
105
+
106
+ JPH_HingeConstraintSettings settings{};
107
+ JPH_HingeConstraintSettings_Init(&settings);
108
+ settings.space = JPH_ConstraintSpace_WorldSpace;
109
+ settings.point1 = to_vec3(anchor);
110
+ settings.point2 = settings.point1;
111
+ settings.hingeAxis1 = to_vec3(axis);
112
+ settings.hingeAxis2 = settings.hingeAxis1;
113
+ settings.normalAxis1 = to_vec3(normal);
114
+ settings.normalAxis2 = settings.normalAxis1;
115
+ if (has_limits) {
116
+ settings.limitsMin = min_angle;
117
+ settings.limitsMax = max_angle;
118
+ }
119
+ return add_constraint(
120
+ system,
121
+ reinterpret_cast<JPH_Constraint*>(
122
+ JPH_HingeConstraint_Create(&settings, first, second)));
123
+ }
124
+
125
+ JPH_Constraint* JR_Constraint_CreateSlider(
126
+ JPH_PhysicsSystem* system,
127
+ uint32_t body_a,
128
+ uint32_t body_b,
129
+ const float* anchor,
130
+ const float* axis,
131
+ bool has_limits,
132
+ float min_distance,
133
+ float max_distance) {
134
+ auto* first = find_body(system, body_a);
135
+ auto* second = find_body(system, body_b);
136
+ if (!first || !second || !anchor || !axis) return nullptr;
137
+
138
+ JPH_SliderConstraintSettings settings{};
139
+ JPH_SliderConstraintSettings_Init(&settings);
140
+ settings.space = JPH_ConstraintSpace_WorldSpace;
141
+ settings.autoDetectPoint = false;
142
+ settings.point1 = to_vec3(anchor);
143
+ settings.point2 = settings.point1;
144
+ const JPH_Vec3 slider_axis = to_vec3(axis);
145
+ JPH_SliderConstraintSettings_SetSliderAxis(&settings, &slider_axis);
146
+ if (has_limits) {
147
+ settings.limitsMin = min_distance;
148
+ settings.limitsMax = max_distance;
149
+ }
150
+ return add_constraint(
151
+ system,
152
+ reinterpret_cast<JPH_Constraint*>(
153
+ JPH_SliderConstraint_Create(&settings, first, second)));
154
+ }
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "mkmf"
5
+ require "rbconfig"
6
+ require File.expand_path("../../lib/jolt/native/platform", __dir__)
7
+
8
+ source_dir = __dir__
9
+ platform = Jolt::Native::Platform.tag
10
+ build_dir = File.join(source_dir, "build", platform)
11
+ artifact_dir = File.join(source_dir, "native-artifacts")
12
+ host_os = RbConfig::CONFIG.fetch("host_os")
13
+ library_names =
14
+ case host_os
15
+ when /darwin/
16
+ %w[libjoltc.dylib libjolt_ruby_helper.dylib]
17
+ when /mswin|mingw/
18
+ %w[joltc.dll jolt_ruby_helper.dll]
19
+ else
20
+ %w[libjoltc.so libjolt_ruby_helper.so]
21
+ end
22
+
23
+ configure = [
24
+ "cmake",
25
+ "-S", source_dir,
26
+ "-B", build_dir,
27
+ "-DCMAKE_BUILD_TYPE=Release"
28
+ ]
29
+ configure << "-DCMAKE_OSX_ARCHITECTURES=#{RbConfig::CONFIG.fetch("host_cpu")}" if host_os.include?("darwin")
30
+
31
+ abort "CMake configuration failed" unless system(*configure)
32
+ abort "native build failed" unless system(
33
+ "cmake", "--build", build_dir, "--config", "Release", "--parallel"
34
+ )
35
+
36
+ search_directories = [
37
+ File.join(build_dir, "lib"),
38
+ File.join(build_dir, "lib", "Release"),
39
+ File.join(build_dir, "Release")
40
+ ]
41
+ FileUtils.rm_rf(artifact_dir)
42
+ FileUtils.mkdir_p(artifact_dir)
43
+ library_names.each do |name|
44
+ source = search_directories.lazy
45
+ .map { |directory| File.join(directory, name) }
46
+ .find { |path| File.file?(path) }
47
+ abort "native build did not produce #{name}" unless source
48
+
49
+ FileUtils.cp(source, artifact_dir)
50
+ end
51
+
52
+ $srcs = []
53
+ $INSTALLFILES = library_names.map do |name|
54
+ ["./native-artifacts/#{name}", "$(RUBYARCHDIR)/jolt/native/#{platform}", "native-artifacts"]
55
+ end
56
+ create_makefile("jolt_ruby_native")
@@ -0,0 +1,225 @@
1
+ #include "helper.h"
2
+
3
+ #include <joltc.h>
4
+
5
+ #include <atomic>
6
+ #include <cstddef>
7
+ #include <cstdint>
8
+ #include <memory>
9
+ #include <mutex>
10
+ #include <new>
11
+
12
+ namespace {
13
+
14
+ struct Slot {
15
+ std::atomic<size_t> sequence;
16
+ JR_ContactEvent event;
17
+ };
18
+
19
+ uint32_t next_power_of_two(uint32_t value) {
20
+ if (value < 2) return 2;
21
+
22
+ --value;
23
+ value |= value >> 1;
24
+ value |= value >> 2;
25
+ value |= value >> 4;
26
+ value |= value >> 8;
27
+ value |= value >> 16;
28
+ return value + 1;
29
+ }
30
+
31
+ void copy_vec3(float target[3], const JPH_Vec3& source) {
32
+ target[0] = source.x;
33
+ target[1] = source.y;
34
+ target[2] = source.z;
35
+ }
36
+
37
+ void copy_rvec3(float target[3], const JPH_RVec3& source) {
38
+ target[0] = static_cast<float>(source.x);
39
+ target[1] = static_cast<float>(source.y);
40
+ target[2] = static_cast<float>(source.z);
41
+ }
42
+
43
+ } // namespace
44
+
45
+ struct JR_ContactQueue {
46
+ explicit JR_ContactQueue(uint32_t requested_capacity)
47
+ : capacity(next_power_of_two(requested_capacity)),
48
+ mask(capacity - 1),
49
+ slots(new Slot[capacity]) {
50
+ for (size_t index = 0; index < capacity; ++index) {
51
+ slots[index].sequence.store(index, std::memory_order_relaxed);
52
+ }
53
+ }
54
+
55
+ bool push(const JR_ContactEvent& event) {
56
+ size_t position = enqueue_position.load(std::memory_order_relaxed);
57
+ Slot* slot = nullptr;
58
+
59
+ for (;;) {
60
+ slot = &slots[position & mask];
61
+ const size_t sequence = slot->sequence.load(std::memory_order_acquire);
62
+ const intptr_t difference = static_cast<intptr_t>(sequence) - static_cast<intptr_t>(position);
63
+ if (difference == 0) {
64
+ if (enqueue_position.compare_exchange_weak(position, position + 1, std::memory_order_relaxed)) break;
65
+ } else if (difference < 0) {
66
+ dropped.fetch_add(1, std::memory_order_relaxed);
67
+ return false;
68
+ } else {
69
+ position = enqueue_position.load(std::memory_order_relaxed);
70
+ }
71
+ }
72
+
73
+ slot->event = event;
74
+ slot->sequence.store(position + 1, std::memory_order_release);
75
+ return true;
76
+ }
77
+
78
+ bool pop(JR_ContactEvent& event) {
79
+ size_t position = dequeue_position.load(std::memory_order_relaxed);
80
+ Slot* slot = nullptr;
81
+
82
+ for (;;) {
83
+ slot = &slots[position & mask];
84
+ const size_t sequence = slot->sequence.load(std::memory_order_acquire);
85
+ const intptr_t difference =
86
+ static_cast<intptr_t>(sequence) - static_cast<intptr_t>(position + 1);
87
+ if (difference == 0) {
88
+ if (dequeue_position.compare_exchange_weak(position, position + 1, std::memory_order_relaxed)) break;
89
+ } else if (difference < 0) {
90
+ return false;
91
+ } else {
92
+ position = dequeue_position.load(std::memory_order_relaxed);
93
+ }
94
+ }
95
+
96
+ event = slot->event;
97
+ slot->sequence.store(position + capacity, std::memory_order_release);
98
+ return true;
99
+ }
100
+
101
+ const size_t capacity;
102
+ const size_t mask;
103
+ std::unique_ptr<Slot[]> slots;
104
+ alignas(64) std::atomic<size_t> enqueue_position{0};
105
+ alignas(64) std::atomic<size_t> dequeue_position{0};
106
+ std::atomic<uint64_t> dropped{0};
107
+ JPH_ContactListener* listener{nullptr};
108
+ };
109
+
110
+ namespace {
111
+
112
+ JPH_ValidateResult on_contact_validate(
113
+ void*,
114
+ const JPH_Body*,
115
+ const JPH_Body*,
116
+ const JPH_RVec3*,
117
+ const JPH_CollideShapeResult*) {
118
+ return JPH_ValidateResult_AcceptAllContactsForThisBodyPair;
119
+ }
120
+
121
+ void push_manifold_event(
122
+ JR_ContactQueue* queue,
123
+ JR_ContactEventType type,
124
+ const JPH_Body* body1,
125
+ const JPH_Body* body2,
126
+ const JPH_ContactManifold* manifold) {
127
+ JR_ContactEvent event{};
128
+ event.type = type;
129
+ event.body_a = JPH_Body_GetID(body1);
130
+ event.body_b = JPH_Body_GetID(body2);
131
+ event.sub_shape_a = JPH_ContactManifold_GetSubShapeID1(manifold);
132
+ event.sub_shape_b = JPH_ContactManifold_GetSubShapeID2(manifold);
133
+ event.penetration = JPH_ContactManifold_GetPenetrationDepth(manifold);
134
+
135
+ JPH_Vec3 normal{};
136
+ JPH_ContactManifold_GetWorldSpaceNormal(manifold, &normal);
137
+ copy_vec3(event.normal, normal);
138
+
139
+ if (JPH_ContactManifold_GetPointCount(manifold) > 0) {
140
+ JPH_RVec3 point{};
141
+ JPH_ContactManifold_GetWorldSpaceContactPointOn1(manifold, 0, &point);
142
+ copy_rvec3(event.point, point);
143
+ }
144
+
145
+ queue->push(event);
146
+ }
147
+
148
+ void on_contact_added(
149
+ void* user_data,
150
+ const JPH_Body* body1,
151
+ const JPH_Body* body2,
152
+ const JPH_ContactManifold* manifold,
153
+ JPH_ContactSettings*) {
154
+ push_manifold_event(
155
+ static_cast<JR_ContactQueue*>(user_data), JR_CONTACT_ADDED, body1, body2, manifold);
156
+ }
157
+
158
+ void on_contact_persisted(
159
+ void* user_data,
160
+ const JPH_Body* body1,
161
+ const JPH_Body* body2,
162
+ const JPH_ContactManifold* manifold,
163
+ JPH_ContactSettings*) {
164
+ push_manifold_event(
165
+ static_cast<JR_ContactQueue*>(user_data), JR_CONTACT_PERSISTED, body1, body2, manifold);
166
+ }
167
+
168
+ void on_contact_removed(void* user_data, const JPH_SubShapeIDPair* pair) {
169
+ JR_ContactEvent event{};
170
+ event.type = JR_CONTACT_REMOVED;
171
+ event.body_a = pair->Body1ID;
172
+ event.body_b = pair->Body2ID;
173
+ event.sub_shape_a = pair->subShapeID1;
174
+ event.sub_shape_b = pair->subShapeID2;
175
+ static_cast<JR_ContactQueue*>(user_data)->push(event);
176
+ }
177
+
178
+ void install_contact_procs() {
179
+ static JPH_ContactListener_Procs procs{};
180
+ procs.OnContactValidate = on_contact_validate;
181
+ procs.OnContactAdded = on_contact_added;
182
+ procs.OnContactPersisted = on_contact_persisted;
183
+ procs.OnContactRemoved = on_contact_removed;
184
+ JPH_ContactListener_SetProcs(&procs);
185
+ }
186
+
187
+ } // namespace
188
+
189
+ JR_ContactQueue* JR_ContactQueue_Create(uint32_t capacity) {
190
+ if (capacity < 2 || capacity > (1U << 30)) return nullptr;
191
+
192
+ static std::once_flag contact_procs_once;
193
+ std::call_once(contact_procs_once, install_contact_procs);
194
+
195
+ JR_ContactQueue* queue = nullptr;
196
+ try {
197
+ queue = new JR_ContactQueue(capacity);
198
+ } catch (const std::bad_alloc&) {
199
+ return nullptr;
200
+ }
201
+ queue->listener = JPH_ContactListener_Create(queue);
202
+ if (queue->listener) return queue;
203
+
204
+ delete queue;
205
+ return nullptr;
206
+ }
207
+
208
+ void JR_ContactQueue_Destroy(JR_ContactQueue* queue) {
209
+ if (!queue) return;
210
+
211
+ if (queue->listener) JPH_ContactListener_Destroy(queue->listener);
212
+ delete queue;
213
+ }
214
+
215
+ JPH_ContactListener* JR_ContactQueue_GetListener(JR_ContactQueue* queue) {
216
+ return queue ? queue->listener : nullptr;
217
+ }
218
+
219
+ bool JR_ContactQueue_Pop(JR_ContactQueue* queue, JR_ContactEvent* event) {
220
+ return queue && event && queue->pop(*event);
221
+ }
222
+
223
+ uint64_t JR_ContactQueue_GetDroppedCount(const JR_ContactQueue* queue) {
224
+ return queue ? queue->dropped.load(std::memory_order_relaxed) : 0;
225
+ }
@@ -0,0 +1,103 @@
1
+ #ifndef JOLT_RUBY_HELPER_H
2
+ #define JOLT_RUBY_HELPER_H
3
+
4
+ #include <stdbool.h>
5
+ #include <stdint.h>
6
+
7
+ #if defined(_WIN32)
8
+ # define JR_EXPORT __declspec(dllexport)
9
+ #else
10
+ # define JR_EXPORT __attribute__((visibility("default")))
11
+ #endif
12
+
13
+ #ifdef __cplusplus
14
+ extern "C" {
15
+ #endif
16
+
17
+ typedef struct JPH_ContactListener JPH_ContactListener;
18
+ typedef struct JPH_Constraint JPH_Constraint;
19
+ typedef struct JPH_CharacterVirtual JPH_CharacterVirtual;
20
+ typedef struct JPH_PhysicsSystem JPH_PhysicsSystem;
21
+ typedef struct JPH_Shape JPH_Shape;
22
+
23
+ typedef enum JR_ContactEventType {
24
+ JR_CONTACT_ADDED = 0,
25
+ JR_CONTACT_PERSISTED = 1,
26
+ JR_CONTACT_REMOVED = 2
27
+ } JR_ContactEventType;
28
+
29
+ typedef struct JR_ContactEvent {
30
+ uint32_t type;
31
+ uint32_t body_a;
32
+ uint32_t body_b;
33
+ uint32_t sub_shape_a;
34
+ uint32_t sub_shape_b;
35
+ float point[3];
36
+ float normal[3];
37
+ float penetration;
38
+ } JR_ContactEvent;
39
+
40
+ typedef struct JR_ContactQueue JR_ContactQueue;
41
+
42
+ JR_EXPORT JR_ContactQueue* JR_ContactQueue_Create(uint32_t capacity);
43
+ JR_EXPORT void JR_ContactQueue_Destroy(JR_ContactQueue* queue);
44
+ JR_EXPORT JPH_ContactListener* JR_ContactQueue_GetListener(JR_ContactQueue* queue);
45
+ JR_EXPORT bool JR_ContactQueue_Pop(JR_ContactQueue* queue, JR_ContactEvent* event);
46
+ JR_EXPORT uint64_t JR_ContactQueue_GetDroppedCount(const JR_ContactQueue* queue);
47
+
48
+ JR_EXPORT JPH_Constraint* JR_Constraint_CreateFixed(
49
+ JPH_PhysicsSystem* system,
50
+ uint32_t body_a,
51
+ uint32_t body_b,
52
+ const float* anchor);
53
+ JR_EXPORT JPH_Constraint* JR_Constraint_CreatePoint(
54
+ JPH_PhysicsSystem* system,
55
+ uint32_t body_a,
56
+ uint32_t body_b,
57
+ const float* anchor);
58
+ JR_EXPORT JPH_Constraint* JR_Constraint_CreateDistance(
59
+ JPH_PhysicsSystem* system,
60
+ uint32_t body_a,
61
+ uint32_t body_b,
62
+ const float* point_a,
63
+ const float* point_b,
64
+ float min_distance,
65
+ float max_distance);
66
+ JR_EXPORT JPH_Constraint* JR_Constraint_CreateHinge(
67
+ JPH_PhysicsSystem* system,
68
+ uint32_t body_a,
69
+ uint32_t body_b,
70
+ const float* anchor,
71
+ const float* axis,
72
+ const float* normal,
73
+ bool has_limits,
74
+ float min_angle,
75
+ float max_angle);
76
+ JR_EXPORT JPH_Constraint* JR_Constraint_CreateSlider(
77
+ JPH_PhysicsSystem* system,
78
+ uint32_t body_a,
79
+ uint32_t body_b,
80
+ const float* anchor,
81
+ const float* axis,
82
+ bool has_limits,
83
+ float min_distance,
84
+ float max_distance);
85
+
86
+ JR_EXPORT JPH_CharacterVirtual* JR_CharacterVirtual_Create(
87
+ JPH_PhysicsSystem* system,
88
+ const JPH_Shape* shape,
89
+ const float* position,
90
+ const float* rotation,
91
+ float max_slope_angle,
92
+ float mass);
93
+ JR_EXPORT void JR_CharacterVirtual_ExtendedUpdate(
94
+ JPH_CharacterVirtual* character,
95
+ float delta_time,
96
+ uint32_t layer,
97
+ JPH_PhysicsSystem* system);
98
+
99
+ #ifdef __cplusplus
100
+ }
101
+ #endif
102
+
103
+ #endif
@@ -0,0 +1 @@
1
+ github: [amerkoleci]