libgdx/libgdx — pull request #832 by xoppa (2013-10-14 22:37:36+00:00)
Title: Bullet: separate modules

You probably don't want to look at the changes, it's huge. Instead you can look at the individual commits.

Sorry for breaking stuff (again). The main change to the API is that the classes are now located in a different package. I don't expect much problems for users (it basically requires removing old import statements and let eclipse auto resolve them). Some (static, non-class) members (flags or methods) were previously located at the gdxBullet/gdxBulletJNI/gdxBulletConstants class, those are now moved to one of the LinearMath(JNI/Constants) / Collision(JNI/Constants) / Dynamics(JNI/Constants) / Softbody(JNI/Constants) / Extra(JNI/Constants) classes.

We already discussed this change and when I was debugging the previous bug (in pooling) in the wrapper (which took ages to compile every time), I decided to give it a try. Turned out to work quite well.

The modules are:
- linearmath: some helper classes
- collision: collision shape, object, world, etc.
- dynamics: rigid body, dynamic world, etc.
- softbody: softbody world etc.
- extras: world importer, serialize, etc.

The SWIG interfaces are now completely separated, each module has its own sub folder. Common interfaces, like pooling etc is located it the common sub folder. I created a swig ant script (module.xml) which requires a property to be set to identify which module to swig. The default build.xml script will call this script for all modules.

The module.xml script will search and replace the weak_global phrase in the generated wrapper, so the wrapper should also work on ios (not tested). It also generates a file called classes.i so the other wrappers know which class is located in which package (used for directors/callbacks).

The custom (c++) code is also separated into different subfolders (located at custom/gdx). I moved the implementation from the header files to the cpp files (so its not duplicated on inclusion). There is some experimental code (jniHelpers) in there, which is currently not used. The methods to convert Vector3 to btVector3 etc is moved away from the swig interface so its only included once.

Atm the build script simply takes all wrappers and builds them to a single library (simply because I don't know how to separate them so it works on all platforms). But I have updated the visual studio solution to include each individual project and can confirm that each separate module compiles successfully in visual studio.

Tested on win64 and android