Package cc.plural.math

Source Code of cc.plural.math.Matrix4fTest

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cc.plural.math;

import java.nio.FloatBuffer;
import junit.framework.TestCase;
import org.lwjgl.BufferUtils;

/**
*
* @author jmarsden
*/
public class Matrix4fTest extends TestCase {

    public Matrix4fTest(String testName) {
        super(testName);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();
    }

    /**
     * Test of getData method, of class Matrix4f.
     */
    public void testCorrectMatrixOutput() {
        System.out.println("testCorrectMatrixOutput");
        org.lwjgl.util.vector.Matrix4f projectionMatrix = new org.lwjgl.util.vector.Matrix4f();
        projectionMatrix.m01 = 5;
        FloatBuffer matrix44Buffer = BufferUtils.createFloatBuffer(16);
        projectionMatrix.store(matrix44Buffer);
        matrix44Buffer.flip();

        System.out.println("Matrix:\r\n" + projectionMatrix.toString());
        System.out.println("Array:\r\n" + matrix44Buffer.toString());
        for(int i = 0; i < matrix44Buffer.capacity(); i++) {
            System.out.print("" + matrix44Buffer.get() + " ");
        }
        System.out.println();
    }

    public void testMatrixOutput() {
        System.out.println("testMatrixOutput");
        Matrix4f projectionMatrix = Matrix4f.identity();
        projectionMatrix.mat4x4[4] = 5;
        FloatBuffer matrix44Buffer = BufferUtils.createFloatBuffer(16);
        projectionMatrix.loadColumnMajor(matrix44Buffer);
        matrix44Buffer.flip();

        System.out.println("Matrix:\r\n" + projectionMatrix.toString());
        System.out.println("Array:\r\n" + matrix44Buffer.toString());
        for(int i = 0; i < matrix44Buffer.capacity(); i++) {
            System.out.print("" + matrix44Buffer.get() + " ");
        }
        System.out.println();
    }
}
TOP

Related Classes of cc.plural.math.Matrix4fTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.