Skip to content

Commit f1d134b

Browse files
committed
Add Debug Native Libraries
1 parent 73f0f74 commit f1d134b

16 files changed

Lines changed: 76 additions & 23 deletions

File tree

.github/workflows/maven.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
pull_request:
1515
branches: [ "Overhaul" ]
1616

17+
env:
18+
JAR_FILE: JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar
19+
1720
jobs:
1821
Linux_x64:
1922
runs-on: ubuntu-latest
@@ -30,7 +33,12 @@ jobs:
3033
- name: Execute the HelloWorld app
3134
run: |
3235
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED \
33-
-cp target/JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar \
36+
-cp target/$JAR_FILE \
37+
volucris.bindings.jolt.HelloWorld
38+
- name: Execute the HelloWorld app - Debug library
39+
run: |
40+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -Dload.debug.library=true \
41+
-cp target/$JAR_FILE \
3442
volucris.bindings.jolt.HelloWorld
3543
3644
Linux_Arm64:
@@ -48,7 +56,12 @@ jobs:
4856
- name: Execute the HelloWorld app
4957
run: |
5058
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED \
51-
-cp target/JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar \
59+
-cp target/$JAR_FILE \
60+
volucris.bindings.jolt.HelloWorld
61+
- name: Execute the HelloWorld app - Debug library
62+
run: |
63+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -Dload.debug.library=true \
64+
-cp target/$JAR_FILE \
5265
volucris.bindings.jolt.HelloWorld
5366
5467
macOS_Arm64:
@@ -66,7 +79,12 @@ jobs:
6679
- name: Execute the HelloWorld app
6780
run: |
6881
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED \
69-
-cp target/JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar \
82+
-cp target/$JAR_FILE \
83+
volucris.bindings.jolt.HelloWorld
84+
- name: Execute the HelloWorld app - Debug library
85+
run: |
86+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -Dload.debug.library=true \
87+
-cp target/$JAR_FILE \
7088
volucris.bindings.jolt.HelloWorld
7189
7290
macOS_x64:
@@ -84,7 +102,12 @@ jobs:
84102
- name: Execute the HelloWorld app
85103
run: |
86104
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED \
87-
-cp target/JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar \
105+
-cp target/$JAR_FILE \
106+
volucris.bindings.jolt.HelloWorld
107+
- name: Execute the HelloWorld app - Debug library
108+
run: |
109+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -Dload.debug.library=true \
110+
-cp target/$JAR_FILE \
88111
volucris.bindings.jolt.HelloWorld
89112
90113
Windows_x64:
@@ -102,7 +125,13 @@ jobs:
102125
shell: bash
103126
- name: Execute the HelloWorld app
104127
run: |
105-
"$JAVA_HOME/bin/java" --enable-preview --enable-native-access=ALL-UNNAMED \
106-
-cp target/JoltPhysics-JavaFFM-5.5.0-jar-with-dependencies.jar \
128+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED \
129+
-cp target/$JAR_FILE \
130+
volucris.bindings.jolt.HelloWorld
131+
shell: bash
132+
- name: Execute the HelloWorld app - Debug library
133+
run: |
134+
$JAVA_HOME/bin/java --enable-preview --enable-native-access=ALL-UNNAMED -Dload.debug.library=true \
135+
-cp target/$JAR_FILE \
107136
volucris.bindings.jolt.HelloWorld
108137
shell: bash

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ This is a port of the [HelloWorld](https://github.com/jrouwe/JoltPhysics/blob/ma
117117

118118
public static void main(String[] args) {
119119

120-
Jolt.loadNativeLibrary();
120+
if (Boolean.getBoolean("load.debug.library"))
121+
Jolt.loadDebugNativeLibrary();
122+
else
123+
Jolt.loadNativeLibrary();
121124

122125
if (!Jolt.init())
123126
return;
@@ -135,14 +138,16 @@ This is a port of the [HelloWorld](https://github.com/jrouwe/JoltPhysics/blob/ma
135138

136139
BroadPhaseLayerInterfaceTable broadPhaseLayerInterface = new BroadPhaseLayerInterfaceTable(
137140
Layers.NUM_LAYERS,
138-
BroadPhaseLayers.NUM_LAYERS);
141+
BroadPhaseLayers.NUM_LAYERS
142+
);
139143

140144
broadPhaseLayerInterface.mapObjectToBroadPhaseLayer(Layers.NON_MOVING, BroadPhaseLayers.NON_MOVING);
141145
broadPhaseLayerInterface.mapObjectToBroadPhaseLayer(Layers.MOVING, BroadPhaseLayers.MOVING);
142146

143147
ObjectVsBroadPhaseLayerFilter objectVsBroadPhaseLayerFilter = new ObjectVsBroadPhaseLayerFilterTable(
144148
broadPhaseLayerInterface, BroadPhaseLayers.NUM_LAYERS,
145-
objectLayerPairFilter, Layers.NUM_LAYERS);
149+
objectLayerPairFilter, Layers.NUM_LAYERS
150+
);
146151

147152
PhysicsSystemSettings settings = new PhysicsSystemSettings()
148153
.maxBodies(1024)
@@ -165,15 +170,17 @@ This is a port of the [HelloWorld](https://github.com/jrouwe/JoltPhysics/blob/ma
165170

166171
BoxShapeSettings floorShapeSettings = new BoxShapeSettings(
167172
new Vec3().x(100).y(1).z(100),
168-
Jolt.DEFAULT_CONVEX_RADIUS);
173+
Jolt.DEFAULT_CONVEX_RADIUS
174+
);
169175
BoxShape floorShape = floorShapeSettings.createShape();
170176

171177
BodyCreationSettings floorSettings = new BodyCreationSettings(
172178
floorShape,
173179
new Vec3().x(0).y(-1).z(0),
174-
new Quat(),
180+
new Quat().x(0).y(0).z(0).w(1),
175181
MotionType.STATIC,
176-
Layers.NON_MOVING);
182+
Layers.NON_MOVING
183+
);
177184
Body floor = bodyInterface.createBody(floorSettings);
178185

