• 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.physics.bullet.BulletBase;
12 import com.badlogic.gdx.physics.bullet.linearmath.*;
13 import com.badlogic.gdx.math.Vector3;
14 import com.badlogic.gdx.math.Quaternion;
15 import com.badlogic.gdx.math.Matrix3;
16 import com.badlogic.gdx.math.Matrix4;
17 import com.badlogic.gdx.graphics.Mesh;
18 import com.badlogic.gdx.graphics.g3d.Model;
19 import com.badlogic.gdx.graphics.g3d.model.MeshPart;
20 import com.badlogic.gdx.graphics.g3d.model.NodePart;
21 import com.badlogic.gdx.utils.Array;
22 
23 public class btBvhTriangleMeshShape extends btTriangleMeshShape {
24 	private long swigCPtr;
25 
btBvhTriangleMeshShape(final String className, long cPtr, boolean cMemoryOwn)26 	protected btBvhTriangleMeshShape(final String className, long cPtr, boolean cMemoryOwn) {
27 		super(className, CollisionJNI.btBvhTriangleMeshShape_SWIGUpcast(cPtr), cMemoryOwn);
28 		swigCPtr = cPtr;
29 	}
30 
31 	/** Construct a new btBvhTriangleMeshShape, normally you should not need this constructor it's intended for low-level usage. */
btBvhTriangleMeshShape(long cPtr, boolean cMemoryOwn)32 	public btBvhTriangleMeshShape(long cPtr, boolean cMemoryOwn) {
33 		this("btBvhTriangleMeshShape", cPtr, cMemoryOwn);
34 		construct();
35 	}
36 
37 	@Override
reset(long cPtr, boolean cMemoryOwn)38 	protected void reset(long cPtr, boolean cMemoryOwn) {
39 		if (!destroyed)
40 			destroy();
41 		super.reset(CollisionJNI.btBvhTriangleMeshShape_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
42 	}
43 
getCPtr(btBvhTriangleMeshShape obj)44 	public static long getCPtr(btBvhTriangleMeshShape obj) {
45 		return (obj == null) ? 0 : obj.swigCPtr;
46 	}
47 
48 	@Override
finalize()49 	protected void finalize() throws Throwable {
50 		if (!destroyed)
51 			destroy();
52 		super.finalize();
53 	}
54 
delete()55   @Override protected synchronized void delete() {
56 		if (swigCPtr != 0) {
57 			if (swigCMemOwn) {
58 				swigCMemOwn = false;
59 				CollisionJNI.delete_btBvhTriangleMeshShape(swigCPtr);
60 			}
61 			swigCPtr = 0;
62 		}
63 		super.delete();
64 	}
65 
66 	protected final static Array<btBvhTriangleMeshShape> instances = new Array<btBvhTriangleMeshShape>();
67 
getInstance(final Array<T> meshParts)68 	protected static <T extends MeshPart> btBvhTriangleMeshShape getInstance(final Array<T> meshParts) {
69 		for (final btBvhTriangleMeshShape instance : instances) {
70 			if (instance.meshInterface instanceof btTriangleIndexVertexArray &&
71 					btTriangleIndexVertexArray.compare((btTriangleIndexVertexArray)(instance.meshInterface), meshParts))
72 				return instance;
73 		}
74 		return null;
75 	}
76 
77 	/** Obtain an instance of btBvhTriangleMeshShape, made up of the specified {@link MeshPart} instances.
78 	 * Where possible previously obtained objects are reused. You must call {@link #release()},
79 	 * when you no longer need the shape. */
obtain(final Array<T> meshParts)80 	public static <T extends MeshPart> btBvhTriangleMeshShape obtain(final Array<T> meshParts) {
81 		btBvhTriangleMeshShape result = getInstance(meshParts);
82 		if (result == null) {
83 			result = new btBvhTriangleMeshShape(btTriangleIndexVertexArray.obtain(meshParts), true);
84 			instances.add(result);
85 		}
86 		result.obtain();
87 		return result;
88 	}
89 
90 	private btStridingMeshInterface meshInterface = null;
91 
92 	/** @return The {@link btStridingMeshInterface} this shape encapsulates. */
getMeshInterface()93 	public btStridingMeshInterface getMeshInterface() {
94 		return meshInterface;
95 	}
96 
btBvhTriangleMeshShape(final Array<T> meshParts)97 	public <T extends MeshPart> btBvhTriangleMeshShape(final Array<T> meshParts) {
98 		this(meshParts, true);
99 	}
100 
btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression)101 	public <T extends MeshPart> btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression) {
102 		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression);
103 	}
104 
btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, boolean buildBvh)105 	public <T extends MeshPart> btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, boolean buildBvh) {
106 		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, buildBvh);
107 	}
108 
btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax)109 	public <T extends MeshPart> btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
110 		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
111 	}
112 
btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh)113 	public <T extends MeshPart> btBvhTriangleMeshShape(final Array<T> meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
114 		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
115 	}
116 
btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression)117 	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
118 		this(0, meshInterface, useQuantizedAabbCompression);
119 	}
120 
btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh)121 	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
122 		this(0, meshInterface, useQuantizedAabbCompression, buildBvh);
123 	}
124 
btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh)125 	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
126 		this(0, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
127 	}
128 
btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax)129 	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
130 		this(0, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
131 	}
132 
btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression)133 	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
134 		this(true, meshInterface, useQuantizedAabbCompression);
135 		this.meshInterface = meshInterface;
136 		if (obtained == 0)
137 			meshInterface.obtain();
138 	}
139 
btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh)140 	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
141 		this(true, meshInterface, useQuantizedAabbCompression, buildBvh);
142 		this.meshInterface = meshInterface;
143 		if (obtained == 0)
144 			meshInterface.obtain();
145 	}
146 
btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh)147 	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
148 		this(true, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
149 		this.meshInterface = meshInterface;
150 		if (obtained == 0)
151 			meshInterface.obtain();
152 	}
153 
btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax)154 	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
155 		this(true, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
156 		this.meshInterface = meshInterface;
157 		if (obtained == 0)
158 			meshInterface.obtain();
159 	}
160 
161 
dispose()162 	public void dispose() {
163 		if (meshInterface != null)
164 			meshInterface.release();
165 		meshInterface = null;
166 		super.dispose();
167 	}
168 
getOwnsBvh()169   public boolean getOwnsBvh() {
170     return CollisionJNI.btBvhTriangleMeshShape_getOwnsBvh(swigCPtr, this);
171   }
172 
performRaycast(btTriangleCallback callback, Vector3 raySource, Vector3 rayTarget)173   public void performRaycast(btTriangleCallback callback, Vector3 raySource, Vector3 rayTarget) {
174     CollisionJNI.btBvhTriangleMeshShape_performRaycast(swigCPtr, this, btTriangleCallback.getCPtr(callback), callback, raySource, rayTarget);
175   }
176 
performConvexcast(btTriangleCallback callback, Vector3 boxSource, Vector3 boxTarget, Vector3 boxMin, Vector3 boxMax)177   public void performConvexcast(btTriangleCallback callback, Vector3 boxSource, Vector3 boxTarget, Vector3 boxMin, Vector3 boxMax) {
178     CollisionJNI.btBvhTriangleMeshShape_performConvexcast(swigCPtr, this, btTriangleCallback.getCPtr(callback), callback, boxSource, boxTarget, boxMin, boxMax);
179   }
180 
refitTree(Vector3 aabbMin, Vector3 aabbMax)181   public void refitTree(Vector3 aabbMin, Vector3 aabbMax) {
182     CollisionJNI.btBvhTriangleMeshShape_refitTree(swigCPtr, this, aabbMin, aabbMax);
183   }
184 
partialRefitTree(Vector3 aabbMin, Vector3 aabbMax)185   public void partialRefitTree(Vector3 aabbMin, Vector3 aabbMax) {
186     CollisionJNI.btBvhTriangleMeshShape_partialRefitTree(swigCPtr, this, aabbMin, aabbMax);
187   }
188 
getOptimizedBvh()189   public btOptimizedBvh getOptimizedBvh() {
190     long cPtr = CollisionJNI.btBvhTriangleMeshShape_getOptimizedBvh(swigCPtr, this);
191     return (cPtr == 0) ? null : new btOptimizedBvh(cPtr, false);
192   }
193 
setOptimizedBvh(btOptimizedBvh bvh, Vector3 localScaling)194   public void setOptimizedBvh(btOptimizedBvh bvh, Vector3 localScaling) {
195     CollisionJNI.btBvhTriangleMeshShape_setOptimizedBvh__SWIG_0(swigCPtr, this, btOptimizedBvh.getCPtr(bvh), bvh, localScaling);
196   }
197 
setOptimizedBvh(btOptimizedBvh bvh)198   public void setOptimizedBvh(btOptimizedBvh bvh) {
199     CollisionJNI.btBvhTriangleMeshShape_setOptimizedBvh__SWIG_1(swigCPtr, this, btOptimizedBvh.getCPtr(bvh), bvh);
200   }
201 
buildOptimizedBvh()202   public void buildOptimizedBvh() {
203     CollisionJNI.btBvhTriangleMeshShape_buildOptimizedBvh(swigCPtr, this);
204   }
205 
usesQuantizedAabbCompression()206   public boolean usesQuantizedAabbCompression() {
207     return CollisionJNI.btBvhTriangleMeshShape_usesQuantizedAabbCompression(swigCPtr, this);
208   }
209 
setTriangleInfoMap(btTriangleInfoMap triangleInfoMap)210   public void setTriangleInfoMap(btTriangleInfoMap triangleInfoMap) {
211     CollisionJNI.btBvhTriangleMeshShape_setTriangleInfoMap(swigCPtr, this, btTriangleInfoMap.getCPtr(triangleInfoMap), triangleInfoMap);
212   }
213 
getTriangleInfoMap()214   public btTriangleInfoMap getTriangleInfoMap() {
215     long cPtr = CollisionJNI.btBvhTriangleMeshShape_getTriangleInfoMap__SWIG_0(swigCPtr, this);
216     return (cPtr == 0) ? null : new btTriangleInfoMap(cPtr, false);
217   }
218 
serializeSingleBvh(SWIGTYPE_p_btSerializer serializer)219   public void serializeSingleBvh(SWIGTYPE_p_btSerializer serializer) {
220     CollisionJNI.btBvhTriangleMeshShape_serializeSingleBvh(swigCPtr, this, SWIGTYPE_p_btSerializer.getCPtr(serializer));
221   }
222 
serializeSingleTriangleInfoMap(SWIGTYPE_p_btSerializer serializer)223   public void serializeSingleTriangleInfoMap(SWIGTYPE_p_btSerializer serializer) {
224     CollisionJNI.btBvhTriangleMeshShape_serializeSingleTriangleInfoMap(swigCPtr, this, SWIGTYPE_p_btSerializer.getCPtr(serializer));
225   }
226 
btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh)227   private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
228     this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_0(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, buildBvh), true);
229   }
230 
btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression)231   private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
232     this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_1(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression), true);
233   }
234 
btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh)235   private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
236     this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_2(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh), true);
237   }
238 
btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax)239   private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
240     this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_3(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax), true);
241   }
242 
243 }
244