All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.badlogic.gdx.physics.bullet.collision.btBvhTriangleMeshShape Maven / Gradle / Ivy

There is a newer version: 1.12.1
Show newest version
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.11
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.badlogic.gdx.physics.bullet.collision;

import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.physics.bullet.linearmath.*;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Quaternion;
import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.model.MeshPart;
import com.badlogic.gdx.graphics.g3d.model.NodePart;
import com.badlogic.gdx.utils.Array;

public class btBvhTriangleMeshShape extends btTriangleMeshShape {
	private long swigCPtr;
	
	protected btBvhTriangleMeshShape(final String className, long cPtr, boolean cMemoryOwn) {
		super(className, CollisionJNI.btBvhTriangleMeshShape_SWIGUpcast(cPtr), cMemoryOwn);
		swigCPtr = cPtr;
	}
	
	/** Construct a new btBvhTriangleMeshShape, normally you should not need this constructor it's intended for low-level usage. */
	public btBvhTriangleMeshShape(long cPtr, boolean cMemoryOwn) {
		this("btBvhTriangleMeshShape", cPtr, cMemoryOwn);
		construct();
	}
	
	@Override
	protected void reset(long cPtr, boolean cMemoryOwn) {
		if (!destroyed)
			destroy();
		super.reset(CollisionJNI.btBvhTriangleMeshShape_SWIGUpcast(swigCPtr = cPtr), cMemoryOwn);
	}
	
	public static long getCPtr(btBvhTriangleMeshShape obj) {
		return (obj == null) ? 0 : obj.swigCPtr;
	}

	@Override
	protected void finalize() throws Throwable {
		if (!destroyed)
			destroy();
		super.finalize();
	}

  @Override protected synchronized void delete() {
		if (swigCPtr != 0) {
			if (swigCMemOwn) {
				swigCMemOwn = false;
				CollisionJNI.delete_btBvhTriangleMeshShape(swigCPtr);
			}
			swigCPtr = 0;
		}
		super.delete();
	}

	protected final static Array instances = new Array();
	
	protected static  btBvhTriangleMeshShape getInstance(final Array meshParts) {
		for (final btBvhTriangleMeshShape instance : instances) {
			if (instance.meshInterface instanceof btTriangleIndexVertexArray &&
					btTriangleIndexVertexArray.compare((btTriangleIndexVertexArray)(instance.meshInterface), meshParts))
				return instance;
		}
		return null;
	}
	
	/** Obtain an instance of btBvhTriangleMeshShape, made up of the specified {@link MeshPart} instances.
	 * Where possible previously obtained objects are reused. You must call {@link #release()},
	 * when you no longer need the shape. */
	public static  btBvhTriangleMeshShape obtain(final Array meshParts) {
		btBvhTriangleMeshShape result = getInstance(meshParts);
		if (result == null) {
			result = new btBvhTriangleMeshShape(btTriangleIndexVertexArray.obtain(meshParts), true);
			instances.add(result);
		}
		result.obtain();
		return result;
	}
	
	private btStridingMeshInterface meshInterface = null;
	
	/** @return The {@link btStridingMeshInterface} this shape encapsulates. */ 
	public btStridingMeshInterface getMeshInterface() {
		return meshInterface;
	}

	public  btBvhTriangleMeshShape(final Array meshParts) {
		this(meshParts, true);
	}
	
