Class NativeLibrary

java.lang.Object
com.jme3.bullet.util.NativeLibrary

public final class NativeLibrary extends Object
Static interface to the Libbulletjme native library.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    expected version string of the native library
    static final Logger
    message logger for this class
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Count the cumulative number of clamped CCD motions (native variable: gNumClampedCcdMotions).
    static int
    Count how many threads are available for task scheduling.
    static void
    Crash the JVM with an EXCEPTION_ACCESS_VIOLATION or SIGILL.
    static int
    Dump all native-memory allocation/free events to standard output.
    static int
    Dump all Quickprof data to standard output.
    static void
    Execute btAssert(0).
    static boolean
    Test whether the native library was built with debugging enabled.
    static boolean
    Test whether the native library uses double-precision arithmetic.
    static boolean
    isInsideTriangle(com.jme3.math.Vector3f testPoint, float maxSeparation, com.jme3.math.Vector3f v0, com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
    Test whether the specified point and triangle are within the specified distance of each other.
    static boolean
    Test whether the native library includes Quickprof profiling.
    static boolean
    Test whether the native library was built thread-safe.
    static long
    Return the address of the current thread's JNIEnv.
    static void
    Reset Quickprof.
    static void
    setReinitializationCallbackEnabled(boolean callbackFlag)
    Alter whether the native library should invoke the reinitialization() callback.
    static void
    setStartupMessageEnabled(boolean printFlag)
    Alter whether the native library will print its startup message during initialization.
    static String
    Determine the native library's version string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
    • expectedVersion

      public static final String expectedVersion
      expected version string of the native library
      See Also:
  • Method Details

    • countClampedCcdMotions

      public static int countClampedCcdMotions()
      Count the cumulative number of clamped CCD motions (native variable: gNumClampedCcdMotions).

      For debugging. The value shouldn't grow too large.

      Returns:
      the count (≥0)
    • countThreads

      public static int countThreads()
      Count how many threads are available for task scheduling.
      Returns:
      the count (≥0)
    • crash

      public static void crash()
      Crash the JVM with an EXCEPTION_ACCESS_VIOLATION or SIGILL. Intended for testing only!
    • dumpMemoryLeaks

      public static int dumpMemoryLeaks()
      Dump all native-memory allocation/free events to standard output. This feature is enabled only in native libraries built with the BT_DEBUG_MEMORY_ALLOCATIONS macro defined.
      Returns:
      the number of bytes outstanding (≥0), or -1 if this feature is not enabled
    • dumpQuickprof

      public static int dumpQuickprof()
      Dump all Quickprof data to standard output. This feature is enabled only in native libraries built with the BT_ENABLE_PROFILE macro defined. Must be invoked on the designated physics thread.
      Returns:
      the number of frames profiled since the last reset (≥0), or -1 if this feature is not enabled
    • fail

      public static void fail()
      Execute btAssert(0). This has no effect on Release builds, but if the native library was built with debugging enabled, it should terminate the Java Virtual Machine. Intended for testing only!
    • isDebug

      public static boolean isDebug()
      Test whether the native library was built with debugging enabled.
      Returns:
      true if Debug buildType, false if Release buildType
    • isDoublePrecision

      public static boolean isDoublePrecision()
      Test whether the native library uses double-precision arithmetic.
      Returns:
      true if double-precision, false if single-precision
    • isInsideTriangle

      public static boolean isInsideTriangle(com.jme3.math.Vector3f testPoint, float maxSeparation, com.jme3.math.Vector3f v0, com.jme3.math.Vector3f v1, com.jme3.math.Vector3f v2)
      Test whether the specified point and triangle are within the specified distance of each other. Used for testing Bullet's btTriangleShape::isInside().
      Parameters:
      testPoint - the location of the test point (not null, unaffected)
      maxSeparation - the maximum separation allowed
      v0 - the first vertex of the triangle (not null, unaffected)
      v1 - the 2nd vertex of the triangle (not null, unaffected)
      v2 - the 3rd vertex of the triangle (not null, unaffected)
      Returns:
      true if within the specified distance, otherwise false
    • isQuickprof

      public static boolean isQuickprof()
      Test whether the native library includes Quickprof profiling.
      Returns:
      true if included, otherwise false
    • isThreadSafe

      public static boolean isThreadSafe()
      Test whether the native library was built thread-safe.
      Returns:
      true if thread-safe, otherwise false
    • jniEnvId

      public static long jniEnvId()
      Return the address of the current thread's JNIEnv. For debugging and testing.
      Returns:
      the virtual address of the (native) object (not zero)
    • resetQuickprof

      public static void resetQuickprof()
      Reset Quickprof. This feature is enabled only in native libraries built with the BT_ENABLE_PROFILE macro defined. Must be invoked on the designated physics thread.
    • setReinitializationCallbackEnabled

      public static void setReinitializationCallbackEnabled(boolean callbackFlag)
      Alter whether the native library should invoke the reinitialization() callback.
      Parameters:
      callbackFlag - true → invoke, false → don't invoke (default=false)
    • setStartupMessageEnabled

      public static void setStartupMessageEnabled(boolean printFlag)
      Alter whether the native library will print its startup message during initialization.
      Parameters:
      printFlag - true → print message, false → no message (default=true)
    • versionNumber

      public static String versionNumber()
      Determine the native library's version string.
      Returns:
      the version string (typically of the form Major.Minor.Patch)