Package com.ardor3d.scenegraph.shape

Examples of com.ardor3d.scenegraph.shape.Box


        final MaterialState ms = new MaterialState();
        ms.setColorMaterial(ColorMaterial.AmbientAndDiffuse);

        // A box to check aspect ratio of 3D objects
        box1 = new Box("test box 1", new Vector3(-1, -1, -1), new Vector3(1, 1, 1));
        box1.setTranslation(0, 5, 0);
        box1.setRotation(new Quaternion().fromEulerAngles(MathUtils.DEG_TO_RAD * 45, MathUtils.DEG_TO_RAD * 60,
                MathUtils.DEG_TO_RAD * 30));
        box1.setSolidColor(ColorRGBA.GREEN);
        box1.setRenderState(ms);
        box1.updateModelBound();

        // Another one, not rotated
        box2 = new Box("test box 2", new Vector3(-1, -1, -1), new Vector3(1, 1, 1));
        box2.setTranslation(0, -5, 0);
        box2.setSolidColor(ColorRGBA.RED);
        box2.setRenderState(ms);
        box2.updateModelBound();

View Full Code Here


    private static final long serialVersionUID = 1L;

    @Override
    protected void initAppletScene() {
        // Make a box...
        final Box box = new Box("Box", Vector3.ZERO, 5, 5, 5);

        // Make it a bit more colorful.
        box.setRandomColors();

        // Setup a bounding box for it.
        box.setModelBound(new BoundingBox());

        // Set its location in space.
        box.setTranslation(new Vector3(0, 0, -15));

        // Add to root.
        _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.
        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        box.setRenderState(ts);
    }
View Full Code Here

        _canvas.setTitle("Shapes Example");

        wrapCount = 5;
        addMesh(new Arrow("Arrow", 3, 1));
        addMesh(new AxisRods("AxisRods", true, 3, 0.5));
        addMesh(new Box("Box", new Vector3(), 3, 3, 3));
        addMesh(new Capsule("Capsule", 5, 5, 5, 2, 5));
        addMesh(new Cone("Cone", 8, 8, 2, 4));
        addMesh(new Cylinder("Cylinder", 8, 8, 2, 4));
        addMesh(new Disk("Disk", 8, 8, 3));
        addMesh(new Dodecahedron("Dodecahedron", 3));
View Full Code Here

        t.setTranslation(new Vector3(0, 20, 0));
        _root.attachChild(t);

        final SwitchNode switchNode = new SwitchNode();

        Box box = new Box("Box", new Vector3(), 2, 1, 1);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, 0));
        switchNode.attachChild(box);

        box = new Box("Box", new Vector3(), 1, 2, 1);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, 0));
        box.setRandomColors();
        switchNode.attachChild(box);

        box = new Box("Box", new Vector3(), 1, 1, 2);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, 0));
        box.setRandomColors();
        switchNode.attachChild(box);
        switchNode.getSceneHints().setCullHint(CullHint.Dynamic);

        _root.attachChild(switchNode);
        _root.getSceneHints().setCullHint(CullHint.Never);
View Full Code Here

     *
     */
    // -----------------------------------------------------
    void newBox(final Node parent, final double x, final double y, final double z) {
        final float sz = 3;
        final Box box = new Box("box", new Vector3(Vector3.ZERO), new Vector3(sz, sz, sz));
        box.setTranslation(x, y, z);
        // box.setRandomColors();
        parent.attachChild(box);
    }
View Full Code Here

        cs.setEnabled(true);
        trailMesh.setRenderState(cs);

        _root.attachChild(trailMesh);

        final Box box = new Box("Box", new Vector3(0, 0, 0), 1000, 1, 1000);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, -50, 0));
        box.setRandomColors();
        _root.attachChild(box);
        ts = new TextureState();
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        box.setRenderState(ts);

        sphere = new Sphere("Sphere", 16, 16, 4);
        _root.attachChild(sphere);

        // Setup labels for presenting example info.
View Full Code Here

        _lightState.setEnabled(false);

        _canvas.setTitle("Multi-pass Texture Example");

        // Create a new box centered at (0,0,0) with width/height/depth of size 10.
        box = new Box("Box", new Vector3(0, 0, 0), 5, 5, 5);
        // Set a bounding box for frustum culling.
        box.setModelBound(new BoundingBox());
        // Move the box out from the camera 15 units.
        box.setTranslation(new Vector3(0, 0, -15));
View Full Code Here

        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
        box.setTranslation(new Vector3(0, -7, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(15, 10, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(0, -10, 15));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(20, 0, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        ts = new TextureState();
        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
        box.setTranslation(new Vector3(0, -15, 0));
        box.setRenderState(ts);
        box.setModelBound(new BoundingBox());
        objects.attachChild(box);

        return objects;
    }
View Full Code Here

        // just a node with lots of random boxes
        final Node node = new Node();

        final Random r = new Random(1337);
        for (int i = 0; i < 150; i++) {
            final Box box = new Box("b" + i, new Vector3(0, 0, 0), new Vector3(0.1f, 0.1f, 0.1f));
            box.updateModelBound();
            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

        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        Box box = new Box("box1", new Vector3(-10, -10, -10), new Vector3(10, 10, 10));
        box.setTranslation(new Vector3(0, -7, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box2", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(15, 10, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box3", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(0, -10, 15));
        box.setRenderState(ts);
        objects.attachChild(box);

        box = new Box("box4", new Vector3(-5, -5, -5), new Vector3(5, 5, 5));
        box.setTranslation(new Vector3(20, 0, 0));
        box.setRenderState(ts);
        objects.attachChild(box);

        ts = new TextureState();
        t0 = TextureManager
                .load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.BilinearNearestMipMap, true);
        t0.setWrap(Texture.WrapMode.Repeat);
        ts.setTexture(t0);

        box = new Box("box5", new Vector3(-50, -2, -50), new Vector3(50, 2, 50));
        box.setTranslation(new Vector3(0, -15, 0));
        box.setRenderState(ts);
        box.setModelBound(new BoundingBox());
        objects.attachChild(box);

        return objects;
    }
View Full Code Here

TOP

Related Classes of com.ardor3d.scenegraph.shape.Box

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.