• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 %module btCompoundShape
2 
3 %{
4 #include <BulletCollision/CollisionShapes/btCompoundShape.h>
5 %}
6 
7 %typemap(javaimports) btCompoundShape %{
8 import com.badlogic.gdx.utils.Array;
9 import com.badlogic.gdx.math.Vector3;
10 import com.badlogic.gdx.math.Quaternion;
11 import com.badlogic.gdx.math.Matrix3;
12 import com.badlogic.gdx.math.Matrix4;
13 %}
14 
15 %rename(internalAddChildShape) btCompoundShape::addChildShape;
16 %javamethodmodifiers btCompoundShape::addChildShape "private";
17 %rename(internalRemoveChildShape) btCompoundShape::removeChildShape;
18 %javamethodmodifiers btCompoundShape::removeChildShape "private";
19 %rename(internalRemoveChildShapeByIndex) btCompoundShape::removeChildShapeByIndex;
20 %javamethodmodifiers btCompoundShape::removeChildShapeByIndex "private";
21 %ignore btCompoundShape::getChildShape;
22 
23 %typemap(javacode) btCompoundShape %{
24 	protected Array<btCollisionShape> children = new Array<btCollisionShape>();
25 
addChildShape(Matrix4 localTransform,btCollisionShape shape)26 	public void addChildShape(Matrix4 localTransform, btCollisionShape shape) {
27 		internalAddChildShape(localTransform, shape);
28 		children.add(shape);
29 		shape.obtain();
30 	}
31 
removeChildShape(btCollisionShape shape)32 	public void removeChildShape(btCollisionShape shape) {
33 		internalRemoveChildShape(shape);
34 		final int idx = children.indexOf(shape, false);
35 		if (idx >= 0)
36 			children.removeIndex(idx).release();
37 	}
38 
removeChildShapeByIndex(int index)39 	public void removeChildShapeByIndex(int index) {
40 		internalRemoveChildShapeByIndex(index);
41 		children.removeIndex(index).release();
42 	}
43 
getChildShape(int index)44 	public btCollisionShape getChildShape(int index) {
45 		return children.get(index);
46 	}
47 
48 	@Override
dispose()49 	public void dispose() {
50 		for (btCollisionShape child : children)
51 			child.release();
52 		children.clear();
53 		super.dispose();
54 	}
55 %}
56 
57 %include "BulletCollision/CollisionShapes/btCompoundShape.h"