	public  btBvhTriangleMeshShape(final Array meshParts, boolean useQuantizedAabbCompression) {
		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression);
	}
	
	public  btBvhTriangleMeshShape(final Array meshParts, boolean useQuantizedAabbCompression, boolean buildBvh) {
		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, buildBvh);
	}
	
	public  btBvhTriangleMeshShape(final Array meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
	}
	
	public  btBvhTriangleMeshShape(final Array meshParts, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
		this(1, btTriangleIndexVertexArray.obtain(meshParts), useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
	}
	
	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
		this(0, meshInterface, useQuantizedAabbCompression);
	}

	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
		this(0, meshInterface, useQuantizedAabbCompression, buildBvh);
	}
	
	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
		this(0, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
	}
	
	public btBvhTriangleMeshShape(btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
		this(0, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
	}
	
	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
		this(true, meshInterface, useQuantizedAabbCompression);
		this.meshInterface = meshInterface;
		if (obtained == 0)
			meshInterface.obtain();
	}

	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
		this(true, meshInterface, useQuantizedAabbCompression, buildBvh);
		this.meshInterface = meshInterface;
		if (obtained == 0)
			meshInterface.obtain();
	}
	
	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
		this(true, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh);
		this.meshInterface = meshInterface;
		if (obtained == 0)
			meshInterface.obtain();
	}
	
	private btBvhTriangleMeshShape(int obtained, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
		this(true, meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax);
		this.meshInterface = meshInterface;
		if (obtained == 0)
			meshInterface.obtain();
	}
	
	
	public void dispose() {
		if (meshInterface != null)
			meshInterface.release();
		meshInterface = null;
		super.dispose();
	}

  public long operatorNew(long sizeInBytes) {
    return CollisionJNI.btBvhTriangleMeshShape_operatorNew__SWIG_0(swigCPtr, this, sizeInBytes);
  }

  public void operatorDelete(long ptr) {
    CollisionJNI.btBvhTriangleMeshShape_operatorDelete__SWIG_0(swigCPtr, this, ptr);
  }

  public long operatorNew(long arg0, long ptr) {
    return CollisionJNI.btBvhTriangleMeshShape_operatorNew__SWIG_1(swigCPtr, this, arg0, ptr);
  }

  public void operatorDelete(long arg0, long arg1) {
    CollisionJNI.btBvhTriangleMeshShape_operatorDelete__SWIG_1(swigCPtr, this, arg0, arg1);
  }

  public long operatorNewArray(long sizeInBytes) {
    return CollisionJNI.btBvhTriangleMeshShape_operatorNewArray__SWIG_0(swigCPtr, this, sizeInBytes);
  }

  public void operatorDeleteArray(long ptr) {
    CollisionJNI.btBvhTriangleMeshShape_operatorDeleteArray__SWIG_0(swigCPtr, this, ptr);
  }

  public long operatorNewArray(long arg0, long ptr) {
    return CollisionJNI.btBvhTriangleMeshShape_operatorNewArray__SWIG_1(swigCPtr, this, arg0, ptr);
  }

  public void operatorDeleteArray(long arg0, long arg1) {
    CollisionJNI.btBvhTriangleMeshShape_operatorDeleteArray__SWIG_1(swigCPtr, this, arg0, arg1);
  }

  public boolean getOwnsBvh() {
    return CollisionJNI.btBvhTriangleMeshShape_getOwnsBvh(swigCPtr, this);
  }

  public void performRaycast(btTriangleCallback callback, Vector3 raySource, Vector3 rayTarget) {
    CollisionJNI.btBvhTriangleMeshShape_performRaycast(swigCPtr, this, btTriangleCallback.getCPtr(callback), callback, raySource, rayTarget);
  }

  public void performConvexcast(btTriangleCallback callback, Vector3 boxSource, Vector3 boxTarget, Vector3 boxMin, Vector3 boxMax) {
    CollisionJNI.btBvhTriangleMeshShape_performConvexcast(swigCPtr, this, btTriangleCallback.getCPtr(callback), callback, boxSource, boxTarget, boxMin, boxMax);
  }

  public void refitTree(Vector3 aabbMin, Vector3 aabbMax) {
    CollisionJNI.btBvhTriangleMeshShape_refitTree(swigCPtr, this, aabbMin, aabbMax);
  }

  public void partialRefitTree(Vector3 aabbMin, Vector3 aabbMax) {
    CollisionJNI.btBvhTriangleMeshShape_partialRefitTree(swigCPtr, this, aabbMin, aabbMax);
  }

  public btOptimizedBvh getOptimizedBvh() {
    long cPtr = CollisionJNI.btBvhTriangleMeshShape_getOptimizedBvh(swigCPtr, this);
    return (cPtr == 0) ? null : new btOptimizedBvh(cPtr, false);
  }

  public void setOptimizedBvh(btOptimizedBvh bvh, Vector3 localScaling) {
    CollisionJNI.btBvhTriangleMeshShape_setOptimizedBvh__SWIG_0(swigCPtr, this, btOptimizedBvh.getCPtr(bvh), bvh, localScaling);
  }

  public void setOptimizedBvh(btOptimizedBvh bvh) {
    CollisionJNI.btBvhTriangleMeshShape_setOptimizedBvh__SWIG_1(swigCPtr, this, btOptimizedBvh.getCPtr(bvh), bvh);
  }

  public void buildOptimizedBvh() {
    CollisionJNI.btBvhTriangleMeshShape_buildOptimizedBvh(swigCPtr, this);
  }

  public boolean usesQuantizedAabbCompression() {
    return CollisionJNI.btBvhTriangleMeshShape_usesQuantizedAabbCompression(swigCPtr, this);
  }

  public void setTriangleInfoMap(btTriangleInfoMap triangleInfoMap) {
    CollisionJNI.btBvhTriangleMeshShape_setTriangleInfoMap(swigCPtr, this, btTriangleInfoMap.getCPtr(triangleInfoMap), triangleInfoMap);
  }

  public btTriangleInfoMap getTriangleInfoMap() {
    long cPtr = CollisionJNI.btBvhTriangleMeshShape_getTriangleInfoMap__SWIG_0(swigCPtr, this);
    return (cPtr == 0) ? null : new btTriangleInfoMap(cPtr, false);
  }

  public void serializeSingleBvh(btSerializer serializer) {
    CollisionJNI.btBvhTriangleMeshShape_serializeSingleBvh(swigCPtr, this, btSerializer.getCPtr(serializer), serializer);
  }

  public void serializeSingleTriangleInfoMap(btSerializer serializer) {
    CollisionJNI.btBvhTriangleMeshShape_serializeSingleTriangleInfoMap(swigCPtr, this, btSerializer.getCPtr(serializer), serializer);
  }

  private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, boolean buildBvh) {
    this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_0(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, buildBvh), true);
  }

  private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression) {
    this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_1(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression), true);
  }

  private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax, boolean buildBvh) {
    this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_2(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax, buildBvh), true);
  }

  private btBvhTriangleMeshShape(boolean dummy, btStridingMeshInterface meshInterface, boolean useQuantizedAabbCompression, Vector3 bvhAabbMin, Vector3 bvhAabbMax) {
    this(CollisionJNI.new_btBvhTriangleMeshShape__SWIG_3(dummy, btStridingMeshInterface.getCPtr(meshInterface), meshInterface, useQuantizedAabbCompression, bvhAabbMin, bvhAabbMax), true);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy