Package com.ardor3d.scenegraph.shape

Examples of com.ardor3d.scenegraph.shape.Box


    protected void initExample() {

        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


    @Inject
    Physics physics;

    public void onEvent(Event event) {
        if (event instanceof Init) {
            Box floor = new Box("Floor", new Vector3(), width, 1, height);
            floor.setTranslation(0, -30, 0);
           // floor.setRandomColors();
            floor.setSolidColor(ColorRGBA.GREEN);
            nodes.attachToParent(NodeRepository.ROOT_NODE,floor);
            nodes.getNode(NodeRepository.ROOT_NODE).updateGeometricState(0);
           
            physics.addFloor(floor);
           
View Full Code Here

    Box box;
   
    public void initBox(){
           
            // 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, 0));
            // Give the box some nice colors.
View Full Code Here

        createDefaultHandle(extent);
    }

    protected void createDefaultHandle(final double extent) {
        final Box grip = new Box("grip", Vector3.ZERO, extent, extent, extent);
        grip.updateModelBound();
        _handle.attachChild(grip);

        // setup some colors, just at the corner of the primitives since we will use flat shading.
        grip.setSolidColor(ColorRGBA.WHITE);
        final FloatBuffer colors = grip.getMeshData().getColorBuffer();
        BufferUtils.setInBuffer(ColorRGBA.MAGENTA, colors, 0);
        BufferUtils.setInBuffer(ColorRGBA.CYAN, colors, 4);
        BufferUtils.setInBuffer(ColorRGBA.MAGENTA, colors, 8);
        BufferUtils.setInBuffer(ColorRGBA.CYAN, colors, 12);
        BufferUtils.setInBuffer(ColorRGBA.YELLOW, colors, 16);
        BufferUtils.setInBuffer(ColorRGBA.YELLOW, colors, 20);

        // set flat shading
        final ShadingState shade = new ShadingState();
        shade.setShadingMode(ShadingMode.Flat);
        grip.setRenderState(shade);

        // setup a material state to use the colors from the vertices.
        final MaterialState material = new MaterialState();
        material.setColorMaterial(ColorMaterial.Diffuse);
        grip.setRenderState(material);
    }
View Full Code Here

    /**
     * Initialize our scene.
     */
    private void initExample() {
        // Make a box...
        final Box _box = new Box("Box", Vector3.ZERO, 5, 5, 5);

        // Setup a bounding box for it -- updateModelBound is called automatically internally.
        _box.setModelBound(new BoundingBox());

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

        // 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);
            }
        });

        // Add our awt based image loader.
        AWTImageLoader.registerLoader();
View Full Code Here

     */
    private void initExample() {
        _canvas.setTitle("LwjglBasicExample - close window to exit");

        // 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);
            }
        });

        // Add our awt based image loader.
        AWTImageLoader.registerLoader();
View Full Code Here

     */
    private void initExample() {
        _canvas.setTitle("JoglBasicExample - close window to exit");

        // 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<Box>() {
            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 Box 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);
            }
        });

        // Add our awt based image loader.
        AWTImageLoader.registerLoader();
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

        _shapeRoot.getSceneHints().setDataMode(DataMode.Arrays);

        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

        return sphere;
    }

    private Mesh createBox(final Node parentNode, final String textureName, 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, textureName, mode);
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.