Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preset for Bullet Physics SDK #1153

Merged
merged 84 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
e19600a
Download, build and install bullet's library files
mode89 Feb 12, 2022
356a22d
POM scripts necessary for building the bullet preset
mode89 Feb 13, 2022
f3fae53
Fix bullet's cppbuild
mode89 Feb 13, 2022
1c3a5df
Generate bindings for bullet's LinearMath library
mode89 Feb 13, 2022
a7ef132
Generate bindings for bullet's BulletCollision library
mode89 Feb 13, 2022
fa39320
Generate bindings for bullet's BulletDynamics library
mode89 Feb 13, 2022
add934f
Extract each bullet's class into a separate file
mode89 Feb 14, 2022
efa075b
Remove forward declaration of btRigidBody from btDispatcher.h
mode89 Feb 14, 2022
9958160
Generate bindings for btConvexShape
mode89 Feb 14, 2022
a077fe6
Add bullet's sample
mode89 Feb 15, 2022
f4f263f
Generate bindings for BulletSoftBody library
mode89 Feb 17, 2022
38c1037
Generate bindings for forward-declarted types
mode89 Feb 19, 2022
b62f36a
Bindings for multithreaded bullet's solvers
mode89 Feb 19, 2022
b48ddeb
Remove unnecessary btSoftBody bindings
mode89 Feb 19, 2022
894cd8d
Generate btAlignedObjectArray instances for btSoftBody sub-classes
mode89 Feb 19, 2022
4ddbb32
Fix generated types for some btAlignedObjectArray instances
mode89 Feb 19, 2022
c1877f2
Add sample simulating a piece of cloth
mode89 Feb 19, 2022
2d970ef
Print message at the end of SimpleBox sample
mode89 Feb 19, 2022
1501c79
Remove specification of mainClass from sample's pom.xml
mode89 Feb 19, 2022
ddf2741
README for bullet's preset
mode89 Feb 20, 2022
dee5ebc
Skip methods with missing implementation
mode89 Feb 21, 2022
cc3eaa1
Build bullet preset on android platforms
mode89 Feb 21, 2022
3a2ce1b
Build bullet preset on windows platforms
mode89 Feb 21, 2022
d571955
Update version in bullet's `pom.xml` files to 1.5.8-SNAPSHOT
mode89 Feb 22, 2022
c10cf96
Replace tabs with spaces
mode89 Feb 22, 2022
d5a312c
Fix link inside bullet/README.md
mode89 Feb 22, 2022
c8f44c4
Update JavaCPP version comment inside generated files of bullet preset
mode89 Feb 23, 2022
1c058ca
Github Actions workflow for bullet preset
mode89 Feb 23, 2022
f50c3a4
Copy licence from the bullet's repository
mode89 Feb 23, 2022
19553d4
Mention bullet in the root README
mode89 Feb 23, 2022
50d72ce
Refactor bullet's preset classes
mode89 Feb 23, 2022
fe4c0c5
Missing mapping for btAlignedObjectArray<btIndexedMesh>
mode89 Feb 23, 2022
b5b768f
Rename btAlignedObjectArray_btRigidBody and btAlignedObjectArray_btSo…
mode89 Feb 23, 2022
43da83b
Skip tVSolverArray and tPSolverArray
mode89 Feb 23, 2022
da87cef
Simplify mappings for btAlignedObjectArray instances
mode89 Feb 24, 2022
a3b7c08
Update bullet's generated bindings
mode89 Feb 24, 2022
a19894f
Note on btAlignedObjectArray mappings
mode89 Feb 24, 2022
e2cd37f
Add builds for linux-x86 and macosx-x86_64
saudet Feb 28, 2022
8fe6fa4
Merge branch 'master' into bullet
saudet Feb 28, 2022
af6f9b9
Fix builds on Mac
saudet Feb 28, 2022
9df76aa
Update URL in README.md
saudet Feb 28, 2022
c81c377
Map extra headers from bullet's LinearMath
mode89 Feb 28, 2022
bca797b
Update generated code of bullet preset
mode89 Feb 28, 2022
af43474
Map extra headers from bullet's BulletCollision
mode89 Feb 28, 2022
5a05437
Update generated code of bullet preset
mode89 Feb 28, 2022
bcbde6c
Map extra headers from bullet's BulletDynamics
mode89 Feb 28, 2022
7fa9e8b
Update generated code of bullet preset
mode89 Feb 28, 2022
9cd1217
Use `.translate(false)` instead of `.cppText(#define`
mode89 Mar 9, 2022
d8c0ca3
Sort includes of bullet's mappers
mode89 Mar 9, 2022
2441b94
Update generated code for bullet's preset
mode89 Mar 9, 2022
784b718
Remove unused code.
mode89 Mar 9, 2022
4908c76
Complete mapping of BulletCollision library
mode89 Mar 10, 2022
5602f29
Update generated code of bullet preset
mode89 Mar 10, 2022
0cf75c4
Complete mapping of BulletDynamics library
mode89 Mar 11, 2022
2bc443c
Update generated code of bullet preset
mode89 Mar 11, 2022
43ea07e
Complete mapping of BulletSoftBody library
mode89 Mar 13, 2022
a7482c8
Update generate code of bullet preset
mode89 Mar 13, 2022
3d8e128
Skip undefined symbols
mode89 Mar 13, 2022
668a0ba
Update generated code of bullet preset
mode89 Mar 13, 2022
8bb5793
Rename GIM_* arrays
mode89 Mar 13, 2022
5a6866d
Update generated code of bullet preset
mode89 Mar 13, 2022
bd9dbea
Mappings for Bullet3Common library
mode89 Mar 1, 2022
249378e
Update generated code for bullet's preset
mode89 Mar 3, 2022
d28c759
Mappings for Bullet3Collision library
mode89 Mar 3, 2022
bf0a8ee
Update generated code for bullet's preset
mode89 Mar 3, 2022
87fd5d6
Mappings for Bullet3Dynamics library
mode89 Mar 4, 2022
99b5bd5
Update generated code for bullet's preset
mode89 Mar 4, 2022
6400dce
Mappings for Bullet3OpenCL library
mode89 Mar 8, 2022
0d3122c
Update generated code for bullet's preset
mode89 Mar 8, 2022
ecbf1b5
Skip undefined symbols
mode89 Mar 8, 2022
dcdad47
Update generated code for bullet's preset
mode89 Mar 8, 2022
8df5786
Fix building bullet preset on windows platform
mode89 Mar 13, 2022
3004790
Update generated code of bullet preset
mode89 Mar 13, 2022
5c2db37
Allow bullet preset use istalled headers
mode89 Mar 13, 2022
2f2b64c
Ignore python cache
mode89 Mar 16, 2022
8d294c9
Mappings of bullet's clew library
mode89 Mar 16, 2022
e2d246e
Update generated code of bullet preset
mode89 Mar 16, 2022
d11e27d
Preload Bullet3Geometry.so
mode89 Mar 24, 2022
5f995f1
Merge branch 'master' into bullet
mode89 Mar 24, 2022
1826324
Fix module-info.java
saudet Mar 25, 2022
737428e
Fix build on Mac
saudet Mar 26, 2022
0d9716f
Remove mappings for clew
saudet Mar 26, 2022
48b90ff
Merge branch 'master' into bullet
mode89 Mar 28, 2022
ed5fe63
Fix presets and module-info.java
saudet Mar 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 64 additions & 0 deletions .github/workflows/bullet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: bullet
on:
push:
paths:
- bullet/**
pull_request:
paths:
- bullet/**
workflow_dispatch:
env:
CI_DEPLOY_MODULE: ${{ github.workflow }}
CI_DEPLOY_PLATFORM: ${{ github.job }}
CI_DEPLOY_SETTINGS: ${{ secrets.CI_DEPLOY_SETTINGS }}
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
STAGING_REPOSITORY: ${{ secrets.STAGING_REPOSITORY }}
jobs:
android-arm:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
android-arm64:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
android-x86:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
android-x86_64:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
linux-x86:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
linux-x86_64:
runs-on: ubuntu-18.04
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
macosx-x86_64:
runs-on: macos-10.15
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
windows-x86:
runs-on: windows-2019
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
windows-x86_64:
runs-on: windows-2019
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [android-arm, android-arm64, android-x86, android-x86_64, linux-x86, linux-x86_64, macosx-x86_64, windows-x86, windows-x86_64]
runs-on: ubuntu-18.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Add presets for Bullet Physics SDK 3.21 ([pull #1153](https://github.com/bytedeco/javacpp-presets/pull/1153))
* Add `long[] pytorch.Tensor.shape()` method for convenience ([pull #1161](https://github.com/bytedeco/javacpp-presets/pull/1161))
* Enable DNNL codegen as BYOC backend in presets for TVM
* Allow passing raw pointer as deleter to `from_blob()`, etc functions of PyTorch ([discussion #1160](https://github.com/bytedeco/javacpp-presets/discussions/1160))
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ JavaCPP Presets
[![ngraph](https://github.com/bytedeco/javacpp-presets/workflows/ngraph/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Angraph)
[![onnxruntime](https://github.com/bytedeco/javacpp-presets/workflows/onnxruntime/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aonnxruntime)
[![tvm](https://github.com/bytedeco/javacpp-presets/workflows/tvm/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Atvm)
[![bullet](https://github.com/bytedeco/javacpp-presets/workflows/bullet/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Abullet)
[![liquidfun](https://github.com/bytedeco/javacpp-presets/workflows/liquidfun/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aliquidfun)
[![qt](https://github.com/bytedeco/javacpp-presets/workflows/qt/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Aqt)
[![skia](https://github.com/bytedeco/javacpp-presets/workflows/skia/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Askia)
Expand Down Expand Up @@ -224,6 +225,7 @@ Each child module in turn relies by default on the included [`cppbuild.sh` scrip
* nGraph 0.26.0 https://github.com/NervanaSystems/ngraph
* ONNX Runtime 1.10.x https://github.com/microsoft/onnxruntime
* TVM 0.8.x https://github.com/apache/tvm
* Bullet Physics SDK 3.21 https://pybullet.org
* LiquidFun http://google.github.io/liquidfun/
* Qt 5.15.x https://download.qt.io/archive/qt/
* Mono/Skia 2.80.x https://github.com/mono/skia
Expand Down
15 changes: 15 additions & 0 deletions bullet/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

The files in this repository are licensed under the zlib license, except for the files under 'Extras' and examples/ThirdPartyLibs.

Bullet Continuous Collision Detection and Physics Library
http://bulletphysics.org

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.
166 changes: 166 additions & 0 deletions bullet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
JavaCPP Presets for Bullet Physics SDK
======================================

[![Gitter](https://badges.gitter.im/bytedeco/javacpp.svg)](https://gitter.im/bytedeco/javacpp) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/bullet/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/bullet) [![Sonatype Nexus (Snapshots)](https://img.shields.io/nexus/s/https/oss.sonatype.org/org.bytedeco/bullet.svg)](http://bytedeco.org/builds/)
<sup>Build status for all platforms:</sup> [![bullet](https://github.com/bytedeco/javacpp-presets/workflows/bullet/badge.svg)](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Abullet) <sup>Commercial support:</sup> [![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/bytedeco/javacpp-presets)


Introduction
------------
This directory contains the JavaCPP Presets module for:

* Bullet Physics SDK 3.21 https://github.com/bulletphysics/bullet3

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.


Documentation
-------------
Java API documentation is available here:

* http://bytedeco.org/javacpp-presets/bullet/apidocs/


### Special Mappings
Mappings of `btAlignedObjectArray`'s instances for privitime types:

| C++ | Java |
|--------------------------------------|-----------------|
| `btAlignedObjectArray<bool>` | `btBoolArray` |
| `btAlignedObjectArray<char>` | `btCharArray` |
| `btAlignedObjectArray<int>` | `btIntArray` |
| `btAlignedObjectArray<unsigned int>` | `btUIntArray` |
| `btAlignedObjectArray<btScalar>` | `btScalarArray` |

Name of a Java class, corresponding to an instance of `btAlignedObjectArray`
for a composite type, is constructed by adding `Array` suffix to the name of
the composite type, e.g. `btAlignedObjectArray<btQuaternion>` maps to
`btQuaternionArray`.


Sample Usage
------------
Here is a simple example of Bullet Physics SDK ported to Java and based on code found from:

* https://github.com/bulletphysics/bullet3/tree/3.21/examples/

We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `SimpleBox.java` source files below, simply execute on the command line:
```bash
$ mvn compile exec:java
```

### The `pom.xml` build file
```xml
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.bullet</groupId>
<artifactId>samples</artifactId>
<version>1.5.8-SNAPSHOT</version>
<properties>
<exec.mainClass>SimpleBox</exec.mainClass>
</properties>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>bullet-platform</artifactId>
<version>3.21-1.5.8-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>.</sourceDirectory>
</build>
</project>
```

### The `SimpleBox.java` source file
```java
import org.bytedeco.javacpp.*;
import org.bytedeco.bullet.BulletCollision.*;
import org.bytedeco.bullet.BulletDynamics.*;
import org.bytedeco.bullet.LinearMath.*;

public class SimpleBox {

private static btDefaultCollisionConfiguration m_collisionConfiguration;
private static btCollisionDispatcher m_dispatcher;
private static btBroadphaseInterface m_broadphase;
private static btConstraintSolver m_solver;
private static btDiscreteDynamicsWorld m_dynamicsWorld;

public static void main(String[] args)
{
createEmptyDynamicsWorld();

btBoxShape groundShape = new btBoxShape(new btVector3(50, 50, 50));

btTransform groundTransform = new btTransform();
groundTransform.setIdentity();
groundTransform.setOrigin(new btVector3(0, -50, 0));

createRigidBody(0, groundTransform, groundShape);

btBoxShape colShape = new btBoxShape(new btVector3(1, 1, 1));
float mass = 1.0f;

colShape.calculateLocalInertia(mass, new btVector3(0, 0, 0));

btTransform startTransform = new btTransform();
startTransform.setIdentity();
startTransform.setOrigin(new btVector3(0, 3, 0));
btRigidBody box = createRigidBody(mass, startTransform, colShape);

for (int i = 0; i < 10; ++ i)
{
m_dynamicsWorld.stepSimulation(0.1f, 10, 0.01f);
btVector3 position = box.getWorldTransform().getOrigin();
System.out.println(position.y());
}

System.out.println(
"\n" +
"This sample simulates falling of a rigid box, followed by \n" +
"an inelastic collision with a ground plane.\n" +
"The numbers show height of the box at each simulation step. \n" +
"It should start around 3.0 and end up around 1.0.\n");
}

private static void createEmptyDynamicsWorld()
{
m_collisionConfiguration = new btDefaultCollisionConfiguration();
m_dispatcher = new btCollisionDispatcher(m_collisionConfiguration);
m_broadphase = new btDbvtBroadphase();
m_solver = new btSequentialImpulseConstraintSolver();
m_dynamicsWorld = new btDiscreteDynamicsWorld(
m_dispatcher, m_broadphase, m_solver, m_collisionConfiguration);
m_dynamicsWorld.setGravity(new btVector3(0, -10, 0));
}

private static btRigidBody createRigidBody(
float mass,
btTransform startTransform,
btCollisionShape shape)
{
boolean isDynamic = (mass != 0.f);

btVector3 localInertia = new btVector3(0, 0, 0);
if (isDynamic)
shape.calculateLocalInertia(mass, localInertia);

btDefaultMotionState motionState = new btDefaultMotionState(
startTransform, btTransform.getIdentity());

btRigidBody.btRigidBodyConstructionInfo cInfo =
new btRigidBody.btRigidBodyConstructionInfo(
mass, motionState, shape, localInertia);

btRigidBody body = new btRigidBody(cInfo);

body.setUserIndex(-1);
m_dynamicsWorld.addRigidBody(body);

return body;
}
}
```

See the [samples](samples) subdirectory for more.
Loading