Package com.ardor3d.scenegraph.shape

Examples of com.ardor3d.scenegraph.shape.Box


            return;
        }
        // add a cube to the scene
        // add a rotating controller to the cube
        // add a light
        box = new Box("The cube", new Vector3(-1, -1, -1), new Vector3(1, 1, 1));

        final ZBufferState buf = new ZBufferState();
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
        scene.getRoot().setRenderState(buf);
View Full Code Here


        _canvas.setTitle("Mouse Manager Example");

        final Vector3 max = new Vector3(5, 5, 5);
        final Vector3 min = new Vector3(-5, -5, -5);

        t = new Box("Box", min, max);
        t.setModelBound(new BoundingBox());
        t.setTranslation(new Vector3(0, 0, -15));
        _root.attachChild(t);

        t.setRandomColors();
View Full Code Here

        keyText.getSceneHints().setRenderBucketType(RenderBucketType.Ortho);
        keyText.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        keyText.setTranslation(new Vector3(0, 20, 0));
        _root.attachChild(keyText);

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

        final QuadImposterNode imposter0 = new QuadImposterNode("Imposter1", 256, 256, _settings.getDepthBits(),
                _settings.getSamples(), _timer);
        imposter0.setRedrawRate(0.0); // No timed update
View Full Code Here

    }

    private Node createModel() {
        final Node node = new Node("Node");

        final Box box = new Box("Box", new Vector3(), 5, 5, 5);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(-3, 0, 0));
        box.setRandomColors();
        node.attachChild(box);

        final Teapot teapot = new Teapot("Teapot");
        teapot.setScale(2.0);
        teapot.setTranslation(new Vector3(3, 0, 0));
View Full Code Here

    protected void initExample() {
        _canvas.setTitle("Matrix LookAt Test");

        _canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 0, 140));

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

        targetMesh = new Sphere("Target", 8, 8, 2);
        // update the default bounding sphere
        targetMesh.updateModelBound();
        _root.attachChild(targetMesh);
        targetMesh.setRandomColors();

        for (int x = 0; x < 10; x++) {
            for (int y = 0; y < 10; y++) {
                final Mesh sm = box.makeCopy(true);

                sm.setTranslation((x - 5.0) * 10.0, (y - 5.0) * 10.0, -10.0);
                _root.attachChild(sm);

                boxes.add(sm);
View Full Code Here

    @Override
    protected void initExample() {
        _canvas.setTitle("Box 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));
        // Give the box some nice colors.
View Full Code Here

        orthos.getSceneHints().setRenderBucketType(RenderBucketType.Skip);
        _root.attachChild(orthos);
        _root.attachChild(transps);
        _root.attachChild(opaques);

        final Box b1 = new Box("Box", min, max);
        b1.setModelBound(new BoundingBox());
        b1.setTranslation(new Vector3(0, 0, -15));
        opaques.attachChild(b1);

        final Box b2 = new Box("Box", min, max);
        b2.setModelBound(new BoundingBox());
        b2.setTranslation(new Vector3(0, 0, -30));
        opaques.attachChild(b2);

        final Box b3 = new Box("Box", min, max);
        b3.setModelBound(new BoundingBox());
        b3.setTranslation(new Vector3(0, -15, -15));
        opaques.attachChild(b3);

        final TextureState ts = new TextureState();
        ts.setEnabled(true);
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", MinificationFilter.Trilinear, true));
        opaques.setRenderState(ts);

        final LightState ls = new LightState();
        ls.setEnabled(true);
        final DirectionalLight dLight = new DirectionalLight();
        dLight.setEnabled(true);
        dLight.setDiffuse(new ColorRGBA(1, 1, 1, 1));
        dLight.setDirection(new Vector3(1, 1, 1));
        ls.attach(dLight);
        final DirectionalLight dLight2 = new DirectionalLight();
        dLight2.setEnabled(true);
        dLight2.setDiffuse(new ColorRGBA(1, 1, 1, 1));
        dLight2.setDirection(new Vector3(-1, -1, -1));
        ls.attach(dLight2);
        ls.setTwoSidedLighting(false);
        transps.setRenderState(ls);
        transps.getSceneHints().setLightCombineMode(LightCombineMode.Replace);

        final Box tb1 = new Box("TBox Blue", min, max);
        tb1.setModelBound(new BoundingBox());
        tb1.setTranslation(new Vector3(0, 15, 15));
        transps.attachChild(tb1);
        final MaterialState ms1 = new MaterialState();
        ms1.setEnabled(true);
        ms1.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 0, 1, .75f));
        ms1.setShininess(MaterialFace.FrontAndBack, 128);
        tb1.setRenderState(ms1);

        final Torus tb2 = new Torus("TBox Green", 20, 20, 3, 6);
        tb2.setModelBound(new BoundingBox());
        tb2.setTranslation(new Vector3(0, 0, 30));
        transps.attachChild(tb2);
        final MaterialState ms2 = new MaterialState();
        ms2.setEnabled(true);
        ms2.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(0, 1, 0, .5f));
        ms2.setShininess(MaterialFace.FrontAndBack, 128);
        tb2.setRenderState(ms2);

        final Box tb3 = new Box("TBox Red", min, max);
        tb3.setModelBound(new BoundingBox());
        tb3.setTranslation(new Vector3(0, 0, 15));
        transps.attachChild(tb3);
        final MaterialState ms3 = new MaterialState();
        ms3.setEnabled(true);
        ms3.setDiffuse(MaterialFace.FrontAndBack, new ColorRGBA(1, 0, 0, .5f));
        ms3.setShininess(MaterialFace.FrontAndBack, 128);
        tb3.setRenderState(ms3);

        final BlendState as = new BlendState();
        as.setEnabled(true);
        as.setBlendEnabled(true);
        as.setSourceFunction(SourceFunction.SourceAlpha);
View Full Code Here

    @Override
    protected void initExample() {
        _canvas.setTitle("Interpolation Controller Example");

        // Create a new box to interpolate (see BoxExample for more info)
        box = new Box("Box", new Vector3(0, 0, 0), 5, 5, 5);
        box.setModelBound(new BoundingBox());
        box.setTranslation(new Vector3(0, 0, -15));
        _root.attachChild(box);

        final TextureState ts = new TextureState();
View Full Code Here

        }));

        final Vector3 max = new Vector3(5, 5, 5);
        final Vector3 min = new Vector3(-5, -5, -5);

        t = new Box("Box", min, max);
        t.setModelBound(new BoundingBox());
        t.setTranslation(new Vector3(0, 0, -15));
        _root.attachChild(t);

        final TextureState ts = new TextureState();
View Full Code Here

        cam.setLocation(new Vector3(0, 0, 50));
        cam.lookAt(new Vector3(0, 0, 0), Vector3.UNIT_Y);

        buildShader();

        box = new Box("box", Vector3.ZERO, 10, 10, 10);
        box.setRenderState(_wireframeShaderState);
        _root.attachChild(box);
    }
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.