- separate jar files for engine components - resolve dependencies between code parts - remove Nifty dependency from Cinematics - remove Physics dependency from TerrainGrid - add public accessors to Natives Extraction - remove RenderHint serialization from networking git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8839 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
1cc957e7e9
commit
c906508e62
@ -0,0 +1,169 @@ |
|||||||
|
*********************************** |
||||||
|
* Build info for bulletjme * |
||||||
|
* (c) 2011 Normen Hansen * |
||||||
|
*********************************** |
||||||
|
|
||||||
|
This document outlines the process of building bullet-jme on different platforms. |
||||||
|
Since bullet-jme is a native java library and bullet gets included statically, |
||||||
|
building requires you to download and build the bullet source first. |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*********************************** |
||||||
|
* Building bullet * |
||||||
|
*********************************** |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
General info |
||||||
|
----------------------------------- |
||||||
|
Note that the compilation of bullet should not produce dll / so / dylib files |
||||||
|
but static *.a libraries which can later be compiled into the binary of bullet-jme. |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Downloading and extracting bullet |
||||||
|
----------------------------------- |
||||||
|
Requirements: |
||||||
|
- Bullet source: http://bullet.googlecode.com/ |
||||||
|
|
||||||
|
Extract bullet source and build bullet (see below) |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Building on Mac OSX |
||||||
|
----------------------------------- |
||||||
|
Requirements: |
||||||
|
- Apple Developer tools: http://developer.apple.com/ |
||||||
|
- CMake: http://www.cmake.org/ (or via http://www.macports.org) |
||||||
|
|
||||||
|
Commands: |
||||||
|
> cd bullet-trunk |
||||||
|
> cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON \ |
||||||
|
-DCMAKE_OSX_ARCHITECTURES='ppc;i386;x86_64' \ |
||||||
|
-DBUILD_EXTRAS=off -DBUILD_DEMOS=off -DCMAKE_BUILD_TYPE=Release |
||||||
|
> make |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Building on WINDOWS (MinGW/GCC, Recommended) |
||||||
|
----------------------------------- |
||||||
|
Requirements: |
||||||
|
- GNU C++ Compiler: http://www.mingw.org/ |
||||||
|
http://mingw-w64.sourceforge.net/ |
||||||
|
- CMake: http://www.cmake.org/ |
||||||
|
|
||||||
|
Commands: |
||||||
|
> cd bullet-trunk |
||||||
|
> cmake . -DBUILD_SHARED_LIBS=OFF -DBUILD_DEMOS:BOOL=OFF -DBUILD_EXTRAS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release . -G "MinGW Makefiles" |
||||||
|
> mingw32-make |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Building on WINDOWS (VisualStudio, untested) |
||||||
|
----------------------------------- |
||||||
|
Requirements: |
||||||
|
- Microsoft Visual Studio http://msdn.microsoft.com/ |
||||||
|
|
||||||
|
Bullet comes with autogenerated Project Files for Microsoft Visual Studio 6, 7, 7.1 and 8. |
||||||
|
The main Workspace/Solution is located in Bullet/msvc/8/wksbullet.sln (replace 8 with your version). |
||||||
|
|
||||||
|
Build the project to create static libraries. |
||||||
|
|
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Building bullet on LINUX |
||||||
|
----------------------------------- |
||||||
|
Requirements: |
||||||
|
- Gnu C++ Compiler: http://gcc.gnu.org/ |
||||||
|
- CMake: http://www.cmake.org/ (or via your package manager of choice) |
||||||
|
|
||||||
|
Commands: |
||||||
|
> cd bullet-trunk |
||||||
|
> cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC"\ |
||||||
|
-DBUILD_EXTRAS=off -DBUILD_DEMOS=off -DCMAKE_BUILD_TYPE=Release |
||||||
|
> make |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
More info on building bullet |
||||||
|
----------------------------------- |
||||||
|
http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Installation |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*********************************** |
||||||
|
* Building bulletjme * |
||||||
|
*********************************** |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Requirements |
||||||
|
----------------------------------- |
||||||
|
- Java SDK 1.5+: http://java.sun.com |
||||||
|
- Apache ANT: http://ant.apache.org |
||||||
|
- C++ Compiler: (see below) |
||||||
|
- jme3 Source: http://jmonkeyengine.googlecode.com/ |
||||||
|
- Statically compiled bullet source (see above) |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Preparation |
||||||
|
----------------------------------- |
||||||
|
- copy/link bullet-trunk folder into the same folder where the bullet-jme folder is: |
||||||
|
|
||||||
|
disk |
||||||
|
| |
||||||
|
+-root folder |
||||||
|
| |
||||||
|
+-engine |
||||||
|
| |
||||||
|
+-sdk |
||||||
|
| |
||||||
|
+-bullet-trunk |
||||||
|
|
||||||
|
- You can alter options in the "src/bullet/native/bullet.properties" file, such as the used bullet |
||||||
|
version, native compilation options etc. (see below) |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Building bulletjme native |
||||||
|
----------------------------------- |
||||||
|
Commands: |
||||||
|
> cd engine |
||||||
|
> ant jar |
||||||
|
> ant build-bullet-natives |
||||||
|
|
||||||
|
Thats all. ANT takes care building native binaries and copies them to th elib directory. |
||||||
|
|
||||||
|
If you get compilation errors, try setting "native.java.include" in the build.properties file to your |
||||||
|
JDK include directory, e.g. /opt/java/include or "c:\Program Files\Java\jdk1.6.0_20\include". |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Altering the native build process |
||||||
|
----------------------------------- |
||||||
|
bullet-jme uses cpptasks to compile native code. |
||||||
|
|
||||||
|
To change the used compiler, edit the "native.platform.compiler" entry in the |
||||||
|
"build.properties" file. The following c++ compilers work with cpptasks: |
||||||
|
|
||||||
|
gcc GCC C++ compiler |
||||||
|
g++ GCC C++ compiler |
||||||
|
c++ GCC C++ compiler |
||||||
|
msvc Microsoft Visual C++ |
||||||
|
bcc Borland C++ Compiler |
||||||
|
icl Intel C++ compiler for Windows (IA-32) |
||||||
|
ecl Intel C++ compiler for Windows (IA-64) |
||||||
|
icc Intel C++ compiler for Linux (IA-32) |
||||||
|
ecc Intel C++ compiler for Linux (IA-64) |
||||||
|
CC Sun ONE C++ compiler |
||||||
|
aCC HP aC++ C++ Compiler |
||||||
|
wcl OpenWatcom C/C++ compiler |
||||||
|
|
||||||
|
In the "nbproject" folder you can find "build-native-platform.xml" files containing the commands |
||||||
|
to compile bullet-jme on different platforms. If you want to alter the process, |
||||||
|
you can copy and modify one of the files and import it in the "build.xml" file instead |
||||||
|
of the old one. |
||||||
|
|
||||||
|
----------------------------------- |
||||||
|
Netbeans Project |
||||||
|
----------------------------------- |
||||||
|
The project also includes a Netbeans project to edit and build |
||||||
|
the source in the Netbeans IDE in the /src/bullet/ subfolder. |
||||||
|
|
||||||
|
To have correct syntax highlighting in .cpp/.h files: |
||||||
|
|
||||||
|
- in Netbeans Settings -> C/C++ -> Code Assistance -> C++ |
||||||
|
- add bullet-2.77/src as include directories for c++ |
||||||
|
- add JAVA_HOME/include as include directories for c++ |
@ -0,0 +1,310 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project name="build bullet natives" default="all" basedir="../"> |
||||||
|
<!-- load cpp compiler ant task --> |
||||||
|
<taskdef resource="cpptasks.tasks" classpath="lib/antlibs/cpptasks.jar"/> |
||||||
|
<!-- load properties --> |
||||||
|
<property file="nbproject/bullet-native.properties"/> |
||||||
|
<!-- condition for mac platform check --> |
||||||
|
<condition property="isSolaris"> |
||||||
|
<os name="SunOS"/> |
||||||
|
</condition> |
||||||
|
<condition property="isMac"> |
||||||
|
<and> |
||||||
|
<os family="mac" /> |
||||||
|
<os family="unix" /> |
||||||
|
</and> |
||||||
|
</condition> |
||||||
|
<!-- condition for windows platform check --> |
||||||
|
<condition property="isWindows"> |
||||||
|
<os family="windows" /> |
||||||
|
</condition> |
||||||
|
<!-- condition for linux platform check --> |
||||||
|
<condition property="isLinux"> |
||||||
|
<and> |
||||||
|
<os family="unix"/> |
||||||
|
<not> |
||||||
|
<os family="mac"/> |
||||||
|
</not> |
||||||
|
<not> |
||||||
|
<os name="SunOS"/> |
||||||
|
</not> |
||||||
|
</and> |
||||||
|
</condition> |
||||||
|
<!-- condition for x86_64 check --> |
||||||
|
<condition property="isx86_64"> |
||||||
|
<os arch="x86_64" /> |
||||||
|
</condition> |
||||||
|
|
||||||
|
<condition property="ndk-build-name" value="ndk-build.cmd" else="ndk-build"> |
||||||
|
<os family="windows" /> |
||||||
|
</condition> |
||||||
|
|
||||||
|
<fileset id="lib.jars" dir="${bullet.lib.dir}"> |
||||||
|
<include name="**/*.jar"/> |
||||||
|
</fileset> |
||||||
|
<fileset id="lib.jme.jars" dir="${bullet.jme.dir}"> |
||||||
|
<include name="**/*.jar"/> |
||||||
|
</fileset> |
||||||
|
|
||||||
|
<pathconvert property="lib.importpath"> |
||||||
|
<fileset refid="lib.jars"/> |
||||||
|
<fileset refid="lib.jme.jars"/> |
||||||
|
</pathconvert> |
||||||
|
|
||||||
|
<target name="build-bullet-natives" description="builds the native bullet library for the platform being run on" depends="-create-folders, create-native-headers, -nativelib-osx, -nativelib-windows, -nativelib-linux, -nativelib-solaris, -nativelib-android"> |
||||||
|
<echo message="Updating native jME3-bullet-natives.jar"/> |
||||||
|
<zip basedir="${bullet.output.base}/jarcontent" file="${bullet.output.base}/jME3-bullet-natives.jar" compress="true"/> |
||||||
|
<zip basedir="${bullet.output.base}/android" file="${bullet.output.base}/jME3-bullet-natives-android.jar" compress="true"/> |
||||||
|
<copy file="${bullet.output.base}/jME3-bullet-natives.jar" todir="dist/opt/native-bullet/lib/"/> |
||||||
|
<copy file="${bullet.output.base}/jME3-bullet-natives-android.jar" todir="dist/opt/native-bullet/lib/"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="create-native-headers" description="creates the native headers"> |
||||||
|
<javah destdir="${bullet.source.dir}" classpath="${bullet.build.dir}${path.separator}${lib.importpath}" force="yes"> |
||||||
|
<class name="com.jme3.bullet.PhysicsSpace"/> |
||||||
|
|
||||||
|
<class name="com.jme3.bullet.collision.PhysicsCollisionEvent"/> |
||||||
|
<class name="com.jme3.bullet.collision.PhysicsCollisionObject"/> |
||||||
|
<class name="com.jme3.bullet.objects.PhysicsCharacter"/> |
||||||
|
<class name="com.jme3.bullet.objects.PhysicsGhostObject"/> |
||||||
|
<class name="com.jme3.bullet.objects.PhysicsRigidBody"/> |
||||||
|
<class name="com.jme3.bullet.objects.PhysicsVehicle"/> |
||||||
|
<class name="com.jme3.bullet.objects.VehicleWheel"/> |
||||||
|
<class name="com.jme3.bullet.objects.infos.RigidBodyMotionState"/> |
||||||
|
|
||||||
|
<class name="com.jme3.bullet.collision.shapes.CollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.BoxCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.CapsuleCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.CompoundCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.ConeCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.CylinderCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.GImpactCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.HeightfieldCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.HullCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.MeshCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.PlaneCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.SimplexCollisionShape"/> |
||||||
|
<class name="com.jme3.bullet.collision.shapes.SphereCollisionShape"/> |
||||||
|
|
||||||
|
<class name="com.jme3.bullet.joints.PhysicsJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.ConeJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.HingeJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.Point2PointJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.SixDofJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.SixDofSpringJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.SliderJoint"/> |
||||||
|
<class name="com.jme3.bullet.joints.motors.RotationalLimitMotor"/> |
||||||
|
<class name="com.jme3.bullet.joints.motors.TranslationalLimitMotor"/> |
||||||
|
|
||||||
|
<class name="com.jme3.bullet.util.NativeMeshUtil"/> |
||||||
|
<class name="com.jme3.bullet.util.DebugShapeFactory"/> |
||||||
|
</javah> |
||||||
|
</target> |
||||||
|
|
||||||
|
<!-- compares the API of native bullet and java version--> |
||||||
|
<target name="bullet-api-diff"> |
||||||
|
<echo message="Comparing bullet and jbullet API"/> |
||||||
|
<property name="dependencyfinder.home" value="lib/antlibs/depfinder"/> |
||||||
|
<path id="dependencyfinder"> |
||||||
|
<pathelement location="${dependencyfinder.home}/classes"/> |
||||||
|
<pathelement location="${dependencyfinder.home}/lib/DependencyFinder.jar"/> |
||||||
|
<pathelement location="${dependencyfinder.home}/lib/jakarta-oro.jar"/> |
||||||
|
<pathelement location="${dependencyfinder.home}/lib/log4j.jar"/> |
||||||
|
<pathelement location="${dependencyfinder.home}/lib/guava.jar"/> |
||||||
|
</path> |
||||||
|
<taskdef resource="dependencyfindertasks.properties"> |
||||||
|
<classpath refid="dependencyfinder"/> |
||||||
|
</taskdef> |
||||||
|
<jarjardiff destfile="bullet-api-diff.xml" |
||||||
|
name="jMonkeyEngine3 Bullet Physics API Comparison" |
||||||
|
oldlabel="Java Version" |
||||||
|
newlabel="Native Version" |
||||||
|
level="incompatible"> |
||||||
|
<old> |
||||||
|
<pathelement location="build/jME3-jbullet.jar"/> |
||||||
|
</old> |
||||||
|
<new> |
||||||
|
<pathelement location="build/jME3-bullet.jar"/> |
||||||
|
</new> |
||||||
|
</jarjardiff> |
||||||
|
<xslt style="${dependencyfinder.home}/etc/DiffToHTML.xsl" |
||||||
|
in="bullet-api-diff.xml" |
||||||
|
out="bullet-api-diff.html" force="true"/> |
||||||
|
<delete file="bullet-api-diff.xml"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-create-folders" description="creates the native headers"> |
||||||
|
<mkdir dir="${bullet.source.dir}"/> |
||||||
|
<mkdir dir="${bullet.build.dir}"/> |
||||||
|
<mkdir dir="${bullet.output.dir}"/> |
||||||
|
<mkdir dir="build/bullet-native"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-nativelib-osx" if="isMac"> |
||||||
|
<echo message="Building MacOSX version of native bullet"/> |
||||||
|
<mkdir dir="${bullet.output.dir}/macosx"/> |
||||||
|
<cc name="${bullet.osx.compiler}" warnings="none" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/macosx/${bullet.library.name}" objdir="build/bullet-native"> |
||||||
|
<fileset dir="${bullet.source.dir}"> |
||||||
|
<include name="*.cpp"> |
||||||
|
</include> |
||||||
|
</fileset> |
||||||
|
<includepath path="${bullet.osx.java.include}"/> |
||||||
|
<includepath path="${bullet.bullet.include}"/> |
||||||
|
<compilerarg value="-syslibroot ${bullet.osx.syslibroot}"/> |
||||||
|
<!--compilerarg value="-arch"/> |
||||||
|
<compilerarg value="ppc"/--> |
||||||
|
<compilerarg value="-arch"/> |
||||||
|
<compilerarg value="i386"/> |
||||||
|
<compilerarg value="-arch"/> |
||||||
|
<compilerarg value="x86_64"/> |
||||||
|
<linker name="${bullet.osx.compiler}"> |
||||||
|
<!--libset dir="${bullet.folder}/src/BulletSoftBody" libs="BulletSoftBody"/--> |
||||||
|
<libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/> |
||||||
|
<libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/> |
||||||
|
<!--linkerarg value="-arch"/> |
||||||
|
<linkerarg value="ppc"/--> |
||||||
|
<linkerarg value="-arch"/> |
||||||
|
<linkerarg value="i386"/> |
||||||
|
<linkerarg value="-arch"/> |
||||||
|
<linkerarg value="x86_64"/> |
||||||
|
</linker> |
||||||
|
</cc> |
||||||
|
<move file="${bullet.output.dir}/macosx/lib${bullet.library.name}.dylib" tofile="${bullet.output.dir}/macosx/lib${bullet.library.name}.jnilib" failonerror="true" verbose="true"/> |
||||||
|
<delete file="${bullet.output.dir}/macosx/history.xml"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-nativelib-linux" if="isLinux"> |
||||||
|
<echo message="Building Linux version of native bullet"/> |
||||||
|
<mkdir dir="${bullet.output.dir}/linux"/> |
||||||
|
<cc name="${bullet.linux.compiler}" warnings="severe" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/linux/${bullet.library.name}" objdir="build/bullet-native"> |
||||||
|
<fileset dir="${bullet.source.dir}"> |
||||||
|
<include name="*.cpp"> |
||||||
|
</include> |
||||||
|
</fileset> |
||||||
|
<includepath path="${bullet.java.include}"/> |
||||||
|
<includepath path="${bullet.java.include}/linux"/> |
||||||
|
<includepath path="${bullet.bullet.include}"/> |
||||||
|
<!--compilerarg value="-m32"/--> |
||||||
|
<!--compilerarg value="-static-libgcc"/> |
||||||
|
<compilerarg value="-fPIC"/--> |
||||||
|
<linker name="${bullet.linux.compiler}"> |
||||||
|
<!-- linkerarg value="-static-libgcc"/ --> |
||||||
|
<libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/> |
||||||
|
<libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/> |
||||||
|
</linker> |
||||||
|
</cc> |
||||||
|
<delete file="${bullet.output.dir}/linux/history.xml"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-nativelib-solaris" if="isSolaris"> |
||||||
|
<echo message="Building Solaris version of native bullet"/> |
||||||
|
<mkdir dir="${bullet.output.dir}/linux"/> |
||||||
|
<cc name="${bullet.solaris.compiler}" warnings="severe" debug="${bullet.compile.debug}" link="shared" outfile="${bullet.output.dir}/solaris/${bullet.library.name}" objdir="build/bullet-native"> |
||||||
|
<fileset dir="${bullet.source.dir}"> |
||||||
|
<include name="*.cpp"> |
||||||
|
</include> |
||||||
|
</fileset> |
||||||
|
<includepath path="${bullet.java.include}"/> |
||||||
|
<includepath path="${bullet.java.include}/solaris"/> |
||||||
|
<includepath path="${bullet.bullet.include}"/> |
||||||
|
<!--compilerarg value="-m32"/--> |
||||||
|
<compilerarg value="-m32"/> |
||||||
|
<compilerarg value="-fno-strict-aliasing"/> |
||||||
|
<compilerarg value="-pthread"/> |
||||||
|
<compilerarg value="-fPIC"/> |
||||||
|
<compilerarg value="-D_REENTRANT"/> |
||||||
|
<compilerarg value="-static-libstdc++"/> |
||||||
|
<compilerarg value="-static-libgcc"/> |
||||||
|
<compilerarg value="-D_REENTRANT"/> |
||||||
|
<linker name="${bullet.solaris.compiler}"> |
||||||
|
<linkerarg value="-R/usr/sfw/lib"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletMultiThreaded" libs="BulletMultiThreaded"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletDynamics" libs="BulletDynamics"/> |
||||||
|
<libset dir="${bullet.folder}/src/BulletCollision" libs="BulletCollision"/> |
||||||
|
<libset dir="${bullet.folder}/src/LinearMath" libs="LinearMath"/> |
||||||
|
</linker> |
||||||
|
</cc> |
||||||
|
<delete file="${bullet.output.dir}/solaris/history.xml"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-nativelib-windows" if="isWindows"> |
||||||
|
<echo message="Building Windows version of native bullet"/> |
||||||
|
<mkdir dir="${bullet.output.dir}/windows"/> |
||||||
|
<cc multithreaded="" name="${bullet.windows.compiler}" warnings="none" debug="${bullet.compile.debug}" outtype="shared" outfile="${bullet.output.dir}/windows/${bullet.library.name}" objdir="build/bullet-native"> |
||||||
|
<fileset dir="${bullet.source.dir}"> |
||||||
|
<include name="*.cpp"> |
||||||
|
</include> |
||||||
|
</fileset> |
||||||
|
<includepath path="${bullet.java.include}"/> |
||||||
|
<includepath path="${bullet.java.include}/win32"/> |
||||||
|
<includepath path="${bullet.bullet.include}"/> |
||||||
|
<!--compilerarg value="-m32"/--> |
||||||
|
<linker name="${bullet.windows.compiler}" debug="${bullet.compile.debug}" > |
||||||
|
<linkerarg value="-o${bullet.library.name}.dll" /> |
||||||
|
<linkerarg value="--kill-at" /> |
||||||
|
<linkerarg value="-static"/> |
||||||
|
<libset dir="${bullet.folder}/lib" libs="BulletMultiThreaded,BulletDynamics,BulletCollision,LinearMath"/> |
||||||
|
</linker> |
||||||
|
</cc> |
||||||
|
<delete file="${bullet.output.dir}/windows/history.xml"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-nativelib-android" depends="-check-android-ndk" if="haveAndoidNdk"> |
||||||
|
<!-- delete previous android jni, libs, and obj subdirectories for a clean start --> |
||||||
|
<delete dir="build/bullet-android/jni" failonerror="false"/> |
||||||
|
<delete dir="build/bullet-android/libs" failonerror="false"/> |
||||||
|
<delete dir="build/bullet-android/obj" failonerror="false"/> |
||||||
|
<!-- create the android subdirectory in jarcontent for the libbulletjme.so shared library --> |
||||||
|
<mkdir dir="${bullet.output.base}/android"/> |
||||||
|
<!-- create the jni subdirectory --> |
||||||
|
<mkdir dir="build/bullet-android/jni" /> |
||||||
|
<!-- copy Android.mk and Application.mk files into jni directory --> |
||||||
|
<copy file="${bullet.source.dir}/android/Android.mk" todir="build/bullet-android/jni" verbose="true"/> |
||||||
|
<copy file="${bullet.source.dir}/android/Application.mk" todir="build/bullet-android/jni" verbose="true"/> |
||||||
|
|
||||||
|
<!-- copy edited version of jmePhysicsSpace to remove NDK compile error --> |
||||||
|
<copy file="${bullet.source.dir}/android/jmePhysicsSpace.cpp" todir="build/bullet-android/jni" verbose="true"/> |
||||||
|
|
||||||
|
<!-- copy jME3 Native Bullet files into jni directory --> |
||||||
|
<copy todir="build/bullet-android/jni" verbose="true" flatten="false"> |
||||||
|
<fileset dir="${bullet.source.dir}"> |
||||||
|
<include name="*.cpp" /> |
||||||
|
<include name="*.h" /> |
||||||
|
<!-- skip jmePhysicsSpace (use edited one) to remove NDK compile error --> |
||||||
|
<exclude name="jmePhysicsSpace.cpp" /> |
||||||
|
</fileset> |
||||||
|
</copy> |
||||||
|
|
||||||
|
<!-- copy Bullet-2.79 files into jni directory --> |
||||||
|
<copy todir="build/bullet-android/jni" verbose="true" flatten="false"> |
||||||
|
<fileset dir="${bullet.bullet.include}"> |
||||||
|
<include name="**/*.cpp"/> |
||||||
|
<include name="**/*.h"/> |
||||||
|
<include name="**/*.cl"/> |
||||||
|
</fileset> |
||||||
|
</copy> |
||||||
|
|
||||||
|
<exec executable="${ndk.dir}/${ndk-build-name}" failonerror="true" > |
||||||
|
<arg line="-C build/bullet-android/"/> |
||||||
|
</exec> |
||||||
|
|
||||||
|
<!-- copy resulting library directories to jarcontent directory --> |
||||||
|
<copy todir="${bullet.output.base}/android" verbose="true" flatten="false"> |
||||||
|
<fileset dir="build/bullet-android/libs"> |
||||||
|
<include name="**/*.*"/> |
||||||
|
<include name="**/*.*"/> |
||||||
|
<!--exclude name="**/x86/*.*"/--> |
||||||
|
</fileset> |
||||||
|
</copy> |
||||||
|
|
||||||
|
</target> |
||||||
|
|
||||||
|
<target name="-check-android-ndk"> |
||||||
|
<available file="${ndk.dir}/${ndk-build-name}" property="haveAndoidNdk"/> |
||||||
|
</target> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,35 @@ |
|||||||
|
##################################################### |
||||||
|
# these are the ant build properties for bullet-jme # |
||||||
|
##################################################### |
||||||
|
bullet.library.name=bulletjme |
||||||
|
bullet.library.version=0.9 |
||||||
|
|
||||||
|
# change if bullet folder has different location |
||||||
|
bullet.folder=../bullet-2.79 |
||||||
|
|
||||||
|
# compile options |
||||||
|
bullet.compile.debug=false |
||||||
|
|
||||||
|
# native library compilation options |
||||||
|
bullet.osx.compiler=g++ |
||||||
|
bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.6.sdk |
||||||
|
# change this to msvc for MS Visual Studio compiler |
||||||
|
bullet.windows.compiler=g++ |
||||||
|
bullet.linux.compiler=g++ |
||||||
|
bullet.solaris.compiler=g++ |
||||||
|
# native header include directories |
||||||
|
bullet.java.include=${java.home}/../include |
||||||
|
# OSX has no JRE, only JDK |
||||||
|
bullet.osx.java.include=/System/Library/Frameworks/JavaVM.framework/Headers |
||||||
|
|
||||||
|
# location of Android NDK |
||||||
|
ndk.dir=/opt/android-ndk-r7 |
||||||
|
|
||||||
|
# dont change these.. |
||||||
|
bullet.bullet.include=${bullet.folder}/src |
||||||
|
bullet.build.dir=build/bullet/ |
||||||
|
bullet.source.dir=src/bullet-native |
||||||
|
bullet.output.base=lib/bullet |
||||||
|
bullet.output.dir=${bullet.output.base}/jarcontent/native |
||||||
|
bullet.jme.dir=dist |
||||||
|
bullet.lib.dir=dist/lib |
@ -0,0 +1,50 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.collision.shapes.infos; |
||||||
|
|
||||||
|
import com.jme3.bullet.collision.shapes.BoxCollisionShape; |
||||||
|
import com.jme3.bullet.collision.shapes.CollisionShape; |
||||||
|
import com.jme3.export.InputCapsule; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.export.OutputCapsule; |
||||||
|
import com.jme3.export.Savable; |
||||||
|
import com.jme3.math.Matrix3f; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public class ChildCollisionShape implements Savable { |
||||||
|
|
||||||
|
public Vector3f location; |
||||||
|
public Matrix3f rotation; |
||||||
|
public CollisionShape shape; |
||||||
|
|
||||||
|
public ChildCollisionShape() { |
||||||
|
} |
||||||
|
|
||||||
|
public ChildCollisionShape(Vector3f location, Matrix3f rotation, CollisionShape shape) { |
||||||
|
this.location = location; |
||||||
|
this.rotation = rotation; |
||||||
|
this.shape = shape; |
||||||
|
} |
||||||
|
|
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
OutputCapsule capsule = ex.getCapsule(this); |
||||||
|
capsule.write(location, "location", new Vector3f()); |
||||||
|
capsule.write(rotation, "rotation", new Matrix3f()); |
||||||
|
capsule.write(shape, "shape", new BoxCollisionShape(new Vector3f(1, 1, 1))); |
||||||
|
} |
||||||
|
|
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
InputCapsule capsule = im.getCapsule(this); |
||||||
|
location = (Vector3f) capsule.readSavable("location", new Vector3f()); |
||||||
|
rotation = (Matrix3f) capsule.readSavable("rotation", new Matrix3f()); |
||||||
|
shape = (CollisionShape) capsule.readSavable("shape", new BoxCollisionShape(new Vector3f(1, 1, 1))); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,208 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.bullet.collision.shapes.CollisionShape; |
||||||
|
import com.jme3.bullet.objects.PhysicsCharacter; |
||||||
|
import com.jme3.export.InputCapsule; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.export.OutputCapsule; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.renderer.RenderManager; |
||||||
|
import com.jme3.renderer.ViewPort; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public class CharacterControl extends PhysicsCharacter implements PhysicsControl { |
||||||
|
|
||||||
|
protected Spatial spatial; |
||||||
|
protected boolean enabled = true; |
||||||
|
protected boolean added = false; |
||||||
|
protected PhysicsSpace space = null; |
||||||
|
protected Vector3f viewDirection = new Vector3f(Vector3f.UNIT_Z); |
||||||
|
protected boolean useViewDirection = true; |
||||||
|
protected boolean applyLocal = false; |
||||||
|
|
||||||
|
public CharacterControl() { |
||||||
|
} |
||||||
|
|
||||||
|
public CharacterControl(CollisionShape shape, float stepHeight) { |
||||||
|
super(shape, stepHeight); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isApplyPhysicsLocal() { |
||||||
|
return applyLocal; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* When set to true, the physics coordinates will be applied to the local |
||||||
|
* translation of the Spatial |
||||||
|
* @param applyPhysicsLocal |
||||||
|
*/ |
||||||
|
public void setApplyPhysicsLocal(boolean applyPhysicsLocal) { |
||||||
|
applyLocal = applyPhysicsLocal; |
||||||
|
} |
||||||
|
|
||||||
|
private Vector3f getSpatialTranslation() { |
||||||
|
if (applyLocal) { |
||||||
|
return spatial.getLocalTranslation(); |
||||||
|
} |
||||||
|
return spatial.getWorldTranslation(); |
||||||
|
} |
||||||
|
|
||||||
|
public Control cloneForSpatial(Spatial spatial) { |
||||||
|
CharacterControl control = new CharacterControl(collisionShape, stepHeight); |
||||||
|
control.setCcdMotionThreshold(getCcdMotionThreshold()); |
||||||
|
control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); |
||||||
|
control.setCollideWithGroups(getCollideWithGroups()); |
||||||
|
control.setCollisionGroup(getCollisionGroup()); |
||||||
|
control.setFallSpeed(getFallSpeed()); |
||||||
|
control.setGravity(getGravity()); |
||||||
|
control.setJumpSpeed(getJumpSpeed()); |
||||||
|
control.setMaxSlope(getMaxSlope()); |
||||||
|
control.setPhysicsLocation(getPhysicsLocation()); |
||||||
|
control.setUpAxis(getUpAxis()); |
||||||
|
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); |
||||||
|
|
||||||
|
control.setSpatial(spatial); |
||||||
|
return control; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpatial(Spatial spatial) { |
||||||
|
if (getUserObject() == null || getUserObject() == this.spatial) { |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
this.spatial = spatial; |
||||||
|
if (spatial == null) { |
||||||
|
if (getUserObject() == spatial) { |
||||||
|
setUserObject(null); |
||||||
|
} |
||||||
|
return; |
||||||
|
} |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
this.enabled = enabled; |
||||||
|
if (space != null) { |
||||||
|
if (enabled && !added) { |
||||||
|
if (spatial != null) { |
||||||
|
warp(getSpatialTranslation()); |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} else if (!enabled && added) { |
||||||
|
space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEnabled() { |
||||||
|
return enabled; |
||||||
|
} |
||||||
|
|
||||||
|
public void setViewDirection(Vector3f vec) { |
||||||
|
viewDirection.set(vec); |
||||||
|
} |
||||||
|
|
||||||
|
public Vector3f getViewDirection() { |
||||||
|
return viewDirection; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isUseViewDirection() { |
||||||
|
return useViewDirection; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUseViewDirection(boolean viewDirectionEnabled) { |
||||||
|
this.useViewDirection = viewDirectionEnabled; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(float tpf) { |
||||||
|
if (enabled && spatial != null) { |
||||||
|
Quaternion localRotationQuat = spatial.getLocalRotation(); |
||||||
|
Vector3f localLocation = spatial.getLocalTranslation(); |
||||||
|
if (!applyLocal && spatial.getParent() != null) { |
||||||
|
getPhysicsLocation(localLocation); |
||||||
|
localLocation.subtractLocal(spatial.getParent().getWorldTranslation()); |
||||||
|
localLocation.divideLocal(spatial.getParent().getWorldScale()); |
||||||
|
tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); |
||||||
|
spatial.setLocalTranslation(localLocation); |
||||||
|
|
||||||
|
if (useViewDirection) { |
||||||
|
localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); |
||||||
|
spatial.setLocalRotation(localRotationQuat); |
||||||
|
} |
||||||
|
} else { |
||||||
|
spatial.setLocalTranslation(getPhysicsLocation()); |
||||||
|
localRotationQuat.lookAt(viewDirection, Vector3f.UNIT_Y); |
||||||
|
spatial.setLocalRotation(localRotationQuat); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void render(RenderManager rm, ViewPort vp) { |
||||||
|
if (enabled && space != null && space.getDebugManager() != null) { |
||||||
|
if (debugShape == null) { |
||||||
|
attachDebugShape(space.getDebugManager()); |
||||||
|
} |
||||||
|
debugShape.setLocalTranslation(getPhysicsLocation()); |
||||||
|
debugShape.updateLogicalState(0); |
||||||
|
debugShape.updateGeometricState(); |
||||||
|
rm.renderScene(debugShape, vp); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setPhysicsSpace(PhysicsSpace space) { |
||||||
|
if (space == null) { |
||||||
|
if (this.space != null) { |
||||||
|
this.space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (this.space == space) { |
||||||
|
return; |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} |
||||||
|
this.space = space; |
||||||
|
} |
||||||
|
|
||||||
|
public PhysicsSpace getPhysicsSpace() { |
||||||
|
return space; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
super.write(ex); |
||||||
|
OutputCapsule oc = ex.getCapsule(this); |
||||||
|
oc.write(enabled, "enabled", true); |
||||||
|
oc.write(applyLocal, "applyLocalPhysics", false); |
||||||
|
oc.write(useViewDirection, "viewDirectionEnabled", true); |
||||||
|
oc.write(viewDirection, "viewDirection", new Vector3f(Vector3f.UNIT_Z)); |
||||||
|
oc.write(spatial, "spatial", null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
super.read(im); |
||||||
|
InputCapsule ic = im.getCapsule(this); |
||||||
|
enabled = ic.readBoolean("enabled", true); |
||||||
|
useViewDirection = ic.readBoolean("viewDirectionEnabled", true); |
||||||
|
viewDirection = (Vector3f) ic.readSavable("viewDirection", new Vector3f(Vector3f.UNIT_Z)); |
||||||
|
applyLocal = ic.readBoolean("applyLocalPhysics", false); |
||||||
|
spatial = (Spatial) ic.readSavable("spatial", null); |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,178 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.bullet.collision.shapes.CollisionShape; |
||||||
|
import com.jme3.bullet.objects.PhysicsGhostObject; |
||||||
|
import com.jme3.export.InputCapsule; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.export.OutputCapsule; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.renderer.RenderManager; |
||||||
|
import com.jme3.renderer.ViewPort; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* A GhostControl moves with the spatial it is attached to and can be used to check |
||||||
|
* overlaps with other physics objects (e.g. aggro radius). |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public class GhostControl extends PhysicsGhostObject implements PhysicsControl { |
||||||
|
|
||||||
|
protected Spatial spatial; |
||||||
|
protected boolean enabled = true; |
||||||
|
protected boolean added = false; |
||||||
|
protected PhysicsSpace space = null; |
||||||
|
protected boolean applyLocal = false; |
||||||
|
|
||||||
|
public GhostControl() { |
||||||
|
} |
||||||
|
|
||||||
|
public GhostControl(CollisionShape shape) { |
||||||
|
super(shape); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isApplyPhysicsLocal() { |
||||||
|
return applyLocal; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* When set to true, the physics coordinates will be applied to the local |
||||||
|
* translation of the Spatial |
||||||
|
* @param applyPhysicsLocal |
||||||
|
*/ |
||||||
|
public void setApplyPhysicsLocal(boolean applyPhysicsLocal) { |
||||||
|
applyLocal = applyPhysicsLocal; |
||||||
|
} |
||||||
|
|
||||||
|
private Vector3f getSpatialTranslation() { |
||||||
|
if (applyLocal) { |
||||||
|
return spatial.getLocalTranslation(); |
||||||
|
} |
||||||
|
return spatial.getWorldTranslation(); |
||||||
|
} |
||||||
|
|
||||||
|
private Quaternion getSpatialRotation() { |
||||||
|
if (applyLocal) { |
||||||
|
return spatial.getLocalRotation(); |
||||||
|
} |
||||||
|
return spatial.getWorldRotation(); |
||||||
|
} |
||||||
|
|
||||||
|
public Control cloneForSpatial(Spatial spatial) { |
||||||
|
GhostControl control = new GhostControl(collisionShape); |
||||||
|
control.setCcdMotionThreshold(getCcdMotionThreshold()); |
||||||
|
control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); |
||||||
|
control.setCollideWithGroups(getCollideWithGroups()); |
||||||
|
control.setCollisionGroup(getCollisionGroup()); |
||||||
|
control.setPhysicsLocation(getPhysicsLocation()); |
||||||
|
control.setPhysicsRotation(getPhysicsRotationMatrix()); |
||||||
|
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); |
||||||
|
|
||||||
|
control.setSpatial(spatial); |
||||||
|
return control; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpatial(Spatial spatial) { |
||||||
|
if (getUserObject() == null || getUserObject() == this.spatial) { |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
this.spatial = spatial; |
||||||
|
if (spatial == null) { |
||||||
|
if (getUserObject() == spatial) { |
||||||
|
setUserObject(null); |
||||||
|
} |
||||||
|
return; |
||||||
|
} |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
this.enabled = enabled; |
||||||
|
if (space != null) { |
||||||
|
if (enabled && !added) { |
||||||
|
if (spatial != null) { |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} else if (!enabled && added) { |
||||||
|
space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEnabled() { |
||||||
|
return enabled; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(float tpf) { |
||||||
|
if (!enabled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
|
||||||
|
public void render(RenderManager rm, ViewPort vp) { |
||||||
|
if (enabled && space != null && space.getDebugManager() != null) { |
||||||
|
if (debugShape == null) { |
||||||
|
attachDebugShape(space.getDebugManager()); |
||||||
|
} |
||||||
|
debugShape.setLocalTranslation(spatial.getWorldTranslation()); |
||||||
|
debugShape.setLocalRotation(spatial.getWorldRotation()); |
||||||
|
debugShape.updateLogicalState(0); |
||||||
|
debugShape.updateGeometricState(); |
||||||
|
rm.renderScene(debugShape, vp); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setPhysicsSpace(PhysicsSpace space) { |
||||||
|
if (space == null) { |
||||||
|
if (this.space != null) { |
||||||
|
this.space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (this.space == space) { |
||||||
|
return; |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} |
||||||
|
this.space = space; |
||||||
|
} |
||||||
|
|
||||||
|
public PhysicsSpace getPhysicsSpace() { |
||||||
|
return space; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
super.write(ex); |
||||||
|
OutputCapsule oc = ex.getCapsule(this); |
||||||
|
oc.write(enabled, "enabled", true); |
||||||
|
oc.write(applyLocal, "applyLocalPhysics", false); |
||||||
|
oc.write(spatial, "spatial", null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
super.read(im); |
||||||
|
InputCapsule ic = im.getCapsule(this); |
||||||
|
enabled = ic.readBoolean("enabled", true); |
||||||
|
spatial = (Spatial) ic.readSavable("spatial", null); |
||||||
|
applyLocal = ic.readBoolean("applyLocalPhysics", false); |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,873 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.control.ragdoll.RagdollPreset; |
||||||
|
import com.jme3.bullet.control.ragdoll.HumanoidRagdollPreset; |
||||||
|
import com.jme3.animation.AnimControl; |
||||||
|
import com.jme3.animation.Bone; |
||||||
|
import com.jme3.animation.Skeleton; |
||||||
|
import com.jme3.animation.SkeletonControl; |
||||||
|
import com.jme3.asset.AssetManager; |
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.bullet.collision.PhysicsCollisionEvent; |
||||||
|
import com.jme3.bullet.collision.PhysicsCollisionListener; |
||||||
|
import com.jme3.bullet.collision.PhysicsCollisionObject; |
||||||
|
import com.jme3.bullet.collision.RagdollCollisionListener; |
||||||
|
import com.jme3.bullet.collision.shapes.BoxCollisionShape; |
||||||
|
import com.jme3.bullet.collision.shapes.HullCollisionShape; |
||||||
|
import com.jme3.bullet.control.ragdoll.RagdollUtils; |
||||||
|
import com.jme3.bullet.joints.SixDofJoint; |
||||||
|
import com.jme3.bullet.objects.PhysicsRigidBody; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.renderer.RenderManager; |
||||||
|
import com.jme3.renderer.ViewPort; |
||||||
|
import com.jme3.scene.Node; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
import com.jme3.util.TempVars; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Iterator; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.TreeSet; |
||||||
|
import java.util.logging.Level; |
||||||
|
import java.util.logging.Logger; |
||||||
|
|
||||||
|
/**<strong>This control is still a WIP, use it at your own risk</strong><br> |
||||||
|
* To use this control you need a model with an AnimControl and a SkeletonControl.<br> |
||||||
|
* This should be the case if you imported an animated model from Ogre or blender.<br> |
||||||
|
* Note enabling/disabling the control add/removes it from the physic space<br> |
||||||
|
* <p> |
||||||
|
* This control creates collision shapes for each bones of the skeleton when you call spatial.addControl(ragdollControl). |
||||||
|
* <ul> |
||||||
|
* <li>The shape is HullCollision shape based on the vertices associated with each bone and based on a tweakable weight threshold (see setWeightThreshold)</li> |
||||||
|
* <li>If you don't want each bone to be a collision shape, you can specify what bone to use by using the addBoneName method<br> |
||||||
|
* By using this method, bone that are not used to create a shape, are "merged" to their parent to create the collision shape. |
||||||
|
* </li> |
||||||
|
* </ul> |
||||||
|
*</p> |
||||||
|
*<p> |
||||||
|
*There are 2 modes for this control : |
||||||
|
* <ul> |
||||||
|
* <li><strong>The kinematic modes :</strong><br> |
||||||
|
* this is the default behavior, this means that the collision shapes of the body are able to interact with physics enabled objects. |
||||||
|
* in this mode physic shapes follow the moovements of the animated skeleton (for example animated by a key framed animation) |
||||||
|
* this mode is enabled by calling setKinematicMode(); |
||||||
|
* </li> |
||||||
|
* <li><strong>The ragdoll modes :</strong><br> |
||||||
|
* To enable this behavior, you need to call setRagdollMode() method. |
||||||
|
* In this mode the charater is entirely controled by physics, so it will fall under the gravity and move if any force is applied to it. |
||||||
|
* </li> |
||||||
|
* </ul> |
||||||
|
*</p> |
||||||
|
* |
||||||
|
* @author Normen Hansen and Rémy Bouquet (Nehon) |
||||||
|
*/ |
||||||
|
public class KinematicRagdollControl implements PhysicsControl, PhysicsCollisionListener { |
||||||
|
|
||||||
|
protected static final Logger logger = Logger.getLogger(KinematicRagdollControl.class.getName()); |
||||||
|
protected Map<String, PhysicsBoneLink> boneLinks = new HashMap<String, PhysicsBoneLink>(); |
||||||
|
protected Skeleton skeleton; |
||||||
|
protected PhysicsSpace space; |
||||||
|
protected boolean enabled = true; |
||||||
|
protected boolean debug = false; |
||||||
|
protected PhysicsRigidBody baseRigidBody; |
||||||
|
protected float weightThreshold = -1.0f; |
||||||
|
protected Spatial targetModel; |
||||||
|
protected Vector3f initScale; |
||||||
|
protected Mode mode = Mode.Kinetmatic; |
||||||
|
protected boolean blendedControl = false; |
||||||
|
protected float blendTime = 1.0f; |
||||||
|
protected float blendStart = 0.0f; |
||||||
|
protected List<RagdollCollisionListener> listeners; |
||||||
|
protected float eventDispatchImpulseThreshold = 10; |
||||||
|
protected RagdollPreset preset = new HumanoidRagdollPreset(); |
||||||
|
protected Set<String> boneList = new TreeSet<String>(); |
||||||
|
protected Vector3f modelPosition = new Vector3f(); |
||||||
|
protected Quaternion modelRotation = new Quaternion(); |
||||||
|
protected float rootMass = 15; |
||||||
|
protected float totalMass = 0; |
||||||
|
protected boolean added = false; |
||||||
|
|
||||||
|
public static enum Mode { |
||||||
|
|
||||||
|
Kinetmatic, |
||||||
|
Ragdoll |
||||||
|
} |
||||||
|
|
||||||
|
protected class PhysicsBoneLink { |
||||||
|
|
||||||
|
protected Bone bone; |
||||||
|
protected Quaternion initalWorldRotation; |
||||||
|
protected SixDofJoint joint; |
||||||
|
protected PhysicsRigidBody rigidBody; |
||||||
|
protected Quaternion startBlendingRot = new Quaternion(); |
||||||
|
protected Vector3f startBlendingPos = new Vector3f(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* contruct a KinematicRagdollControl |
||||||
|
*/ |
||||||
|
public KinematicRagdollControl() { |
||||||
|
} |
||||||
|
|
||||||
|
public KinematicRagdollControl(float weightThreshold) { |
||||||
|
this.weightThreshold = weightThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
public KinematicRagdollControl(RagdollPreset preset, float weightThreshold) { |
||||||
|
this.preset = preset; |
||||||
|
this.weightThreshold = weightThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
public KinematicRagdollControl(RagdollPreset preset) { |
||||||
|
this.preset = preset; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(float tpf) { |
||||||
|
if (!enabled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
TempVars vars = TempVars.get(); |
||||||
|
|
||||||
|
Quaternion tmpRot1 = vars.quat1; |
||||||
|
Quaternion tmpRot2 = vars.quat2; |
||||||
|
|
||||||
|
//if the ragdoll has the control of the skeleton, we update each bone with its position in physic world space.
|
||||||
|
if (mode == mode.Ragdoll && targetModel.getLocalTranslation().equals(modelPosition)) { |
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
|
||||||
|
Vector3f position = vars.vect1; |
||||||
|
|
||||||
|
//retrieving bone position in physic world space
|
||||||
|
Vector3f p = link.rigidBody.getMotionState().getWorldLocation(); |
||||||
|
//transforming this position with inverse transforms of the model
|
||||||
|
targetModel.getWorldTransform().transformInverseVector(p, position); |
||||||
|
|
||||||
|
//retrieving bone rotation in physic world space
|
||||||
|
Quaternion q = link.rigidBody.getMotionState().getWorldRotationQuat(); |
||||||
|
|
||||||
|
//multiplying this rotation by the initialWorld rotation of the bone,
|
||||||
|
//then transforming it with the inverse world rotation of the model
|
||||||
|
tmpRot1.set(q).multLocal(link.initalWorldRotation); |
||||||
|
tmpRot2.set(targetModel.getWorldRotation()).inverseLocal().mult(tmpRot1, tmpRot1); |
||||||
|
tmpRot1.normalizeLocal(); |
||||||
|
|
||||||
|
//if the bone is the root bone, we apply the physic's transform to the model, so its position and rotation are correctly updated
|
||||||
|
if (link.bone.getParent() == null) { |
||||||
|
|
||||||
|
//offsetting the physic's position/rotation by the root bone inverse model space position/rotaion
|
||||||
|
modelPosition.set(p).subtractLocal(link.bone.getWorldBindPosition()); |
||||||
|
targetModel.getParent().getWorldTransform().transformInverseVector(modelPosition, modelPosition); |
||||||
|
modelRotation.set(q).multLocal(tmpRot2.set(link.bone.getWorldBindRotation()).inverseLocal()); |
||||||
|
|
||||||
|
|
||||||
|
//applying transforms to the model
|
||||||
|
targetModel.setLocalTranslation(modelPosition); |
||||||
|
|
||||||
|
targetModel.setLocalRotation(modelRotation); |
||||||
|
|
||||||
|
//Applying computed transforms to the bone
|
||||||
|
link.bone.setUserTransformsWorld(position, tmpRot1); |
||||||
|
|
||||||
|
} else { |
||||||
|
//if boneList is empty, this means that every bone in the ragdoll has a collision shape,
|
||||||
|
//so we just update the bone position
|
||||||
|
if (boneList.isEmpty()) { |
||||||
|
link.bone.setUserTransformsWorld(position, tmpRot1); |
||||||
|
} else { |
||||||
|
//boneList is not empty, this means some bones of the skeleton might not be associated with a collision shape.
|
||||||
|
//So we update them recusively
|
||||||
|
RagdollUtils.setTransform(link.bone, position, tmpRot1, false, boneList); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} else { |
||||||
|
//the ragdoll does not have the controll, so the keyframed animation updates the physic position of the physic bonces
|
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
|
||||||
|
Vector3f position = vars.vect1; |
||||||
|
|
||||||
|
//if blended control this means, keyframed animation is updating the skeleton,
|
||||||
|
//but to allow smooth transition, we blend this transformation with the saved position of the ragdoll
|
||||||
|
if (blendedControl) { |
||||||
|
Vector3f position2 = vars.vect2; |
||||||
|
//initializing tmp vars with the start position/rotation of the ragdoll
|
||||||
|
position.set(link.startBlendingPos); |
||||||
|
tmpRot1.set(link.startBlendingRot); |
||||||
|
|
||||||
|
//interpolating between ragdoll position/rotation and keyframed position/rotation
|
||||||
|
tmpRot2.set(tmpRot1).nlerp(link.bone.getModelSpaceRotation(), blendStart / blendTime); |
||||||
|
position2.set(position).interpolate(link.bone.getModelSpacePosition(), blendStart / blendTime); |
||||||
|
tmpRot1.set(tmpRot2); |
||||||
|
position.set(position2); |
||||||
|
|
||||||
|
//updating bones transforms
|
||||||
|
if (boneList.isEmpty()) { |
||||||
|
//we ensure we have the control to update the bone
|
||||||
|
link.bone.setUserControl(true); |
||||||
|
link.bone.setUserTransformsWorld(position, tmpRot1); |
||||||
|
//we give control back to the key framed animation.
|
||||||
|
link.bone.setUserControl(false); |
||||||
|
} else { |
||||||
|
RagdollUtils.setTransform(link.bone, position, tmpRot1, true, boneList); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
//setting skeleton transforms to the ragdoll
|
||||||
|
matchPhysicObjectToBone(link, position, tmpRot1); |
||||||
|
modelPosition.set(targetModel.getLocalTranslation()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//time control for blending
|
||||||
|
if (blendedControl) { |
||||||
|
blendStart += tpf; |
||||||
|
if (blendStart > blendTime) { |
||||||
|
blendedControl = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
vars.release(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the transforms of a rigidBody to match the transforms of a bone. |
||||||
|
* this is used to make the ragdoll follow the skeleton motion while in Kinematic mode |
||||||
|
* @param link the link containing the bone and the rigidBody |
||||||
|
* @param position just a temp vector for position |
||||||
|
* @param tmpRot1 just a temp quaternion for rotation |
||||||
|
*/ |
||||||
|
private void matchPhysicObjectToBone(PhysicsBoneLink link, Vector3f position, Quaternion tmpRot1) { |
||||||
|
//computing position from rotation and scale
|
||||||
|
targetModel.getWorldTransform().transformVector(link.bone.getModelSpacePosition(), position); |
||||||
|
|
||||||
|
//computing rotation
|
||||||
|
tmpRot1.set(link.bone.getModelSpaceRotation()).multLocal(link.bone.getWorldBindInverseRotation()); |
||||||
|
targetModel.getWorldRotation().mult(tmpRot1, tmpRot1); |
||||||
|
tmpRot1.normalizeLocal(); |
||||||
|
|
||||||
|
//updating physic location/rotation of the physic bone
|
||||||
|
link.rigidBody.setPhysicsLocation(position); |
||||||
|
link.rigidBody.setPhysicsRotation(tmpRot1); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public Control cloneForSpatial(Spatial spatial) { |
||||||
|
throw new UnsupportedOperationException("Not supported yet."); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* rebuild the ragdoll |
||||||
|
* this is useful if you applied scale on the ragdoll after it's been initialized |
||||||
|
*/ |
||||||
|
public void reBuild() { |
||||||
|
setSpatial(targetModel); |
||||||
|
addToPhysicsSpace(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpatial(Spatial model) { |
||||||
|
if (model == null) { |
||||||
|
removeFromPhysicsSpace(); |
||||||
|
clearData(); |
||||||
|
return; |
||||||
|
} |
||||||
|
targetModel = model; |
||||||
|
Node parent = model.getParent(); |
||||||
|
|
||||||
|
|
||||||
|
Vector3f initPosition = model.getLocalTranslation().clone(); |
||||||
|
Quaternion initRotation = model.getLocalRotation().clone(); |
||||||
|
initScale = model.getLocalScale().clone(); |
||||||
|
|
||||||
|
model.removeFromParent(); |
||||||
|
model.setLocalTranslation(Vector3f.ZERO); |
||||||
|
model.setLocalRotation(Quaternion.IDENTITY); |
||||||
|
model.setLocalScale(1); |
||||||
|
//HACK ALERT change this
|
||||||
|
//I remove the skeletonControl and readd it to the spatial to make sure it's after the ragdollControl in the stack
|
||||||
|
//Find a proper way to order the controls.
|
||||||
|
SkeletonControl sc = model.getControl(SkeletonControl.class); |
||||||
|
model.removeControl(sc); |
||||||
|
model.addControl(sc); |
||||||
|
//----
|
||||||
|
|
||||||
|
removeFromPhysicsSpace(); |
||||||
|
clearData(); |
||||||
|
// put into bind pose and compute bone transforms in model space
|
||||||
|
// maybe dont reset to ragdoll out of animations?
|
||||||
|
scanSpatial(model); |
||||||
|
|
||||||
|
|
||||||
|
if (parent != null) { |
||||||
|
parent.attachChild(model); |
||||||
|
|
||||||
|
} |
||||||
|
model.setLocalTranslation(initPosition); |
||||||
|
model.setLocalRotation(initRotation); |
||||||
|
model.setLocalScale(initScale); |
||||||
|
|
||||||
|
logger.log(Level.INFO, "Created physics ragdoll for skeleton {0}", skeleton); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Add a bone name to this control |
||||||
|
* Using this method you can specify which bones of the skeleton will be used to build the collision shapes. |
||||||
|
* @param name |
||||||
|
*/ |
||||||
|
public void addBoneName(String name) { |
||||||
|
boneList.add(name); |
||||||
|
} |
||||||
|
|
||||||
|
private void scanSpatial(Spatial model) { |
||||||
|
AnimControl animControl = model.getControl(AnimControl.class); |
||||||
|
Map<Integer, List<Float>> pointsMap = null; |
||||||
|
if (weightThreshold == -1.0f) { |
||||||
|
pointsMap = RagdollUtils.buildPointMap(model); |
||||||
|
} |
||||||
|
|
||||||
|
skeleton = animControl.getSkeleton(); |
||||||
|
skeleton.resetAndUpdate(); |
||||||
|
for (int i = 0; i < skeleton.getRoots().length; i++) { |
||||||
|
Bone childBone = skeleton.getRoots()[i]; |
||||||
|
if (childBone.getParent() == null) { |
||||||
|
logger.log(Level.INFO, "Found root bone in skeleton {0}", skeleton); |
||||||
|
baseRigidBody = new PhysicsRigidBody(new BoxCollisionShape(Vector3f.UNIT_XYZ.mult(0.1f)), 1); |
||||||
|
baseRigidBody.setKinematic(mode == Mode.Kinetmatic); |
||||||
|
boneRecursion(model, childBone, baseRigidBody, 1, pointsMap); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void boneRecursion(Spatial model, Bone bone, PhysicsRigidBody parent, int reccount, Map<Integer, List<Float>> pointsMap) { |
||||||
|
PhysicsRigidBody parentShape = parent; |
||||||
|
if (boneList.isEmpty() || boneList.contains(bone.getName())) { |
||||||
|
|
||||||
|
PhysicsBoneLink link = new PhysicsBoneLink(); |
||||||
|
link.bone = bone; |
||||||
|
|
||||||
|
//creating the collision shape
|
||||||
|
HullCollisionShape shape = null; |
||||||
|
if (pointsMap != null) { |
||||||
|
//build a shape for the bone, using the vertices that are most influenced by this bone
|
||||||
|
shape = RagdollUtils.makeShapeFromPointMap(pointsMap, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition()); |
||||||
|
} else { |
||||||
|
//build a shape for the bone, using the vertices associated with this bone with a weight above the threshold
|
||||||
|
shape = RagdollUtils.makeShapeFromVerticeWeights(model, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition(), weightThreshold); |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / (float) reccount); |
||||||
|
|
||||||
|
shapeNode.setKinematic(mode == Mode.Kinetmatic); |
||||||
|
totalMass += rootMass / (float) reccount; |
||||||
|
|
||||||
|
link.rigidBody = shapeNode; |
||||||
|
link.initalWorldRotation = bone.getModelSpaceRotation().clone(); |
||||||
|
|
||||||
|
if (parent != null) { |
||||||
|
//get joint position for parent
|
||||||
|
Vector3f posToParent = new Vector3f(); |
||||||
|
if (bone.getParent() != null) { |
||||||
|
bone.getModelSpacePosition().subtract(bone.getParent().getModelSpacePosition(), posToParent).multLocal(initScale); |
||||||
|
} |
||||||
|
|
||||||
|
SixDofJoint joint = new SixDofJoint(parent, shapeNode, posToParent, new Vector3f(0, 0, 0f), true); |
||||||
|
preset.setupJointForBone(bone.getName(), joint); |
||||||
|
|
||||||
|
link.joint = joint; |
||||||
|
joint.setCollisionBetweenLinkedBodys(false); |
||||||
|
} |
||||||
|
boneLinks.put(bone.getName(), link); |
||||||
|
shapeNode.setUserObject(link); |
||||||
|
parentShape = shapeNode; |
||||||
|
} |
||||||
|
|
||||||
|
for (Iterator<Bone> it = bone.getChildren().iterator(); it.hasNext();) { |
||||||
|
Bone childBone = it.next(); |
||||||
|
boneRecursion(model, childBone, parentShape, reccount + 1, pointsMap); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the joint limits for the joint between the given bone and its parent. |
||||||
|
* This method can't work before attaching the control to a spatial |
||||||
|
* @param boneName the name of the bone |
||||||
|
* @param maxX the maximum rotation on the x axis (in radians) |
||||||
|
* @param minX the minimum rotation on the x axis (in radians) |
||||||
|
* @param maxY the maximum rotation on the y axis (in radians) |
||||||
|
* @param minY the minimum rotation on the z axis (in radians) |
||||||
|
* @param maxZ the maximum rotation on the z axis (in radians) |
||||||
|
* @param minZ the minimum rotation on the z axis (in radians) |
||||||
|
*/ |
||||||
|
public void setJointLimit(String boneName, float maxX, float minX, float maxY, float minY, float maxZ, float minZ) { |
||||||
|
PhysicsBoneLink link = boneLinks.get(boneName); |
||||||
|
if (link != null) { |
||||||
|
RagdollUtils.setJointLimit(link.joint, maxX, minX, maxY, minY, maxZ, minZ); |
||||||
|
} else { |
||||||
|
logger.log(Level.WARNING, "Not joint was found for bone {0}. make sure you call spatial.addControl(ragdoll) before setting joints limit", boneName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Return the joint between the given bone and its parent. |
||||||
|
* This return null if it's called before attaching the control to a spatial |
||||||
|
* @param boneName the name of the bone |
||||||
|
* @return the joint between the given bone and its parent |
||||||
|
*/ |
||||||
|
public SixDofJoint getJoint(String boneName) { |
||||||
|
PhysicsBoneLink link = boneLinks.get(boneName); |
||||||
|
if (link != null) { |
||||||
|
return link.joint; |
||||||
|
} else { |
||||||
|
logger.log(Level.WARNING, "Not joint was found for bone {0}. make sure you call spatial.addControl(ragdoll) before setting joints limit", boneName); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void clearData() { |
||||||
|
boneLinks.clear(); |
||||||
|
baseRigidBody = null; |
||||||
|
} |
||||||
|
|
||||||
|
private void addToPhysicsSpace() { |
||||||
|
if (space == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (baseRigidBody != null) { |
||||||
|
space.add(baseRigidBody); |
||||||
|
added = true; |
||||||
|
} |
||||||
|
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) { |
||||||
|
PhysicsBoneLink physicsBoneLink = it.next(); |
||||||
|
if (physicsBoneLink.rigidBody != null) { |
||||||
|
space.add(physicsBoneLink.rigidBody); |
||||||
|
if (physicsBoneLink.joint != null) { |
||||||
|
space.add(physicsBoneLink.joint); |
||||||
|
|
||||||
|
} |
||||||
|
added = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void removeFromPhysicsSpace() { |
||||||
|
if (space == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (baseRigidBody != null) { |
||||||
|
space.remove(baseRigidBody); |
||||||
|
} |
||||||
|
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) { |
||||||
|
PhysicsBoneLink physicsBoneLink = it.next(); |
||||||
|
if (physicsBoneLink.joint != null) { |
||||||
|
space.remove(physicsBoneLink.joint); |
||||||
|
if (physicsBoneLink.rigidBody != null) { |
||||||
|
space.remove(physicsBoneLink.rigidBody); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
added = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* enable or disable the control |
||||||
|
* note that if enabled is true and that the physic space has been set on the ragdoll, the ragdoll is added to the physic space |
||||||
|
* if enabled is false the ragdoll is removed from physic space. |
||||||
|
* @param enabled |
||||||
|
*/ |
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
if (this.enabled == enabled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
this.enabled = enabled; |
||||||
|
if (!enabled && space != null) { |
||||||
|
removeFromPhysicsSpace(); |
||||||
|
} else if (enabled && space != null) { |
||||||
|
addToPhysicsSpace(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* returns true if the control is enabled |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean isEnabled() { |
||||||
|
return enabled; |
||||||
|
} |
||||||
|
|
||||||
|
protected void attachDebugShape(AssetManager manager) { |
||||||
|
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) { |
||||||
|
PhysicsBoneLink physicsBoneLink = it.next(); |
||||||
|
physicsBoneLink.rigidBody.createDebugShape(manager); |
||||||
|
} |
||||||
|
debug = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected void detachDebugShape() { |
||||||
|
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) { |
||||||
|
PhysicsBoneLink physicsBoneLink = it.next(); |
||||||
|
physicsBoneLink.rigidBody.detachDebugShape(); |
||||||
|
} |
||||||
|
debug = false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* For internal use only |
||||||
|
* specific render for the ragdoll(if debugging) |
||||||
|
* @param rm |
||||||
|
* @param vp |
||||||
|
*/ |
||||||
|
public void render(RenderManager rm, ViewPort vp) { |
||||||
|
if (enabled && space != null && space.getDebugManager() != null) { |
||||||
|
if (!debug) { |
||||||
|
attachDebugShape(space.getDebugManager()); |
||||||
|
} |
||||||
|
for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) { |
||||||
|
PhysicsBoneLink physicsBoneLink = it.next(); |
||||||
|
Spatial debugShape = physicsBoneLink.rigidBody.debugShape(); |
||||||
|
if (debugShape != null) { |
||||||
|
debugShape.setLocalTranslation(physicsBoneLink.rigidBody.getMotionState().getWorldLocation()); |
||||||
|
debugShape.setLocalRotation(physicsBoneLink.rigidBody.getMotionState().getWorldRotationQuat()); |
||||||
|
debugShape.updateGeometricState(); |
||||||
|
rm.renderScene(debugShape, vp); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* set the physic space to this ragdoll |
||||||
|
* @param space |
||||||
|
*/ |
||||||
|
public void setPhysicsSpace(PhysicsSpace space) { |
||||||
|
if (space == null) { |
||||||
|
removeFromPhysicsSpace(); |
||||||
|
this.space = space; |
||||||
|
} else { |
||||||
|
if (this.space == space) { |
||||||
|
return; |
||||||
|
} |
||||||
|
this.space = space; |
||||||
|
addToPhysicsSpace(); |
||||||
|
this.space.addCollisionListener(this); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* returns the physic space |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public PhysicsSpace getPhysicsSpace() { |
||||||
|
return space; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* serialize this control |
||||||
|
* @param ex |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
throw new UnsupportedOperationException("Not supported yet."); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* de-serialize this control |
||||||
|
* @param im |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
throw new UnsupportedOperationException("Not supported yet."); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* For internal use only |
||||||
|
* callback for collisionevent |
||||||
|
* @param event |
||||||
|
*/ |
||||||
|
public void collision(PhysicsCollisionEvent event) { |
||||||
|
PhysicsCollisionObject objA = event.getObjectA(); |
||||||
|
PhysicsCollisionObject objB = event.getObjectB(); |
||||||
|
|
||||||
|
//excluding collisions that involve 2 parts of the ragdoll
|
||||||
|
if (event.getNodeA() == null && event.getNodeB() == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
//discarding low impulse collision
|
||||||
|
if (event.getAppliedImpulse() < eventDispatchImpulseThreshold) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
boolean hit = false; |
||||||
|
Bone hitBone = null; |
||||||
|
PhysicsCollisionObject hitObject = null; |
||||||
|
|
||||||
|
//Computing which bone has been hit
|
||||||
|
if (objA.getUserObject() instanceof PhysicsBoneLink) { |
||||||
|
PhysicsBoneLink link = (PhysicsBoneLink) objA.getUserObject(); |
||||||
|
if (link != null) { |
||||||
|
hit = true; |
||||||
|
hitBone = link.bone; |
||||||
|
hitObject = objB; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (objB.getUserObject() instanceof PhysicsBoneLink) { |
||||||
|
PhysicsBoneLink link = (PhysicsBoneLink) objB.getUserObject(); |
||||||
|
if (link != null) { |
||||||
|
hit = true; |
||||||
|
hitBone = link.bone; |
||||||
|
hitObject = objA; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//dispatching the event if the ragdoll has been hit
|
||||||
|
if (hit && listeners != null) { |
||||||
|
for (RagdollCollisionListener listener : listeners) { |
||||||
|
listener.collide(hitBone, hitObject, event); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Enable or disable the ragdoll behaviour. |
||||||
|
* if ragdollEnabled is true, the character motion will only be powerd by physics |
||||||
|
* else, the characted will be animated by the keyframe animation, |
||||||
|
* but will be able to physically interact with its physic environnement |
||||||
|
* @param ragdollEnabled |
||||||
|
*/ |
||||||
|
protected void setMode(Mode mode) { |
||||||
|
this.mode = mode; |
||||||
|
AnimControl animControl = targetModel.getControl(AnimControl.class); |
||||||
|
animControl.setEnabled(mode == Mode.Kinetmatic); |
||||||
|
|
||||||
|
baseRigidBody.setKinematic(mode == Mode.Kinetmatic); |
||||||
|
TempVars vars = TempVars.get(); |
||||||
|
|
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
link.rigidBody.setKinematic(mode == Mode.Kinetmatic); |
||||||
|
if (mode == Mode.Ragdoll) { |
||||||
|
Quaternion tmpRot1 = vars.quat1; |
||||||
|
Vector3f position = vars.vect1; |
||||||
|
//making sure that the ragdoll is at the correct place.
|
||||||
|
matchPhysicObjectToBone(link, position, tmpRot1); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
vars.release(); |
||||||
|
|
||||||
|
for (Bone bone : skeleton.getRoots()) { |
||||||
|
RagdollUtils.setUserControl(bone, mode == Mode.Ragdoll); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Smoothly blend from Ragdoll mode to Kinematic mode |
||||||
|
* This is useful to blend ragdoll actual position to a keyframe animation for example |
||||||
|
* @param blendTime the blending time between ragdoll to anim. |
||||||
|
*/ |
||||||
|
public void blendToKinematicMode(float blendTime) { |
||||||
|
if (mode == Mode.Kinetmatic) { |
||||||
|
return; |
||||||
|
} |
||||||
|
blendedControl = true; |
||||||
|
this.blendTime = blendTime; |
||||||
|
mode = Mode.Kinetmatic; |
||||||
|
AnimControl animControl = targetModel.getControl(AnimControl.class); |
||||||
|
animControl.setEnabled(true); |
||||||
|
|
||||||
|
|
||||||
|
TempVars vars = TempVars.get(); |
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
|
||||||
|
Vector3f p = link.rigidBody.getMotionState().getWorldLocation(); |
||||||
|
Vector3f position = vars.vect1; |
||||||
|
|
||||||
|
targetModel.getWorldTransform().transformInverseVector(p, position); |
||||||
|
|
||||||
|
Quaternion q = link.rigidBody.getMotionState().getWorldRotationQuat(); |
||||||
|
Quaternion q2 = vars.quat1; |
||||||
|
Quaternion q3 = vars.quat2; |
||||||
|
|
||||||
|
q2.set(q).multLocal(link.initalWorldRotation).normalizeLocal(); |
||||||
|
q3.set(targetModel.getWorldRotation()).inverseLocal().mult(q2, q2); |
||||||
|
q2.normalizeLocal(); |
||||||
|
link.startBlendingPos.set(position); |
||||||
|
link.startBlendingRot.set(q2); |
||||||
|
link.rigidBody.setKinematic(true); |
||||||
|
} |
||||||
|
vars.release(); |
||||||
|
|
||||||
|
for (Bone bone : skeleton.getRoots()) { |
||||||
|
RagdollUtils.setUserControl(bone, false); |
||||||
|
} |
||||||
|
|
||||||
|
blendStart = 0; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the control into Kinematic mode |
||||||
|
* In theis mode, the collision shapes follow the movements of the skeleton, |
||||||
|
* and can interact with physical environement |
||||||
|
*/ |
||||||
|
public void setKinematicMode() { |
||||||
|
if (mode != Mode.Kinetmatic) { |
||||||
|
setMode(Mode.Kinetmatic); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Sets the control into Ragdoll mode |
||||||
|
* The skeleton is entirely controlled by physics. |
||||||
|
*/ |
||||||
|
public void setRagdollMode() { |
||||||
|
if (mode != Mode.Ragdoll) { |
||||||
|
setMode(Mode.Ragdoll); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* retruns the mode of this control |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public Mode getMode() { |
||||||
|
return mode; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* add a |
||||||
|
* @param listener |
||||||
|
*/ |
||||||
|
public void addCollisionListener(RagdollCollisionListener listener) { |
||||||
|
if (listeners == null) { |
||||||
|
listeners = new ArrayList<RagdollCollisionListener>(); |
||||||
|
} |
||||||
|
listeners.add(listener); |
||||||
|
} |
||||||
|
|
||||||
|
public void setRootMass(float rootMass) { |
||||||
|
this.rootMass = rootMass; |
||||||
|
} |
||||||
|
|
||||||
|
public float getTotalMass() { |
||||||
|
return totalMass; |
||||||
|
} |
||||||
|
|
||||||
|
public float getWeightThreshold() { |
||||||
|
return weightThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
public void setWeightThreshold(float weightThreshold) { |
||||||
|
this.weightThreshold = weightThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
public float getEventDispatchImpulseThreshold() { |
||||||
|
return eventDispatchImpulseThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
public void setEventDispatchImpulseThreshold(float eventDispatchImpulseThreshold) { |
||||||
|
this.eventDispatchImpulseThreshold = eventDispatchImpulseThreshold; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the CcdMotionThreshold of all the bone's rigidBodies of the ragdoll |
||||||
|
* @see PhysicsRigidBody#setCcdMotionThreshold(float) |
||||||
|
* @param value |
||||||
|
*/ |
||||||
|
public void setCcdMotionThreshold(float value) { |
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
link.rigidBody.setCcdMotionThreshold(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the CcdSweptSphereRadius of all the bone's rigidBodies of the ragdoll |
||||||
|
* @see PhysicsRigidBody#setCcdSweptSphereRadius(float) |
||||||
|
* @param value |
||||||
|
*/ |
||||||
|
public void setCcdSweptSphereRadius(float value) { |
||||||
|
for (PhysicsBoneLink link : boneLinks.values()) { |
||||||
|
link.rigidBody.setCcdSweptSphereRadius(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the CcdMotionThreshold of the given bone's rigidBodies of the ragdoll |
||||||
|
* @see PhysicsRigidBody#setCcdMotionThreshold(float) |
||||||
|
* @param value |
||||||
|
* @deprecated use getBoneRigidBody(String BoneName).setCcdMotionThreshold(float) instead |
||||||
|
*/ |
||||||
|
@Deprecated |
||||||
|
public void setBoneCcdMotionThreshold(String boneName, float value) { |
||||||
|
PhysicsBoneLink link = boneLinks.get(boneName); |
||||||
|
if (link != null) { |
||||||
|
link.rigidBody.setCcdMotionThreshold(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Set the CcdSweptSphereRadius of the given bone's rigidBodies of the ragdoll |
||||||
|
* @see PhysicsRigidBody#setCcdSweptSphereRadius(float) |
||||||
|
* @param value |
||||||
|
* @deprecated use getBoneRigidBody(String BoneName).setCcdSweptSphereRadius(float) instead |
||||||
|
*/ |
||||||
|
@Deprecated |
||||||
|
public void setBoneCcdSweptSphereRadius(String boneName, float value) { |
||||||
|
PhysicsBoneLink link = boneLinks.get(boneName); |
||||||
|
if (link != null) { |
||||||
|
link.rigidBody.setCcdSweptSphereRadius(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* return the rigidBody associated to the given bone |
||||||
|
* @param boneName the name of the bone |
||||||
|
* @return the associated rigidBody. |
||||||
|
*/ |
||||||
|
public PhysicsRigidBody getBoneRigidBody(String boneName) { |
||||||
|
PhysicsBoneLink link = boneLinks.get(boneName); |
||||||
|
if (link != null) { |
||||||
|
return link.rigidBody; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public interface PhysicsControl extends Control { |
||||||
|
|
||||||
|
public void setPhysicsSpace(PhysicsSpace space); |
||||||
|
|
||||||
|
public PhysicsSpace getPhysicsSpace(); |
||||||
|
|
||||||
|
/** |
||||||
|
* The physics object is removed from the physics space when the control |
||||||
|
* is disabled. When the control is enabled again the physics object is |
||||||
|
* moved to the current location of the spatial and then added to the physics |
||||||
|
* space. This allows disabling/enabling physics to move the spatial freely. |
||||||
|
* @param state |
||||||
|
*/ |
||||||
|
public void setEnabled(boolean state); |
||||||
|
} |
@ -0,0 +1,266 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.bullet.collision.shapes.BoxCollisionShape; |
||||||
|
import com.jme3.bullet.collision.shapes.CollisionShape; |
||||||
|
import com.jme3.bullet.collision.shapes.SphereCollisionShape; |
||||||
|
import com.jme3.bullet.objects.PhysicsRigidBody; |
||||||
|
import com.jme3.bullet.util.CollisionShapeFactory; |
||||||
|
import com.jme3.export.InputCapsule; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.export.OutputCapsule; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.renderer.RenderManager; |
||||||
|
import com.jme3.renderer.ViewPort; |
||||||
|
import com.jme3.scene.Geometry; |
||||||
|
import com.jme3.scene.Mesh; |
||||||
|
import com.jme3.scene.Node; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
import com.jme3.scene.shape.Box; |
||||||
|
import com.jme3.scene.shape.Sphere; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl { |
||||||
|
|
||||||
|
protected Spatial spatial; |
||||||
|
protected boolean enabled = true; |
||||||
|
protected boolean added = false; |
||||||
|
protected PhysicsSpace space = null; |
||||||
|
protected boolean kinematicSpatial = true; |
||||||
|
|
||||||
|
public RigidBodyControl() { |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* When using this constructor, the CollisionShape for the RigidBody is generated |
||||||
|
* automatically when the Control is added to a Spatial. |
||||||
|
* @param mass When not 0, a HullCollisionShape is generated, otherwise a MeshCollisionShape is used. For geometries with box or sphere meshes the proper box or sphere collision shape is used. |
||||||
|
*/ |
||||||
|
public RigidBodyControl(float mass) { |
||||||
|
this.mass = mass; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a new PhysicsNode with the supplied collision shape and mass 1 |
||||||
|
* @param child |
||||||
|
* @param shape |
||||||
|
*/ |
||||||
|
public RigidBodyControl(CollisionShape shape) { |
||||||
|
super(shape); |
||||||
|
} |
||||||
|
|
||||||
|
public RigidBodyControl(CollisionShape shape, float mass) { |
||||||
|
super(shape, mass); |
||||||
|
} |
||||||
|
|
||||||
|
public Control cloneForSpatial(Spatial spatial) { |
||||||
|
RigidBodyControl control = new RigidBodyControl(collisionShape, mass); |
||||||
|
control.setAngularFactor(getAngularFactor()); |
||||||
|
control.setAngularSleepingThreshold(getAngularSleepingThreshold()); |
||||||
|
control.setCcdMotionThreshold(getCcdMotionThreshold()); |
||||||
|
control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); |
||||||
|
control.setCollideWithGroups(getCollideWithGroups()); |
||||||
|
control.setCollisionGroup(getCollisionGroup()); |
||||||
|
control.setDamping(getLinearDamping(), getAngularDamping()); |
||||||
|
control.setFriction(getFriction()); |
||||||
|
control.setGravity(getGravity()); |
||||||
|
control.setKinematic(isKinematic()); |
||||||
|
control.setKinematicSpatial(isKinematicSpatial()); |
||||||
|
control.setLinearSleepingThreshold(getLinearSleepingThreshold()); |
||||||
|
control.setPhysicsLocation(getPhysicsLocation(null)); |
||||||
|
control.setPhysicsRotation(getPhysicsRotationMatrix(null)); |
||||||
|
control.setRestitution(getRestitution()); |
||||||
|
|
||||||
|
if (mass > 0) { |
||||||
|
control.setAngularVelocity(getAngularVelocity()); |
||||||
|
control.setLinearVelocity(getLinearVelocity()); |
||||||
|
} |
||||||
|
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); |
||||||
|
|
||||||
|
control.setSpatial(spatial); |
||||||
|
return control; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpatial(Spatial spatial) { |
||||||
|
if (getUserObject() == null || getUserObject() == this.spatial) { |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
this.spatial = spatial; |
||||||
|
if (spatial == null) { |
||||||
|
if (getUserObject() == spatial) { |
||||||
|
setUserObject(null); |
||||||
|
} |
||||||
|
spatial = null; |
||||||
|
collisionShape = null; |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionShape == null) { |
||||||
|
createCollisionShape(); |
||||||
|
rebuildRigidBody(); |
||||||
|
} |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
|
||||||
|
protected void createCollisionShape() { |
||||||
|
if (spatial == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (spatial instanceof Geometry) { |
||||||
|
Geometry geom = (Geometry) spatial; |
||||||
|
Mesh mesh = geom.getMesh(); |
||||||
|
if (mesh instanceof Sphere) { |
||||||
|
collisionShape = new SphereCollisionShape(((Sphere) mesh).getRadius()); |
||||||
|
return; |
||||||
|
} else if (mesh instanceof Box) { |
||||||
|
collisionShape = new BoxCollisionShape(new Vector3f(((Box) mesh).getXExtent(), ((Box) mesh).getYExtent(), ((Box) mesh).getZExtent())); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
if (mass > 0) { |
||||||
|
collisionShape = CollisionShapeFactory.createDynamicMeshShape(spatial); |
||||||
|
} else { |
||||||
|
collisionShape = CollisionShapeFactory.createMeshShape(spatial); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
this.enabled = enabled; |
||||||
|
if (space != null) { |
||||||
|
if (enabled && !added) { |
||||||
|
if (spatial != null) { |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} else if (!enabled && added) { |
||||||
|
space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEnabled() { |
||||||
|
return enabled; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Checks if this control is in kinematic spatial mode. |
||||||
|
* @return true if the spatial location is applied to this kinematic rigidbody |
||||||
|
*/ |
||||||
|
public boolean isKinematicSpatial() { |
||||||
|
return kinematicSpatial; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Sets this control to kinematic spatial mode so that the spatials transform will |
||||||
|
* be applied to the rigidbody in kinematic mode, defaults to true. |
||||||
|
* @param kinematicSpatial |
||||||
|
*/ |
||||||
|
public void setKinematicSpatial(boolean kinematicSpatial) { |
||||||
|
this.kinematicSpatial = kinematicSpatial; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isApplyPhysicsLocal() { |
||||||
|
return motionState.isApplyPhysicsLocal(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* When set to true, the physics coordinates will be applied to the local |
||||||
|
* translation of the Spatial instead of the world traslation. |
||||||
|
* @param applyPhysicsLocal |
||||||
|
*/ |
||||||
|
public void setApplyPhysicsLocal(boolean applyPhysicsLocal) { |
||||||
|
motionState.setApplyPhysicsLocal(applyPhysicsLocal); |
||||||
|
} |
||||||
|
|
||||||
|
private Vector3f getSpatialTranslation(){ |
||||||
|
if(motionState.isApplyPhysicsLocal()){ |
||||||
|
return spatial.getLocalTranslation(); |
||||||
|
} |
||||||
|
return spatial.getWorldTranslation(); |
||||||
|
} |
||||||
|
|
||||||
|
private Quaternion getSpatialRotation(){ |
||||||
|
if(motionState.isApplyPhysicsLocal()){ |
||||||
|
return spatial.getLocalRotation(); |
||||||
|
} |
||||||
|
return spatial.getWorldRotation(); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(float tpf) { |
||||||
|
if (enabled && spatial != null) { |
||||||
|
if (isKinematic() && kinematicSpatial) { |
||||||
|
super.setPhysicsLocation(getSpatialTranslation()); |
||||||
|
super.setPhysicsRotation(getSpatialRotation()); |
||||||
|
} else { |
||||||
|
getMotionState().applyTransform(spatial); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void render(RenderManager rm, ViewPort vp) { |
||||||
|
if (enabled && space != null && space.getDebugManager() != null) { |
||||||
|
if (debugShape == null) { |
||||||
|
attachDebugShape(space.getDebugManager()); |
||||||
|
} |
||||||
|
//TODO: using spatial traslation/rotation..
|
||||||
|
debugShape.setLocalTranslation(spatial.getWorldTranslation()); |
||||||
|
debugShape.setLocalRotation(spatial.getWorldRotation()); |
||||||
|
debugShape.updateLogicalState(0); |
||||||
|
debugShape.updateGeometricState(); |
||||||
|
rm.renderScene(debugShape, vp); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setPhysicsSpace(PhysicsSpace space) { |
||||||
|
if (space == null) { |
||||||
|
if (this.space != null) { |
||||||
|
this.space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if(this.space==space) return; |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} |
||||||
|
this.space = space; |
||||||
|
} |
||||||
|
|
||||||
|
public PhysicsSpace getPhysicsSpace() { |
||||||
|
return space; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
super.write(ex); |
||||||
|
OutputCapsule oc = ex.getCapsule(this); |
||||||
|
oc.write(enabled, "enabled", true); |
||||||
|
oc.write(motionState.isApplyPhysicsLocal(), "applyLocalPhysics", false); |
||||||
|
oc.write(kinematicSpatial, "kinematicSpatial", true); |
||||||
|
oc.write(spatial, "spatial", null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
super.read(im); |
||||||
|
InputCapsule ic = im.getCapsule(this); |
||||||
|
enabled = ic.readBoolean("enabled", true); |
||||||
|
kinematicSpatial = ic.readBoolean("kinematicSpatial", true); |
||||||
|
spatial = (Spatial) ic.readSavable("spatial", null); |
||||||
|
motionState.setApplyPhysicsLocal(ic.readBoolean("applyLocalPhysics", false)); |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,270 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control; |
||||||
|
|
||||||
|
import com.jme3.bullet.PhysicsSpace; |
||||||
|
import com.jme3.bullet.collision.shapes.CollisionShape; |
||||||
|
import com.jme3.bullet.joints.PhysicsJoint; |
||||||
|
import com.jme3.bullet.objects.PhysicsVehicle; |
||||||
|
import com.jme3.bullet.objects.VehicleWheel; |
||||||
|
import com.jme3.export.InputCapsule; |
||||||
|
import com.jme3.export.JmeExporter; |
||||||
|
import com.jme3.export.JmeImporter; |
||||||
|
import com.jme3.export.OutputCapsule; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.renderer.RenderManager; |
||||||
|
import com.jme3.renderer.ViewPort; |
||||||
|
import com.jme3.scene.Geometry; |
||||||
|
import com.jme3.scene.Node; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.control.Control; |
||||||
|
import com.jme3.scene.debug.Arrow; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.Iterator; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author normenhansen |
||||||
|
*/ |
||||||
|
public class VehicleControl extends PhysicsVehicle implements PhysicsControl { |
||||||
|
|
||||||
|
protected Spatial spatial; |
||||||
|
protected boolean enabled = true; |
||||||
|
protected PhysicsSpace space = null; |
||||||
|
protected boolean added = false; |
||||||
|
|
||||||
|
public VehicleControl() { |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Creates a new PhysicsNode with the supplied collision shape |
||||||
|
* @param child |
||||||
|
* @param shape |
||||||
|
*/ |
||||||
|
public VehicleControl(CollisionShape shape) { |
||||||
|
super(shape); |
||||||
|
} |
||||||
|
|
||||||
|
public VehicleControl(CollisionShape shape, float mass) { |
||||||
|
super(shape, mass); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isApplyPhysicsLocal() { |
||||||
|
return motionState.isApplyPhysicsLocal(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* When set to true, the physics coordinates will be applied to the local |
||||||
|
* translation of the Spatial |
||||||
|
* @param applyPhysicsLocal |
||||||
|
*/ |
||||||
|
public void setApplyPhysicsLocal(boolean applyPhysicsLocal) { |
||||||
|
motionState.setApplyPhysicsLocal(applyPhysicsLocal); |
||||||
|
for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { |
||||||
|
VehicleWheel vehicleWheel = it.next(); |
||||||
|
vehicleWheel.setApplyLocal(applyPhysicsLocal); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private Vector3f getSpatialTranslation(){ |
||||||
|
if(motionState.isApplyPhysicsLocal()){ |
||||||
|
return spatial.getLocalTranslation(); |
||||||
|
} |
||||||
|
return spatial.getWorldTranslation(); |
||||||
|
} |
||||||
|
|
||||||
|
private Quaternion getSpatialRotation(){ |
||||||
|
if(motionState.isApplyPhysicsLocal()){ |
||||||
|
return spatial.getLocalRotation(); |
||||||
|
} |
||||||
|
return spatial.getWorldRotation(); |
||||||
|
} |
||||||
|
|
||||||
|
public Control cloneForSpatial(Spatial spatial) { |
||||||
|
VehicleControl control = new VehicleControl(collisionShape, mass); |
||||||
|
control.setAngularFactor(getAngularFactor()); |
||||||
|
control.setAngularSleepingThreshold(getAngularSleepingThreshold()); |
||||||
|
control.setAngularVelocity(getAngularVelocity()); |
||||||
|
control.setCcdMotionThreshold(getCcdMotionThreshold()); |
||||||
|
control.setCcdSweptSphereRadius(getCcdSweptSphereRadius()); |
||||||
|
control.setCollideWithGroups(getCollideWithGroups()); |
||||||
|
control.setCollisionGroup(getCollisionGroup()); |
||||||
|
control.setDamping(getLinearDamping(), getAngularDamping()); |
||||||
|
control.setFriction(getFriction()); |
||||||
|
control.setGravity(getGravity()); |
||||||
|
control.setKinematic(isKinematic()); |
||||||
|
control.setLinearSleepingThreshold(getLinearSleepingThreshold()); |
||||||
|
control.setLinearVelocity(getLinearVelocity()); |
||||||
|
control.setPhysicsLocation(getPhysicsLocation()); |
||||||
|
control.setPhysicsRotation(getPhysicsRotationMatrix()); |
||||||
|
control.setRestitution(getRestitution()); |
||||||
|
|
||||||
|
control.setFrictionSlip(getFrictionSlip()); |
||||||
|
control.setMaxSuspensionTravelCm(getMaxSuspensionTravelCm()); |
||||||
|
control.setSuspensionStiffness(getSuspensionStiffness()); |
||||||
|
control.setSuspensionCompression(tuning.suspensionCompression); |
||||||
|
control.setSuspensionDamping(tuning.suspensionDamping); |
||||||
|
control.setMaxSuspensionForce(getMaxSuspensionForce()); |
||||||
|
|
||||||
|
for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { |
||||||
|
VehicleWheel wheel = it.next(); |
||||||
|
VehicleWheel newWheel = control.addWheel(wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), wheel.isFrontWheel()); |
||||||
|
newWheel.setFrictionSlip(wheel.getFrictionSlip()); |
||||||
|
newWheel.setMaxSuspensionTravelCm(wheel.getMaxSuspensionTravelCm()); |
||||||
|
newWheel.setSuspensionStiffness(wheel.getSuspensionStiffness()); |
||||||
|
newWheel.setWheelsDampingCompression(wheel.getWheelsDampingCompression()); |
||||||
|
newWheel.setWheelsDampingRelaxation(wheel.getWheelsDampingRelaxation()); |
||||||
|
newWheel.setMaxSuspensionForce(wheel.getMaxSuspensionForce()); |
||||||
|
|
||||||
|
//TODO: bad way finding children!
|
||||||
|
if (spatial instanceof Node) { |
||||||
|
Node node = (Node) spatial; |
||||||
|
Spatial wheelSpat = node.getChild(wheel.getWheelSpatial().getName()); |
||||||
|
if (wheelSpat != null) { |
||||||
|
newWheel.setWheelSpatial(wheelSpat); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
control.setApplyPhysicsLocal(isApplyPhysicsLocal()); |
||||||
|
|
||||||
|
control.setSpatial(spatial); |
||||||
|
return control; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSpatial(Spatial spatial) { |
||||||
|
if (getUserObject() == null || getUserObject() == this.spatial) { |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
this.spatial = spatial; |
||||||
|
if (spatial == null) { |
||||||
|
if (getUserObject() == spatial) { |
||||||
|
setUserObject(null); |
||||||
|
} |
||||||
|
this.spatial = null; |
||||||
|
this.collisionShape = null; |
||||||
|
return; |
||||||
|
} |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setEnabled(boolean enabled) { |
||||||
|
this.enabled = enabled; |
||||||
|
if (space != null) { |
||||||
|
if (enabled && !added) { |
||||||
|
if(spatial!=null){ |
||||||
|
setPhysicsLocation(getSpatialTranslation()); |
||||||
|
setPhysicsRotation(getSpatialRotation()); |
||||||
|
} |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} else if (!enabled && added) { |
||||||
|
space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEnabled() { |
||||||
|
return enabled; |
||||||
|
} |
||||||
|
|
||||||
|
public void update(float tpf) { |
||||||
|
if (enabled && spatial != null) { |
||||||
|
if (getMotionState().applyTransform(spatial)) { |
||||||
|
spatial.getWorldTransform(); |
||||||
|
applyWheelTransforms(); |
||||||
|
} |
||||||
|
} else if (enabled) { |
||||||
|
applyWheelTransforms(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Spatial getDebugShape() { |
||||||
|
return super.getDebugShape(); |
||||||
|
} |
||||||
|
|
||||||
|
public void render(RenderManager rm, ViewPort vp) { |
||||||
|
if (enabled && space != null && space.getDebugManager() != null) { |
||||||
|
if (debugShape == null) { |
||||||
|
attachDebugShape(space.getDebugManager()); |
||||||
|
} |
||||||
|
Node debugNode = (Node) debugShape; |
||||||
|
debugShape.setLocalTranslation(spatial.getWorldTranslation()); |
||||||
|
debugShape.setLocalRotation(spatial.getWorldRotation()); |
||||||
|
int i = 0; |
||||||
|
for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) { |
||||||
|
VehicleWheel physicsVehicleWheel = it.next(); |
||||||
|
Vector3f location = physicsVehicleWheel.getLocation().clone(); |
||||||
|
Vector3f direction = physicsVehicleWheel.getDirection().clone(); |
||||||
|
Vector3f axle = physicsVehicleWheel.getAxle().clone(); |
||||||
|
float restLength = physicsVehicleWheel.getRestLength(); |
||||||
|
float radius = physicsVehicleWheel.getRadius(); |
||||||
|
|
||||||
|
Geometry locGeom = (Geometry) debugNode.getChild("WheelLocationDebugShape" + i); |
||||||
|
Geometry dirGeom = (Geometry) debugNode.getChild("WheelDirectionDebugShape" + i); |
||||||
|
Geometry axleGeom = (Geometry) debugNode.getChild("WheelAxleDebugShape" + i); |
||||||
|
Geometry wheelGeom = (Geometry) debugNode.getChild("WheelRadiusDebugShape" + i); |
||||||
|
|
||||||
|
Arrow locArrow = (Arrow) locGeom.getMesh(); |
||||||
|
locArrow.setArrowExtent(location); |
||||||
|
Arrow axleArrow = (Arrow) axleGeom.getMesh(); |
||||||
|
axleArrow.setArrowExtent(axle.normalizeLocal().multLocal(0.3f)); |
||||||
|
Arrow wheelArrow = (Arrow) wheelGeom.getMesh(); |
||||||
|
wheelArrow.setArrowExtent(direction.normalizeLocal().multLocal(radius)); |
||||||
|
Arrow dirArrow = (Arrow) dirGeom.getMesh(); |
||||||
|
dirArrow.setArrowExtent(direction.normalizeLocal().multLocal(restLength)); |
||||||
|
|
||||||
|
dirGeom.setLocalTranslation(location); |
||||||
|
axleGeom.setLocalTranslation(location.addLocal(direction)); |
||||||
|
wheelGeom.setLocalTranslation(location); |
||||||
|
i++; |
||||||
|
} |
||||||
|
debugShape.updateLogicalState(0); |
||||||
|
debugShape.updateGeometricState(); |
||||||
|
rm.renderScene(debugShape, vp); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void setPhysicsSpace(PhysicsSpace space) { |
||||||
|
createVehicle(space); |
||||||
|
if (space == null) { |
||||||
|
if (this.space != null) { |
||||||
|
this.space.removeCollisionObject(this); |
||||||
|
added = false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if(this.space==space) return; |
||||||
|
space.addCollisionObject(this); |
||||||
|
added = true; |
||||||
|
} |
||||||
|
this.space = space; |
||||||
|
} |
||||||
|
|
||||||
|
public PhysicsSpace getPhysicsSpace() { |
||||||
|
return space; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void write(JmeExporter ex) throws IOException { |
||||||
|
super.write(ex); |
||||||
|
OutputCapsule oc = ex.getCapsule(this); |
||||||
|
oc.write(enabled, "enabled", true); |
||||||
|
oc.write(motionState.isApplyPhysicsLocal(), "applyLocalPhysics", false); |
||||||
|
oc.write(spatial, "spatial", null); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void read(JmeImporter im) throws IOException { |
||||||
|
super.read(im); |
||||||
|
InputCapsule ic = im.getCapsule(this); |
||||||
|
enabled = ic.readBoolean("enabled", true); |
||||||
|
spatial = (Spatial) ic.readSavable("spatial", null); |
||||||
|
motionState.setApplyPhysicsLocal(ic.readBoolean("applyLocalPhysics", false)); |
||||||
|
setUserObject(spatial); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,99 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control.ragdoll; |
||||||
|
|
||||||
|
import com.jme3.math.FastMath; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author Nehon |
||||||
|
*/ |
||||||
|
public class HumanoidRagdollPreset extends RagdollPreset { |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initBoneMap() { |
||||||
|
boneMap.put("head", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
boneMap.put("torso", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.QUARTER_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
boneMap.put("upperleg", new JointPreset(FastMath.PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI/2, -FastMath.QUARTER_PI/2, FastMath.QUARTER_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
boneMap.put("lowerleg", new JointPreset(0, -FastMath.PI, 0, 0, 0, 0)); |
||||||
|
|
||||||
|
boneMap.put("foot", new JointPreset(0, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
boneMap.put("upperarm", new JointPreset(FastMath.HALF_PI, -FastMath.QUARTER_PI, 0, 0, FastMath.HALF_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
boneMap.put("lowerarm", new JointPreset(FastMath.HALF_PI, 0, 0, 0, 0, 0)); |
||||||
|
|
||||||
|
boneMap.put("hand", new JointPreset(FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI, FastMath.QUARTER_PI, -FastMath.QUARTER_PI)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initLexicon() { |
||||||
|
LexiconEntry entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("head", 100); |
||||||
|
lexicon.put("head", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("torso", 100); |
||||||
|
entry.addSynonym("chest", 100); |
||||||
|
entry.addSynonym("spine", 45); |
||||||
|
entry.addSynonym("high", 25); |
||||||
|
lexicon.put("torso", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("upperleg", 100); |
||||||
|
entry.addSynonym("thigh", 100); |
||||||
|
entry.addSynonym("hip", 75); |
||||||
|
entry.addSynonym("leg", 40); |
||||||
|
entry.addSynonym("high", 10); |
||||||
|
entry.addSynonym("up", 15); |
||||||
|
entry.addSynonym("upper", 15); |
||||||
|
lexicon.put("upperleg", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("lowerleg", 100); |
||||||
|
entry.addSynonym("calf", 100); |
||||||
|
entry.addSynonym("knee", 75); |
||||||
|
entry.addSynonym("leg", 50); |
||||||
|
entry.addSynonym("low", 10); |
||||||
|
entry.addSynonym("lower", 10); |
||||||
|
lexicon.put("lowerleg", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("foot", 100); |
||||||
|
entry.addSynonym("ankle", 75); |
||||||
|
lexicon.put("foot", entry); |
||||||
|
|
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("upperarm", 100); |
||||||
|
entry.addSynonym("humerus", 100); |
||||||
|
entry.addSynonym("shoulder", 50); |
||||||
|
entry.addSynonym("arm", 40); |
||||||
|
entry.addSynonym("high", 10); |
||||||
|
entry.addSynonym("up", 15); |
||||||
|
entry.addSynonym("upper", 15); |
||||||
|
lexicon.put("upperarm", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("lowerarm", 100); |
||||||
|
entry.addSynonym("ulna", 100); |
||||||
|
entry.addSynonym("elbow", 75); |
||||||
|
entry.addSynonym("arm", 50); |
||||||
|
entry.addSynonym("low", 10); |
||||||
|
entry.addSynonym("lower", 10); |
||||||
|
lexicon.put("lowerarm", entry); |
||||||
|
|
||||||
|
entry = new LexiconEntry(); |
||||||
|
entry.addSynonym("hand", 100); |
||||||
|
entry.addSynonym("fist", 100); |
||||||
|
entry.addSynonym("wrist", 75); |
||||||
|
lexicon.put("hand", entry); |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control.ragdoll; |
||||||
|
|
||||||
|
import com.jme3.bullet.joints.SixDofJoint; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.logging.Level; |
||||||
|
import java.util.logging.Logger; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author Nehon |
||||||
|
*/ |
||||||
|
public abstract class RagdollPreset { |
||||||
|
|
||||||
|
protected static final Logger logger = Logger.getLogger(RagdollPreset.class.getName()); |
||||||
|
protected Map<String, JointPreset> boneMap = new HashMap<String, JointPreset>(); |
||||||
|
protected Map<String, LexiconEntry> lexicon = new HashMap<String, LexiconEntry>(); |
||||||
|
|
||||||
|
protected abstract void initBoneMap(); |
||||||
|
|
||||||
|
protected abstract void initLexicon(); |
||||||
|
|
||||||
|
public void setupJointForBone(String boneName, SixDofJoint joint) { |
||||||
|
|
||||||
|
if (boneMap.isEmpty()) { |
||||||
|
initBoneMap(); |
||||||
|
} |
||||||
|
if (lexicon.isEmpty()) { |
||||||
|
initLexicon(); |
||||||
|
} |
||||||
|
String resultName = ""; |
||||||
|
int resultScore = 0; |
||||||
|
|
||||||
|
for (String key : lexicon.keySet()) { |
||||||
|
|
||||||
|
int score = lexicon.get(key).getScore(boneName); |
||||||
|
if (score > resultScore) { |
||||||
|
resultScore = score; |
||||||
|
resultName = key; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
JointPreset preset = boneMap.get(resultName); |
||||||
|
|
||||||
|
if (preset != null && resultScore >= 50) { |
||||||
|
logger.log(Level.INFO, "Found matching joint for bone {0} : {1} with score {2}", new Object[]{boneName, resultName, resultScore}); |
||||||
|
preset.setupJoint(joint); |
||||||
|
} else { |
||||||
|
logger.log(Level.INFO, "No joint match found for bone {0}", boneName); |
||||||
|
if (resultScore > 0) { |
||||||
|
logger.log(Level.INFO, "Best match found is {0} with score {1}", new Object[]{resultName, resultScore}); |
||||||
|
} |
||||||
|
new JointPreset().setupJoint(joint); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected class JointPreset { |
||||||
|
|
||||||
|
private float maxX, minX, maxY, minY, maxZ, minZ; |
||||||
|
|
||||||
|
public JointPreset() { |
||||||
|
} |
||||||
|
|
||||||
|
public JointPreset(float maxX, float minX, float maxY, float minY, float maxZ, float minZ) { |
||||||
|
this.maxX = maxX; |
||||||
|
this.minX = minX; |
||||||
|
this.maxY = maxY; |
||||||
|
this.minY = minY; |
||||||
|
this.maxZ = maxZ; |
||||||
|
this.minZ = minZ; |
||||||
|
} |
||||||
|
|
||||||
|
public void setupJoint(SixDofJoint joint) { |
||||||
|
joint.getRotationalLimitMotor(0).setHiLimit(maxX); |
||||||
|
joint.getRotationalLimitMotor(0).setLoLimit(minX); |
||||||
|
joint.getRotationalLimitMotor(1).setHiLimit(maxY); |
||||||
|
joint.getRotationalLimitMotor(1).setLoLimit(minY); |
||||||
|
joint.getRotationalLimitMotor(2).setHiLimit(maxZ); |
||||||
|
joint.getRotationalLimitMotor(2).setLoLimit(minZ); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected class LexiconEntry extends HashMap<String, Integer> { |
||||||
|
|
||||||
|
public void addSynonym(String word, int score) { |
||||||
|
put(word.toLowerCase(), score); |
||||||
|
} |
||||||
|
|
||||||
|
public int getScore(String word) { |
||||||
|
int score = 0; |
||||||
|
String searchWord = word.toLowerCase(); |
||||||
|
for (String key : this.keySet()) { |
||||||
|
if (searchWord.indexOf(key) >= 0) { |
||||||
|
score += get(key); |
||||||
|
} |
||||||
|
} |
||||||
|
return score; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,273 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
package com.jme3.bullet.control.ragdoll; |
||||||
|
|
||||||
|
import com.jme3.animation.Bone; |
||||||
|
import com.jme3.animation.Skeleton; |
||||||
|
import com.jme3.bullet.collision.shapes.HullCollisionShape; |
||||||
|
import com.jme3.bullet.joints.SixDofJoint; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Transform; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.scene.Geometry; |
||||||
|
import com.jme3.scene.Mesh; |
||||||
|
import com.jme3.scene.Node; |
||||||
|
import com.jme3.scene.Spatial; |
||||||
|
import com.jme3.scene.VertexBuffer.Type; |
||||||
|
import java.nio.ByteBuffer; |
||||||
|
import java.nio.FloatBuffer; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.LinkedList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author Nehon |
||||||
|
*/ |
||||||
|
public class RagdollUtils { |
||||||
|
|
||||||
|
public static void setJointLimit(SixDofJoint joint, float maxX, float minX, float maxY, float minY, float maxZ, float minZ) { |
||||||
|
|
||||||
|
joint.getRotationalLimitMotor(0).setHiLimit(maxX); |
||||||
|
joint.getRotationalLimitMotor(0).setLoLimit(minX); |
||||||
|
joint.getRotationalLimitMotor(1).setHiLimit(maxY); |
||||||
|
joint.getRotationalLimitMotor(1).setLoLimit(minY); |
||||||
|
joint.getRotationalLimitMotor(2).setHiLimit(maxZ); |
||||||
|
joint.getRotationalLimitMotor(2).setLoLimit(minZ); |
||||||
|
} |
||||||
|
|
||||||
|
public static Map<Integer, List<Float>> buildPointMap(Spatial model) { |
||||||
|
|
||||||
|
|
||||||
|
Map<Integer, List<Float>> map = new HashMap<Integer, List<Float>>(); |
||||||
|
if (model instanceof Geometry) { |
||||||
|
Geometry g = (Geometry) model; |
||||||
|
buildPointMapForMesh(g.getMesh(), map); |
||||||
|
} else if (model instanceof Node) { |
||||||
|
Node node = (Node) model; |
||||||
|
for (Spatial s : node.getChildren()) { |
||||||
|
if (s instanceof Geometry) { |
||||||
|
Geometry g = (Geometry) s; |
||||||
|
buildPointMapForMesh(g.getMesh(), map); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return map; |
||||||
|
} |
||||||
|
|
||||||
|
private static Map<Integer, List<Float>> buildPointMapForMesh(Mesh mesh, Map<Integer, List<Float>> map) { |
||||||
|
|
||||||
|
FloatBuffer vertices = mesh.getFloatBuffer(Type.Position); |
||||||
|
ByteBuffer boneIndices = (ByteBuffer) mesh.getBuffer(Type.BoneIndex).getData(); |
||||||
|
FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData(); |
||||||
|
|
||||||
|
vertices.rewind(); |
||||||
|
boneIndices.rewind(); |
||||||
|
boneWeight.rewind(); |
||||||
|
|
||||||
|
int vertexComponents = mesh.getVertexCount() * 3; |
||||||
|
int k, start, index; |
||||||
|
float maxWeight = 0; |
||||||
|
|
||||||
|
for (int i = 0; i < vertexComponents; i += 3) { |
||||||
|
|
||||||
|
|
||||||
|
start = i / 3 * 4; |
||||||
|
index = 0; |
||||||
|
maxWeight = -1; |
||||||
|
for (k = start; k < start + 4; k++) { |
||||||
|
float weight = boneWeight.get(k); |
||||||
|
if (weight > maxWeight) { |
||||||
|
maxWeight = weight; |
||||||
|
index = boneIndices.get(k); |
||||||
|
} |
||||||
|
} |
||||||
|
List<Float> points = map.get(index); |
||||||
|
if (points == null) { |
||||||
|
points = new ArrayList<Float>(); |
||||||
|
map.put(index, points); |
||||||
|
} |
||||||
|
points.add(vertices.get(i)); |
||||||
|
points.add(vertices.get(i + 1)); |
||||||
|
points.add(vertices.get(i + 2)); |
||||||
|
} |
||||||
|
return map; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Create a hull collision shape from linked vertices to this bone. |
||||||
|
* Vertices have to be previoulsly gathered in a map using buildPointMap method |
||||||
|
* @param link |
||||||
|
* @param model |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static HullCollisionShape makeShapeFromPointMap(Map<Integer, List<Float>> pointsMap, List<Integer> boneIndices, Vector3f initialScale, Vector3f initialPosition) { |
||||||
|
|
||||||
|
ArrayList<Float> points = new ArrayList<Float>(); |
||||||
|
for (Integer index : boneIndices) { |
||||||
|
List<Float> l = pointsMap.get(index); |
||||||
|
if (l != null) { |
||||||
|
|
||||||
|
for (int i = 0; i < l.size(); i += 3) { |
||||||
|
Vector3f pos = new Vector3f(); |
||||||
|
pos.x = l.get(i); |
||||||
|
pos.y = l.get(i + 1); |
||||||
|
pos.z = l.get(i + 2); |
||||||
|
pos.subtractLocal(initialPosition).multLocal(initialScale); |
||||||
|
points.add(pos.x); |
||||||
|
points.add(pos.y); |
||||||
|
points.add(pos.z); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
float[] p = new float[points.size()]; |
||||||
|
for (int i = 0; i < points.size(); i++) { |
||||||
|
p[i] = points.get(i); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return new HullCollisionShape(p); |
||||||
|
} |
||||||
|
|
||||||
|
//retruns the list of bone indices of the given bone and its child(if they are not in the boneList)
|
||||||
|
public static List<Integer> getBoneIndices(Bone bone, Skeleton skeleton, Set<String> boneList) { |
||||||
|
List<Integer> list = new LinkedList<Integer>(); |
||||||
|
if (boneList.isEmpty()) { |
||||||
|
list.add(skeleton.getBoneIndex(bone)); |
||||||
|
} else { |
||||||
|
list.add(skeleton.getBoneIndex(bone)); |
||||||
|
for (Bone chilBone : bone.getChildren()) { |
||||||
|
if (!boneList.contains(chilBone.getName())) { |
||||||
|
list.addAll(getBoneIndices(chilBone, skeleton, boneList)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Create a hull collision shape from linked vertices to this bone. |
||||||
|
* |
||||||
|
* @param link |
||||||
|
* @param model |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static HullCollisionShape makeShapeFromVerticeWeights(Spatial model, List<Integer> boneIndices, Vector3f initialScale, Vector3f initialPosition, float weightThreshold) { |
||||||
|
|
||||||
|
ArrayList<Float> points = new ArrayList<Float>(); |
||||||
|
if (model instanceof Geometry) { |
||||||
|
Geometry g = (Geometry) model; |
||||||
|
for (Integer index : boneIndices) { |
||||||
|
points.addAll(getPoints(g.getMesh(), index, initialScale, initialPosition, weightThreshold)); |
||||||
|
} |
||||||
|
} else if (model instanceof Node) { |
||||||
|
Node node = (Node) model; |
||||||
|
for (Spatial s : node.getChildren()) { |
||||||
|
if (s instanceof Geometry) { |
||||||
|
Geometry g = (Geometry) s; |
||||||
|
for (Integer index : boneIndices) { |
||||||
|
points.addAll(getPoints(g.getMesh(), index, initialScale, initialPosition, weightThreshold)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
float[] p = new float[points.size()]; |
||||||
|
for (int i = 0; i < points.size(); i++) { |
||||||
|
p[i] = points.get(i); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return new HullCollisionShape(p); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* returns a list of points for the given bone |
||||||
|
* @param mesh |
||||||
|
* @param boneIndex |
||||||
|
* @param offset |
||||||
|
* @param link |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private static List<Float> getPoints(Mesh mesh, int boneIndex, Vector3f initialScale, Vector3f offset, float weightThreshold) { |
||||||
|
|
||||||
|
FloatBuffer vertices = mesh.getFloatBuffer(Type.Position); |
||||||
|
ByteBuffer boneIndices = (ByteBuffer) mesh.getBuffer(Type.BoneIndex).getData(); |
||||||
|
FloatBuffer boneWeight = (FloatBuffer) mesh.getBuffer(Type.BoneWeight).getData(); |
||||||
|
|
||||||
|
vertices.rewind(); |
||||||
|
boneIndices.rewind(); |
||||||
|
boneWeight.rewind(); |
||||||
|
|
||||||
|
ArrayList<Float> results = new ArrayList<Float>(); |
||||||
|
|
||||||
|
int vertexComponents = mesh.getVertexCount() * 3; |
||||||
|
|
||||||
|
for (int i = 0; i < vertexComponents; i += 3) { |
||||||
|
int k; |
||||||
|
boolean add = false; |
||||||
|
int start = i / 3 * 4; |
||||||
|
for (k = start; k < start + 4; k++) { |
||||||
|
if (boneIndices.get(k) == boneIndex && boneWeight.get(k) >= weightThreshold) { |
||||||
|
add = true; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
if (add) { |
||||||
|
|
||||||
|
Vector3f pos = new Vector3f(); |
||||||
|
pos.x = vertices.get(i); |
||||||
|
pos.y = vertices.get(i + 1); |
||||||
|
pos.z = vertices.get(i + 2); |
||||||
|
pos.subtractLocal(offset).multLocal(initialScale); |
||||||
|
results.add(pos.x); |
||||||
|
results.add(pos.y); |
||||||
|
results.add(pos.z); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return results; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Updates a bone position and rotation. |
||||||
|
* if the child bones are not in the bone list this means, they are not associated with a physic shape. |
||||||
|
* So they have to be updated |
||||||
|
* @param bone the bone |
||||||
|
* @param pos the position |
||||||
|
* @param rot the rotation |
||||||
|
*/ |
||||||
|
public static void setTransform(Bone bone, Vector3f pos, Quaternion rot, boolean restoreBoneControl, Set<String> boneList) { |
||||||
|
//we ensure that we have the control
|
||||||
|
if (restoreBoneControl) { |
||||||
|
bone.setUserControl(true); |
||||||
|
} |
||||||
|
//we set te user transforms of the bone
|
||||||
|
bone.setUserTransformsWorld(pos, rot); |
||||||
|
for (Bone childBone : bone.getChildren()) { |
||||||
|
//each child bone that is not in the list is updated
|
||||||
|
if (!boneList.contains(childBone.getName())) { |
||||||
|
Transform t = childBone.getCombinedTransform(pos, rot); |
||||||
|
setTransform(childBone, t.getTranslation(), t.getRotation(), restoreBoneControl, boneList); |
||||||
|
} |
||||||
|
} |
||||||
|
//we give back the control to the keyframed animation
|
||||||
|
if (restoreBoneControl) { |
||||||
|
bone.setUserControl(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void setUserControl(Bone bone, boolean bool) { |
||||||
|
bone.setUserControl(bool); |
||||||
|
for (Bone child : bone.getChildren()) { |
||||||
|
setUserControl(child, bool); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,259 @@ |
|||||||
|
# /*
|
||||||
|
# Bullet Continuous Collision Detection and Physics Library for Android NDK
|
||||||
|
# Copyright (c) 2006-2009 Noritsuna Imamura <a href="http://www.siprop.org/" rel="nofollow">http://www.siprop.org/</a>
|
||||||
|
#
|
||||||
|
# This software is provided 'as-is', without any express or implied warranty.
|
||||||
|
# In no event will the authors be held liable for any damages arising from the use of this software.
|
||||||
|
# Permission is granted to anyone to use this software for any purpose,
|
||||||
|
# including commercial applications, and to alter it and redistribute it freely,
|
||||||
|
# subject to the following restrictions:
|
||||||
|
#
|
||||||
|
# 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
|
||||||
|
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||||
|
# 3. This notice may not be removed or altered from any source distribution.
|
||||||
|
# */
|
||||||
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
JME3_PATH:=
|
||||||
|
BULLET_PATH:=
|
||||||
|
|
||||||
|
include $(CLEAR_VARS) |
||||||
|
|
||||||
|
LOCAL_MODULE := bulletjme
|
||||||
|
LOCAL_C_INCLUDES := $(BULLET_PATH)/\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Vehicle\
|
||||||
|
$(BULLET_PATH)/LinearMath\
|
||||||
|
$(BULLET_PATH)/BulletCollision\
|
||||||
|
$(BULLET_PATH)/BulletDynamics\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody\
|
||||||
|
$(BULLET_PATH)/ibmsdk\
|
||||||
|
$(BULLET_PATH)/LinearMath\
|
||||||
|
$(BULLET_PATH)/MiniCL\
|
||||||
|
$(BULLET_PATH)/vectormath\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact\
|
||||||
|
$(BULLET_PATH)/BulletCollision/ibmsdk\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Character\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ibmsdk\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Vehicle\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/out\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTask\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/CPU\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/DX11\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/DX11/HLSL\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/AMD\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/Apple\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/NVidia\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/OpenCLC10\
|
||||||
|
$(BULLET_PATH)/LinearMath/ibmsdk\
|
||||||
|
$(BULLET_PATH)/MiniCL/MiniCLTask\
|
||||||
|
$(BULLET_PATH)/vectormath/scalar\
|
||||||
|
$(BULLET_PATH)/vectormath/sse
|
||||||
|
|
||||||
|
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%)
|
||||||
|
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -lm -llog
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(JME3_PATH)/com_jme3_bullet_collision_PhysicsCollisionEvent.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_PhysicsCollisionObject.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_BoxCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CapsuleCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CompoundCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_ConeCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_CylinderCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_GImpactCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_HullCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_MeshCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_PlaneCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_SimplexCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_collision_shapes_SphereCollisionShape.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_ConeJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_HingeJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_motors_RotationalLimitMotor.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_motors_TranslationalLimitMotor.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_PhysicsJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_Point2PointJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_SixDofJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_SixDofSpringJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_joints_SliderJoint.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_infos_RigidBodyMotionState.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsCharacter.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsGhostObject.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsRigidBody.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_PhysicsVehicle.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_objects_VehicleWheel.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_PhysicsSpace.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_util_DebugShapeFactory.cpp\
|
||||||
|
$(JME3_PATH)/com_jme3_bullet_util_NativeMeshUtil.cpp\
|
||||||
|
$(JME3_PATH)/jmeBulletUtil.cpp\
|
||||||
|
$(JME3_PATH)/jmeClasses.cpp\
|
||||||
|
$(JME3_PATH)/jmeMotionState.cpp\
|
||||||
|
$(JME3_PATH)/jmePhysicsSpace.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btAxisSweep3.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDbvt.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btDispatcher.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionObject.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCollisionWorld.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btGhostObject.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btManifoldResult.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/btUnionFind.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBox2dShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBoxShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCapsuleShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCollisionShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCompoundShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConcaveShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConeShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvex2dShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexHullShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexInternalShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btCylinderShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btEmptyShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btMultiSphereShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btOptimizedBvh.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btShapeHull.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btSphereShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btStaticPlaneShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTetrahedronShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleBuffer.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleCallback.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleMesh.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btTriangleMeshShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/CollisionShapes/btUniformScalingShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btContactProcessing.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btGenericPoolAllocator.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactBvh.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btGImpactShape.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/btTriangleShapeEx.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/gim_box_set.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/gim_contact.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/gim_memory.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/Gimpact/gim_tri_collision.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btConvexCast.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp\
|
||||||
|
$(BULLET_PATH)/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Character/btKinematicCharacterController.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btContactConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics/btRigidBody.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Dynamics/Bullet-C-API.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Vehicle/btRaycastVehicle.cpp\
|
||||||
|
$(BULLET_PATH)/BulletDynamics/Vehicle/btWheelInfo.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/btGpu3DGridBroadphase.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/btParallelConstraintSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/btThreadSupportInterface.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/PosixThreadSupport.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SequentialThreadSupport.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuCollisionObjectWrapper.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuCollisionTaskProcess.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuFakeDma.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuLibspe2Support.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTaskProcess.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/Win32ThreadSupport.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/CPU/btSoftBodySolver_CPU.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/GpuSoftBodySolvers/OpenCL/MiniCL/MiniCLTaskWrap.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/boxBoxDistance.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletMultiThreaded/SpuSampleTask/SpuSampleTask.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btDefaultSoftBodySolver.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftBody.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftBodyHelpers.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftRigidDynamicsWorld.cpp\
|
||||||
|
$(BULLET_PATH)/BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btAlignedAllocator.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btConvexHull.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btConvexHullComputer.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btGeometryUtil.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btQuickprof.cpp\
|
||||||
|
$(BULLET_PATH)/LinearMath/btSerializer.cpp\
|
||||||
|
$(BULLET_PATH)/MiniCL/MiniCL.cpp\
|
||||||
|
$(BULLET_PATH)/MiniCL/MiniCLTaskScheduler.cpp\
|
||||||
|
$(BULLET_PATH)/MiniCL/MiniCLTask/MiniCLTask.cpp
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY) |
@ -0,0 +1,2 @@ |
|||||||
|
APP_MODULES := bulletjme
|
||||||
|
APP_ABI := all
|
@ -0,0 +1,273 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
#include "jmePhysicsSpace.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include <stdio.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
jmePhysicsSpace::jmePhysicsSpace(JNIEnv* env, jobject javaSpace) { |
||||||
|
//TODO: global ref? maybe not -> cleaning, rather callback class?
|
||||||
|
this->javaPhysicsSpace = env->NewWeakGlobalRef(javaSpace); |
||||||
|
this->env = env; |
||||||
|
env->GetJavaVM(&vm); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmePhysicsSpace::attachThread() { |
||||||
|
#ifdef JNI_VERSION_1_2 |
||||||
|
vm->AttachCurrentThread((JNIEnv**) &env, NULL); |
||||||
|
#else |
||||||
|
vm->AttachCurrentThread(&env, NULL); |
||||||
|
#endif |
||||||
|
} |
||||||
|
|
||||||
|
JNIEnv* jmePhysicsSpace::getEnv() { |
||||||
|
attachThread(); |
||||||
|
return this->env; |
||||||
|
} |
||||||
|
|
||||||
|
void jmePhysicsSpace::stepSimulation(jfloat tpf, jint maxSteps, jfloat accuracy) { |
||||||
|
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy); |
||||||
|
} |
||||||
|
|
||||||
|
btThreadSupportInterface* jmePhysicsSpace::createSolverThreadSupport(int maxNumThreads) { |
||||||
|
#ifdef _WIN32 |
||||||
|
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", SolverThreadFunc, SolverlsMemoryFunc, maxNumThreads); |
||||||
|
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#elif defined (USE_PTHREADS) |
||||||
|
PosixThreadSupport::ThreadConstructionInfo constructionInfo("collision", SolverThreadFunc, |
||||||
|
SolverlsMemoryFunc, maxNumThreads); |
||||||
|
PosixThreadSupport* threadSupport = new PosixThreadSupport(constructionInfo); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#else |
||||||
|
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", SolverThreadFunc, SolverlsMemoryFunc); |
||||||
|
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#endif |
||||||
|
return threadSupport; |
||||||
|
} |
||||||
|
|
||||||
|
btThreadSupportInterface* jmePhysicsSpace::createDispatchThreadSupport(int maxNumThreads) { |
||||||
|
#ifdef _WIN32 |
||||||
|
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", processCollisionTask, createCollisionLocalStoreMemory, maxNumThreads); |
||||||
|
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#elif defined (USE_PTHREADS) |
||||||
|
PosixThreadSupport::ThreadConstructionInfo solverConstructionInfo("solver", processCollisionTask, |
||||||
|
createCollisionLocalStoreMemory, maxNumThreads); |
||||||
|
PosixThreadSupport* threadSupport = new PosixThreadSupport(solverConstructionInfo); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#else |
||||||
|
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", processCollisionTask, createCollisionLocalStoreMemory); |
||||||
|
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci); |
||||||
|
threadSupport->startSPU(); |
||||||
|
#endif |
||||||
|
return threadSupport; |
||||||
|
} |
||||||
|
|
||||||
|
void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphaseId, jboolean threading) { |
||||||
|
// collision configuration contains default setup for memory, collision setup
|
||||||
|
btDefaultCollisionConstructionInfo cci; |
||||||
|
// if(threading){
|
||||||
|
// cci.m_defaultMaxPersistentManifoldPoolSize = 32768;
|
||||||
|
// }
|
||||||
|
btCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration(cci); |
||||||
|
|
||||||
|
btVector3 min = btVector3(minX, minY, minZ); |
||||||
|
btVector3 max = btVector3(maxX, maxY, maxZ); |
||||||
|
|
||||||
|
btBroadphaseInterface* broadphase; |
||||||
|
|
||||||
|
switch (broadphaseId) { |
||||||
|
case 0: |
||||||
|
broadphase = new btSimpleBroadphase(); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
broadphase = new btAxisSweep3(min, max); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
//TODO: 32bit!
|
||||||
|
broadphase = new btAxisSweep3(min, max); |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
broadphase = new btDbvtBroadphase(); |
||||||
|
break; |
||||||
|
case 4: |
||||||
|
// broadphase = new btGpu3DGridBroadphase(
|
||||||
|
// min, max,
|
||||||
|
// 20, 20, 20,
|
||||||
|
// 10000, 1000, 25);
|
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
btCollisionDispatcher* dispatcher; |
||||||
|
btConstraintSolver* solver; |
||||||
|
// use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
|
||||||
|
if (threading) { |
||||||
|
btThreadSupportInterface* dispatchThreads = createDispatchThreadSupport(4); |
||||||
|
dispatcher = new SpuGatheringCollisionDispatcher(dispatchThreads, 4, collisionConfiguration); |
||||||
|
dispatcher->setDispatcherFlags(btCollisionDispatcher::CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION); |
||||||
|
} else { |
||||||
|
dispatcher = new btCollisionDispatcher(collisionConfiguration); |
||||||
|
} |
||||||
|
|
||||||
|
// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
|
||||||
|
if (threading) { |
||||||
|
btThreadSupportInterface* solverThreads = createSolverThreadSupport(4); |
||||||
|
solver = new btParallelConstraintSolver(solverThreads); |
||||||
|
} else { |
||||||
|
solver = new btSequentialImpulseConstraintSolver; |
||||||
|
} |
||||||
|
|
||||||
|
//create dynamics world
|
||||||
|
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration); |
||||||
|
dynamicsWorld = world; |
||||||
|
dynamicsWorld->setWorldUserInfo(this); |
||||||
|
|
||||||
|
//parallel solver requires the contacts to be in a contiguous pool, so avoid dynamic allocation
|
||||||
|
if (threading) { |
||||||
|
world->getSimulationIslandManager()->setSplitIslands(false); |
||||||
|
world->getSolverInfo().m_numIterations = 4; |
||||||
|
world->getSolverInfo().m_solverMode = SOLVER_SIMD + SOLVER_USE_WARMSTARTING; //+SOLVER_RANDMIZE_ORDER;
|
||||||
|
world->getDispatchInfo().m_enableSPU = true; |
||||||
|
} |
||||||
|
|
||||||
|
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback()); |
||||||
|
|
||||||
|
dynamicsWorld->setGravity(btVector3(0, -9.81f, 0)); |
||||||
|
|
||||||
|
struct jmeFilterCallback : public btOverlapFilterCallback { |
||||||
|
// return true when pairs need collision
|
||||||
|
|
||||||
|
virtual bool needBroadphaseCollision(btBroadphaseProxy* proxy0, btBroadphaseProxy * proxy1) const { |
||||||
|
// bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0;
|
||||||
|
// collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask);
|
||||||
|
bool collides = (proxy0->m_collisionFilterGroup & proxy1->m_collisionFilterMask) != 0; |
||||||
|
collides = collides && (proxy1->m_collisionFilterGroup & proxy0->m_collisionFilterMask); |
||||||
|
if (collides) { |
||||||
|
btCollisionObject* co0 = (btCollisionObject*) proxy0->m_clientObject; |
||||||
|
btCollisionObject* co1 = (btCollisionObject*) proxy1->m_clientObject; |
||||||
|
jmeUserPointer *up0 = (jmeUserPointer*) co0 -> getUserPointer(); |
||||||
|
jmeUserPointer *up1 = (jmeUserPointer*) co1 -> getUserPointer(); |
||||||
|
if (up0 != NULL && up1 != NULL) { |
||||||
|
collides = (up0->group & up1->groups) != 0; |
||||||
|
collides = collides && (up1->group & up0->groups); |
||||||
|
|
||||||
|
//add some additional logic here that modified 'collides'
|
||||||
|
return collides; |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
return collides; |
||||||
|
} |
||||||
|
}; |
||||||
|
dynamicsWorld->getPairCache()->setOverlapFilterCallback(new jmeFilterCallback()); |
||||||
|
dynamicsWorld->setInternalTickCallback(&jmePhysicsSpace::preTickCallback, static_cast<void *> (this), true); |
||||||
|
dynamicsWorld->setInternalTickCallback(&jmePhysicsSpace::postTickCallback, static_cast<void *> (this)); |
||||||
|
if (gContactProcessedCallback == NULL) { |
||||||
|
gContactProcessedCallback = &jmePhysicsSpace::contactProcessedCallback; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmePhysicsSpace::preTickCallback(btDynamicsWorld *world, btScalar timeStep) { |
||||||
|
jmePhysicsSpace* dynamicsWorld = (jmePhysicsSpace*) world->getWorldUserInfo(); |
||||||
|
JNIEnv* env = dynamicsWorld->getEnv(); |
||||||
|
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace()); |
||||||
|
if (javaPhysicsSpace != NULL) { |
||||||
|
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_preTick, timeStep); |
||||||
|
env->DeleteLocalRef(javaPhysicsSpace); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmePhysicsSpace::postTickCallback(btDynamicsWorld *world, btScalar timeStep) { |
||||||
|
jmePhysicsSpace* dynamicsWorld = (jmePhysicsSpace*) world->getWorldUserInfo(); |
||||||
|
JNIEnv* env = dynamicsWorld->getEnv(); |
||||||
|
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace()); |
||||||
|
if (javaPhysicsSpace != NULL) { |
||||||
|
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_postTick, timeStep); |
||||||
|
env->DeleteLocalRef(javaPhysicsSpace); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
bool jmePhysicsSpace::contactProcessedCallback(btManifoldPoint &cp, void *body0, void *body1) { |
||||||
|
// printf("contactProcessedCallback %d %dn", body0, body1);
|
||||||
|
btCollisionObject* co0 = (btCollisionObject*) body0; |
||||||
|
jmeUserPointer *up0 = (jmeUserPointer*) co0 -> getUserPointer(); |
||||||
|
btCollisionObject* co1 = (btCollisionObject*) body1; |
||||||
|
jmeUserPointer *up1 = (jmeUserPointer*) co1 -> getUserPointer(); |
||||||
|
if (up0 != NULL) { |
||||||
|
jmePhysicsSpace *dynamicsWorld = (jmePhysicsSpace *)up0->space; |
||||||
|
if (dynamicsWorld != NULL) { |
||||||
|
JNIEnv* env = dynamicsWorld->getEnv(); |
||||||
|
jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace()); |
||||||
|
if (javaPhysicsSpace != NULL) { |
||||||
|
jobject javaCollisionObject0 = env->NewLocalRef(up0->javaCollisionObject); |
||||||
|
jobject javaCollisionObject1 = env->NewLocalRef(up1->javaCollisionObject); |
||||||
|
env->CallVoidMethod(javaPhysicsSpace, jmeClasses::PhysicsSpace_addCollisionEvent, javaCollisionObject0, javaCollisionObject1, (jlong) & cp); |
||||||
|
env->DeleteLocalRef(javaPhysicsSpace); |
||||||
|
env->DeleteLocalRef(javaCollisionObject0); |
||||||
|
env->DeleteLocalRef(javaCollisionObject1); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
btDynamicsWorld* jmePhysicsSpace::getDynamicsWorld() { |
||||||
|
return dynamicsWorld; |
||||||
|
} |
||||||
|
|
||||||
|
jobject jmePhysicsSpace::getJavaPhysicsSpace() { |
||||||
|
return javaPhysicsSpace; |
||||||
|
} |
||||||
|
|
||||||
|
jmePhysicsSpace::~jmePhysicsSpace() { |
||||||
|
delete(dynamicsWorld); |
||||||
|
} |
@ -0,0 +1,450 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_PhysicsSpace.h" |
||||||
|
#include "jmePhysicsSpace.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: createPhysicsSpace |
||||||
|
* Signature: (FFFFFFI)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_PhysicsSpace_createPhysicsSpace |
||||||
|
(JNIEnv * env, jobject object, jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphase, jboolean threading) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
jmePhysicsSpace* space = new jmePhysicsSpace(env, object); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space has not been created."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
space->createPhysicsSpace(minX, minY, minZ, maxX, maxY, maxZ, broadphase, threading); |
||||||
|
return reinterpret_cast<jlong>(space); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: stepSimulation |
||||||
|
* Signature: (JFIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_stepSimulation |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jfloat tpf, jint maxSteps, jfloat accuracy) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->stepSimulation(tpf, maxSteps, accuracy); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addCollisionObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addCollisionObject |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = space; |
||||||
|
|
||||||
|
space->getDynamicsWorld()->addCollisionObject(collisionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeCollisionObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeCollisionObject |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->removeCollisionObject(collisionObject); |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = NULL; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addRigidBody |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addRigidBody |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong rigidBodyId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btRigidBody* collisionObject = reinterpret_cast<btRigidBody*>(rigidBodyId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = space; |
||||||
|
space->getDynamicsWorld()->addRigidBody(collisionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeRigidBody |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeRigidBody |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong rigidBodyId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btRigidBody* collisionObject = reinterpret_cast<btRigidBody*>(rigidBodyId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = NULL; |
||||||
|
space->getDynamicsWorld()->removeRigidBody(collisionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addCharacterObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addCharacterObject |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = space; |
||||||
|
space->getDynamicsWorld()->addCollisionObject(collisionObject, |
||||||
|
btBroadphaseProxy::CharacterFilter, |
||||||
|
btBroadphaseProxy::StaticFilter | btBroadphaseProxy::DefaultFilter |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeCharacterObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeCharacterObject |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
userPointer -> space = NULL; |
||||||
|
space->getDynamicsWorld()->removeCollisionObject(collisionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addAction |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addAction |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btActionInterface* actionObject = reinterpret_cast<btActionInterface*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (actionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The action object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->addAction(actionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeAction |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeAction |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btActionInterface* actionObject = reinterpret_cast<btActionInterface*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (actionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The action object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->removeAction(actionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addVehicle |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addVehicle |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btActionInterface* actionObject = reinterpret_cast<btActionInterface*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (actionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The vehicle object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->addVehicle(actionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeVehicle |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeVehicle |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btActionInterface* actionObject = reinterpret_cast<btActionInterface*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (actionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The action object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->removeVehicle(actionObject); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addConstraint |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addConstraint |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btTypedConstraint* constraint = reinterpret_cast<btTypedConstraint*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (constraint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The constraint object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->addConstraint(constraint); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeConstraint |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeConstraint |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jlong objectId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
btTypedConstraint* constraint = reinterpret_cast<btTypedConstraint*>(objectId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (constraint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The constraint object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
space->getDynamicsWorld()->removeConstraint(constraint); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setGravity |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId, jobject vector) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 gravity = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &gravity); |
||||||
|
space->getDynamicsWorld()->setGravity(gravity); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: initNativePhysics |
||||||
|
* Signature: ()V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_initNativePhysics |
||||||
|
(JNIEnv * env, jclass clazz) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_finalizeNative |
||||||
|
(JNIEnv * env, jobject object, jlong spaceId) { |
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
if (space == NULL) { |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(space); |
||||||
|
} |
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native |
||||||
|
(JNIEnv * env, jobject object, jobject to, jobject from, jlong spaceId, jobject resultlist) { |
||||||
|
|
||||||
|
jmePhysicsSpace* space = reinterpret_cast<jmePhysicsSpace*> (spaceId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The physics space does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
struct AllRayResultCallback : public btCollisionWorld::RayResultCallback { |
||||||
|
|
||||||
|
AllRayResultCallback(const btVector3& rayFromWorld, const btVector3 & rayToWorld) : m_rayFromWorld(rayFromWorld), m_rayToWorld(rayToWorld) { |
||||||
|
} |
||||||
|
jobject resultlist; |
||||||
|
JNIEnv* env; |
||||||
|
btVector3 m_rayFromWorld; //used to calculate hitPointWorld from hitFraction
|
||||||
|
btVector3 m_rayToWorld; |
||||||
|
|
||||||
|
btVector3 m_hitNormalWorld; |
||||||
|
btVector3 m_hitPointWorld; |
||||||
|
|
||||||
|
virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { |
||||||
|
if (normalInWorldSpace) { |
||||||
|
m_hitNormalWorld = rayResult.m_hitNormalLocal; |
||||||
|
} else { |
||||||
|
m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal; |
||||||
|
} |
||||||
|
m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction); |
||||||
|
|
||||||
|
jmeBulletUtil::addResult(env, resultlist, m_hitNormalWorld, m_hitPointWorld, rayResult.m_hitFraction, rayResult.m_collisionObject); |
||||||
|
|
||||||
|
return 1.f; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
btVector3 native_to = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, to, &native_to); |
||||||
|
|
||||||
|
btVector3 native_from = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, from, &native_from); |
||||||
|
|
||||||
|
AllRayResultCallback resultCallback(native_from, native_to); |
||||||
|
resultCallback.env = env; |
||||||
|
resultCallback.resultlist = resultlist; |
||||||
|
space->getDynamicsWorld()->rayTest(native_from, native_to, resultCallback); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,165 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_PhysicsSpace */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_PhysicsSpace |
||||||
|
#define _Included_com_jme3_bullet_PhysicsSpace |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_PhysicsSpace_AXIS_X |
||||||
|
#define com_jme3_bullet_PhysicsSpace_AXIS_X 0L |
||||||
|
#undef com_jme3_bullet_PhysicsSpace_AXIS_Y |
||||||
|
#define com_jme3_bullet_PhysicsSpace_AXIS_Y 1L |
||||||
|
#undef com_jme3_bullet_PhysicsSpace_AXIS_Z |
||||||
|
#define com_jme3_bullet_PhysicsSpace_AXIS_Z 2L |
||||||
|
/* Inaccessible static: pQueueTL */ |
||||||
|
/* Inaccessible static: physicsSpaceTL */ |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: createPhysicsSpace |
||||||
|
* Signature: (FFFFFFIZ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_PhysicsSpace_createPhysicsSpace |
||||||
|
(JNIEnv *, jobject, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jint, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: stepSimulation |
||||||
|
* Signature: (JFIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_stepSimulation |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addCollisionObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addCollisionObject |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeCollisionObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeCollisionObject |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addRigidBody |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addRigidBody |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeRigidBody |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeRigidBody |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addCharacterObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addCharacterObject |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeCharacterObject |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeCharacterObject |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addAction |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addAction |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeAction |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeAction |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addVehicle |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addVehicle |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeVehicle |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeVehicle |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: addConstraint |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addConstraint |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: removeConstraint |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeConstraint |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setGravity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: rayTest_native |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native |
||||||
|
(JNIEnv *, jobject, jobject, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: initNativePhysics |
||||||
|
* Signature: ()V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_initNativePhysics |
||||||
|
(JNIEnv *, jclass); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_PhysicsSpace |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,308 @@ |
|||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h" |
||||||
|
#include "com_jme3_bullet_collision_PhysicsCollisionEvent.h" |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulse |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_appliedImpulse; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulseLateral1 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulseLateral1 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_appliedImpulseLateral1; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulseLateral2 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulseLateral2 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_appliedImpulseLateral2; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getCombinedFriction |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getCombinedFriction |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_combinedFriction; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getCombinedRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getCombinedRestitution |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_combinedRestitution; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getDistance1 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getDistance1 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_distance1; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getIndex0 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getIndex0 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_index0; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getIndex1 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getIndex1 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_index1; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLateralFrictionDir1 |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLateralFrictionDir1 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject lateralFrictionDir1) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_lateralFrictionDir1, lateralFrictionDir1); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLateralFrictionDir2 |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLateralFrictionDir2 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject lateralFrictionDir2) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_lateralFrictionDir2, lateralFrictionDir2); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: isLateralFrictionInitialized |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_isLateralFrictionInitialized |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_lateralFrictionInitialized; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLifeTime |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLifeTime |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_lifeTime; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLocalPointA |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLocalPointA |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject localPointA) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_localPointA, localPointA); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLocalPointB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLocalPointB |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject localPointB) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_localPointB, localPointB); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getNormalWorldOnB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getNormalWorldOnB |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject normalWorldOnB) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_normalWorldOnB, normalWorldOnB); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPartId0 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPartId0 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_partId0; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPartId1 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPartId1 |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return mp -> m_partId1; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPositionWorldOnA |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPositionWorldOnA |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject positionWorldOnA) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_positionWorldOnA, positionWorldOnA); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPositionWorldOnB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPositionWorldOnB |
||||||
|
(JNIEnv * env, jobject object, jlong manifoldPointObjectId, jobject positionWorldOnB) { |
||||||
|
btManifoldPoint* mp = reinterpret_cast<btManifoldPoint*>(manifoldPointObjectId); |
||||||
|
if (mp == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The manifoldPoint does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &mp -> m_positionWorldOnB, positionWorldOnB); |
||||||
|
} |
@ -0,0 +1,173 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_PhysicsCollisionEvent */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
#define _Included_com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionEvent_serialVersionUID |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionEvent_serialVersionUID 5516075349620653480LL |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_ADDED |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_ADDED 0L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_PROCESSED |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_PROCESSED 1L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_DESTROYED |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionEvent_TYPE_DESTROYED 2L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulse |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulseLateral1 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulseLateral1 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getAppliedImpulseLateral2 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getAppliedImpulseLateral2 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getCombinedFriction |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getCombinedFriction |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getCombinedRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getCombinedRestitution |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getDistance1 |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getDistance1 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getIndex0 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getIndex0 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getIndex1 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getIndex1 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLateralFrictionDir1 |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLateralFrictionDir1 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLateralFrictionDir2 |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLateralFrictionDir2 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: isLateralFrictionInitialized |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_isLateralFrictionInitialized |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLifeTime |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLifeTime |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLocalPointA |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLocalPointA |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getLocalPointB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getLocalPointB |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getNormalWorldOnB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getNormalWorldOnB |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPartId0 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPartId0 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPartId1 |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPartId1 |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPositionWorldOnA |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPositionWorldOnA |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionEvent |
||||||
|
* Method: getPositionWorldOnB |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionEvent_getPositionWorldOnB |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,148 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_PhysicsCollisionObject.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "jmePhysicsSpace.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: attachCollisionShape |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_attachCollisionShape |
||||||
|
(JNIEnv * env, jobject object, jlong objectId, jlong shapeId) { |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/IllegalStateException"); |
||||||
|
env->ThrowNew(newExc, "The collision object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btCollisionShape* collisionShape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (collisionShape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/IllegalStateException"); |
||||||
|
env->ThrowNew(newExc, "The collision shape does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
collisionObject->setCollisionShape(collisionShape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_finalizeNative |
||||||
|
(JNIEnv * env, jobject object, jlong objectId) { |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (collisionObject -> getUserPointer() != NULL){ |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
delete(userPointer); |
||||||
|
} |
||||||
|
delete(collisionObject); |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: initUserPointer |
||||||
|
* Signature: (JII)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_initUserPointer |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jint group, jint groups) { |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
if (userPointer != NULL) { |
||||||
|
// delete(userPointer);
|
||||||
|
} |
||||||
|
userPointer = new jmeUserPointer(); |
||||||
|
userPointer -> javaCollisionObject = env->NewWeakGlobalRef(object); |
||||||
|
userPointer -> group = group; |
||||||
|
userPointer -> groups = groups; |
||||||
|
userPointer -> space = NULL; |
||||||
|
collisionObject -> setUserPointer(userPointer); |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: setCollisionGroup |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_setCollisionGroup |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jint group) { |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
if (userPointer != NULL){ |
||||||
|
userPointer -> group = group; |
||||||
|
} |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: setCollideWithGroups |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_setCollideWithGroups |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jint groups) { |
||||||
|
btCollisionObject* collisionObject = reinterpret_cast<btCollisionObject*>(objectId); |
||||||
|
if (collisionObject == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeUserPointer *userPointer = (jmeUserPointer*)collisionObject->getUserPointer(); |
||||||
|
if (userPointer != NULL){ |
||||||
|
userPointer -> groups = groups; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,87 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_PhysicsCollisionObject */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
#define _Included_com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_NONE |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_NONE 0L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_01 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_01 1L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_02 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_02 2L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_03 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_03 4L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_04 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_04 8L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_05 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_05 16L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_06 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_06 32L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_07 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_07 64L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_08 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_08 128L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_09 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_09 256L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_10 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_10 512L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_11 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_11 1024L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_12 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_12 2048L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_13 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_13 4096L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_14 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_14 8192L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_15 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_15 16384L |
||||||
|
#undef com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_16 |
||||||
|
#define com_jme3_bullet_collision_PhysicsCollisionObject_COLLISION_GROUP_16 32768L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: initUserPointer |
||||||
|
* Signature: (JII)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_initUserPointer |
||||||
|
(JNIEnv *, jobject, jlong, jint, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: attachCollisionShape |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_attachCollisionShape |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: setCollisionGroup |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_setCollisionGroup |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: setCollideWithGroups |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_setCollideWithGroups |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_PhysicsCollisionObject |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_PhysicsCollisionObject_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,59 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_BoxCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_BoxCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_BoxCollisionShape_createShape |
||||||
|
(JNIEnv *env, jobject object, jobject halfExtents) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 extents = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, halfExtents, &extents); |
||||||
|
btBoxShape* shape = new btBoxShape(extents); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_BoxCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_BoxCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_BoxCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_BoxCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_BoxCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,68 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_CapsuleCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CapsuleCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (IFF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CapsuleCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jint axis, jfloat radius, jfloat height) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btCollisionShape* shape; |
||||||
|
switch(axis){ |
||||||
|
case 0: |
||||||
|
shape = new btCapsuleShapeX(radius, height); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
shape = new btCapsuleShape(radius, height); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
shape = new btCapsuleShapeZ(radius, height); |
||||||
|
break; |
||||||
|
} |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_CapsuleCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_CapsuleCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_CapsuleCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CapsuleCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (IFF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CapsuleCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jint, jfloat, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,110 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_CollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: getMargin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_getMargin |
||||||
|
(JNIEnv * env, jobject object, jlong shapeId) { |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return shape->getMargin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: setLocalScaling |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_setLocalScaling |
||||||
|
(JNIEnv * env, jobject object, jlong shapeId, jobject scale) { |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 scl = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, scale, &scl); |
||||||
|
shape->setLocalScaling(scl); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: setMargin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_setMargin |
||||||
|
(JNIEnv * env, jobject object, jlong shapeId, jfloat newMargin) { |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
shape->setMargin(newMargin); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_finalizeNative |
||||||
|
(JNIEnv * env, jobject object, jlong shapeId) { |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(shape); |
||||||
|
} |
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,45 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_CollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: getMargin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_getMargin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: setLocalScaling |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_setLocalScaling |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: setMargin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_setMargin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_CollisionShape_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,107 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_CompoundCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_createShape |
||||||
|
(JNIEnv *env, jobject object) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btCompoundShape* shape = new btCompoundShape(); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: addChildShape |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_addChildShape |
||||||
|
(JNIEnv *env, jobject object, jlong compoundId, jlong childId, jobject childLocation, jobject childRotation) { |
||||||
|
btCompoundShape* shape = reinterpret_cast<btCompoundShape*>(compoundId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btCollisionShape* child = reinterpret_cast<btCollisionShape*>(childId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btMatrix3x3 mtx = btMatrix3x3(); |
||||||
|
btTransform trans = btTransform(mtx); |
||||||
|
jmeBulletUtil::convert(env, childLocation, &trans.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, childRotation, &trans.getBasis()); |
||||||
|
shape->addChildShape(trans, child); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: removeChildShape |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_removeChildShape |
||||||
|
(JNIEnv * env, jobject object, jlong compoundId, jlong childId) { |
||||||
|
btCompoundShape* shape = reinterpret_cast<btCompoundShape*>(compoundId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btCollisionShape* child = reinterpret_cast<btCollisionShape*>(childId); |
||||||
|
if (shape == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
shape->removeChildShape(child); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,37 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_CompoundCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: addChildShape |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_addChildShape |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CompoundCollisionShape |
||||||
|
* Method: removeChildShape |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CompoundCollisionShape_removeChildShape |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,68 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_ConeCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_ConeCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (IFF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_ConeCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jint axis, jfloat radius, jfloat height) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btCollisionShape* shape; |
||||||
|
switch (axis) { |
||||||
|
case 0: |
||||||
|
shape = new btConeShapeX(radius, height); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
shape = new btConeShape(radius, height); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
shape = new btConeShapeZ(radius, height); |
||||||
|
break; |
||||||
|
} |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_ConeCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_ConeCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_ConeCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_ConeCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (IFF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_ConeCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jint, jfloat, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,70 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_CylinderCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CylinderCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (ILcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CylinderCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jint axis, jobject halfExtents) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 extents = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, halfExtents, &extents); |
||||||
|
btCollisionShape* shape; |
||||||
|
switch (axis) { |
||||||
|
case 0: |
||||||
|
shape = new btCylinderShapeX(extents); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
shape = new btCylinderShape(extents); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
shape = new btCylinderShapeZ(extents); |
||||||
|
break; |
||||||
|
} |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_CylinderCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_CylinderCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_CylinderCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_CylinderCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (ILcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_CylinderCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jint, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,70 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_GImpactCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include <BulletCollision/Gimpact/btGImpactShape.h> |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jlong meshId) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btTriangleIndexVertexArray* array = reinterpret_cast<btTriangleIndexVertexArray*>(meshId); |
||||||
|
btGImpactMeshShape* shape = new btGImpactMeshShape(array); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_finalizeNative |
||||||
|
(JNIEnv * env, jobject object, jlong meshId) { |
||||||
|
btTriangleIndexVertexArray* array = reinterpret_cast<btTriangleIndexVertexArray*> (meshId); |
||||||
|
delete(array); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,29 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_GImpactCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_GImpactCollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_GImpactCollisionShape_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,59 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_HeightfieldCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_HeightfieldCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (II[FFFFIZ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jint heightStickWidth, jint heightStickLength, jobject heightfieldData, jfloat heightScale, jfloat minHeight, jfloat maxHeight, jint upAxis, jboolean flipQuadEdges) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
void* data = env->GetDirectBufferAddress(heightfieldData); |
||||||
|
btHeightfieldTerrainShape* shape=new btHeightfieldTerrainShape(heightStickWidth, heightStickLength, data, heightScale, minHeight, maxHeight, upAxis, PHY_FLOAT, flipQuadEdges); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_HeightfieldCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_HeightfieldCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (IILjava/nio/ByteBuffer;FFFIZ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HeightfieldCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jint, jint, jobject, jfloat, jfloat, jfloat, jint, jboolean); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,69 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_HullCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionShapes/btConvexHullShape.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_HullCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: ([F)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HullCollisionShape_createShape |
||||||
|
(JNIEnv *env, jobject object, jobject array) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
float* data = (float*) env->GetDirectBufferAddress(array); |
||||||
|
//TODO: capacity will not always be length!
|
||||||
|
int length = env->GetDirectBufferCapacity(array)/4; |
||||||
|
btConvexHullShape* shape = new btConvexHullShape(); |
||||||
|
for (int i = 0; i < length; i+=3) { |
||||||
|
btVector3 vect = btVector3(data[i], |
||||||
|
data[i + 1], |
||||||
|
data[i + 2]); |
||||||
|
|
||||||
|
shape->addPoint(vect); |
||||||
|
} |
||||||
|
|
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_HullCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_HullCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_HullCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_HullCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Ljava/nio/ByteBuffer;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_HullCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,70 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_MeshCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jlong arrayId) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btTriangleIndexVertexArray* array = reinterpret_cast<btTriangleIndexVertexArray*>(arrayId); |
||||||
|
btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(array, true, true); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_finalizeNative |
||||||
|
(JNIEnv * env, jobject object, jlong arrayId){ |
||||||
|
btTriangleIndexVertexArray* array = reinterpret_cast<btTriangleIndexVertexArray*>(arrayId); |
||||||
|
delete(array); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,29 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_MeshCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_MeshCollisionShape |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_collision_shapes_MeshCollisionShape_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,60 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_PlaneCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionShapes/btStaticPlaneShape.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_PlaneCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;F)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_PlaneCollisionShape_createShape |
||||||
|
(JNIEnv * env, jobject object, jobject normal, jfloat constant) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 norm = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, normal, &norm); |
||||||
|
btStaticPlaneShape* shape = new btStaticPlaneShape(norm, constant); |
||||||
|
return reinterpret_cast<jlong>(shape); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_PlaneCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_PlaneCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_PlaneCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_PlaneCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;F)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_PlaneCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jobject, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,110 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_collision_shapes_SimplexCollisionShape.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *env, jobject object, jobject vector1) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector1, &vec1); |
||||||
|
btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1); |
||||||
|
return reinterpret_cast<jlong>(simplexShape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *env, jobject object, jobject vector1, jobject vector2) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector1, &vec1); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector2, &vec2); |
||||||
|
btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2); |
||||||
|
return reinterpret_cast<jlong>(simplexShape); |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector1, &vec1); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector2, &vec2); |
||||||
|
btVector3 vec3 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector3, &vec3); |
||||||
|
btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3); |
||||||
|
return reinterpret_cast<jlong>(simplexShape); |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv * env, jobject object, jobject vector1, jobject vector2, jobject vector3, jobject vector4) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector1, &vec1); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector2, &vec2); |
||||||
|
btVector3 vec3 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector3, &vec3); |
||||||
|
btVector3 vec4 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector4, &vec4); |
||||||
|
btBU_Simplex1to4* simplexShape = new btBU_Simplex1to4(vec1, vec2, vec3, vec4); |
||||||
|
return reinterpret_cast<jlong>(simplexShape); |
||||||
|
} |
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,45 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_SimplexCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *, jobject, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *, jobject, jobject, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SimplexCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SimplexCollisionShape_createShape__Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2Lcom_jme3_math_Vector3f_2 |
||||||
|
(JNIEnv *, jobject, jobject, jobject, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_collision_shapes_SphereCollisionShape */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_collision_shapes_SphereCollisionShape |
||||||
|
#define _Included_com_jme3_bullet_collision_shapes_SphereCollisionShape |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_collision_shapes_SphereCollisionShape |
||||||
|
* Method: createShape |
||||||
|
* Signature: (F)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_collision_shapes_SphereCollisionShape_createShape |
||||||
|
(JNIEnv *, jobject, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,100 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_ConeJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_ConeJoint_setLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat swingSpan1, jfloat swingSpan2, jfloat twistSpan) { |
||||||
|
btConeTwistConstraint* joint = reinterpret_cast<btConeTwistConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
//TODO: extended setLimit!
|
||||||
|
joint->setLimit(swingSpan1, swingSpan2, twistSpan); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: setAngularOnly |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_ConeJoint_setAngularOnly |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jboolean angularOnly) { |
||||||
|
btConeTwistConstraint* joint = reinterpret_cast<btConeTwistConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setAngularOnly(angularOnly); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_ConeJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
btMatrix3x3 mtx1 = btMatrix3x3(); |
||||||
|
btMatrix3x3 mtx2 = btMatrix3x3(); |
||||||
|
btTransform transA = btTransform(mtx1); |
||||||
|
jmeBulletUtil::convert(env, pivotA, &transA.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotA, &transA.getBasis()); |
||||||
|
btTransform transB = btTransform(mtx2); |
||||||
|
jmeBulletUtil::convert(env, pivotB, &transB.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotB, &transB.getBasis()); |
||||||
|
btConeTwistConstraint* joint = new btConeTwistConstraint(*bodyA, *bodyB, transA, transB); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,37 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_ConeJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_ConeJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_ConeJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_ConeJoint_setLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: setAngularOnly |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_ConeJoint_setAngularOnly |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_ConeJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_ConeJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,226 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_HingeJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: enableMotor |
||||||
|
* Signature: (JZFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_enableMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jboolean enable, jfloat targetVelocity, jfloat maxMotorImpulse) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->enableAngularMotor(enable, targetVelocity, maxMotorImpulse); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getEnableAngularMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_HingeJoint_getEnableAngularMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return joint->getEnableAngularMotor(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getMotorTargetVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getMotorTargetVelocity |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getMotorTargetVelosity(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getMaxMotorImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getMaxMotorImpulse |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getMaxMotorImpulse(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setLimit__JFF |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat low, jfloat high) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
return joint->setLimit(low, high); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFFFFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setLimit__JFFFFF |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat low, jfloat high, jfloat softness, jfloat biasFactor, jfloat relaxationFactor) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
return joint->setLimit(low, high, softness, biasFactor, relaxationFactor); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getUpperLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getUpperLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getUpperLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getLowerLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getLowerLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getLowerLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setAngularOnly |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setAngularOnly |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jboolean angular) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setAngularOnly(angular); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getHingeAngle |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getHingeAngle |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btHingeConstraint* joint = reinterpret_cast<btHingeConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getHingeAngle(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_HingeJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject axisA, jobject pivotB, jobject axisB) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
btVector3 vec3 = btVector3(); |
||||||
|
btVector3 vec4 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, pivotA, &vec1); |
||||||
|
jmeBulletUtil::convert(env, pivotB, &vec2); |
||||||
|
jmeBulletUtil::convert(env, axisA, &vec3); |
||||||
|
jmeBulletUtil::convert(env, axisB, &vec4); |
||||||
|
btHingeConstraint* joint = new btHingeConstraint(*bodyA, *bodyB, vec1, vec2, vec3, vec4); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,101 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_HingeJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_HingeJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_HingeJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: enableMotor |
||||||
|
* Signature: (JZFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_enableMotor |
||||||
|
(JNIEnv *, jobject, jlong, jboolean, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getEnableAngularMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_HingeJoint_getEnableAngularMotor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getMotorTargetVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getMotorTargetVelocity |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getMaxMotorImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getMaxMotorImpulse |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setLimit__JFF |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setLimit |
||||||
|
* Signature: (JFFFFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setLimit__JFFFFF |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jfloat, jfloat, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getUpperLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getUpperLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getLowerLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getLowerLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: setAngularOnly |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_HingeJoint_setAngularOnly |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: getHingeAngle |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_HingeJoint_getHingeAngle |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_HingeJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_HingeJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,61 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_PhysicsJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_PhysicsJoint |
||||||
|
* Method: getAppliedImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_PhysicsJoint_getAppliedImpulse |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btTypedConstraint* joint = reinterpret_cast<btTypedConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getAppliedImpulse(); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,29 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_PhysicsJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_PhysicsJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_PhysicsJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_PhysicsJoint |
||||||
|
* Method: getAppliedImpulse |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_PhysicsJoint_getAppliedImpulse |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_PhysicsJoint |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_PhysicsJoint_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,162 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_Point2PointJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setDamping |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat damping) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->m_setting.m_damping = damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setImpulseClamp |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setImpulseClamp |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat clamp) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->m_setting.m_impulseClamp = clamp; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setTau |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setTau |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat tau) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->m_setting.m_tau = tau; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getDamping |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->m_setting.m_damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getImpulseClamp |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getImpulseClamp |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->m_setting.m_damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getTau |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getTau |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btPoint2PointConstraint* joint = reinterpret_cast<btPoint2PointConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->m_setting.m_damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject pivotB) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
//TODO: matrix not needed?
|
||||||
|
btMatrix3x3 mtx1 = btMatrix3x3(); |
||||||
|
btMatrix3x3 mtx2 = btMatrix3x3(); |
||||||
|
btTransform transA = btTransform(mtx1); |
||||||
|
jmeBulletUtil::convert(env, pivotA, &transA.getOrigin()); |
||||||
|
btTransform transB = btTransform(mtx2); |
||||||
|
jmeBulletUtil::convert(env, pivotB, &transB.getOrigin()); |
||||||
|
btHingeConstraint* joint = new btHingeConstraint(*bodyA, *bodyB, transA, transB); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,69 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_Point2PointJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_Point2PointJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_Point2PointJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setDamping |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setImpulseClamp |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setImpulseClamp |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: setTau |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_setTau |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getDamping |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getImpulseClamp |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getImpulseClamp |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: getTau |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_getTau |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_Point2PointJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_Point2PointJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,170 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_SixDofJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: getRotationalLimitMotor |
||||||
|
* Signature: (JI)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_getRotationalLimitMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jint index) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return reinterpret_cast<jlong>(joint->getRotationalLimitMotor(index)); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: getTranslationalLimitMotor |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_getTranslationalLimitMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return reinterpret_cast<jlong>(joint->getTranslationalLimitMotor()); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setLinearUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearUpperLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jobject vector) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
joint->setLinearUpperLimit(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setLinearLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearLowerLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jobject vector) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
joint->setLinearLowerLimit(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setAngularUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularUpperLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jobject vector) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
joint->setAngularUpperLimit(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setAngularLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularLowerLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jobject vector) { |
||||||
|
btGeneric6DofConstraint* joint = reinterpret_cast<btGeneric6DofConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
joint->setAngularLowerLimit(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
btMatrix3x3 mtx1 = btMatrix3x3(); |
||||||
|
btMatrix3x3 mtx2 = btMatrix3x3(); |
||||||
|
btTransform transA = btTransform(mtx1); |
||||||
|
jmeBulletUtil::convert(env, pivotA, &transA.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotA, &transA.getBasis()); |
||||||
|
btTransform transB = btTransform(mtx2); |
||||||
|
jmeBulletUtil::convert(env, pivotB, &transB.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotB, &transB.getBasis()); |
||||||
|
btGeneric6DofConstraint* joint = new btGeneric6DofConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,69 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_SixDofJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_SixDofJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_SixDofJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: getRotationalLimitMotor |
||||||
|
* Signature: (JI)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_getRotationalLimitMotor |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: getTranslationalLimitMotor |
||||||
|
* Signature: (J)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_getTranslationalLimitMotor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setLinearUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearUpperLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setLinearLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setLinearLowerLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setAngularUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularUpperLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: setAngularLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofJoint_setAngularLowerLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject, jobject, jobject, jboolean); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,94 @@ |
|||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_SixDofSpringJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: enableString |
||||||
|
* Signature: (JIZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_enableSpring |
||||||
|
(JNIEnv *env, jobject object, jlong jointId, jint index, jboolean onOff) { |
||||||
|
btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId); |
||||||
|
joint -> enableSpring(index, onOff); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setStiffness |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setStiffness |
||||||
|
(JNIEnv *env, jobject object, jlong jointId, jint index, jfloat stiffness) { |
||||||
|
btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId); |
||||||
|
joint -> setStiffness(index, stiffness); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setDamping |
||||||
|
(JNIEnv *env, jobject object, jlong jointId, jint index, jfloat damping) { |
||||||
|
btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId); |
||||||
|
joint -> setDamping(index, damping); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setEquilibriumPoint |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__J |
||||||
|
(JNIEnv *env, jobject object, jlong jointId) { |
||||||
|
btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId); |
||||||
|
joint -> setEquilibriumPoint(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setEquilibriumPoint |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__JI |
||||||
|
(JNIEnv *env, jobject object, jlong jointId, jint index) { |
||||||
|
btGeneric6DofSpringConstraint* joint = reinterpret_cast<btGeneric6DofSpringConstraint*>(jointId); |
||||||
|
joint -> setEquilibriumPoint(index); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
btTransform transA; |
||||||
|
jmeBulletUtil::convert(env, pivotA, &transA.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotA, &transA.getBasis()); |
||||||
|
btTransform transB; |
||||||
|
jmeBulletUtil::convert(env, pivotB, &transB.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotB, &transB.getBasis()); |
||||||
|
|
||||||
|
btGeneric6DofSpringConstraint* joint = new btGeneric6DofSpringConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,61 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_SixDofSpringJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: enableSpring |
||||||
|
* Signature: (JIZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_enableSpring |
||||||
|
(JNIEnv *, jobject, jlong, jint, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setStiffness |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setStiffness |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setDamping |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setEquilibriumPoint |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__J |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: setEquilibriumPoint |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_setEquilibriumPoint__JI |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SixDofSpringJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SixDofSpringJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject, jobject, jobject, jboolean); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,963 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_SliderJoint.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getLowerLinLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getLowerLinLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getLowerLinLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setLowerLinLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setLowerLinLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setLowerLinLimit(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getUpperLinLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getUpperLinLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getUpperLinLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setUpperLinLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setUpperLinLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setUpperLinLimit(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getLowerAngLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getLowerAngLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getLowerAngLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setLowerAngLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setLowerAngLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setLowerAngLimit(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getUpperAngLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getUpperAngLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getUpperAngLimit(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setUpperAngLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setUpperAngLimit |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setUpperAngLimit(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessDirLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessDirLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionDirLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionDirLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingDirLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingDirLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingDirLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessDirAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessDirAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionDirAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionDirAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingDirAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingDirAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingDirAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessLimLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessLimLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionLimLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionLimLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingLimLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingLimLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingLimLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessLimAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessLimAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionLimAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionLimAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingLimAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingLimAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingLimAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessOrthoLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessOrthoLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionOrthoLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionOrthoLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingOrthoLin(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingOrthoLin |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingOrthoLin(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getSoftnessOrthoAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setSoftnessOrthoAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getRestitutionOrthoAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setRestitutionOrthoAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getDampingOrthoAng(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingOrthoAng |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setDampingOrthoAng(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: isPoweredLinMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_SliderJoint_isPoweredLinMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return joint->getPoweredLinMotor(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setPoweredLinMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setPoweredLinMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jboolean value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setPoweredLinMotor(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getTargetLinMotorVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getTargetLinMotorVelocity |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getTargetLinMotorVelocity(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setTargetLinMotorVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setTargetLinMotorVelocity |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setTargetLinMotorVelocity(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getMaxLinMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getMaxLinMotorForce |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getMaxLinMotorForce(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setMaxLinMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setMaxLinMotorForce |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setMaxLinMotorForce(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: isPoweredAngMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_SliderJoint_isPoweredAngMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return joint->getPoweredAngMotor(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setPoweredAngMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setPoweredAngMotor |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jboolean value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setPoweredAngMotor(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getTargetAngMotorVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getTargetAngMotorVelocity |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getTargetAngMotorVelocity(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setTargetAngMotorVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setTargetAngMotorVelocity |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setTargetAngMotorVelocity(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getMaxAngMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getMaxAngMotorForce |
||||||
|
(JNIEnv * env, jobject object, jlong jointId) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return joint->getMaxAngMotorForce(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setMaxAngMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setMaxAngMotorForce |
||||||
|
(JNIEnv * env, jobject object, jlong jointId, jfloat value) { |
||||||
|
btSliderConstraint* joint = reinterpret_cast<btSliderConstraint*>(jointId); |
||||||
|
if (joint == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
joint->setMaxAngMotorForce(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SliderJoint_createJoint |
||||||
|
(JNIEnv * env, jobject object, jlong bodyIdA, jlong bodyIdB, jobject pivotA, jobject rotA, jobject pivotB, jobject rotB, jboolean useLinearReferenceFrameA) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* bodyA = reinterpret_cast<btRigidBody*>(bodyIdA); |
||||||
|
btRigidBody* bodyB = reinterpret_cast<btRigidBody*>(bodyIdB); |
||||||
|
btMatrix3x3 mtx1 = btMatrix3x3(); |
||||||
|
btMatrix3x3 mtx2 = btMatrix3x3(); |
||||||
|
btTransform transA = btTransform(mtx1); |
||||||
|
jmeBulletUtil::convert(env, pivotA, &transA.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotA, &transA.getBasis()); |
||||||
|
btTransform transB = btTransform(mtx2); |
||||||
|
jmeBulletUtil::convert(env, pivotB, &transB.getOrigin()); |
||||||
|
jmeBulletUtil::convert(env, rotB, &transB.getBasis()); |
||||||
|
btSliderConstraint* joint = new btSliderConstraint(*bodyA, *bodyB, transA, transB, useLinearReferenceFrameA); |
||||||
|
return reinterpret_cast<jlong>(joint); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,469 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_SliderJoint */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_SliderJoint |
||||||
|
#define _Included_com_jme3_bullet_joints_SliderJoint |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getLowerLinLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getLowerLinLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setLowerLinLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setLowerLinLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getUpperLinLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getUpperLinLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setUpperLinLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setUpperLinLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getLowerAngLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getLowerAngLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setLowerAngLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setLowerAngLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getUpperAngLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getUpperAngLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setUpperAngLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setUpperAngLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessDirLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessDirLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionDirLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionDirLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingDirLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingDirLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingDirLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingDirLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessDirAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessDirAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionDirAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionDirAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingDirAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingDirAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingDirAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingDirAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessLimLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessLimLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionLimLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionLimLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingLimLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingLimLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingLimLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingLimLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessLimAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessLimAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionLimAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionLimAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingLimAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingLimAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingLimAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingLimAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingOrthoLin |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingOrthoLin |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingOrthoLin |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getSoftnessOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getSoftnessOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setSoftnessOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setSoftnessOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getRestitutionOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getRestitutionOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setRestitutionOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setRestitutionOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getDampingOrthoAng |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getDampingOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setDampingOrthoAng |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setDampingOrthoAng |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: isPoweredLinMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_SliderJoint_isPoweredLinMotor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setPoweredLinMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setPoweredLinMotor |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getTargetLinMotorVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getTargetLinMotorVelocity |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setTargetLinMotorVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setTargetLinMotorVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getMaxLinMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getMaxLinMotorForce |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setMaxLinMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setMaxLinMotorForce |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: isPoweredAngMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_SliderJoint_isPoweredAngMotor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setPoweredAngMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setPoweredAngMotor |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getTargetAngMotorVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getTargetAngMotorVelocity |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setTargetAngMotorVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setTargetAngMotorVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: getMaxAngMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_SliderJoint_getMaxAngMotorForce |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: setMaxAngMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_SliderJoint_setMaxAngMotorForce |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_SliderJoint |
||||||
|
* Method: createJoint |
||||||
|
* Signature: (JJLcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Matrix3f;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_joints_SliderJoint_createJoint |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jobject, jobject, jobject, jobject, jboolean); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,365 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_motors_RotationalLimitMotor.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getLoLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLoLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_loLimit; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setLoLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLoLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_loLimit = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getHiLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getHiLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_hiLimit; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setHiLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setHiLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_hiLimit = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getTargetVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getTargetVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_targetVelocity; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setTargetVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setTargetVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_targetVelocity = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getMaxMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxMotorForce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_maxMotorForce; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setMaxMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxMotorForce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_maxMotorForce = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getMaxLimitForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxLimitForce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_maxLimitForce; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setMaxLimitForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxLimitForce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_maxLimitForce = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getDamping |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setDamping |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_damping = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getLimitSoftness |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLimitSoftness |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_limitSoftness; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setLimitSoftness |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLimitSoftness |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_limitSoftness = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getERP |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getERP |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_stopERP; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setERP |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setERP |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_stopERP = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getBounce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getBounce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_bounce; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setBounce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setBounce |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_bounce = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: isEnableMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_isEnableMotor |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return motor->m_enableMotor; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setEnableMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setEnableMotor |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jboolean value) { |
||||||
|
btRotationalLimitMotor* motor = reinterpret_cast<btRotationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_enableMotor = value; |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,173 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_motors_RotationalLimitMotor */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
#define _Included_com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getLoLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLoLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setLoLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLoLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getHiLimit |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getHiLimit |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setHiLimit |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setHiLimit |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getTargetVelocity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getTargetVelocity |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setTargetVelocity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setTargetVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getMaxMotorForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxMotorForce |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setMaxMotorForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxMotorForce |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getMaxLimitForce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getMaxLimitForce |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setMaxLimitForce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setMaxLimitForce |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getDamping |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setDamping |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getLimitSoftness |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getLimitSoftness |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setLimitSoftness |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setLimitSoftness |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getERP |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getERP |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setERP |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setERP |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: getBounce |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_getBounce |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setBounce |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setBounce |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: isEnableMotor |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_isEnableMotor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_RotationalLimitMotor |
||||||
|
* Method: setEnableMotor |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_RotationalLimitMotor_setEnableMotor |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,237 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_joints_motors_TranslationalLimitMotor.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLowerLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &motor->m_lowerLimit, vector); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLowerLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, vector, &motor->m_lowerLimit); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getUpperLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &motor->m_upperLimit, vector); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setUpperLimit |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, vector, &motor->m_upperLimit); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getAccumulatedImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getAccumulatedImpulse |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &motor->m_accumulatedImpulse, vector); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setAccumulatedImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setAccumulatedImpulse |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jobject vector) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, vector, &motor->m_accumulatedImpulse); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getLimitSoftness |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLetLimitSoftness |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_limitSoftness; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setLimitSoftness |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLimitSoftness |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_limitSoftness = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getDamping |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_damping; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setDamping |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_damping = value; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getRestitution |
||||||
|
(JNIEnv *env, jobject object, jlong motorId) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return motor->m_restitution; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setRestitution |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setRestitution |
||||||
|
(JNIEnv *env, jobject object, jlong motorId, jfloat value) { |
||||||
|
btTranslationalLimitMotor* motor = reinterpret_cast<btTranslationalLimitMotor*>(motorId); |
||||||
|
if (motor == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
motor->m_restitution = value; |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,109 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_joints_motors_TranslationalLimitMotor */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
#define _Included_com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLowerLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setLowerLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLowerLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getUpperLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setUpperLimit |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setUpperLimit |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getAccumulatedImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getAccumulatedImpulse |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setAccumulatedImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setAccumulatedImpulse |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getLimitSoftness |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getLimitSoftness |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setLimitSoftness |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setLimitSoftness |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getDamping |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setDamping |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: getRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_getRestitution |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_joints_motors_TranslationalLimitMotor |
||||||
|
* Method: setRestitution |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_joints_motors_TranslationalLimitMotor_setRestitution |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,388 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "com_jme3_bullet_objects_PhysicsCharacter.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionDispatch/btGhostObject.h" |
||||||
|
#include "BulletDynamics/Character/btKinematicCharacterController.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: createGhostObject |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_createGhostObject |
||||||
|
(JNIEnv * env, jobject object) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btPairCachingGhostObject* ghost = new btPairCachingGhostObject(); |
||||||
|
return reinterpret_cast<jlong>(ghost); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCharacterFlags |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCharacterFlags |
||||||
|
(JNIEnv *env, jobject object, jlong ghostId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(ghostId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCollisionFlags(/*ghost->getCollisionFlags() |*/ btCollisionObject::CF_CHARACTER_OBJECT); |
||||||
|
ghost->setCollisionFlags(ghost->getCollisionFlags() & ~btCollisionObject::CF_NO_CONTACT_RESPONSE); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: createCharacterObject |
||||||
|
* Signature: (JJF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_createCharacterObject |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jlong shapeId, jfloat stepHeight) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
//TODO: check convexshape!
|
||||||
|
btConvexShape* shape = reinterpret_cast<btConvexShape*>(shapeId); |
||||||
|
btKinematicCharacterController* character = new btKinematicCharacterController(ghost, shape, stepHeight); |
||||||
|
return reinterpret_cast<jlong>(character); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: warp |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_warp |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject vector) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
character->warp(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setWalkDirection |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setWalkDirection |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject vector) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, vector, &vec); |
||||||
|
character->setWalkDirection(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setUpAxis |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUpAxis |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jint value) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->setUpAxis(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setFallSpeed |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setFallSpeed |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->setFallSpeed(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setJumpSpeed |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setJumpSpeed |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->setJumpSpeed(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->setGravity(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getGravity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return character->getGravity(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setMaxSlope |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setMaxSlope |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->setMaxSlope(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getMaxSlope |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxSlope |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return character->getMaxSlope(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: onGround |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_onGround |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return character->onGround(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: jump |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
character->jump(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getPhysicsLocation |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &ghost->getWorldTransform().getOrigin(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCcdSweptSphereRadius(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCcdMotionThreshold(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdSweptSphereRadius(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btGhostObject* ghost = reinterpret_cast<btGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdSquareMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: finalizeNativeCharacter |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_finalizeNativeCharacter |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btKinematicCharacterController* character = reinterpret_cast<btKinematicCharacterController*>(objectId); |
||||||
|
if (character == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(character); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,215 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_PhysicsCharacter */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
#define _Included_com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_NONE |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_NONE 0L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_01 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_01 1L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_02 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_02 2L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_03 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_03 4L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_04 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_04 8L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_05 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_05 16L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_06 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_06 32L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_07 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_07 64L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_08 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_08 128L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_09 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_09 256L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_10 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_10 512L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_11 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_11 1024L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_12 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_12 2048L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_13 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_13 4096L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_14 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_14 8192L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_15 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_15 16384L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_16 |
||||||
|
#define com_jme3_bullet_objects_PhysicsCharacter_COLLISION_GROUP_16 32768L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: createGhostObject |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_createGhostObject |
||||||
|
(JNIEnv *, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCharacterFlags |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCharacterFlags |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: createCharacterObject |
||||||
|
* Signature: (JJF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_createCharacterObject |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: warp |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_warp |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setWalkDirection |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setWalkDirection |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setUpAxis |
||||||
|
* Signature: (JI)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setUpAxis |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setFallSpeed |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setFallSpeed |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setJumpSpeed |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setJumpSpeed |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setGravity |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getGravity |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getGravity |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setMaxSlope |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setMaxSlope |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getMaxSlope |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getMaxSlope |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: onGround |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_onGround |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: jump |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_jump |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getPhysicsLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_setCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsCharacter |
||||||
|
* Method: finalizeNativeCharacter |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsCharacter_finalizeNativeCharacter |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,313 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <BulletCollision/CollisionDispatch/btGhostObject.h> |
||||||
|
|
||||||
|
#include "com_jme3_bullet_objects_PhysicsGhostObject.h" |
||||||
|
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "jmePhysicsSpace.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: createGhostObject |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_createGhostObject |
||||||
|
(JNIEnv * env, jobject object) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btPairCachingGhostObject* ghost = new btPairCachingGhostObject(); |
||||||
|
return reinterpret_cast<jlong>(ghost); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setGhostFlags |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setGhostFlags |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCollisionFlags(ghost->getCollisionFlags() | btCollisionObject::CF_NO_CONTACT_RESPONSE); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsLocation |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, value, &ghost->getWorldTransform().getOrigin()); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Matrix3f_2 |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, value, &ghost->getWorldTransform().getBasis()); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Quaternion_2 |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convertQuat(env, value, &ghost->getWorldTransform().getBasis()); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsLocation |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &ghost->getWorldTransform().getOrigin(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsRotation |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convertQuat(env, &ghost->getWorldTransform().getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsRotationMatrix |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsRotationMatrix |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jobject value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &ghost->getWorldTransform().getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
class jmeGhostOverlapCallback : public btOverlapCallback { |
||||||
|
JNIEnv* m_env; |
||||||
|
jobject m_object; |
||||||
|
public: |
||||||
|
jmeGhostOverlapCallback(JNIEnv *env, jobject object) |
||||||
|
:m_env(env), |
||||||
|
m_object(object) |
||||||
|
{ |
||||||
|
} |
||||||
|
virtual ~jmeGhostOverlapCallback() {} |
||||||
|
virtual bool processOverlap(btBroadphasePair& pair) |
||||||
|
{ |
||||||
|
btCollisionObject *co1 = (btCollisionObject *)pair.m_pProxy0->m_clientObject; |
||||||
|
jmeUserPointer *up1 = (jmeUserPointer*)co1 -> getUserPointer(); |
||||||
|
jobject javaCollisionObject1 = m_env->NewLocalRef(up1->javaCollisionObject); |
||||||
|
m_env->CallVoidMethod(m_object, jmeClasses::PhysicsGhostObject_addOverlappingObject, javaCollisionObject1); |
||||||
|
m_env->DeleteLocalRef(javaCollisionObject1); |
||||||
|
if (m_env->ExceptionCheck()) { |
||||||
|
m_env->Throw(m_env->ExceptionOccurred()); |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getOverlappingObjects |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getOverlappingObjects |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btHashedOverlappingPairCache * pc = ghost->getOverlappingPairCache(); |
||||||
|
jmeGhostOverlapCallback cb(env, object); |
||||||
|
pc -> processAllOverlappingPairs(&cb, NULL); |
||||||
|
} |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getOverlappingCount |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getOverlappingCount |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getNumOverlappingObjects(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCcdSweptSphereRadius(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jfloat value) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
ghost->setCcdMotionThreshold(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdSweptSphereRadius(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong objectId) { |
||||||
|
btPairCachingGhostObject* ghost = reinterpret_cast<btPairCachingGhostObject*>(objectId); |
||||||
|
if (ghost == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return ghost->getCcdSquareMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,167 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_PhysicsGhostObject */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
#define _Included_com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_NONE |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_NONE 0L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_01 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_01 1L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_02 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_02 2L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_03 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_03 4L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_04 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_04 8L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_05 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_05 16L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_06 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_06 32L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_07 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_07 64L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_08 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_08 128L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_09 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_09 256L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_10 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_10 512L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_11 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_11 1024L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_12 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_12 2048L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_13 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_13 4096L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_14 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_14 8192L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_15 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_15 16384L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_16 |
||||||
|
#define com_jme3_bullet_objects_PhysicsGhostObject_COLLISION_GROUP_16 32768L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: createGhostObject |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_createGhostObject |
||||||
|
(JNIEnv *, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setGhostFlags |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setGhostFlags |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Matrix3f_2 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setPhysicsRotation__JLcom_jme3_math_Quaternion_2 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsRotation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getPhysicsRotationMatrix |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getPhysicsRotationMatrix |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getOverlappingObjects |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getOverlappingObjects |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getOverlappingCount |
||||||
|
* Signature: (J)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getOverlappingCount |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_setCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsGhostObject |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsGhostObject_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,849 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_objects_PhysicsRigidBody.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "jmeMotionState.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: createRigidBody |
||||||
|
* Signature: (FJJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_createRigidBody |
||||||
|
(JNIEnv *env, jobject object, jfloat mass, jlong motionstatId, jlong shapeId) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btMotionState* motionState = reinterpret_cast<btMotionState*>(motionstatId); |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
btVector3 localInertia = btVector3(); |
||||||
|
shape->calculateLocalInertia(mass, localInertia); |
||||||
|
btRigidBody* body = new btRigidBody(mass, motionState, shape, localInertia); |
||||||
|
body->setUserPointer(NULL); |
||||||
|
return reinterpret_cast<jlong>(body); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: isInWorld |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_isInWorld |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return body->isInWorld(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsLocation |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
// if (body->isStaticOrKinematicObject() || !body->isInWorld())
|
||||||
|
((jmeMotionState*) body->getMotionState())->setKinematicLocation(env, value); |
||||||
|
body->setCenterOfMassTransform(((jmeMotionState*) body->getMotionState())->worldTransform); |
||||||
|
// else{
|
||||||
|
// btMatrix3x3* mtx = &btMatrix3x3();
|
||||||
|
// btTransform* trans = &btTransform(*mtx);
|
||||||
|
// trans->setBasis(body->getCenterOfMassTransform().getBasis());
|
||||||
|
// jmeBulletUtil::convert(env, value, &trans->getOrigin());
|
||||||
|
// body->setCenterOfMassTransform(*trans);
|
||||||
|
// }
|
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsRotation__JLcom_jme3_math_Matrix3f_2 |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
// if (body->isStaticOrKinematicObject() || !body->isInWorld())
|
||||||
|
((jmeMotionState*) body->getMotionState())->setKinematicRotation(env, value); |
||||||
|
body->setCenterOfMassTransform(((jmeMotionState*) body->getMotionState())->worldTransform); |
||||||
|
// else{
|
||||||
|
// btMatrix3x3* mtx = &btMatrix3x3();
|
||||||
|
// btTransform* trans = &btTransform(*mtx);
|
||||||
|
// trans->setOrigin(body->getCenterOfMassTransform().getOrigin());
|
||||||
|
// jmeBulletUtil::convert(env, value, &trans->getBasis());
|
||||||
|
// body->setCenterOfMassTransform(*trans);
|
||||||
|
// }
|
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsRotation__JLcom_jme3_math_Quaternion_2 |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
// if (body->isStaticOrKinematicObject() || !body->isInWorld())
|
||||||
|
((jmeMotionState*) body->getMotionState())->setKinematicRotationQuat(env, value); |
||||||
|
body->setCenterOfMassTransform(((jmeMotionState*) body->getMotionState())->worldTransform); |
||||||
|
// else{
|
||||||
|
// btMatrix3x3* mtx = &btMatrix3x3();
|
||||||
|
// btTransform* trans = &btTransform(*mtx);
|
||||||
|
// trans->setOrigin(body->getCenterOfMassTransform().getOrigin());
|
||||||
|
// jmeBulletUtil::convertQuat(env, value, &trans->getBasis());
|
||||||
|
// body->setCenterOfMassTransform(*trans);
|
||||||
|
// }
|
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsLocation |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &body->getWorldTransform().getOrigin(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsRotation |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convertQuat(env, &body->getWorldTransform().getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsRotationMatrix |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsRotationMatrix |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &body->getWorldTransform().getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setKinematic |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setKinematic |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jboolean value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (value) { |
||||||
|
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT); |
||||||
|
body->setActivationState(DISABLE_DEACTIVATION); |
||||||
|
} else { |
||||||
|
body->setCollisionFlags(body->getCollisionFlags() & ~btCollisionObject::CF_KINEMATIC_OBJECT); |
||||||
|
body->setActivationState(ACTIVE_TAG); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setCcdSweptSphereRadius(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setCcdMotionThreshold(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getCcdSweptSphereRadius(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getCcdMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getCcdSquareMotionThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setStatic |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setStatic |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jboolean value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (value) { |
||||||
|
body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT); |
||||||
|
} else { |
||||||
|
body->setCollisionFlags(body->getCollisionFlags() & ~btCollisionObject::CF_STATIC_OBJECT); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: updateMassProps |
||||||
|
* Signature: (JJF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_updateMassProps |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jlong shapeId, jfloat mass) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
btVector3 localInertia = btVector3(); |
||||||
|
shape->calculateLocalInertia(mass, localInertia); |
||||||
|
body->setMassProps(mass, localInertia); |
||||||
|
return reinterpret_cast<jlong>(body); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getGravity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &body->getGravity(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setGravity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, value, &vec); |
||||||
|
body->setGravity(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getFriction |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getFriction |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getFriction(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setFriction |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setFriction |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setFriction(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setDamping |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value1, jfloat value2) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setDamping(value1, value2); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularDamping |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setDamping(body->getAngularDamping(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearDamping |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getLinearDamping(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularDamping |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getAngularDamping(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getRestitution |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getRestitution(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setRestitution |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setRestitution |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setRestitution(value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &body->getAngularVelocity(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, value, &vec); |
||||||
|
body->setAngularVelocity(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &body->getLinearVelocity(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setLinearVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setLinearVelocity |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, value, &vec); |
||||||
|
body->setLinearVelocity(vec); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyForce |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyForce |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject force, jobject location) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, force, &vec1); |
||||||
|
jmeBulletUtil::convert(env, location, &vec2); |
||||||
|
body->applyForce(vec1, vec2); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyCentralForce |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyCentralForce |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject force) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, force, &vec1); |
||||||
|
body->applyCentralForce(vec1); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyTorque |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorque |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject force) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, force, &vec1); |
||||||
|
body->applyTorque(vec1); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyImpulse |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject force, jobject location) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, force, &vec1); |
||||||
|
jmeBulletUtil::convert(env, location, &vec2); |
||||||
|
body->applyImpulse(vec1, vec2); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyTorqueImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorqueImpulse |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jobject force) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, force, &vec1); |
||||||
|
body->applyTorqueImpulse(vec1); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: clearForces |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_clearForces |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->clearForces(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCollisionShape |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCollisionShape |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jlong shapeId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
body->setCollisionShape(shape); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: activate |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_activate |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->activate(false); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: isActive |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_isActive |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return body->isActive(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setSleepingThresholds |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setSleepingThresholds |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat linear, jfloat angular) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setSleepingThresholds(linear, angular); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setLinearSleepingThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setLinearSleepingThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setSleepingThresholds(value, body->getLinearSleepingThreshold()); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularSleepingThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularSleepingThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
body->setSleepingThresholds(body->getAngularSleepingThreshold(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearSleepingThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearSleepingThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getLinearSleepingThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularSleepingThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularSleepingThreshold |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getAngularSleepingThreshold(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularFactor |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularFactor |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return body->getAngularFactor().getX(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularFactor |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularFactor |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jfloat value) { |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(bodyId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
vec1.setX(value); |
||||||
|
vec1.setY(value); |
||||||
|
vec1.setZ(value); |
||||||
|
body->setAngularFactor(vec1); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,415 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_PhysicsRigidBody */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
#define _Included_com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_NONE |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_NONE 0L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_01 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_01 1L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_02 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_02 2L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_03 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_03 4L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_04 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_04 8L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_05 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_05 16L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_06 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_06 32L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_07 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_07 64L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_08 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_08 128L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_09 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_09 256L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_10 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_10 512L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_11 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_11 1024L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_12 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_12 2048L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_13 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_13 4096L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_14 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_14 8192L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_15 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_15 16384L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_16 |
||||||
|
#define com_jme3_bullet_objects_PhysicsRigidBody_COLLISION_GROUP_16 32768L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: createRigidBody |
||||||
|
* Signature: (FJJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_createRigidBody |
||||||
|
(JNIEnv *, jobject, jfloat, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: isInWorld |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_isInWorld |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsRotation__JLcom_jme3_math_Matrix3f_2 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setPhysicsRotation__JLcom_jme3_math_Quaternion_2 |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsRotation |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsRotation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getPhysicsRotationMatrix |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getPhysicsRotationMatrix |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setKinematic |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setKinematic |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCcdSweptSphereRadius |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCcdMotionThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdSweptSphereRadius |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdSweptSphereRadius |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getCcdSquareMotionThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getCcdSquareMotionThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setStatic |
||||||
|
* Signature: (JZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setStatic |
||||||
|
(JNIEnv *, jobject, jlong, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: updateMassProps |
||||||
|
* Signature: (JJF)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_updateMassProps |
||||||
|
(JNIEnv *, jobject, jlong, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getGravity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setGravity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setGravity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getFriction |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getFriction |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setFriction |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setFriction |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setDamping |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setDamping |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularDamping |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularDamping |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearDamping |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularDamping |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularDamping |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getRestitution |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getRestitution |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setRestitution |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setRestitution |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setLinearVelocity |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setLinearVelocity |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyForce |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyForce |
||||||
|
(JNIEnv *, jobject, jlong, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyCentralForce |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyCentralForce |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyTorque |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorque |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyImpulse |
||||||
|
(JNIEnv *, jobject, jlong, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: applyTorqueImpulse |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_applyTorqueImpulse |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: clearForces |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_clearForces |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setCollisionShape |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setCollisionShape |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: activate |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_activate |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: isActive |
||||||
|
* Signature: (J)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_isActive |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setSleepingThresholds |
||||||
|
* Signature: (JFF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setSleepingThresholds |
||||||
|
(JNIEnv *, jobject, jlong, jfloat, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setLinearSleepingThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setLinearSleepingThreshold |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularSleepingThreshold |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularSleepingThreshold |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getLinearSleepingThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getLinearSleepingThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularSleepingThreshold |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularSleepingThreshold |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: getAngularFactor |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_getAngularFactor |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsRigidBody |
||||||
|
* Method: setAngularFactor |
||||||
|
* Signature: (JF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsRigidBody_setAngularFactor |
||||||
|
(JNIEnv *, jobject, jlong, jfloat); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,272 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "com_jme3_bullet_objects_PhysicsVehicle.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "jmePhysicsSpace.h" |
||||||
|
#include "BulletDynamics/Vehicle/btRaycastVehicle.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: updateWheelTransform |
||||||
|
* Signature: (JIZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_updateWheelTransform |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheel, jboolean interpolated) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->updateWheelTransform(wheel, interpolated); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: createVehicleRaycaster |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_createVehicleRaycaster |
||||||
|
(JNIEnv *env, jobject object, jlong bodyId, jlong spaceId) { |
||||||
|
//btRigidBody* body = reinterpret_cast<btRigidBody*> bodyId;
|
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
jmePhysicsSpace *space = reinterpret_cast<jmePhysicsSpace*>(spaceId); |
||||||
|
if (space == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btDefaultVehicleRaycaster* caster = new btDefaultVehicleRaycaster(space->getDynamicsWorld()); |
||||||
|
return reinterpret_cast<jlong>(caster); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: createRaycastVehicle |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_createRaycastVehicle |
||||||
|
(JNIEnv *env, jobject object, jlong objectId, jlong casterId) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
btRigidBody* body = reinterpret_cast<btRigidBody*>(objectId); |
||||||
|
if (body == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
body->setActivationState(DISABLE_DEACTIVATION); |
||||||
|
btVehicleRaycaster* caster = reinterpret_cast<btDefaultVehicleRaycaster*>(casterId); |
||||||
|
if (caster == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btRaycastVehicle::btVehicleTuning tuning; |
||||||
|
btRaycastVehicle* vehicle = new btRaycastVehicle(tuning, body, caster); |
||||||
|
return reinterpret_cast<jlong>(vehicle); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: setCoordinateSystem |
||||||
|
* Signature: (JIII)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_setCoordinateSystem |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint right, jint up, jint forward) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->setCoordinateSystem(right, up, forward); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: addWheel |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jobject location, jobject direction, jobject axle, jfloat restLength, jfloat radius, jobject tuning, jboolean frontWheel) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
btVector3 vec1 = btVector3(); |
||||||
|
btVector3 vec2 = btVector3(); |
||||||
|
btVector3 vec3 = btVector3(); |
||||||
|
jmeBulletUtil::convert(env, location, &vec1); |
||||||
|
jmeBulletUtil::convert(env, direction, &vec2); |
||||||
|
jmeBulletUtil::convert(env, axle, &vec3); |
||||||
|
btRaycastVehicle::btVehicleTuning tune; |
||||||
|
btWheelInfo* info = &vehicle->addWheel(vec1, vec2, vec3, restLength, radius, tune, frontWheel); |
||||||
|
int idx = vehicle->getNumWheels(); |
||||||
|
return idx-1; |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: resetSuspension |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_resetSuspension |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->resetSuspension(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: applyEngineForce |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_applyEngineForce |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheel, jfloat force) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->applyEngineForce(force, wheel); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: steer |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_steer |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheel, jfloat value) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->setSteeringValue(value, wheel); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: brake |
||||||
|
* Signature: (JIF)F |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_brake |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheel, jfloat value) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
vehicle->setBrake(value, wheel); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: getCurrentVehicleSpeedKmHour |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_getCurrentVehicleSpeedKmHour |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return vehicle->getCurrentSpeedKmHour(); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: getForwardVector |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_getForwardVector |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jobject out) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
btVector3 forwardVector = vehicle->getForwardVector(); |
||||||
|
jmeBulletUtil::convert(env, &forwardVector, out); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_finalizeNative |
||||||
|
(JNIEnv *env, jobject object, jlong casterId, jlong vehicleId) { |
||||||
|
btVehicleRaycaster* rayCaster = reinterpret_cast<btVehicleRaycaster*>(casterId); |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(vehicle); |
||||||
|
if (rayCaster == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(rayCaster); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
|
@ -0,0 +1,143 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_PhysicsVehicle */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
#define _Included_com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_NONE |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_NONE 0L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_01 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_01 1L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_02 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_02 2L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_03 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_03 4L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_04 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_04 8L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_05 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_05 16L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_06 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_06 32L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_07 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_07 64L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_08 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_08 128L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_09 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_09 256L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_10 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_10 512L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_11 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_11 1024L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_12 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_12 2048L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_13 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_13 4096L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_14 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_14 8192L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_15 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_15 16384L |
||||||
|
#undef com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_16 |
||||||
|
#define com_jme3_bullet_objects_PhysicsVehicle_COLLISION_GROUP_16 32768L |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: updateWheelTransform |
||||||
|
* Signature: (JIZ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_updateWheelTransform |
||||||
|
(JNIEnv *, jobject, jlong, jint, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: createVehicleRaycaster |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_createVehicleRaycaster |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: createRaycastVehicle |
||||||
|
* Signature: (JJ)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_createRaycastVehicle |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: setCoordinateSystem |
||||||
|
* Signature: (JIII)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_setCoordinateSystem |
||||||
|
(JNIEnv *, jobject, jlong, jint, jint, jint); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: addWheel |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;FFLcom/jme3/bullet/objects/infos/VehicleTuning;Z)I |
||||||
|
*/ |
||||||
|
JNIEXPORT jint JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_addWheel |
||||||
|
(JNIEnv *, jobject, jlong, jobject, jobject, jobject, jfloat, jfloat, jobject, jboolean); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: resetSuspension |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_resetSuspension |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: applyEngineForce |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_applyEngineForce |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: steer |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_steer |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: brake |
||||||
|
* Signature: (JIF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_brake |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: getCurrentVehicleSpeedKmHour |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_getCurrentVehicleSpeedKmHour |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: getForwardVector |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_getForwardVector |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_PhysicsVehicle |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (JJ)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,147 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "com_jme3_bullet_objects_VehicleWheel.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getWheelLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_worldTransform.getOrigin(), out); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getWheelRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_worldTransform.getBasis(), out); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: applyInfo |
||||||
|
* Signature: (JFFFFFFFFZF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jfloat suspensionStiffness, jfloat wheelsDampingRelaxation, jfloat wheelsDampingCompression, jfloat frictionSlip, jfloat rollInfluence, jfloat maxSuspensionTravelCm, jfloat maxSuspensionForce, jfloat radius, jboolean frontWheel, jfloat restLength) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_suspensionStiffness = suspensionStiffness; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_wheelsDampingRelaxation = wheelsDampingRelaxation; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_wheelsDampingCompression = wheelsDampingCompression; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_frictionSlip = frictionSlip; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_rollInfluence = rollInfluence; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_maxSuspensionTravelCm = maxSuspensionTravelCm; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_maxSuspensionForce = maxSuspensionForce; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_wheelsRadius = radius; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_bIsFrontWheel = frontWheel; |
||||||
|
vehicle->getWheelInfo(wheelIndex).m_suspensionRestLength1 = restLength; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getCollisionLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_raycastInfo.m_contactPointWS, out); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getCollisionNormal |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex, jobject out) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &vehicle->getWheelInfo(wheelIndex).m_raycastInfo.m_contactNormalWS, out); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getSkidInfo |
||||||
|
* Signature: (J)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo |
||||||
|
(JNIEnv *env, jobject object, jlong vehicleId, jint wheelIndex) { |
||||||
|
btRaycastVehicle* vehicle = reinterpret_cast<btRaycastVehicle*>(vehicleId); |
||||||
|
if (vehicle == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return 0; |
||||||
|
} |
||||||
|
return vehicle->getWheelInfo(wheelIndex).m_skidInfo; |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,61 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_VehicleWheel */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_VehicleWheel |
||||||
|
#define _Included_com_jme3_bullet_objects_VehicleWheel |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getWheelLocation |
||||||
|
* Signature: (JILcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelLocation |
||||||
|
(JNIEnv *, jobject, jlong, jint, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getWheelRotation |
||||||
|
* Signature: (JILcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getWheelRotation |
||||||
|
(JNIEnv *, jobject, jlong, jint, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: applyInfo |
||||||
|
* Signature: (JIFFFFFFFFZF)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_applyInfo |
||||||
|
(JNIEnv *, jobject, jlong, jint, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jboolean, jfloat); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getCollisionLocation |
||||||
|
* Signature: (JILcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionLocation |
||||||
|
(JNIEnv *, jobject, jlong, jint, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getCollisionNormal |
||||||
|
* Signature: (JILcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getCollisionNormal |
||||||
|
(JNIEnv *, jobject, jlong, jint, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_VehicleWheel |
||||||
|
* Method: getSkidInfo |
||||||
|
* Signature: (JI)F |
||||||
|
*/ |
||||||
|
JNIEXPORT jfloat JNICALL Java_com_jme3_bullet_objects_VehicleWheel_getSkidInfo |
||||||
|
(JNIEnv *, jobject, jlong, jint); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,138 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_objects_infos_RigidBodyMotionState.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "jmeMotionState.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: createMotionState |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_createMotionState |
||||||
|
(JNIEnv *env, jobject object) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
jmeMotionState* motionState = new jmeMotionState(); |
||||||
|
return reinterpret_cast<jlong>(motionState); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: applyTransform |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Quaternion;)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_applyTransform |
||||||
|
(JNIEnv *env, jobject object, jlong stateId, jobject location, jobject rotation) { |
||||||
|
jmeMotionState* motionState = reinterpret_cast<jmeMotionState*>(stateId); |
||||||
|
if (motionState == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return motionState->applyTransform(env, location, rotation); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldLocation |
||||||
|
(JNIEnv *env, jobject object, jlong stateId, jobject value) { |
||||||
|
jmeMotionState* motionState = reinterpret_cast<jmeMotionState*>(stateId); |
||||||
|
if (motionState == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &motionState->worldTransform.getOrigin(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldRotation |
||||||
|
(JNIEnv *env, jobject object, jlong stateId, jobject value) { |
||||||
|
jmeMotionState* motionState = reinterpret_cast<jmeMotionState*>(stateId); |
||||||
|
if (motionState == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convert(env, &motionState->worldTransform.getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldRotationQuat |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldRotationQuat |
||||||
|
(JNIEnv *env, jobject object, jlong stateId, jobject value) { |
||||||
|
jmeMotionState* motionState = reinterpret_cast<jmeMotionState*>(stateId); |
||||||
|
if (motionState == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
jmeBulletUtil::convertQuat(env, &motionState->worldTransform.getBasis(), value); |
||||||
|
} |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_finalizeNative |
||||||
|
(JNIEnv *env, jobject object, jlong stateId) { |
||||||
|
jmeMotionState* motionState = reinterpret_cast<jmeMotionState*>(stateId); |
||||||
|
if (motionState == NULL) { |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, "The native object does not exist."); |
||||||
|
return; |
||||||
|
} |
||||||
|
delete(motionState); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,61 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_objects_infos_RigidBodyMotionState */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
#define _Included_com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: createMotionState |
||||||
|
* Signature: ()J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_createMotionState |
||||||
|
(JNIEnv *, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: applyTransform |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;Lcom/jme3/math/Quaternion;)Z |
||||||
|
*/ |
||||||
|
JNIEXPORT jboolean JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_applyTransform |
||||||
|
(JNIEnv *, jobject, jlong, jobject, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldLocation |
||||||
|
* Signature: (JLcom/jme3/math/Vector3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldLocation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldRotation |
||||||
|
* Signature: (JLcom/jme3/math/Matrix3f;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldRotation |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: getWorldRotationQuat |
||||||
|
* Signature: (JLcom/jme3/math/Quaternion;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_getWorldRotationQuat |
||||||
|
(JNIEnv *, jobject, jlong, jobject); |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_objects_infos_RigidBodyMotionState |
||||||
|
* Method: finalizeNative |
||||||
|
* Signature: (J)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_objects_infos_RigidBodyMotionState_finalizeNative |
||||||
|
(JNIEnv *, jobject, jlong); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,152 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen, CJ Hare |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_util_DebugShapeFactory.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
#include "BulletCollision/CollisionShapes/btShapeHull.h" |
||||||
|
|
||||||
|
class DebugCallback : public btTriangleCallback, public btInternalTriangleIndexCallback { |
||||||
|
public: |
||||||
|
JNIEnv* env; |
||||||
|
jobject callback; |
||||||
|
|
||||||
|
DebugCallback(JNIEnv* env, jobject object) { |
||||||
|
this->env = env; |
||||||
|
this->callback = object; |
||||||
|
} |
||||||
|
|
||||||
|
virtual void internalProcessTriangleIndex(btVector3* triangle, int partId, int triangleIndex) { |
||||||
|
processTriangle(triangle, partId, triangleIndex); |
||||||
|
} |
||||||
|
|
||||||
|
virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex) { |
||||||
|
btVector3 vertexA, vertexB, vertexC; |
||||||
|
vertexA = triangle[0]; |
||||||
|
vertexB = triangle[1]; |
||||||
|
vertexC = triangle[2]; |
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexA.getX(), vertexA.getY(), vertexA.getZ(), partId, triangleIndex); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
// triangle =
|
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexB.getX(), vertexB.getY(), vertexB.getZ(), partId, triangleIndex); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexC.getX(), vertexC.getY(), vertexC.getZ(), partId, triangleIndex); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/* Inaccessible static: _00024assertionsDisabled */ |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_util_DebugShapeFactory |
||||||
|
* Method: getVertices |
||||||
|
* Signature: (JLcom/jme3/bullet/util/DebugMeshCallback;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getVertices |
||||||
|
(JNIEnv *env, jclass clazz, jlong shapeId, jobject callback) { |
||||||
|
btCollisionShape* shape = reinterpret_cast<btCollisionShape*>(shapeId); |
||||||
|
if (shape->isConcave()) { |
||||||
|
btConcaveShape* concave = reinterpret_cast<btConcaveShape*>(shape); |
||||||
|
DebugCallback* clb = new DebugCallback(env, callback); |
||||||
|
btVector3 min = btVector3(-1e30, -1e30, -1e30); |
||||||
|
btVector3 max = btVector3(1e30, 1e30, 1e30); |
||||||
|
concave->processAllTriangles(clb, min, max); |
||||||
|
delete(clb); |
||||||
|
} else if (shape->isConvex()) { |
||||||
|
btConvexShape* convexShape = reinterpret_cast<btConvexShape*>(shape); |
||||||
|
// Check there is a hull shape to render
|
||||||
|
if (convexShape->getUserPointer() == NULL) { |
||||||
|
// create a hull approximation
|
||||||
|
btShapeHull* hull = new btShapeHull(convexShape); |
||||||
|
float margin = convexShape->getMargin(); |
||||||
|
hull->buildHull(margin); |
||||||
|
convexShape->setUserPointer(hull); |
||||||
|
} |
||||||
|
|
||||||
|
btShapeHull* hull = (btShapeHull*) convexShape->getUserPointer(); |
||||||
|
|
||||||
|
int numberOfTriangles = hull->numTriangles(); |
||||||
|
int numberOfFloats = 3 * 3 * numberOfTriangles; |
||||||
|
int byteBufferSize = numberOfFloats * 4; |
||||||
|
|
||||||
|
// Loop variables
|
||||||
|
const unsigned int* hullIndices = hull->getIndexPointer(); |
||||||
|
const btVector3* hullVertices = hull->getVertexPointer(); |
||||||
|
btVector3 vertexA, vertexB, vertexC; |
||||||
|
int index = 0; |
||||||
|
|
||||||
|
for (int i = 0; i < numberOfTriangles; i++) { |
||||||
|
// Grab the data for this triangle from the hull
|
||||||
|
vertexA = hullVertices[hullIndices[index++]]; |
||||||
|
vertexB = hullVertices[hullIndices[index++]]; |
||||||
|
vertexC = hullVertices[hullIndices[index++]]; |
||||||
|
|
||||||
|
// Put the verticies into the vertex buffer
|
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexA.getX(), vertexA.getY(), vertexA.getZ()); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexB.getX(), vertexB.getY(), vertexB.getZ()); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->CallVoidMethod(callback, jmeClasses::DebugMeshCallback_addVector, vertexC.getX(), vertexC.getY(), vertexC.getZ()); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
delete hull; |
||||||
|
convexShape->setUserPointer(NULL); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_util_DebugShapeFactory */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_util_DebugShapeFactory |
||||||
|
#define _Included_com_jme3_bullet_util_DebugShapeFactory |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_util_DebugShapeFactory |
||||||
|
* Method: getVertices |
||||||
|
* Signature: (JLcom/jme3/bullet/util/DebugMeshCallback;)V |
||||||
|
*/ |
||||||
|
JNIEXPORT void JNICALL Java_com_jme3_bullet_util_DebugShapeFactory_getVertices |
||||||
|
(JNIEnv *, jclass, jlong, jobject); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,59 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
#include "com_jme3_bullet_util_NativeMeshUtil.h" |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_util_NativeMeshUtil |
||||||
|
* Method: createTriangleIndexVertexArray |
||||||
|
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIII)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_util_NativeMeshUtil_createTriangleIndexVertexArray |
||||||
|
(JNIEnv * env, jclass cls, jobject triangleIndexBase, jobject vertexIndexBase, jint numTriangles, jint numVertices, jint vertexStride, jint triangleIndexStride) { |
||||||
|
jmeClasses::initJavaClasses(env); |
||||||
|
int* triangles = (int*) env->GetDirectBufferAddress(triangleIndexBase); |
||||||
|
float* vertices = (float*) env->GetDirectBufferAddress(vertexIndexBase); |
||||||
|
btTriangleIndexVertexArray* array = new btTriangleIndexVertexArray(numTriangles, triangles, triangleIndexStride, numVertices, vertices, vertexStride); |
||||||
|
return reinterpret_cast<jlong>(array); |
||||||
|
} |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
@ -0,0 +1,21 @@ |
|||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */ |
||||||
|
#include <jni.h> |
||||||
|
/* Header for class com_jme3_bullet_util_NativeMeshUtil */ |
||||||
|
|
||||||
|
#ifndef _Included_com_jme3_bullet_util_NativeMeshUtil |
||||||
|
#define _Included_com_jme3_bullet_util_NativeMeshUtil |
||||||
|
#ifdef __cplusplus |
||||||
|
extern "C" { |
||||||
|
#endif |
||||||
|
/*
|
||||||
|
* Class: com_jme3_bullet_util_NativeMeshUtil |
||||||
|
* Method: createTriangleIndexVertexArray |
||||||
|
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIII)J |
||||||
|
*/ |
||||||
|
JNIEXPORT jlong JNICALL Java_com_jme3_bullet_util_NativeMeshUtil_createTriangleIndexVertexArray |
||||||
|
(JNIEnv *, jclass, jobject, jobject, jint, jint, jint, jint); |
||||||
|
|
||||||
|
#ifdef __cplusplus |
||||||
|
} |
||||||
|
#endif |
||||||
|
#endif |
@ -0,0 +1,327 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
#include <math.h> |
||||||
|
#include "jmeBulletUtil.h" |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen,Empire Phoenix, Lutherion |
||||||
|
*/ |
||||||
|
void jmeBulletUtil::convert(JNIEnv* env, jobject in, btVector3* out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
float x = env->GetFloatField(in, jmeClasses::Vector3f_x); //env->CallFloatMethod(in, jmeClasses::Vector3f_getX);
|
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float y = env->GetFloatField(in, jmeClasses::Vector3f_y); //env->CallFloatMethod(in, jmeClasses::Vector3f_getY);
|
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float z = env->GetFloatField(in, jmeClasses::Vector3f_z); //env->CallFloatMethod(in, jmeClasses::Vector3f_getZ);
|
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
out->setX(x); |
||||||
|
out->setY(y); |
||||||
|
out->setZ(z); |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::convert(JNIEnv* env, const btVector3* in, jobject out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
float x = in->getX(); |
||||||
|
float y = in->getY(); |
||||||
|
float z = in->getZ(); |
||||||
|
env->SetFloatField(out, jmeClasses::Vector3f_x, x); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Vector3f_y, y); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Vector3f_z, z); |
||||||
|
// env->CallObjectMethod(out, jmeClasses::Vector3f_set, x, y, z);
|
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::convert(JNIEnv* env, jobject in, btMatrix3x3* out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
float m00 = env->GetFloatField(in, jmeClasses::Matrix3f_m00); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m01 = env->GetFloatField(in, jmeClasses::Matrix3f_m01); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m02 = env->GetFloatField(in, jmeClasses::Matrix3f_m02); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m10 = env->GetFloatField(in, jmeClasses::Matrix3f_m10); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m11 = env->GetFloatField(in, jmeClasses::Matrix3f_m11); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m12 = env->GetFloatField(in, jmeClasses::Matrix3f_m12); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m20 = env->GetFloatField(in, jmeClasses::Matrix3f_m20); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m21 = env->GetFloatField(in, jmeClasses::Matrix3f_m21); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float m22 = env->GetFloatField(in, jmeClasses::Matrix3f_m22); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
out->setValue(m00, m01, m02, m10, m11, m12, m20, m21, m22); |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::convert(JNIEnv* env, const btMatrix3x3* in, jobject out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
float m00 = in->getRow(0).m_floats[0]; |
||||||
|
float m01 = in->getRow(0).m_floats[1]; |
||||||
|
float m02 = in->getRow(0).m_floats[2]; |
||||||
|
float m10 = in->getRow(1).m_floats[0]; |
||||||
|
float m11 = in->getRow(1).m_floats[1]; |
||||||
|
float m12 = in->getRow(1).m_floats[2]; |
||||||
|
float m20 = in->getRow(2).m_floats[0]; |
||||||
|
float m21 = in->getRow(2).m_floats[1]; |
||||||
|
float m22 = in->getRow(2).m_floats[2]; |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m00, m00); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m01, m01); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m02, m02); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m10, m10); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m11, m11); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m12, m12); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m20, m20); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m21, m21); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Matrix3f_m22, m22); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::convertQuat(JNIEnv* env, jobject in, btMatrix3x3* out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
float x = env->GetFloatField(in, jmeClasses::Quaternion_x); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float y = env->GetFloatField(in, jmeClasses::Quaternion_y); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float z = env->GetFloatField(in, jmeClasses::Quaternion_z); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
float w = env->GetFloatField(in, jmeClasses::Quaternion_w); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
float norm = w * w + x * x + y * y + z * z; |
||||||
|
float s = (norm == 1.0) ? 2.0 : (norm > 0.1) ? 2.0 / norm : 0.0; |
||||||
|
|
||||||
|
// compute xs/ys/zs first to save 6 multiplications, since xs/ys/zs
|
||||||
|
// will be used 2-4 times each.
|
||||||
|
float xs = x * s; |
||||||
|
float ys = y * s; |
||||||
|
float zs = z * s; |
||||||
|
float xx = x * xs; |
||||||
|
float xy = x * ys; |
||||||
|
float xz = x * zs; |
||||||
|
float xw = w * xs; |
||||||
|
float yy = y * ys; |
||||||
|
float yz = y * zs; |
||||||
|
float yw = w * ys; |
||||||
|
float zz = z * zs; |
||||||
|
float zw = w * zs; |
||||||
|
|
||||||
|
// using s=2/norm (instead of 1/norm) saves 9 multiplications by 2 here
|
||||||
|
out->setValue(1.0 - (yy + zz), (xy - zw), (xz + yw), |
||||||
|
(xy + zw), 1 - (xx + zz), (yz - xw), |
||||||
|
(xz - yw), (yz + xw), 1.0 - (xx + yy)); |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::convertQuat(JNIEnv* env, const btMatrix3x3* in, jobject out) { |
||||||
|
if (in == NULL || out == NULL) { |
||||||
|
jmeClasses::throwNPE(env); |
||||||
|
} |
||||||
|
// the trace is the sum of the diagonal elements; see
|
||||||
|
// http://mathworld.wolfram.com/MatrixTrace.html
|
||||||
|
float t = in->getRow(0).m_floats[0] + in->getRow(1).m_floats[1] + in->getRow(2).m_floats[2]; |
||||||
|
float w, x, y, z; |
||||||
|
// we protect the division by s by ensuring that s>=1
|
||||||
|
if (t >= 0) { // |w| >= .5
|
||||||
|
float s = sqrt(t + 1); // |s|>=1 ...
|
||||||
|
w = 0.5f * s; |
||||||
|
s = 0.5f / s; // so this division isn't bad
|
||||||
|
x = (in->getRow(2).m_floats[1] - in->getRow(1).m_floats[2]) * s; |
||||||
|
y = (in->getRow(0).m_floats[2] - in->getRow(2).m_floats[0]) * s; |
||||||
|
z = (in->getRow(1).m_floats[0] - in->getRow(0).m_floats[1]) * s; |
||||||
|
} else if ((in->getRow(0).m_floats[0] > in->getRow(1).m_floats[1]) && (in->getRow(0).m_floats[0] > in->getRow(2).m_floats[2])) { |
||||||
|
float s = sqrt(1.0f + in->getRow(0).m_floats[0] - in->getRow(1).m_floats[1] - in->getRow(2).m_floats[2]); // |s|>=1
|
||||||
|
x = s * 0.5f; // |x| >= .5
|
||||||
|
s = 0.5f / s; |
||||||
|
y = (in->getRow(1).m_floats[0] + in->getRow(0).m_floats[1]) * s; |
||||||
|
z = (in->getRow(0).m_floats[2] + in->getRow(2).m_floats[0]) * s; |
||||||
|
w = (in->getRow(2).m_floats[1] - in->getRow(1).m_floats[2]) * s; |
||||||
|
} else if (in->getRow(1).m_floats[1] > in->getRow(2).m_floats[2]) { |
||||||
|
float s = sqrt(1.0f + in->getRow(1).m_floats[1] - in->getRow(0).m_floats[0] - in->getRow(2).m_floats[2]); // |s|>=1
|
||||||
|
y = s * 0.5f; // |y| >= .5
|
||||||
|
s = 0.5f / s; |
||||||
|
x = (in->getRow(1).m_floats[0] + in->getRow(0).m_floats[1]) * s; |
||||||
|
z = (in->getRow(2).m_floats[1] + in->getRow(1).m_floats[2]) * s; |
||||||
|
w = (in->getRow(0).m_floats[2] - in->getRow(2).m_floats[0]) * s; |
||||||
|
} else { |
||||||
|
float s = sqrt(1.0f + in->getRow(2).m_floats[2] - in->getRow(0).m_floats[0] - in->getRow(1).m_floats[1]); // |s|>=1
|
||||||
|
z = s * 0.5f; // |z| >= .5
|
||||||
|
s = 0.5f / s; |
||||||
|
x = (in->getRow(0).m_floats[2] + in->getRow(2).m_floats[0]) * s; |
||||||
|
y = (in->getRow(2).m_floats[1] + in->getRow(1).m_floats[2]) * s; |
||||||
|
w = (in->getRow(1).m_floats[0] - in->getRow(0).m_floats[1]) * s; |
||||||
|
} |
||||||
|
|
||||||
|
env->SetFloatField(out, jmeClasses::Quaternion_x, x); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Quaternion_y, y); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Quaternion_z, z); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
env->SetFloatField(out, jmeClasses::Quaternion_w, w); |
||||||
|
// env->CallObjectMethod(out, jmeClasses::Quaternion_set, x, y, z, w);
|
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmeBulletUtil::addResult(JNIEnv* env, jobject resultlist, btVector3 hitnormal, btVector3 m_hitPointWorld, btScalar m_hitFraction, btCollisionObject* hitobject) { |
||||||
|
|
||||||
|
jobject singleresult = env->AllocObject(jmeClasses::PhysicsRay_Class); |
||||||
|
jobject hitnormalvec = env->AllocObject(jmeClasses::Vector3f); |
||||||
|
|
||||||
|
convert(env, const_cast<btVector3*> (&hitnormal), hitnormalvec); |
||||||
|
jmeUserPointer *up1 = (jmeUserPointer*) hitobject -> getUserPointer(); |
||||||
|
|
||||||
|
env->SetObjectField(singleresult, jmeClasses::PhysicsRay_normalInWorldSpace, hitnormalvec); |
||||||
|
env->SetFloatField(singleresult, jmeClasses::PhysicsRay_hitfraction, m_hitFraction); |
||||||
|
|
||||||
|
env->SetObjectField(singleresult, jmeClasses::PhysicsRay_collisionObject, up1->javaCollisionObject); |
||||||
|
env->CallVoidMethod(resultlist, jmeClasses::PhysicsRay_addmethod, singleresult); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
#include "jmeClasses.h" |
||||||
|
#include "btBulletDynamicsCommon.h" |
||||||
|
#include "btBulletCollisionCommon.h" |
||||||
|
#include "LinearMath/btVector3.h" |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen |
||||||
|
*/ |
||||||
|
class jmeBulletUtil{ |
||||||
|
public: |
||||||
|
static void convert(JNIEnv* env, jobject in, btVector3* out); |
||||||
|
static void convert(JNIEnv* env, const btVector3* in, jobject out); |
||||||
|
static void convert(JNIEnv* env, jobject in, btMatrix3x3* out); |
||||||
|
static void convert(JNIEnv* env, const btMatrix3x3* in, jobject out); |
||||||
|
static void convertQuat(JNIEnv* env, jobject in, btMatrix3x3* out); |
||||||
|
static void convertQuat(JNIEnv* env, const btMatrix3x3* in, jobject out); |
||||||
|
static void addResult(JNIEnv* env, jobject resultlist, const btVector3 hitnormal,const btVector3 m_hitPointWorld,const btScalar m_hitFraction,btCollisionObject* hitobject); |
||||||
|
private: |
||||||
|
jmeBulletUtil(){}; |
||||||
|
~jmeBulletUtil(){}; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
class jmeUserPointer { |
||||||
|
public: |
||||||
|
jobject javaCollisionObject; |
||||||
|
jint group; |
||||||
|
jint groups; |
||||||
|
void *space; |
||||||
|
}; |
@ -0,0 +1,250 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2010 jMonkeyEngine |
||||||
|
* All rights reserved. |
||||||
|
* |
||||||
|
* Redistribution and use in source and binary forms, with or without |
||||||
|
* modification, are permitted provided that the following conditions are |
||||||
|
* met: |
||||||
|
* |
||||||
|
* * Redistributions of source code must retain the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer. |
||||||
|
* |
||||||
|
* * Redistributions in binary form must reproduce the above copyright |
||||||
|
* notice, this list of conditions and the following disclaimer in the |
||||||
|
* documentation and/or other materials provided with the distribution. |
||||||
|
* |
||||||
|
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors |
||||||
|
* may be used to endorse or promote products derived from this software |
||||||
|
* without specific prior written permission. |
||||||
|
* |
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||||
|
*/ |
||||||
|
#include "jmeClasses.h" |
||||||
|
#include <stdio.h> |
||||||
|
|
||||||
|
/**
|
||||||
|
* Author: Normen Hansen,Empire Phoenix, Lutherion |
||||||
|
*/ |
||||||
|
//public fields
|
||||||
|
jclass jmeClasses::PhysicsSpace; |
||||||
|
jmethodID jmeClasses::PhysicsSpace_preTick; |
||||||
|
jmethodID jmeClasses::PhysicsSpace_postTick; |
||||||
|
jmethodID jmeClasses::PhysicsSpace_addCollisionEvent; |
||||||
|
|
||||||
|
jclass jmeClasses::PhysicsGhostObject; |
||||||
|
jmethodID jmeClasses::PhysicsGhostObject_addOverlappingObject; |
||||||
|
|
||||||
|
jclass jmeClasses::Vector3f; |
||||||
|
jmethodID jmeClasses::Vector3f_set; |
||||||
|
jmethodID jmeClasses::Vector3f_toArray; |
||||||
|
jmethodID jmeClasses::Vector3f_getX; |
||||||
|
jmethodID jmeClasses::Vector3f_getY; |
||||||
|
jmethodID jmeClasses::Vector3f_getZ; |
||||||
|
jfieldID jmeClasses::Vector3f_x; |
||||||
|
jfieldID jmeClasses::Vector3f_y; |
||||||
|
jfieldID jmeClasses::Vector3f_z; |
||||||
|
|
||||||
|
jclass jmeClasses::Quaternion; |
||||||
|
jmethodID jmeClasses::Quaternion_set; |
||||||
|
jmethodID jmeClasses::Quaternion_getX; |
||||||
|
jmethodID jmeClasses::Quaternion_getY; |
||||||
|
jmethodID jmeClasses::Quaternion_getZ; |
||||||
|
jmethodID jmeClasses::Quaternion_getW; |
||||||
|
jfieldID jmeClasses::Quaternion_x; |
||||||
|
jfieldID jmeClasses::Quaternion_y; |
||||||
|
jfieldID jmeClasses::Quaternion_z; |
||||||
|
jfieldID jmeClasses::Quaternion_w; |
||||||
|
|
||||||
|
jclass jmeClasses::Matrix3f; |
||||||
|
jmethodID jmeClasses::Matrix3f_set; |
||||||
|
jmethodID jmeClasses::Matrix3f_get; |
||||||
|
jfieldID jmeClasses::Matrix3f_m00; |
||||||
|
jfieldID jmeClasses::Matrix3f_m01; |
||||||
|
jfieldID jmeClasses::Matrix3f_m02; |
||||||
|
jfieldID jmeClasses::Matrix3f_m10; |
||||||
|
jfieldID jmeClasses::Matrix3f_m11; |
||||||
|
jfieldID jmeClasses::Matrix3f_m12; |
||||||
|
jfieldID jmeClasses::Matrix3f_m20; |
||||||
|
jfieldID jmeClasses::Matrix3f_m21; |
||||||
|
jfieldID jmeClasses::Matrix3f_m22; |
||||||
|
|
||||||
|
jclass jmeClasses::DebugMeshCallback; |
||||||
|
jmethodID jmeClasses::DebugMeshCallback_addVector; |
||||||
|
|
||||||
|
jclass jmeClasses::PhysicsRay_Class; |
||||||
|
jmethodID jmeClasses::PhysicsRay_newSingleResult; |
||||||
|
|
||||||
|
jfieldID jmeClasses::PhysicsRay_normalInWorldSpace; |
||||||
|
jfieldID jmeClasses::PhysicsRay_hitfraction; |
||||||
|
jfieldID jmeClasses::PhysicsRay_collisionObject; |
||||||
|
|
||||||
|
jclass jmeClasses::PhysicsRay_listresult; |
||||||
|
jmethodID jmeClasses::PhysicsRay_addmethod; |
||||||
|
|
||||||
|
//private fields
|
||||||
|
//JNIEnv* jmeClasses::env;
|
||||||
|
JavaVM* jmeClasses::vm; |
||||||
|
|
||||||
|
void jmeClasses::initJavaClasses(JNIEnv* env) { |
||||||
|
// if (env != NULL) {
|
||||||
|
// fprintf(stdout, "Check Java VM state\n");
|
||||||
|
// fflush(stdout);
|
||||||
|
// int res = vm->AttachCurrentThread((void**) &jmeClasses::env, NULL);
|
||||||
|
// if (res < 0) {
|
||||||
|
// fprintf(stdout, "** ERROR: getting Java env!\n");
|
||||||
|
// if (res == JNI_EVERSION) fprintf(stdout, "GetEnv Error because of different JNI Version!\n");
|
||||||
|
// fflush(stdout);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if(PhysicsSpace!=NULL) return; |
||||||
|
fprintf(stdout, "Bullet-Native: Initializing java classes\n"); |
||||||
|
fflush(stdout); |
||||||
|
// jmeClasses::env = env;
|
||||||
|
env->GetJavaVM(&vm); |
||||||
|
|
||||||
|
PhysicsSpace = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/PhysicsSpace")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsSpace_preTick = env->GetMethodID(PhysicsSpace, "preTick_native", "(F)V"); |
||||||
|
PhysicsSpace_postTick = env->GetMethodID(PhysicsSpace, "postTick_native", "(F)V"); |
||||||
|
PhysicsSpace_addCollisionEvent = env->GetMethodID(PhysicsSpace, "addCollisionEvent_native","(Lcom/jme3/bullet/collision/PhysicsCollisionObject;Lcom/jme3/bullet/collision/PhysicsCollisionObject;J)V"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsGhostObject = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/objects/PhysicsGhostObject")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
PhysicsGhostObject_addOverlappingObject = env->GetMethodID(PhysicsGhostObject, "addOverlappingObject_native","(Lcom/jme3/bullet/collision/PhysicsCollisionObject;)V"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
Vector3f = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Vector3f")); |
||||||
|
Vector3f_set = env->GetMethodID(Vector3f, "set", "(FFF)Lcom/jme3/math/Vector3f;"); |
||||||
|
Vector3f_toArray = env->GetMethodID(Vector3f, "toArray", "([F)[F"); |
||||||
|
Vector3f_getX = env->GetMethodID(Vector3f, "getX", "()F"); |
||||||
|
Vector3f_getY = env->GetMethodID(Vector3f, "getY", "()F"); |
||||||
|
Vector3f_getZ = env->GetMethodID(Vector3f, "getZ", "()F"); |
||||||
|
Vector3f_x = env->GetFieldID(Vector3f, "x", "F"); |
||||||
|
Vector3f_y = env->GetFieldID(Vector3f, "y", "F"); |
||||||
|
Vector3f_z = env->GetFieldID(Vector3f, "z", "F"); |
||||||
|
|
||||||
|
Quaternion = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Quaternion")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
Quaternion_set = env->GetMethodID(Quaternion, "set", "(FFFF)Lcom/jme3/math/Quaternion;"); |
||||||
|
Quaternion_getW = env->GetMethodID(Quaternion, "getW", "()F"); |
||||||
|
Quaternion_getX = env->GetMethodID(Quaternion, "getX", "()F"); |
||||||
|
Quaternion_getY = env->GetMethodID(Quaternion, "getY", "()F"); |
||||||
|
Quaternion_getZ = env->GetMethodID(Quaternion, "getZ", "()F"); |
||||||
|
Quaternion_x = env->GetFieldID(Quaternion, "x", "F"); |
||||||
|
Quaternion_y = env->GetFieldID(Quaternion, "y", "F"); |
||||||
|
Quaternion_z = env->GetFieldID(Quaternion, "z", "F"); |
||||||
|
Quaternion_w = env->GetFieldID(Quaternion, "w", "F"); |
||||||
|
|
||||||
|
Matrix3f = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Matrix3f")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
Matrix3f_set = env->GetMethodID(Matrix3f, "set", "(IIF)Lcom/jme3/math/Matrix3f;"); |
||||||
|
Matrix3f_get = env->GetMethodID(Matrix3f, "get", "(II)F"); |
||||||
|
Matrix3f_m00 = env->GetFieldID(Matrix3f, "m00", "F"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
Matrix3f_m01 = env->GetFieldID(Matrix3f, "m01", "F"); |
||||||
|
Matrix3f_m02 = env->GetFieldID(Matrix3f, "m02", "F"); |
||||||
|
Matrix3f_m10 = env->GetFieldID(Matrix3f, "m10", "F"); |
||||||
|
Matrix3f_m11 = env->GetFieldID(Matrix3f, "m11", "F"); |
||||||
|
Matrix3f_m12 = env->GetFieldID(Matrix3f, "m12", "F"); |
||||||
|
Matrix3f_m20 = env->GetFieldID(Matrix3f, "m20", "F"); |
||||||
|
Matrix3f_m21 = env->GetFieldID(Matrix3f, "m21", "F"); |
||||||
|
Matrix3f_m22 = env->GetFieldID(Matrix3f, "m22", "F"); |
||||||
|
|
||||||
|
DebugMeshCallback = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/util/DebugMeshCallback")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
DebugMeshCallback_addVector = env->GetMethodID(DebugMeshCallback, "addVector", "(FFFII)V"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRay_Class = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/collision/PhysicsRayTestResult")); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRay_newSingleResult = env->GetMethodID(PhysicsRay_Class,"<init>","()V"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRay_normalInWorldSpace = env->GetFieldID(PhysicsRay_Class,"hitNormalLocal","Lcom/jme3/math/Vector3f;"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
PhysicsRay_hitfraction = env->GetFieldID(PhysicsRay_Class,"hitFraction","F"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
PhysicsRay_collisionObject = env->GetFieldID(PhysicsRay_Class,"collisionObject","Lcom/jme3/bullet/collision/PhysicsCollisionObject;"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRay_listresult = env->FindClass("java/util/List"); |
||||||
|
PhysicsRay_listresult = (jclass)env->NewGlobalRef(PhysicsRay_listresult); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
PhysicsRay_addmethod = env->GetMethodID(PhysicsRay_listresult,"add","(Ljava/lang/Object;)Z"); |
||||||
|
if (env->ExceptionCheck()) { |
||||||
|
env->Throw(env->ExceptionOccurred()); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void jmeClasses::throwNPE(JNIEnv* env) { |
||||||
|
if (env == NULL) return; |
||||||
|
jclass newExc = env->FindClass("java/lang/NullPointerException"); |
||||||
|
env->ThrowNew(newExc, ""); |
||||||
|
return; |
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue