Package com.github.stephengold.joltjni
Class Jolt
java.lang.Object
com.github.stephengold.joltjni.Jolt
Utility methods providing JNI access to Jolt Physics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstandard 2nd argument to theJobSystemThreadPoolconstructorstatic final intstandard first argument to theJobSystemThreadPoolconstructorstatic final floatsingle-precision value of Pi -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturn the jolt-jni build-type string.static floatdegreesToRadians(float degrees) Convert the specified angle from degrees to radians.static voidDestroy the factory for deserialization of saved data.static voidAppend a message to the determinism log.static StringReturn a string containing important configuration settings.static longhashBytes(long dataVa, int inSize) Return a hash code for the specified data bytes.static longCombine the specified quaternion with the specified hash code.static longCombine the specified vector with the specified hash code.static booleanTest whether the native library implements debug rendering.static booleanTest whether the native library implements extra logging to help debug determinism issues.static voidInstall the default assert callback.static voidInstall the default trace callback.static booleanTest whether the native library uses double-precision location vectors.static FloatBuffernewDirectFloatBuffer(int numFloats) Create a directFloatBufferwith native byte order and the specified capacity.static IntBuffernewDirectIntBuffer(int numInts) Create a directIntBufferwith native byte order and the specified capacity.static voidCreate a factory for deserialization of saved data.static voidprofileDump(String message) Dump profiler data.static voidTerminate the profiler.static voidIncrement profiler's frame counter.static voidprofileStart(String name) Start an instrumented code section.static floatradiansToDegrees(float radians) Convert the specified angle from radians to degrees.static booleanrayAaBoxHits(Vec3Arg startLocation, Vec3Arg offset, Vec3Arg minimum, Vec3Arg maximum) Intersect the specified axis-aligned box with the specified ray.static voidRegister the allocation hook to use malloc/free.static voidRegister all physics types with the factory and install their collision handlers.static voidsetTraceAllocations(boolean setting) Enable or disable allocation tracing in Debug native libraries.static booleanTest whether the native library supports the ObjectStream format.static voidUnregister all physics types with the factory.static StringReturn the jolt-jni version string.
-
Field Details
-
JPH_PI
public static final float JPH_PIsingle-precision value of Pi- See Also:
-
cMaxPhysicsBarriers
public static final int cMaxPhysicsBarriersstandard 2nd argument to theJobSystemThreadPoolconstructorvalue should match Jolt/Physics/PhysicsSettings.h
- See Also:
-
cMaxPhysicsJobs
public static final int cMaxPhysicsJobsstandard first argument to theJobSystemThreadPoolconstructorvalue should match Jolt/Physics/PhysicsSettings.h
- See Also:
-
-
Method Details
-
buildType
Return the jolt-jni build-type string.- Returns:
- either "Debug" or "Release"
-
degreesToRadians
public static float degreesToRadians(float degrees) Convert the specified angle from degrees to radians.- Parameters:
degrees- the angle to convert (in degrees)- Returns:
- the converted angle (in radians)
-
destroyFactory
public static void destroyFactory()Destroy the factory for deserialization of saved data.- See Also:
-
detLog
Append a message to the determinism log.- Parameters:
message- (not null)
-
getConfigurationString
Return a string containing important configuration settings.- Returns:
- the string value
-
hashBytes
public static long hashBytes(long dataVa, int inSize) Return a hash code for the specified data bytes.- Parameters:
dataVa- the virtual address of the data, or 0 for no datainSize- the number of data bytes, or 0 for no data- Returns:
- the hash code
-
hashBytes
Combine the specified quaternion with the specified hash code.- Parameters:
quaternion- the quaternion to combine (not null, unaffected)oldHash- the old hash code- Returns:
- the new hash code
-
hashBytes
Combine the specified vector with the specified hash code.- Parameters:
vector- the vector to combine (not null, unaffected)oldHash- the old hash code- Returns:
- the new hash code
-
implementsDebugRendering
public static boolean implementsDebugRendering()Test whether the native library implements debug rendering. (native macro: JPH_DEBUG_RENDERER)- Returns:
- true if implemented, otherwise false
-
implementsDeterminismLog
public static boolean implementsDeterminismLog()Test whether the native library implements extra logging to help debug determinism issues. (native macro: JPH_DET_LOG)- Returns:
- true if implemented, otherwise false
-
installDefaultAssertCallback
public static void installDefaultAssertCallback()Install the default assert callback. -
installDefaultTraceCallback
public static void installDefaultTraceCallback()Install the default trace callback. -
isDoublePrecision
public static boolean isDoublePrecision()Test whether the native library uses double-precision location vectors. (native macro: JPH_DOUBLE_PRECISION)- Returns:
- true if double-precision, otherwise false
-
newDirectFloatBuffer
Create a directFloatBufferwith native byte order and the specified capacity.- Parameters:
numFloats- the desired capacity (in floats)- Returns:
- a new direct buffer, zeroed and rewound but not flipped
-
newDirectIntBuffer
Create a directIntBufferwith native byte order and the specified capacity.- Parameters:
numInts- the desired capacity (in floats)- Returns:
- a new direct buffer, zeroed and rewound but not flipped
-
profileDump
Dump profiler data.- Parameters:
message- (not null)
-
profileEnd
public static void profileEnd()Terminate the profiler. -
profileNextFrame
public static void profileNextFrame()Increment profiler's frame counter. -
profileStart
Start an instrumented code section.- Parameters:
name- the section name (not null)
-
newFactory
public static void newFactory()Create a factory for deserialization of saved data.- See Also:
-
radiansToDegrees
public static float radiansToDegrees(float radians) Convert the specified angle from radians to degrees.- Parameters:
radians- the angle to convert (in radians)- Returns:
- the converted angle (in degrees)
-
rayAaBoxHits
public static boolean rayAaBoxHits(Vec3Arg startLocation, Vec3Arg offset, Vec3Arg minimum, Vec3Arg maximum) Intersect the specified axis-aligned box with the specified ray.- Parameters:
startLocation- the desired start location (not null, unaffected)offset- the desired end offset from the start (not null, unaffected)minimum- the minimum coordinates of the box (not null, unaffected)maximum- the maximum coordinates of the box (not null, unaffected)- Returns:
- true if there is a hit
-
registerDefaultAllocator
public static void registerDefaultAllocator()Register the allocation hook to use malloc/free. This must be done before any other Jolt function is called. -
registerTypes
public static void registerTypes()Register all physics types with the factory and install their collision handlers.- See Also:
-
setTraceAllocations
public static void setTraceAllocations(boolean setting) Enable or disable allocation tracing in Debug native libraries.- Parameters:
setting- true to enable tracing, false to disable it (default=false)
-
supportsObjectStream
public static boolean supportsObjectStream()Test whether the native library supports the ObjectStream format. (native macro: JPH_OBJECT_STREAM)- Returns:
- true if supported, otherwise false
-
unregisterTypes
public static void unregisterTypes()Unregister all physics types with the factory.- See Also:
-
versionString
Return the jolt-jni version string.- Returns:
- the version string (not null, not empty)
-