Package javax.media.j3d

Examples of javax.media.j3d.BoundingSphere


  public void addLight(SimpleUniverse su)
  {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), Double.MAX_VALUE);

    //Directional light.
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.5f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
View Full Code Here


    addLight(simpUniv);


    //The following three lines enable navigation through the scene using the mouse.
    OrbitBehavior ob = new OrbitBehavior(myCanvas3D);
    ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
    simpUniv.getViewingPlatform().setViewPlatformBehavior(ob);


    //Show the canvas/window.
    setTitle("A moving light spotlight");
View Full Code Here



    //Generate a white background.
    Background bg = new Background(new Color3f(1.0f,1.0f,1.0f));
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    bg.setApplicationBounds(bounds);
    theScene.addChild(bg);


View Full Code Here

  public void addLight(SimpleUniverse su)
  {

    BranchGroup bgLight = new BranchGroup();

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), Double.MAX_VALUE);


    //A spotlight rotating around the scene.
    Color3f lightColourSpot = new Color3f(0.3f, 0.3f, 0.3f);
    SpotLight lightSpot = new SpotLight(lightColourSpot,
View Full Code Here

    addLight(simpUniv);


    //The following three lines enable navigation through the scene using the mouse.
    OrbitBehavior ob = new OrbitBehavior(myCanvas3D);
    ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
    simpUniv.getViewingPlatform().setViewPlatformBehavior(ob);


    //Show the canvas/window.
    setTitle("Background and point sound");
View Full Code Here

    soundPoint.setLoop(Sound.INFINITE_LOOPS);
    soundPoint.setInitialGain(0.6f);



    BoundingSphere sbounds = new BoundingSphere (new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    soundBG.setSchedulingBounds(sbounds);
    soundPoint.setSchedulingBounds(sbounds);


    //The colours for the Appearance of the bird.
    Color3f ambientColourBird = new Color3f(0.0f,0.0f,0.0f);
    Color3f emissiveColourBird = new Color3f(0.0f,0.0f,0.0f);
    Color3f diffuseColourBird = new Color3f(0.1f,0.1f,0.1f);
    Color3f specularColourBird = new Color3f(0.1f,0.1f,0.1f);
    float shininessBird = 10.0f;



    //The bird's Appearance.
    Appearance birdApp = new Appearance();
    birdApp.setMaterial(new Material(ambientColourBird,emissiveColourBird,
                          diffuseColourBird,specularColourBird,shininessBird));

    //The wings.
    Box wings = new Box(0.03f,0.005f,0.3f,birdApp);

    //The transformation group for the bird including the flight and the sound.
    TransformGroup tgmBird = new TransformGroup();
    tgmBird.addChild(wings);

    //The body of the bird.
    Box body = new Box(0.1f,0.01f,0.01f,birdApp);
    tgmBird.addChild(body);


    //The bird's flight.
    long flightTime = 10000;
    Alpha flightAlpha = new Alpha(-1,Alpha.INCREASING_ENABLE+Alpha.DECREASING_ENABLE,
                                  0,0,flightTime,0,0,flightTime,0,0);

    float flightDistance = 9.0f;
    PositionInterpolator posIFlight = new PositionInterpolator(flightAlpha,
                                                   tgmBird,new Transform3D(),
                                                   0.0f,flightDistance);

    BoundingSphere bs = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    posIFlight.setSchedulingBounds(bs);

    tgmBird.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    tgmBird.addChild(posIFlight);

    //Add the PointSound also to the transformation group of the bird.
    tgmBird.addChild(soundPoint);


    //A transformation group to position the bird including its flight and sound.
    Transform3D tfBird = new Transform3D();
    tfBird.setTranslation(new Vector3f(-flightDistance/2,1.7f,-5.0f));
    TransformGroup tgBird = new TransformGroup(tfBird);
    tgBird.addChild(tgmBird);


    //Add everything to the scene.
    BranchGroup theScene = new BranchGroup();
    theScene.addChild(tgBird);


    //The bounding region for the background sound.
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    //Load the background image.
    TextureLoader textureLoad = new TextureLoader("./eas/miscellaneous/java3D/darkclouds.jpg",null);
    //Define the loaded image as the background for the scene.
    Background bgImage = new Background(textureLoad.getImage());
    bgImage.setApplicationBounds(bounds);
View Full Code Here

  {

    BranchGroup bgLight = new BranchGroup();

    //Directional light.
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), Double.MAX_VALUE);
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.1f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);
View Full Code Here

    addLight(simpUniv);


    //The following three lines enable navigation through the scene using the mouse.
    OrbitBehavior ob = new OrbitBehavior(myCanvas3D);
    ob.setSchedulingBounds(new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE));
    simpUniv.getViewingPlatform().setViewPlatformBehavior(ob);


    //Show the canvas/window.
    setTitle("An image as a background");
View Full Code Here

    theScene.addChild(tgBSphere);



    //The bounding region for the background.
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),Double.MAX_VALUE);
    //Load the background image.
    TextureLoader textureLoad = new TextureLoader("./eas/miscellaneous/java3D/darkclouds.jpg",null);
    //Define the image as the background and add it to the scene.
    Background bgImage = new Background(textureLoad.getImage());
    bgImage.setApplicationBounds(bounds);
View Full Code Here

  {

    BranchGroup bgLight = new BranchGroup();

    //Directional light.
    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), Double.MAX_VALUE);
    Color3f lightColour1 = new Color3f(1.0f,1.0f,1.0f);
    Vector3f lightDir1  = new Vector3f(-1.0f,0.0f,-0.1f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);
View Full Code Here

TOP

Related Classes of javax.media.j3d.BoundingSphere

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.