Package com.ardor3d.math

Examples of com.ardor3d.math.Quaternion


        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        sp.setRenderState(ts);

        // add some scenery
        final Pyramid b = new Pyramid("box", 2, 3);
        b.setRotation(new Quaternion().fromAngleNormalAxis(MathUtils.PI, Vector3.UNIT_X));
        b.addController(new SpatialController<Spatial>() {
            public void update(final double time, final Spatial caller) {
                b.setTranslation(-3, 6 * MathUtils.sin(_timer.getTimeInSeconds()), 0);
            };
        });
View Full Code Here


            box.setRandomColors();
            final MaterialState ms = new MaterialState();
            ms.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(r.nextFloat(), r.nextFloat(), r.nextFloat(), 1));
            box.setRenderState(ms);
            box.setTranslation(new Vector3(r.nextFloat(), r.nextFloat(), r.nextFloat()));
            box.setRotation(new Quaternion(r.nextFloat(), r.nextFloat(), r.nextFloat(), 1));
            node.attachChild(box);
        }

        return node;
    }
View Full Code Here

    }

    @Override
    protected QuaternionInterpolationController createController() {
        // Create our control point rotations
        final Quaternion[] quats = { new Quaternion(0.0, 0.0, 0.0, 1.0), //
                new Quaternion(1.0, 0.0, 0.0, 1.0), //
                new Quaternion(0.0, 1.0, 0.0, 1.0), //
                new Quaternion(0.0, 0.0, 1.0, 1.0), //
                new Quaternion(1.0, 1.0, 1.0, 1.0) };

        // Create our controller
        final QuaternionInterpolationController controller = new QuaternionInterpolationController();
        controller.setControls(quats);
        controller.setActive(true);
View Full Code Here

        // set the color to green using a single color value
        floor.setDefaultColor(ColorRGBA.GREEN);
        // move back from camera.
        floor.setTranslation(0, -5, -20);
        // rotate to point up
        floor.setRotation(new Quaternion(-1, 0, 0, 1));

        // Add a material state.
        final MaterialState ms = new MaterialState();
        floor.setRenderState(ms);
        // Pull diffuse color for front and back from mesh color
View Full Code Here

        clockPanel.addController(new SpatialController<Spatial>() {
            public void update(final double time, final Spatial caller) {
                final double angle1 = _timer.getTimeInSeconds() % MathUtils.TWO_PI;
                final double angle2 = (_timer.getTimeInSeconds() / 12.) % MathUtils.TWO_PI;

                minute.getTransform().setRotation(new Quaternion().fromAngleAxis(angle1, Vector3.NEG_UNIT_Z));
                hour.getTransform().setRotation(new Quaternion().fromAngleAxis(angle2, Vector3.NEG_UNIT_Z));
                clockPanel.fireComponentDirty();
            };
        });

        return clockPanel;
View Full Code Here

        globesNode.attachChild(geoSphere);

        sphere = new Sphere("Projected mapping, radius 2", Vector3.ZERO, 65, 65, 2, TextureMode.Projected);
        globesNode.attachChild(sphere);

        globesNode.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X));
        int startX = -globesNode.getChildren().size() / 2;
        for (final Spatial s : globesNode.getChildren()) {
            final Mesh m = (Mesh) s;
            m.updateModelBound();
            startX += ((BoundingSphere) m.getModelBound(null)).getRadius() * 2;
 
View Full Code Here

        final Md2DataStore storage = importer.load("md2/drfreak.md2");
        System.out.println("Importing Took " + (System.currentTimeMillis() - time) + " ms");

        final Mesh model = storage.getScene();
        // md2 models are usually z-up - switch to y-up
        model.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X));
        // attack to root
        _root.attachChild(model);

        // speed us up a little
        final KeyframeController<Mesh> controller = storage.getController();
View Full Code Here

        // _pssmPass.setDrawDebug(true);

        // TODO: backside lock test
        final Quad floor = new Quad("floor", 2048, 2048);
        floor.updateModelBound();
        floor.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));
        floor.setTranslation(1024, 0, 1024);
        terrainNode.attachChild(floor);

        _pssmPass.addBoundsReceiver(terrainNode);
View Full Code Here

        try {
            final ColladaStorage storage = new ColladaImporter().load("collada/sketchup/NASA Mars Rover.dae");
            final Node rover = storage.getScene();
            rover.setTranslation(440, 102, 160.1);
            rover.setScale(3);
            rover.setRotation(new Quaternion().fromAngleAxis(-MathUtils.HALF_PI, Vector3.UNIT_X));
            _root.attachChild(rover);
        } catch (final IOException ex) {
            ex.printStackTrace();
        }
View Full Code Here

            final TerrainDataProvider terrainDataProvider = new ArrayTerrainDataProvider(heightMap, SIZE, new Vector3(
                    1, 300, 1));

            terrain = new TerrainBuilder(terrainDataProvider, terrainCamera).setShowDebugPanels(true).build();

            terrain.setRotation(new Quaternion().fromAngleAxis(MathUtils.HALF_PI, Vector3.UNIT_X));

            _root.attachChild(terrain);
        } catch (final Exception ex1) {
            System.out.println("Problem setting up terrain...");
            ex1.printStackTrace();
View Full Code Here

TOP

Related Classes of com.ardor3d.math.Quaternion

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.