• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.8
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.badlogic.gdx.physics.bullet.collision;
10 
11 import com.badlogic.gdx.utils.Array;
12 import com.badlogic.gdx.math.Vector3;
13 import com.badlogic.gdx.math.Quaternion;
14 import com.badlogic.gdx.math.Matrix3;
15 import com.badlogic.gdx.math.Matrix4;
16 
17 public class btCompoundShape extends btCollisionShape {
18 	private long swigCPtr;
19 
btCompoundShape(final String className, long cPtr, boolean cMemoryOwn)20 	protected btCompoundShape(final String className, long cPtr, boolean cMemoryOwn) {
21 		super(className, CollisionJNI.btCompoundShape_SWIGUpcast(cPtr), cMemoryOwn);
22 		swigCPtr = cPtr;
23 	}
24 
25 	/** Construct a new btCompoundShape, normally you should not need this constructor it's intended for low-level usage. */
btCompoundShape(long cPtr, boolean cMemoryOwn)26 	public btCompoundShape(long cPtr, boolean cMemoryOwn) {
27 		this("btCompoundShape", cPtr, cMemoryOwn);
28 		construct();
29 	}
30 
31 	@Override
reset(long cPtr, boolean cMemoryOwn)32 	protected void reset(long cPtr, boolean cMemoryOwn) {
33 		if (!destroyed)
34 			destroy();
35 		super.reset(CollisionJNI.btCompoundShape_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
36 	}
37 
getCPtr(btCompoundShape obj)38 	public static long getCPtr(btCompoundShape obj) {
39 		return (obj == null) ? 0 : obj.swigCPtr;
40 	}
41 
42 	@Override
finalize()43 	protected void finalize() throws Throwable {
44 		if (!destroyed)
45 			destroy();
46 		super.finalize();
47 	}
48 
delete()49   @Override protected synchronized void delete() {
50 		if (swigCPtr != 0) {
51 			if (swigCMemOwn) {
52 				swigCMemOwn = false;
53 				CollisionJNI.delete_btCompoundShape(swigCPtr);
54 			}
55 			swigCPtr = 0;
56 		}
57 		super.delete();
58 	}
59 
60 	protected Array<btCollisionShape> children = new Array<btCollisionShape>();
61 
addChildShape(Matrix4 localTransform, btCollisionShape shape)62 	public void addChildShape(Matrix4 localTransform, btCollisionShape shape) {
63 		internalAddChildShape(localTransform, shape);
64 		children.add(shape);
65 		shape.obtain();
66 	}
67 
removeChildShape(btCollisionShape shape)68 	public void removeChildShape(btCollisionShape shape) {
69 		internalRemoveChildShape(shape);
70 		final int idx = children.indexOf(shape, false);
71 		if (idx >= 0)
72 			children.removeIndex(idx).release();
73 	}
74 
removeChildShapeByIndex(int index)75 	public void removeChildShapeByIndex(int index) {
76 		internalRemoveChildShapeByIndex(index);
77 		children.removeIndex(index).release();
78 	}
79 
getChildShape(int index)80 	public btCollisionShape getChildShape(int index) {
81 		return children.get(index);
82 	}
83 
84 	@Override
dispose()85 	public void dispose() {
86 		for (btCollisionShape child : children)
87 			child.release();
88 		children.clear();
89 		super.dispose();
90 	}
91 
btCompoundShape(boolean enableDynamicAabbTree, int initialChildCapacity)92   public btCompoundShape(boolean enableDynamicAabbTree, int initialChildCapacity) {
93     this(CollisionJNI.new_btCompoundShape__SWIG_0(enableDynamicAabbTree, initialChildCapacity), true);
94   }
95 
btCompoundShape(boolean enableDynamicAabbTree)96   public btCompoundShape(boolean enableDynamicAabbTree) {
97     this(CollisionJNI.new_btCompoundShape__SWIG_1(enableDynamicAabbTree), true);
98   }
99 
btCompoundShape()100   public btCompoundShape() {
101     this(CollisionJNI.new_btCompoundShape__SWIG_2(), true);
102   }
103 
internalAddChildShape(Matrix4 localTransform, btCollisionShape shape)104   private void internalAddChildShape(Matrix4 localTransform, btCollisionShape shape) {
105     CollisionJNI.btCompoundShape_internalAddChildShape(swigCPtr, this, localTransform, btCollisionShape.getCPtr(shape), shape);
106   }
107 
internalRemoveChildShape(btCollisionShape shape)108   private void internalRemoveChildShape(btCollisionShape shape) {
109     CollisionJNI.btCompoundShape_internalRemoveChildShape(swigCPtr, this, btCollisionShape.getCPtr(shape), shape);
110   }
111 
internalRemoveChildShapeByIndex(int childShapeindex)112   private void internalRemoveChildShapeByIndex(int childShapeindex) {
113     CollisionJNI.btCompoundShape_internalRemoveChildShapeByIndex(swigCPtr, this, childShapeindex);
114   }
115 
getNumChildShapes()116   public int getNumChildShapes() {
117     return CollisionJNI.btCompoundShape_getNumChildShapes(swigCPtr, this);
118   }
119 
getChildTransform(int index)120   public Matrix4 getChildTransform(int index) {
121 	return CollisionJNI.btCompoundShape_getChildTransform__SWIG_0(swigCPtr, this, index);
122 }
123 
updateChildTransform(int childIndex, Matrix4 newChildTransform, boolean shouldRecalculateLocalAabb)124   public void updateChildTransform(int childIndex, Matrix4 newChildTransform, boolean shouldRecalculateLocalAabb) {
125     CollisionJNI.btCompoundShape_updateChildTransform__SWIG_0(swigCPtr, this, childIndex, newChildTransform, shouldRecalculateLocalAabb);
126   }
127 
updateChildTransform(int childIndex, Matrix4 newChildTransform)128   public void updateChildTransform(int childIndex, Matrix4 newChildTransform) {
129     CollisionJNI.btCompoundShape_updateChildTransform__SWIG_1(swigCPtr, this, childIndex, newChildTransform);
130   }
131 
getChildList()132   public btCompoundShapeChild getChildList() {
133     long cPtr = CollisionJNI.btCompoundShape_getChildList(swigCPtr, this);
134     return (cPtr == 0) ? null : new btCompoundShapeChild(cPtr, false);
135   }
136 
recalculateLocalAabb()137   public void recalculateLocalAabb() {
138     CollisionJNI.btCompoundShape_recalculateLocalAabb(swigCPtr, this);
139   }
140 
getDynamicAabbTree()141   public btDbvt getDynamicAabbTree() {
142     long cPtr = CollisionJNI.btCompoundShape_getDynamicAabbTree__SWIG_0(swigCPtr, this);
143     return (cPtr == 0) ? null : new btDbvt(cPtr, false);
144   }
145 
createAabbTreeFromChildren()146   public void createAabbTreeFromChildren() {
147     CollisionJNI.btCompoundShape_createAabbTreeFromChildren(swigCPtr, this);
148   }
149 
calculatePrincipalAxisTransform(java.nio.FloatBuffer masses, Matrix4 principal, Vector3 inertia)150   public void calculatePrincipalAxisTransform(java.nio.FloatBuffer masses, Matrix4 principal, Vector3 inertia) {
151     assert masses.isDirect() : "Buffer must be allocated direct.";
152     {
153       CollisionJNI.btCompoundShape_calculatePrincipalAxisTransform(swigCPtr, this, masses, principal, inertia);
154     }
155   }
156 
getUpdateRevision()157   public int getUpdateRevision() {
158     return CollisionJNI.btCompoundShape_getUpdateRevision(swigCPtr, this);
159   }
160 
161 }
162