179186
bodyInterface.addBody(floor.getID(), Activation.DONT_ACTIVATE);
@@ -182,9 +189,10 @@ This is a port of the [HelloWorld](https://github.com/jrouwe/JoltPhysics/blob/ma
182189
BodyCreationSettings sphereSettings = new BodyCreationSettings(
183190
sphereShape,
184191
new Vec3().x(0).y(2).z(0),
185-
new Quat(),
192+
new Quat().x(0).y(0).z(0).w(1),
186193
MotionType.DYNAMIC,
187-
Layers.MOVING);
194+
Layers.MOVING
195+
);
188196
int sphereId = bodyInterface.createAndAddBody(sphereSettings, Activation.ACTIVATE);
189197

190198
bodyInterface.setLinearVelocity(sphereId, new Vec3().x(0).y(-5).z(0));

src/main/java/volucris/bindings/jolt/HelloWorld.java

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ private static class Layers {
7676

7777
public static void main(String[] args) {
7878

79-
Jolt.loadNativeLibrary();
79+
if (Boolean.getBoolean("load.debug.library"))
80+
Jolt.loadDebugNativeLibrary();
81+
else
82+
Jolt.loadNativeLibrary();
8083

8184
if (!Jolt.init())
8285
return;
@@ -94,14 +97,16 @@ public static void main(String[] args) {
9497

9598
BroadPhaseLayerInterfaceTable broadPhaseLayerInterface = new BroadPhaseLayerInterfaceTable(
9699
Layers.NUM_LAYERS,
97-
BroadPhaseLayers.NUM_LAYERS);
100+
BroadPhaseLayers.NUM_LAYERS
101+
);
98102

99103
broadPhaseLayerInterface.mapObjectToBroadPhaseLayer(Layers.NON_MOVING, BroadPhaseLayers.NON_MOVING);
100104
broadPhaseLayerInterface.mapObjectToBroadPhaseLayer(Layers.MOVING, BroadPhaseLayers.MOVING);
101105

102106
ObjectVsBroadPhaseLayerFilter objectVsBroadPhaseLayerFilter = new ObjectVsBroadPhaseLayerFilterTable(
103107
broadPhaseLayerInterface, BroadPhaseLayers.NUM_LAYERS,
104-
objectLayerPairFilter, Layers.NUM_LAYERS);
108+
objectLayerPairFilter, Layers.NUM_LAYERS
109+
);
105110

106111
PhysicsSystemSettings settings = new PhysicsSystemSettings()
107112
.maxBodies(1024)
@@ -124,15 +129,17 @@ public static void main(String[] args) {
124129

125130
BoxShapeSettings floorShapeSettings = new BoxShapeSettings(
126131
new Vec3().x(100).y(1).z(100),
127-
Jolt.DEFAULT_CONVEX_RADIUS);
132+
Jolt.DEFAULT_CONVEX_RADIUS
133+
);
128134
BoxShape floorShape = floorShapeSettings.createShape();
129135

130136
BodyCreationSettings floorSettings = new BodyCreationSettings(
131137
floorShape,
132138
new Vec3().x(0).y(-1).z(0),
133-
new Quat(),
139+
new Quat().x(0).y(0).z(0).w(1),
134140
MotionType.STATIC,
135-
Layers.NON_MOVING);
141+
Layers.NON_MOVING
142+
);
136143
Body floor = bodyInterface.createBody(floorSettings);
137144

138145
bodyInterface.addBody(floor.getID(), Activation.DONT_ACTIVATE);
@@ -141,9 +148,10 @@ public static void main(String[] args) {
141148
BodyCreationSettings sphereSettings = new BodyCreationSettings(
142149
sphereShape,
143150
new Vec3().x(0).y(2).z(0),
144-
new Quat(),
151+
new Quat().x(0).y(0).z(0).w(1),
145152
MotionType.DYNAMIC,
146-
Layers.MOVING);
153+
Layers.MOVING
154+
);
147155
int sphereId = bodyInterface.createAndAddBody(sphereSettings, Activation.ACTIVATE);
148156

149157
bodyInterface.setLinearVelocity(sphereId, new Vec3().x(0).y(-5).z(0));

src/main/java/volucris/bindings/jolt/Jolt.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ public static void loadNativeLibrary() {
3939
}
4040

4141
public static void loadNativeLibrary(boolean debug) {
42-
NativeLibraryLoader.loadLibrary("natives/jolt", "joltc", debug);
42+
NativeLibraryLoader.loadLibrary("natives/jolt/release", "joltc", debug);
43+
}
44+
45+
public static void loadDebugNativeLibrary() {
46+
loadDebugNativeLibrary(false);
47+
}
48+
49+
public static void loadDebugNativeLibrary(boolean debug) {
50+
NativeLibraryLoader.loadLibrary("natives/jolt/debug", "joltcd", debug);
4351
}
4452

4553
public static boolean init() {
8.47 MB
Binary file not shown.
10.7 MB
Binary file not shown.
17.4 MB
Binary file not shown.
8.79 MB
Binary file not shown.
17.4 MB
Binary file not shown.
8.85 MB
Binary file not shown.

0 commit comments

Comments
 (0)