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

com.badlogic.gdx.physics.bullet.linearmath.btTransform Maven / Gradle / Ivy

There is a newer version: 1.0.0-b6
Show newest version
/*-------------------------------------------------------
 * This file was generated by JParser
 *
 * Do not make changes to this file
 *-------------------------------------------------------*/
package com.badlogic.gdx.physics.bullet.linearmath;

import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.physics.bullet.BulletBase;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.Quaternion;

/**
 * @author xpenatan
 */
public class btTransform extends BulletBase {

    public static btTransform WRAPPER_GEN_01 = new btTransform(false);

    public static btTransform TEMP_0 = new btTransform(true);

    public static btTransform TEMP_1 = new btTransform(true);

    public static btTransform TEMP_2 = new btTransform(true);

    public static btTransform TEMP_3 = new btTransform(true);

    public static btTransform TEMP_4 = new btTransform(true);

    public static btTransform emptyTransform = new btTransform(false);

    public static Matrix4 TEMP_GDX_01 = new Matrix4();

    public btTransform() {
        this(true);
    }

    /**
     * Useful on creating temp objects
     */
    public btTransform(boolean cMemoryOwn) {
        initObject(cMemoryOwn ? createNative() : 0, cMemoryOwn);
    }

    @org.teavm.jso.JSBody(script = "var jsObj = new Bullet.btTransform(); 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.btTransform); Bullet.destroy(jsObj);")
    private static native void deleteNative(int addr);

    public void setFromOpenGLMatrix(float[] m) {
        setFromOpenGLMatrix((int) cPointer, m);
    }

    @org.teavm.jso.JSBody(params = {"addr", "m"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform); jsObj.setFromOpenGLMatrix(m);")
    private static native void setFromOpenGLMatrix(int addr, @org.teavm.jso.JSByRef() float[] m);

    public void getOpenGLMatrix(float[] m) {
        getOpenGLMatrix((int) cPointer, m);
    }

    @org.teavm.jso.JSBody(params = {"addr", "m"}, script = "var worldTrans = Bullet.wrapPointer(addr, Bullet.btTransform); var origin = worldTrans.getOrigin(); var matrix3x3 = worldTrans.getBasis(); var row0 = matrix3x3.getRow(0); var row1 = matrix3x3.getRow(1); var row2 = matrix3x3.getRow(2); m[0] = row0.x(); m[1] = row1.x(); m[2] = row2.x(); m[3] = 0; m[4] = row0.y(); m[5] = row1.y(); m[6] = row2.y(); m[7] = 0; m[8] = row0.z(); m[9] = row1.z(); m[10] = row2.z(); m[11] = 0; m[12] = origin.x(); m[13] = origin.y(); m[14] = origin.z(); m[15] = 1.0;")
    private static native void getOpenGLMatrix(int addr, @org.teavm.jso.JSByRef() float[] m);

    public static void convert(Matrix4 in, btTransform out) {
        out.setFromOpenGLMatrix(in.val);
    }

    public static void convert(btTransform in, Matrix4 out) {
        in.getOpenGLMatrix(out.val);
    }

    public static void convert(Matrix4 in, long outAddr) {
        emptyTransform.setPointer(outAddr);
        convert(in, emptyTransform);
    }

    public static void convert(long inAddr, Matrix4 out) {
        emptyTransform.setPointer(inAddr);
        convert(emptyTransform, out);
    }

    public void setIdentity() {
        setIdentityNATIVE((int) cPointer);
    }

    @org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);jsObj.setIdentity();")
    private static native void setIdentityNATIVE(int addr);

    public void setOrigin(btVector3 origin) {
        setOriginNATIVE((int) cPointer, (int) origin.getCPointer());
    }

    @org.teavm.jso.JSBody(params = {"addr", "originAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);jsObj.setOrigin(originAddr);")
    private static native void setOriginNATIVE(int addr, int originAddr);

    public void setOrigin(Vector3 originGDX) {
        btVector3.convert(originGDX, btVector3.TEMP_0);
        btVector3 origin = btVector3.TEMP_0;
        setOriginNATIVE((int) cPointer, (int) origin.getCPointer());
    }

    public void setRotation(btQuaternion rotation) {
        setRotationNATIVE((int) cPointer, (int) rotation.getCPointer());
    }

    @org.teavm.jso.JSBody(params = {"addr", "rotationAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);jsObj.setRotation(rotationAddr);")
    private static native void setRotationNATIVE(int addr, int rotationAddr);

    public void setRotation(Quaternion rotationGDX) {
        btQuaternion.convert(rotationGDX, btQuaternion.TEMP_0);
        btQuaternion rotation = btQuaternion.TEMP_0;
        setRotationNATIVE((int) cPointer, (int) rotation.getCPointer());
    }

    public Vector3 getOrigin() {
        int pointer = getOriginNATIVE((int) cPointer);
        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"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);var returnedJSObj = jsObj.getOrigin();return Bullet.getPointer(returnedJSObj);")
    private static native int getOriginNATIVE(int addr);

    public Quaternion getRotation() {
        int pointer = getRotationNATIVE((int) cPointer);
        btQuaternion.WRAPPER_GEN_01.setPointer(pointer);
        btQuaternion.convert(btQuaternion.WRAPPER_GEN_01, btQuaternion.TEMP_GDX_01);
        return btQuaternion.TEMP_GDX_01;
    }

    @org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);var returnedJSObj = jsObj.getRotation();return Bullet.getPointer(returnedJSObj);")
    private static native int getRotationNATIVE(int addr);

    public btMatrix3x3 getBasis() {
        int pointer = getBasisNATIVE((int) cPointer);
        btMatrix3x3.WRAPPER_GEN_01.setPointer(pointer);
        return btMatrix3x3.WRAPPER_GEN_01;
    }

    @org.teavm.jso.JSBody(params = {"addr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);var returnedJSObj = jsObj.getBasis();return Bullet.getPointer(returnedJSObj);")
    private static native int getBasisNATIVE(int addr);

    public void setFromOpenGLMatrix(float m) {
        setFromOpenGLMatrixNATIVE((int) cPointer, m);
    }

    @org.teavm.jso.JSBody(params = {"addr", "m"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);jsObj.setFromOpenGLMatrix(m);")
    private static native void setFromOpenGLMatrixNATIVE(int addr, float m);

    public void getOpenGLMatrix(float m) {
        getOpenGLMatrixNATIVE((int) cPointer, m);
    }

    @org.teavm.jso.JSBody(params = {"addr", "m"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btTransform);jsObj.getOpenGLMatrix(m);")
    private static native void getOpenGLMatrixNATIVE(int addr, float m);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy