com.badlogic.gdx.physics.bullet.collision.btConvexHullShape 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.physics.bullet.linearmath.btVector3;
import com.badlogic.gdx.math.Vector3;
/**
* @author xpenatan
*/
public class btConvexHullShape extends btPolyhedralConvexAabbCachingShape {
public static btConvexHullShape WRAPPER_GEN_01 = new btConvexHullShape(false);
public btConvexHullShape(java.nio.FloatBuffer points, int numPoints, int stride) {
// Custom constructor from GDX
initObject(createNative(), true);
int remaining = points.limit();
stride = stride / 4;
int i = 0;
while (i < remaining) {
float x = points.get(i);
float y = points.get(i + 1);
float z = points.get(i + 2);
btVector3.TEMP_0.setValue(x, y, z);
addPoint(btVector3.TEMP_0);
i += stride;
}
}
public btConvexHullShape(btShapeHull hull) {
// Custom constructor from GDX
initObject(createNative((int) hull.getCPointer()), true);
}
@org.teavm.jso.JSBody(params = {"btShapeHullAddr"}, script = "var shapeHull = Bullet.wrapPointer(btShapeHullAddr, Bullet.btShapeHull); var jsObj = new Bullet.btConvexHullShape(); var numVertices = shapeHull.numVertices(); var i = 0; while(i < numVertices) { var vec3 = Bullet.MyClassHelper.prototype.getVertexPointer(shapeHull, i); jsObj.addPoint(vec3); i++; } return Bullet.getPointer(jsObj);")
private static native int createNative(int btShapeHullAddr);
@org.teavm.jso.JSBody(script = "var jsObj = new Bullet.btConvexHullShape(); 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.btConvexHullShape); Bullet.destroy(jsObj);")
private static native void deleteNative(int addr);
public void addPoint(btVector3 point) {
addPointNATIVE((int) cPointer, (int) point.getCPointer());
}
@org.teavm.jso.JSBody(params = {"addr", "btVector3Addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape); jsObj.addPoint(btVector3Addr);")
private static native void addPointNATIVE(int addr, int btVector3Addr);
public btConvexHullShape(boolean cMemoryOwn) {
}
public btConvexHullShape() {
}
public void addPoint(btVector3 point, boolean recalculateLocalAABB) {
addPointNATIVE((int) cPointer, (int) point.getCPointer(), recalculateLocalAABB);
}
@org.teavm.jso.JSBody(params = {"addr", "pointAddr", "recalculateLocalAABB"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);jsObj.addPoint(pointAddr, recalculateLocalAABB);")
private static native void addPointNATIVE(int addr, int pointAddr, boolean recalculateLocalAABB);
public void addPoint(Vector3 pointGDX, boolean recalculateLocalAABB) {
btVector3.convert(pointGDX, btVector3.TEMP_0);
btVector3 point = btVector3.TEMP_0;
addPointNATIVE((int) cPointer, (int) point.getCPointer(), recalculateLocalAABB);
}
public void setMargin(float margin) {
setMarginNATIVE((int) cPointer, margin);
}
@org.teavm.jso.JSBody(params = {"addr", "margin"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);jsObj.setMargin(margin);")
private static native void setMarginNATIVE(int addr, float margin);
public float getMargin() {
return getMarginNATIVE((int) cPointer);
}
@org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);var returnedJSObj = jsObj.getMargin();return returnedJSObj;")
private static native float getMarginNATIVE(int addr);
public int getNumPoints() {
return getNumPointsNATIVE((int) cPointer);
}
@org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);var returnedJSObj = jsObj.getNumPoints();return returnedJSObj;")
private static native int getNumPointsNATIVE(int addr);
public Vector3 getScaledPoint(int i) {
int pointer = getScaledPointNATIVE((int) cPointer, i);
btVector3.WRAPPER_GEN_01.setPointer(pointer);
btVector3.convert(btVector3.WRAPPER_GEN_01, btVector3.TEMP_GDX_01);
return btVector3.TEMP_GDX_01;
}
@org.teavm.jso.JSBody(params = {"addr", "i"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);var returnedJSObj = jsObj.getScaledPoint(i);return Bullet.getPointer(returnedJSObj);")
private static native int getScaledPointNATIVE(int addr, int i);
public void optimizeConvexHull() {
optimizeConvexHullNATIVE((int) cPointer);
}
@org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btConvexHullShape);jsObj.optimizeConvexHull();")
private static native void optimizeConvexHullNATIVE(int addr);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy