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

com.badlogic.gdx.physics.bullet.linearmath.btQuaternion 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.Quaternion;
import com.badlogic.gdx.math.Vector3;

/**
 * @author xpenatan
 */
public class btQuaternion extends btQuadWord {

    public static btQuaternion WRAPPER_GEN_01 = new btQuaternion(false);

    public static btQuaternion TEMP_0 = new btQuaternion(true);

    public static btQuaternion TEMP_1 = new btQuaternion(true);

    public static btQuaternion TEMP_2 = new btQuaternion(true);

    public static btQuaternion TEMP_3 = new btQuaternion(true);

    public static btQuaternion TEMP_4 = new btQuaternion(true);

    public static Quaternion TEMP_GDX_01 = new Quaternion();

    public static btQuaternion emptyTransform = new btQuaternion(false);

    public btQuaternion() {
        this(true);
    }

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

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

    public static void convert(Quaternion in, btQuaternion out) {
        out.setValue(in.x, in.y, in.z, in.w);
    }

    public static void convert(btQuaternion in, Quaternion out) {
        out.x = in.x();
        out.y = in.y();
        out.z = in.z();
        out.w = in.w();
    }

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

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

    public void setValue(float x, float y, float z, float w) {
        setValueNATIVE((int) cPointer, x, y, z, w);
    }

    @org.teavm.jso.JSBody(params = {"addr", "x", "y", "z", "w"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btQuaternion);jsObj.setValue(x, y, z, w);")
    private static native void setValueNATIVE(int addr, float x, float y, float z, float w);

    public void setEulerZYX(float z, float y, float x) {
        setEulerZYXNATIVE((int) cPointer, z, y, x);
    }

    @org.teavm.jso.JSBody(params = {"addr", "z", "y", "x"}, script = "var jsObj = Bullet.wrapPointer(addr, Bullet.btQuaternion);jsObj.setEulerZYX(z, y, x);")
    private static native void setEulerZYXNATIVE(int addr, float z, float y, float x);

    public void setRotation(btVector3 axis, float angle) {
        setRotationNATIVE((int) cPointer, (int) axis.getCPointer(), angle);
    }

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

    public void setRotation(Vector3 axisGDX, float angle) {
        btVector3.convert(axisGDX, btVector3.TEMP_0);
        btVector3 axis = btVector3.TEMP_0;
        setRotationNATIVE((int) cPointer, (int) axis.getCPointer(), angle);
    }

    public void normalize() {
        normalizeNATIVE((int) cPointer);
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy