Package com.ardor3d.bounding

Examples of com.ardor3d.bounding.BoundingBox


    protected void initExample() {
        _canvas.setTitle("Particle System - Swarming Influence");
        _lightState.setEnabled(false);

        sphere = new Sphere("sp", 12, 12, 3);
        sphere.setModelBound(new BoundingBox());
        sphere.setDefaultColor(ColorRGBA.BLUE);
        sphere.getSceneHints().setRenderBucketType(RenderBucketType.Opaque);

        particles = ParticleFactory.buildParticles("particles", 30);
        particles.setEmissionDirection(new Vector3(0, 1, 0));
        particles.setStartSize(3);
        particles.setEndSize(1.5);
        particles.setOriginOffset(new Vector3(0, 0, 0));
        particles.setInitialVelocity(.05);
        particles.setMinimumLifeTime(5000);
        particles.setMaximumLifeTime(15000);
        particles.setStartColor(new ColorRGBA(1, 0, 0, 1));
        particles.setEndColor(new ColorRGBA(0, 1, 0, 1));
        particles.setMaximumAngle(360f * MathUtils.DEG_TO_RAD);
        particles.getParticleController().setControlFlow(false);
        particles.getParticleController().setSpeed(0.75);
        swarm = new SwarmInfluence(new Vector3(particles.getWorldTranslation()), .001);
        swarm.setMaxSpeed(.2);
        swarm.setSpeedBump(0.025);
        swarm.setTurnSpeed(MathUtils.DEG_TO_RAD * 360);
        particles.addInfluence(swarm);

        final BlendState as1 = new BlendState();
        as1.setBlendEnabled(true);
        as1.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        as1.setDestinationFunction(BlendState.DestinationFunction.One);
        particles.setRenderState(as1);

        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/flaresmall.jpg", Texture.MinificationFilter.Trilinear,
                TextureStoreFormat.GuessCompressedFormat, true));
        ts.setEnabled(true);
        particles.setRenderState(ts);

        final ZBufferState zstate = new ZBufferState();
        zstate.setWritable(false);
        particles.setRenderState(zstate);

        particles.getParticleGeometry().setModelBound(new BoundingBox());

        _root.attachChild(particles);
        _root.attachChild(sphere);
    }
View Full Code Here


        _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();
View Full Code Here

        _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));
View Full Code Here

    protected void initExample() {
        _canvas.setTitle("RTT Side By Side");

        sphere = new Sphere("Sphere", 25, 25, 5);
        sphere.setTranslation(new Vector3(-10, 0, 0));
        sphere.setModelBound(new BoundingBox());
        _root.attachChild(sphere);

        quad = new Quad("Quad", 15, 13f);
        quad.setTranslation(new Vector3(10, 0, 0));
        quad.setModelBound(new BoundingBox());
        quad.getSceneHints().setLightCombineMode(LightCombineMode.Off);
        _root.attachChild(quad);

        final GLSLShaderObjectsState shader = new GLSLShaderObjectsState();
        shader.setFragmentShader("void main() { gl_FragColor = vec4(1,0,0,1); }");
View Full Code Here

        _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.
        box.setRandomColors();
        // Attach the box to the scenegraph root.
View Full Code Here

    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();
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
View Full Code Here

        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();
View Full Code Here

        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

        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

        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();
        ts.setEnabled(true);
View Full Code Here

TOP

Related Classes of com.ardor3d.bounding.BoundingBox

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.