Package com.ardor3d.math

Examples of com.ardor3d.math.Matrix3


        _canvas.getCanvasRenderer().getCamera().setLocation(20, 40, 80);
        _canvas.getCanvasRenderer().getCamera().lookAt(0, 0, 0, Vector3.UNIT_Y);

        final Quad floor = new Quad("floor", 100, 100);
        floor.setRotation(new Matrix3().fromAngleNormalAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
        _root.attachChild(floor);

        final Teapot teapot = new Teapot("teapot");
        teapot.setScale(5);
        _root.attachChild(teapot);
View Full Code Here


        final Sphere sphere = new Sphere("Sphere", new Vector3(0, 0, 0), 32, 32, 5);
        sphere.setModelBound(new BoundingBox());
        sphere.setTranslation(new Vector3(0, 0, -15));
        sphere.addController(new SpatialController<Spatial>() {
            private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal();
            private final Matrix3 _rotate = new Matrix3();
            private double _angle = 0;

            public void update(final double time, final Spatial caller) {
                // update our rotation
                _angle = _angle + (_timer.getTimePerFrame() * 25);
                if (_angle > 180) {
                    _angle = -180;
                }

                _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis);
                sphere.setRotation(_rotate);
            }
        });
        _root.attachChild(sphere);

View Full Code Here

                        .getIntersectionPoint(0);
                sphere.setTranslation(intersectionPoint);

                final Vector3 intersectionNormal = pickResults.getPickData(0).getIntersectionRecord()
                        .getIntersectionNormal(0);
                final Matrix3 rotation = new Matrix3();
                rotation.lookAt(intersectionNormal, Vector3.UNIT_Z);
                arrow.setRotation(rotation);
                arrow.setTranslation(intersectionPoint);
            }
        }
    }
View Full Code Here

        _canvas.getCanvasRenderer().getCamera().lookAt(0, 0, 0, Vector3.UNIT_Y);

        projector.setFrustumPerspective(20.0f, 1.0f, 1.0f, 1000.0f);

        final Quad floor = new Quad("floor", 100, 100);
        floor.setRotation(new Matrix3().fromAngleNormalAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
        _root.attachChild(floor);

        final Teapot teapot = new Teapot("teapot");
        teapot.setScale(5);
        _root.attachChild(teapot);
View Full Code Here

        final Torus torus = new Torus("Torus", 50, 50, 8, 17);
        torus.setTranslation(new Vector3(50, -5, 20));
        TextureState ts = new TextureState();
        torus.addController(new SpatialController<Torus>() {
            private double timer = 0;
            private final Matrix3 rotation = new Matrix3();

            public void update(final double time, final Torus caller) {
                timer += time * 0.5;
                caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
                rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
                caller.setRotation(rotation);
            }
        });

        Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
View Full Code Here

        _root.attachChild(box);

        // set it to rotate:
        box.addController(new SpatialController<Spatial>() {
            private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal();
            private final Matrix3 _rotate = new Matrix3();
            private double _angle = 0;

            public void update(final double time, final Spatial caller) {
                // update our rotation
                _angle = _angle + (_timer.getTimePerFrame() * 25);
                if (_angle > 180) {
                    _angle = -180;
                }

                _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis);
                box.setRotation(_rotate);
            }
        });

        // Create a texture from the Ardor3D logo.
View Full Code Here

     *
     */
    // -----------------------------------------------------
    private SpatialController<Node> createNodeMover() {
        final SpatialController<Node> nodeMover = new SpatialController<Node>() {
            Matrix3 rot = new Matrix3();

            public void update(final double time, final Node caller) {
                final long t = System.currentTimeMillis();
                final double s = Math.cos(t * Math.PI / 10000.0);
                final double y = 60 + s * 65;
                caller.setTranslation(0.5, y, 0);
                rot.fromAngleNormalAxis(-(t / 1000.0) % (2 * Math.PI), Vector3.UNIT_Z);
                caller.setRotation(rot);
            }
        };
        return nodeMover;
    }
View Full Code Here

        final Torus torus = new Torus("Torus", 30, 20, 8, 17);
        torus.setTranslation(new Vector3(50, -5, 20));
        TextureState ts = new TextureState();
        torus.addController(new SpatialController<Torus>() {
            private double timer = 0;
            private final Matrix3 rotation = new Matrix3();

            public void update(final double time, final Torus caller) {
                timer += time * 0.5;
                caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
                rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
                caller.setRotation(rotation);
            }
        });

        Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
View Full Code Here

        final Torus torus = new Torus("Torus", 50, 50, 8, 17);
        torus.setTranslation(new Vector3(50, -5, 20));
        TextureState ts = new TextureState();
        torus.addController(new SpatialController<Torus>() {
            private double timer = 0;
            private final Matrix3 rotation = new Matrix3();

            public void update(final double time, final Torus caller) {
                timer += time * 0.5;
                caller.setTranslation(Math.sin(timer) * 40.0, Math.sin(timer) * 40.0, Math.cos(timer) * 40.0);
                rotation.fromAngles(timer * 0.5, timer * 0.5, timer * 0.5);
                caller.setRotation(rotation);
            }
        });

        Texture t0 = TextureManager.load("images/ardor3d_white_256.jpg",
View Full Code Here

        final Function3D scaledBaseWoodGrain = Functions.scaleInput(woodGrainNoise, 1, .25, 1);
        final Function3D woodGrain = Functions.scaleBias(scaledBaseWoodGrain, .125, 0);
        final Function3D combinedWood = Functions.add(baseWood, woodGrain);
        final Function3D perturbedWood = new TurbulenceFunction3D(combinedWood, 1 / 256.0, 4, 4.0);
        final Function3D translatedWood = Functions.translateInput(perturbedWood, 0, 0, 1.5);
        final Function3D rotatedWood = Functions.rotateInput(translatedWood, new Matrix3().fromAngles(
                MathUtils.DEG_TO_RAD * 6, 0, 0));
        final Function3D finalWood = new TurbulenceFunction3D(rotatedWood, 1 / 512.0, 2, 2.0);

        final ReadOnlyColorRGBA[] woodColors = new ReadOnlyColorRGBA[256];
        woodColors[0] = new ColorRGBA(189 / 255f, 94 / 255f, 4 / 255f, 1);
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Matrix3

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.