Package com.ardor3d.scenegraph.shape

Examples of com.ardor3d.scenegraph.shape.Box


        // create an object or two to manipulate
        addObjects();
    }

    private void addFloor() {
        final Box floor = new Box("floor", Vector3.ZERO, 100, 5, 100);
        floor.setTranslation(0, -5, 0);
        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("models/obj/pitcher.jpg", Texture.MinificationFilter.Trilinear, true));
        floor.setRenderState(ts);
        floor.getSceneHints().setPickingHint(PickingHint.Pickable, false);
        floor.setModelBound(new BoundingBox());
        _root.attachChild(floor);
    }
View Full Code Here


        floor.setModelBound(new BoundingBox());
        _root.attachChild(floor);
    }

    private void addObjects() {
        final Box box1 = new Box("box", Vector3.ZERO, 5, 15, 5);
        box1.setTranslation(0, box1.getYExtent(), 0);
        TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/skybox/1.jpg", Texture.MinificationFilter.Trilinear, true));
        box1.setRenderState(ts);
        box1.getSceneHints().setPickingHint(PickingHint.Pickable, true);
        box1.setModelBound(new BoundingBox());

        final Node base = new Node();
        base.setTranslation(0, 0, 0);
        base.attachChild(box1);
        _root.attachChild(base);

        final Sphere sphere = new Sphere("sphere", Vector3.ZERO, 16, 16, 8);
        ts = new TextureState();
        ts.setTexture(TextureManager.load("images/water/dudvmap.png", Texture.MinificationFilter.Trilinear, true));
        sphere.setRenderState(ts);
        sphere.getSceneHints().setPickingHint(PickingHint.Pickable, true);
        sphere.setModelBound(new BoundingSphere());

        final Node joint = new Node();
        joint.setTranslation(0, sphere.getRadius() + 2 * box1.getYExtent(), 0);
        joint.attachChild(sphere);
        base.attachChild(joint);

        final Box box2 = new Box("box", Vector3.ZERO, 5, 15, 5);
        box2.setTranslation(0, box2.getYExtent(), 0);
        ts = new TextureState();
        ts.setTexture(TextureManager.load("images/skybox/3.jpg", Texture.MinificationFilter.Trilinear, true));
        box2.setRenderState(ts);
        box2.getSceneHints().setPickingHint(PickingHint.Pickable, true);
        box2.setModelBound(new BoundingBox());

        final Node arm = new Node();
        arm.setTranslation(0, sphere.getRadius(), 0);
        arm.attachChild(box2);
        joint.attachChild(arm);
View Full Code Here

        _canvas.setTitle("Simple UI Example");

        UIComponent.setUseTransparency(true);

        // Add a spinning 3D box to show behind UI.
        final Box box = new Box("Box", new Vector3(0, 0, 0), 5, 5, 5);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, -15));
        box.addController(new SpatialController<Box>() {
            private final Matrix3 rotate = new Matrix3();
            private double angle = 0;
            private final Vector3 axis = new Vector3(1, 1, 0.5f).normalizeLocal();

            public void update(final double time, final Box caller) {
                angle += time * 50;
                angle %= 360;
                rotate.fromAngleNormalAxis(angle * MathUtils.DEG_TO_RAD, axis);
                caller.setRotation(rotate);
            }
        });
        // Add a texture to the box.
        final TextureState ts = new TextureState();

        final Texture tex = TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear,
                true);
        ts.setTexture(tex);
        box.setRenderState(ts);
        _root.attachChild(box);

        final UIPanel panel = makeWidgetPanel();

        final UIPanel panel2 = makeLoginPanel();
View Full Code Here

    /**
     * Setup terrain.
     */
    private void setupTerrain() {
        final Box box = new Box("box", new Vector3(), 10000, 10, 10000);
        box.setModelBound(new BoundingBox());

        box.addController(new SpatialController<Box>() {
            double timer = 0;

            public void update(final double time, final Box caller) {
                timer += time;
                caller.setTranslation(Math.sin(timer) * 20.0, 0, Math.cos(timer) * 20.0);
 
View Full Code Here

        final Node occluders = new Node("occs");
        _root.attachChild(occluders);
        for (int i = 0; i < 30; i++) {
            final double w = Math.random() * 40 + 10;
            final double y = Math.random() * 20 + 10;
            final Box b = new Box("box", new Vector3(), w, y, w);
            b.setModelBound(new BoundingBox());
            final double x = Math.random() * 1000 - 500;
            final double z = Math.random() * 1000 - 500;
            b.setTranslation(new Vector3(x, y, z));

            occluders.attachChild(b);
        }

        final Torus torusWithoutShadows = new Torus("torus", 32, 10, 15.0f, 20.0f);
View Full Code Here

        pp.setSpecular(new ColorRGBA(.2f, .2f, .2f, 1f));
        pp.setConstant(.1f);
        pp.setLinear(0.0000008f);
        pp.setQuadratic(0.0000008f);

        final Box sb = new Box("SkyBox", Vector3.ZERO, 50, 50, 50);
        sb.setModelBound(new BoundingBox());
        _root.attachChild(sb);

        final BasicText t1 = BasicText.createDefaultTextLabel("Text1", "[K] Show Skeleton.");
        t1.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        t1.getSceneHints().setLightCombineMode(LightCombineMode.Off);
View Full Code Here

    }

    private Node setupOccluders() {
        final Node occluders = new Node("Occluders");

        final Box box = new Box("Box", new Vector3(), 1, 40, 1);
        box.setModelBound(new BoundingBox());
        box.setRandomColors();

        final Random rand = new Random(1337);
        for (int x = 0; x < 8; x++) {
            for (int y = 0; y < 8; y++) {
                final Mesh sm = box.makeCopy(true);

                sm.setTranslation(500 + rand.nextDouble() * 300 - 150, 20 + rand.nextDouble() * 5.0,
                        500 + rand.nextDouble() * 300 - 150);
                occluders.attachChild(sm);
            }
View Full Code Here

        final Mesh sphere = new Sphere("Sphere", 16, 16, 5);
        sphere.setModelBound(new BoundingBox());
        sphere.setTranslation(new Vector3(-8, 0, -30));
        _root.attachChild(sphere);

        final Box box = new Box("Box", new Vector3(), 50, 1, 50);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, -1, -25));
        _root.attachChild(box);

        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
View Full Code Here

    }

    private Mesh createBox(final Node parentNode, final String textureName1, final String textureName2,
            final WrapMode mode) {
        // Create box
        final Box box = new Box("Box", new Vector3(0, 0, 0), 1, 1, 1);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(MathUtils.rand.nextInt(40) - 20, MathUtils.rand.nextInt(40) - 20, MathUtils.rand
                .nextInt(40) - 100));
        parentNode.attachChild(box);

        setupStates(box, textureName1, textureName2, mode);
View Full Code Here

    @Override
    protected void initExample() {
        for (int i = 0; i < 9; i++) {
            final double x = (i % 3 - 1) * 128.0;
            final double z = (i / 3 - 1) * 128.0;
            final Box b = new Box("" + i, new Vector3(x, 0, z), 5, 150, 5);
            _root.attachChild(b);
        }
        // Setup main camera.
        _canvas.setTitle("Shapes + Procedural Terrain Example");
        _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 300, 0));
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.