Skip to content

Commit

Permalink
Merge pull request #58 from fabmax/upgrade-to-physx-5.2.1
Browse files Browse the repository at this point in the history
Upgrade to physx 5.2.1
  • Loading branch information
fabmax authored Jul 2, 2023
2 parents 709158e + 26ac4dc commit 0ae1ab5
Show file tree
Hide file tree
Showing 35 changed files with 381 additions and 185 deletions.
2 changes: 1 addition & 1 deletion PhysX
Submodule PhysX updated 726 files
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.fabmax/physx-jni/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.fabmax/physx-jni)
![Build](https://github.com/fabmax/physx-jni/workflows/Build/badge.svg)

Java JNI bindings for Nvidia [PhysX 5.1.3](https://github.com/NVIDIA-Omniverse/PhysX).
Java JNI bindings for Nvidia [PhysX 5.2.1](https://github.com/NVIDIA-Omniverse/PhysX).

## How to use
The library is published on maven central, so you can easily add this to your dependencies:
```
dependencies {
// java bindings
implementation("de.fabmax:physx-jni:2.1.0")
implementation("de.fabmax:physx-jni:2.2.1")
// native libraries, you can add the one matching your system or all
runtimeOnly("de.fabmax:physx-jni:2.1.0:natives-windows")
runtimeOnly("de.fabmax:physx-jni:2.1.0:natives-linux")
runtimeOnly("de.fabmax:physx-jni:2.1.0:natives-macos")
runtimeOnly("de.fabmax:physx-jni:2.1.0:natives-macos-arm64")
// native libraries - you can add the one matching your system or all
runtimeOnly("de.fabmax:physx-jni:2.2.1:natives-windows")
runtimeOnly("de.fabmax:physx-jni:2.2.1:natives-linux")
runtimeOnly("de.fabmax:physx-jni:2.2.1:natives-macos")
runtimeOnly("de.fabmax:physx-jni:2.2.1:natives-macos-arm64")
}
```

Expand Down Expand Up @@ -84,7 +84,7 @@ They are more or less 1:1 translations of the corresponding PhysX example snippe
### Documentation
The generated bindings contain most of the original documentation converted to javadoc. For further reading
there is also the official
[PhysX documentation](https://nvidia-omniverse.github.io/PhysX/physx/5.1.3/index.html).
[PhysX documentation](https://nvidia-omniverse.github.io/PhysX/physx/5.2.1/index.html).

### Things to consider when working with native objects
Whenever you create an instance of a wrapper class within this library, this also creates an object on the native
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ subprojects {
apply(plugin = "maven-publish")

group = "de.fabmax"
version = "2.1.0"
version = "2.2.1"

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/Generators.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ open class GenerateJavaBindings : DefaultTask() {
@Input
var generatorOutput = "./generated"
@Input
var physxIncludeDir = "../Physx/physx/include"
var physxIncludeDir = "../PhysX/physx/include"

@TaskAction
fun generate() {
Expand Down Expand Up @@ -118,4 +118,4 @@ open class GenerateNativeGlueCode : DefaultTask() {
}
}.generate(model)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibLinux extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("libPhysXJniBindings_64.so");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibLinux extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("libPhysXJniBindings_64.so");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibMacosArm64 extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("libPhysXJniBindings_64.dylib");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibMacos extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("libPhysXJniBindings_64.dylib");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibWindows extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("PhysX_64.dll");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class NativeLibWindows extends NativeLib {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final List<String> libraries = new ArrayList<>() {{
add("PhysX_64.dll");
Expand Down
2 changes: 1 addition & 1 deletion physx-jni/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks.register<GenerateJavaBindings>("generateJniBindings") {
idlModelName = "PhysXJni"
idlSource = File("${projectDir}/src/main/webidl/").absolutePath
generatorOutput = File("${projectDir}/src/main/generated/physx").absolutePath
physxIncludeDir = "$rootDir/Physx/physx/include"
physxIncludeDir = "$rootDir/PhysX/physx/include"
}

tasks.compileJava {
Expand Down
2 changes: 1 addition & 1 deletion physx-jni/src/main/java/de/fabmax/physxjni/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class Loader {

private static final String version = "2.1.0";
private static final String version = "2.2.1";

private static final AtomicBoolean isLoaded = new AtomicBoolean(false);

Expand Down
2 changes: 1 addition & 1 deletion physx-jni/src/main/webidl/PxTopLevel.idl
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ interface PxTopLevelFunctions {
static PxHeightField CreateHeightField([Const, Ref] PxHeightFieldDesc desc);

// PxCooking is deprecated, only needed for scene serialization
static PxCooking CreateCooking(unsigned long version, [Ref] PxFoundation foundation, [Const, Ref] PxCookingParams scale);
//static PxCooking CreateCooking(unsigned long version, [Ref] PxFoundation foundation, [Const, Ref] PxCookingParams scale);
};
21 changes: 4 additions & 17 deletions physx-jni/src/main/webidl/common/PxCuda.idl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ interface PxCudaContextManager {
unsigned long getMaxThreadsPerBlock();
[Const] DOMString getDeviceName();
CUdevice getDevice();
PxCudaInteropModeEnum getInteropMode();
void setUsingConcurrentStreams(boolean flag);
boolean getUsingConcurrentStreams();
long usingDedicatedGPU();
Expand All @@ -94,15 +93,6 @@ interface PxCudaContextManagerDesc {
attribute CUcontext ctx;
attribute VoidPtr graphicsDevice;
attribute DOMString appGUID;
attribute PxCudaInteropModeEnum interopMode;
};

[Platforms="windows;linux"]
enum PxCudaInteropModeEnum {
"PxCudaInteropModeEnum::NO_INTEROP",
"PxCudaInteropModeEnum::D3D10_INTEROP",
"PxCudaInteropModeEnum::D3D11_INTEROP",
"PxCudaInteropModeEnum::OGL_INTEROP"
};

[Platforms="windows;linux", Prefix="physx::"]
Expand Down Expand Up @@ -392,7 +382,7 @@ interface PxParticlePhaseFlags {
interface PxParticleRigidAttachment {
void PxParticleRigidAttachment();
[Value] attribute PxVec4 mLocalPose0;
[Value] attribute PxConeLimitParams mParams;
[Value] attribute PxConeLimitParams mConeLimitParams;
};
PxParticleRigidAttachment implements PxParticleRigidFilterPair;

Expand All @@ -407,8 +397,7 @@ interface PxParticleRigidFilterPair {
enum PxParticleSolverTypeEnum {
"PxParticleSolverTypeEnum::ePBD",
"PxParticleSolverTypeEnum::eFLIP",
"PxParticleSolverTypeEnum::eMPM",
"PxParticleSolverTypeEnum::eCUSTOM"
"PxParticleSolverTypeEnum::eMPM"
};

[Platforms="windows;linux", Prefix="physx::", StackAllocatable]
Expand Down Expand Up @@ -449,10 +438,8 @@ interface PxParticleSystem {
void enableCCD(boolean enable);
unsigned long createPhase(PxParticleMaterial material, [Ref] PxParticlePhaseFlags flags);
unsigned long getNbParticleMaterials();
// void setParticleSystemCallback(PxParticleSystemCallback callback);
// PxParticleSystemCallback getParticleSystemCallback();
void setPeriodicBoundary([Const, Ref] PxVec3 boundary);
[Value] PxVec3 getPeriodicBoundary();
void setParticleSystemCallback(PxParticleSystemCallback callback);
PxParticleSystemCallback getParticleSystemCallback();
void addParticleBuffer(PxParticleBuffer particleBuffer);
void removeParticleBuffer(PxParticleBuffer particleBuffer);
unsigned long getGpuParticleSystemIndex();
Expand Down
61 changes: 61 additions & 0 deletions physx-jni/src/main/webidl/common/PxDebugDrawer.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/****************************************
* [package=common]
****************************************/

[Prefix="physx::", NoDelete]
interface PxDebugPoint {
[Value] attribute PxVec3 pos;
attribute unsigned long color;
};

[Prefix="physx::", NoDelete]
interface PxDebugLine {
[Value] attribute PxVec3 pos0;
attribute unsigned long color0;
[Value] attribute PxVec3 pos1;
attribute unsigned long color1;
};

[Prefix="physx::", NoDelete]
interface PxDebugTriangle {
[Value] attribute PxVec3 pos0;
attribute unsigned long color0;
[Value] attribute PxVec3 pos1;
attribute unsigned long color1;
[Value] attribute PxVec3 pos2;
attribute unsigned long color2;
};

[Prefix="physx::", NoDelete]
interface PxRenderBuffer {
unsigned long getNbPoints();
[Const] PxDebugPoint getPoints();
void addPoint([Const, Ref] PxDebugPoint point);
unsigned long getNbLines();
[Const] PxDebugLine getLines();
void addLine([Const, Ref] PxDebugLine line);
PxDebugLine reserveLines([Const] unsigned long nbLines);
PxDebugPoint reservePoints([Const] unsigned long nbLines);
unsigned long getNbTriangles();
[Const] PxDebugTriangle getTriangles();
void addTriangle([Const, Ref] PxDebugTriangle triangle);
void append([Const, Ref] PxRenderBuffer other);
void clear();
void shift([Const, Ref] PxVec3 delta);
boolean empty();
};

enum PxDebugColorEnum {
"PxDebugColorEnum::eARGB_BLACK",
"PxDebugColorEnum::eARGB_RED",
"PxDebugColorEnum::eARGB_GREEN",
"PxDebugColorEnum::eARGB_BLUE",
"PxDebugColorEnum::eARGB_YELLOW",
"PxDebugColorEnum::eARGB_MAGENTA",
"PxDebugColorEnum::eARGB_CYAN",
"PxDebugColorEnum::eARGB_WHITE",
"PxDebugColorEnum::eARGB_GREY",
"PxDebugColorEnum::eARGB_DARKRED",
"PxDebugColorEnum::eARGB_DARKGREEN",
"PxDebugColorEnum::eARGB_DARKBLUE"
};
14 changes: 7 additions & 7 deletions physx-jni/src/main/webidl/cooking/PxCooking.idl
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ enum PxConvexMeshCookingTypeEnum {
};

// PxCooking is deprecated, use PxTopLevelFunctions instead; however, PxSerialization needs PxCooking
[Prefix="physx::", NoDelete]
interface PxCooking {
void release();
PxConvexMesh createConvexMesh([Const, Ref] PxConvexMeshDesc desc, [Ref] PxInsertionCallback insertionCallback);
PxTriangleMesh createTriangleMesh([Const, Ref] PxTriangleMeshDesc desc, [Ref] PxInsertionCallback insertionCallback);
PxHeightField createHeightField([Const, Ref] PxHeightFieldDesc desc, [Ref] PxInsertionCallback insertionCallback);
};
//[Prefix="physx::", NoDelete]
//interface PxCooking {
// void release();
// PxConvexMesh createConvexMesh([Const, Ref] PxConvexMeshDesc desc, [Ref] PxInsertionCallback insertionCallback);
// PxTriangleMesh createTriangleMesh([Const, Ref] PxTriangleMeshDesc desc, [Ref] PxInsertionCallback insertionCallback);
// PxHeightField createHeightField([Const, Ref] PxHeightFieldDesc desc, [Ref] PxInsertionCallback insertionCallback);
//};

[Prefix="physx::"]
interface PxCookingParams {
Expand Down
4 changes: 2 additions & 2 deletions physx-jni/src/main/webidl/extensions/PxExtensions.idl
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ interface PxSerialization {
static boolean isSerializable([Ref] PxCollection collection, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection externalReferences);
static void complete([Ref] PxCollection collection, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection exceptFor, optional boolean followJoints);
static void createSerialObjectIds([Ref] PxCollection collection, unsigned long long base);
static PxCollection createCollectionFromXml([Ref] PxInputData inputData, [Ref] PxCooking cooking, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection externalRefs);
static PxCollection createCollectionFromXml([Ref] PxInputData inputData, [Const, Ref] PxCookingParams params, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection externalRefs);
static PxCollection createCollectionFromBinary(VoidPtr memBlock, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection externalRefs);
static boolean serializeCollectionToXml([Ref] PxOutputStream outputStream, [Ref] PxCollection collection, [Ref] PxSerializationRegistry sr, optional PxCooking cooking, [Const] optional PxCollection externalRefs);
static boolean serializeCollectionToXml([Ref] PxOutputStream outputStream, [Ref] PxCollection collection, [Ref] PxSerializationRegistry sr, [Const] optional PxCookingParams params, [Const] optional PxCollection externalRefs);
static boolean serializeCollectionToBinary([Ref] PxOutputStream outputStream, [Ref] PxCollection collection, [Ref] PxSerializationRegistry sr, [Const] optional PxCollection externalRefs, optional boolean exportNames);
static PxSerializationRegistry createSerializationRegistry([Ref] PxPhysics physics);
};
Expand Down
Loading

0 comments on commit 0ae1ab5

Please sign in to comment.