Package com.ardor3d.math

Examples of com.ardor3d.math.Matrix4


     * @param transforms
     *            List of transform elements
     * @return an Ardor3D Transform object
     */
    public Transform getNodeTransforms(final List<Element> transforms) {
        final Matrix4 workingMat = Matrix4.fetchTempInstance();
        final Matrix4 finalMat = Matrix4.fetchTempInstance();
        finalMat.setIdentity();
        for (final Element transform : transforms) {
            final double[] array = _colladaDOMUtil.parseDoubleArray(transform);
            if ("translate".equals(transform.getName())) {
                workingMat.setIdentity();
                workingMat.setColumn(3, new Vector4(array[0], array[1], array[2], 1.0));
                finalMat.multiplyLocal(workingMat);
            } else if ("rotate".equals(transform.getName())) {
                if (array[3] != 0) {
                    workingMat.setIdentity();
                    final Matrix3 rotate = new Matrix3().fromAngleAxis(array[3] * MathUtils.DEG_TO_RAD, new Vector3(
                            array[0], array[1], array[2]));
                    workingMat.set(rotate);
                    finalMat.multiplyLocal(workingMat);
                }
            } else if ("scale".equals(transform.getName())) {
                workingMat.setIdentity();
                workingMat.scale(new Vector4(array[0], array[1], array[2], 1), workingMat);
                finalMat.multiplyLocal(workingMat);
            } else if ("matrix".equals(transform.getName())) {
                workingMat.fromArray(array);
                finalMat.multiplyLocal(workingMat);
            } else if ("lookat".equals(transform.getName())) {
                final Vector3 pos = new Vector3(array[0], array[1], array[2]);
                final Vector3 target = new Vector3(array[3], array[4], array[5]);
                final Vector3 up = new Vector3(array[6], array[7], array[8]);
                final Matrix3 rot = new Matrix3();
                rot.lookAt(target.subtractLocal(pos), up);
                workingMat.set(rot);
                workingMat.setColumn(3, new Vector4(array[0], array[1], array[2], 1));
                finalMat.multiplyLocal(workingMat);
            } else {
                logger.warning("transform not currently supported: " + transform.getClass().getCanonicalName());
            }
        }
        return new Transform().fromHomogeneousMatrix(finalMat);
View Full Code Here


        projectionMatrix[6] = scaledPlaneVector.getY();
        projectionMatrix[10] = scaledPlaneVector.getZ() + 1.0;
        projectionMatrix[14] = scaledPlaneVector.getW();

        // Load it back into OpenGL
        final Matrix4 newProjectionMatrix = tmpMatrix.fromArray(projectionMatrix);
        tRenderer.getCamera().setProjectionMatrix(newProjectionMatrix);
    }
View Full Code Here

     */
    protected void setupTextures() {
        textureReflect = new Texture2D();
        textureReflect.setWrap(Texture.WrapMode.EdgeClamp);
        textureReflect.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
        Matrix4 matrix = new Matrix4();
        matrix.setM00(-1.0);
        matrix.setM30(1.0);
        textureReflect.setTextureMatrix(matrix);
        tRenderer.setupTexture(textureReflect);

        normalmapTexture = TextureManager.load(normalMapTextureString, Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true);
        textureState.setTexture(normalmapTexture, 0);
        normalmapTexture.setWrap(Texture.WrapMode.Repeat);

        textureReflectBlur = new Texture2D();
        textureReflectBlur.setWrap(Texture.WrapMode.EdgeClamp);
        textureReflectBlur.setMagnificationFilter(Texture.MagnificationFilter.Bilinear);
        textureReflectBlur.setTextureMatrix(matrix);
        tRenderer.setupTexture(textureReflectBlur);

        textureState.setTexture(textureReflectBlur, 1);

        dudvTexture = TextureManager.load(dudvMapTextureString, Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessNoCompressedFormat, true);
        matrix = new Matrix4();
        matrix.setM00(0.8);
        matrix.setM11(0.8);
        dudvTexture.setTextureMatrix(matrix);
        textureState.setTexture(dudvTexture, 2);
        dudvTexture.setWrap(Texture.WrapMode.Repeat);

        if (useRefraction) {
View Full Code Here

        fallbackTexture = TextureManager.load(fallbackMapTextureString, Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true);
        fallbackTextureState.setTexture(fallbackTexture, 0);
        fallbackTexture.setWrap(Texture.WrapMode.Repeat);

        fallbackTextureStateMatrix = new Matrix4();

        as1 = new BlendState();
        as1.setBlendEnabled(true);
        as1.setTestEnabled(true);
        as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Matrix4

Copyright © 2018 www.massapicom. 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.