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

com.badlogic.gdx.physics.bullet.linearmath.btMotionState 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;

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

    public static btMotionState WRAPPER_GEN_01 = new btMotionState(false);

    private void initJavaObject() {
        SetWorldTransform setWorldTransform = new SetWorldTransform() {

            @Override
            public void setWorldTransformJS(int worldTransAddr) {
                tempMat.idt();
                btTransform.convert(worldTransAddr, tempMat);
                setWorldTransform(tempMat);
            }
        };
        GetWorldTransform getWorldTransform = new GetWorldTransform() {

            @Override
            public void getWorldTransformJS(int worldTransAddr) {
                tempMat.idt();
                getWorldTransform(tempMat);
                btTransform.convert(tempMat, worldTransAddr);
            }
        };
        int pointer = createNative(setWorldTransform, getWorldTransform);
        initObject(pointer, true);
    }

    @org.teavm.jso.JSFunctor
    public interface GetWorldTransform extends org.teavm.jso.JSObject {

        void getWorldTransformJS(int worldTrans);
    }

    @org.teavm.jso.JSFunctor
    public interface SetWorldTransform extends org.teavm.jso.JSObject {

        void setWorldTransformJS(int worldTrans);
    }

    @org.teavm.jso.JSBody(params = { "setWorldTransform", "getWorldTransform" }, script = "var jsMotionState = new Bullet.MyMotionState(); jsMotionState.setWorldTransform = setWorldTransform; jsMotionState.getWorldTransform = getWorldTransform; return Bullet.getPointer(jsMotionState);")
    private static native int createNative(SetWorldTransform setWorldTransform, GetWorldTransform getWorldTransform);

    Matrix4 tempMat = new Matrix4();

    public btMotionState() {
        initJavaObject();
    }

    @Override
    protected void deleteNative() {
        deleteNative((int) cPointer);
    }

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

    /**
     * Called to initialize body position. Modify worldTrans.
     */
    public void getWorldTransform(Matrix4 worldTrans) {
    }

    /**
     * Called when rigid body change position. Update your render matrix with worldTrans.
     */
    public void setWorldTransform(Matrix4 worldTrans) {
    }

    public btMotionState(boolean cMemoryOwn) {
    }

    public void getWorldTransform(btTransform worldTrans) {
        getWorldTransformNATIVE((int) cPointer, (int) worldTrans.getCPointer());
    }

    @org.teavm.jso.JSBody(params = {"addr", "worldTransAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btMotionState);jsObj.getWorldTransform(worldTransAddr);")
    private static native void getWorldTransformNATIVE(int addr, int worldTransAddr);

    public void setWorldTransform(btTransform worldTrans) {
        setWorldTransformNATIVE((int) cPointer, (int) worldTrans.getCPointer());
    }

    @org.teavm.jso.JSBody(params = {"addr", "worldTransAddr"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btMotionState);jsObj.setWorldTransform(worldTransAddr);")
    private static native void setWorldTransformNATIVE(int addr, int worldTransAddr);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy