com.badlogic.gdx.physics.bullet.collision.btTriangleIndexVertexArray Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gdx-bullet-teavm Show documentation
Show all versions of gdx-bullet-teavm Show documentation
Tool to generate libgdx to javascript using teaVM
/*-------------------------------------------------------
* This file was generated by JParser
*
* Do not make changes to this file
*-------------------------------------------------------*/
package com.badlogic.gdx.physics.bullet.collision;
import com.badlogic.gdx.graphics.g3d.model.MeshPart;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.physics.bullet.linearmath.btVector3;
import com.badlogic.gdx.math.Vector3;
/**
* @author xpenatan
*/
public class btTriangleIndexVertexArray extends btStridingMeshInterface {
public static btTriangleIndexVertexArray WRAPPER_GEN_01 = new btTriangleIndexVertexArray(false);
protected final static Array instances = new Array();
/**
* @return Whether the supplied array contains all specified tags.
*/
public static boolean compare(final btTriangleIndexVertexArray array, final Array tags) {
if (array.meshes.size != tags.size)
return false;
for (final btIndexedMesh mesh : array.meshes) {
boolean found = false;
final Object tag = mesh.tag;
if (tag == null)
return false;
for (final T t : tags) {
if (t.equals(tag)) {
found = true;
break;
}
}
if (!found)
return false;
}
return true;
}
protected static btTriangleIndexVertexArray getInstance(final Array tags) {
for (final btTriangleIndexVertexArray instance : instances) {
if (compare(instance, tags))
return instance;
}
return null;
}
/**
* Create or reuse a btTriangleIndexVertexArray instance based on the specified {@link MeshPart} array. Use {@link #release()}
* to release the mesh when it's no longer needed.
*/
public static btTriangleIndexVertexArray obtain(final Array meshParts) {
btTriangleIndexVertexArray result = getInstance(meshParts);
if (result == null) {
result = new btTriangleIndexVertexArray(meshParts);
instances.add(result);
}
result.obtain();
return result;
}
protected final Array meshes = new Array(1);
public btTriangleIndexVertexArray(final MeshPart meshPart) {
// Gdx constructor
initObject(createNative(), true);
addMeshPart(meshPart);
}
public btTriangleIndexVertexArray(final Iterable meshParts) {
// Gdx constructor
initObject(createNative(), true);
addMeshParts(meshParts);
}
@org.teavm.jso.JSBody(script = "var jsObj = new Bullet.btTriangleIndexVertexArray(); return Bullet.getPointer(jsObj);")
private static native int createNative();
@Override
protected void deleteNative() {
deleteNative((int) cPointer);
}
@org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray); Bullet.destroy(jsObj);")
private static native void deleteNative(int addr);
public void addIndexedMesh(btIndexedMesh mesh, int indexType) {
addIndexedMeshNATIVE((int) cPointer, (int) mesh.getCPointer(), indexType);
}
@org.teavm.jso.JSBody(params = {"addr", "meshAddr", "indexType"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray); var meshJSObj = Bullet.wrapPointer(meshAddr, Bullet.btIndexedMesh); jsObj.addIndexedMesh(meshJSObj, indexType);")
private static native void addIndexedMeshNATIVE(int addr, int meshAddr, int indexType);
public void addIndexedMesh(btIndexedMesh mesh) {
addIndexedMeshNATIVE((int) cPointer, (int) mesh.getCPointer());
}
@org.teavm.jso.JSBody(params = {"addr", "meshAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray); var meshJSObj = Bullet.wrapPointer(meshAddr, Bullet.btIndexedMesh); jsObj.addIndexedMesh(meshJSObj);")
private static native void addIndexedMeshNATIVE(int addr, int meshAddr);
/**
* Add a {@link MeshPart} instance to this btTriangleIndexVertexArray.
* The specified mesh must be indexed and triangulated and must outlive this btTriangleIndexVertexArray.
* The buffers for the vertices and indices are shared amongst both.
*/
public btTriangleIndexVertexArray addMeshPart(final MeshPart meshPart) {
btIndexedMesh mesh = btIndexedMesh.obtain(meshPart);
addIndexedMesh(mesh, PHY_ScalarType.PHY_SHORT);
mesh.release();
return this;
}
/**
* Add one or more {@link MeshPart} instances to this btTriangleIndexVertexArray.
* The specified meshes must be indexed and triangulated and must outlive this btTriangleIndexVertexArray.
* The buffers for the vertices and indices are shared amongst both.
*/
public btTriangleIndexVertexArray addMeshParts(final Iterable meshParts) {
for (final MeshPart meshPart : meshParts) addMeshPart(meshPart);
return this;
}
public btTriangleIndexVertexArray(boolean cMemoryOwn) {
}
public btTriangleIndexVertexArray() {
}
public void setPremadeAabb(btVector3 aabbMin, btVector3 aabbMax) {
setPremadeAabbNATIVE((int) cPointer, (int) aabbMin.getCPointer(), (int) aabbMax.getCPointer());
}
@org.teavm.jso.JSBody(params = {"addr", "aabbMinAddr", "aabbMaxAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray);jsObj.setPremadeAabb(aabbMinAddr, aabbMaxAddr);")
private static native void setPremadeAabbNATIVE(int addr, int aabbMinAddr, int aabbMaxAddr);
public void setPremadeAabb(Vector3 aabbMinGDX, Vector3 aabbMaxGDX) {
btVector3.convert(aabbMinGDX, btVector3.TEMP_0);
btVector3 aabbMin = btVector3.TEMP_0;
btVector3.convert(aabbMaxGDX, btVector3.TEMP_1);
btVector3 aabbMax = btVector3.TEMP_1;
setPremadeAabbNATIVE((int) cPointer, (int) aabbMin.getCPointer(), (int) aabbMax.getCPointer());
}
public void getPremadeAabb(btVector3 aabbMin, btVector3 aabbMax) {
getPremadeAabbNATIVE((int) cPointer, (int) aabbMin.getCPointer(), (int) aabbMax.getCPointer());
}
@org.teavm.jso.JSBody(params = {"addr", "aabbMinAddr", "aabbMaxAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray);jsObj.getPremadeAabb(aabbMinAddr, aabbMaxAddr);")
private static native void getPremadeAabbNATIVE(int addr, int aabbMinAddr, int aabbMaxAddr);
public void getPremadeAabb(Vector3 aabbMinGDX, Vector3 aabbMaxGDX) {
btVector3.convert(aabbMinGDX, btVector3.TEMP_0);
btVector3 aabbMin = btVector3.TEMP_0;
btVector3.convert(aabbMaxGDX, btVector3.TEMP_1);
btVector3 aabbMax = btVector3.TEMP_1;
getPremadeAabbNATIVE((int) cPointer, (int) aabbMin.getCPointer(), (int) aabbMax.getCPointer());
}
public boolean hasPremadeAabb() {
return hasPremadeAabbNATIVE((int) cPointer);
}
@org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTriangleIndexVertexArray);var returnedJSObj = jsObj.hasPremadeAabb();return returnedJSObj;")
private static native boolean hasPremadeAabbNATIVE(int addr);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy