Examples of BranchGroup


Examples of javax.media.j3d.BranchGroup

  //The different light sources are added to the scene 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);




    //Light no. 1: directional light.
    Color3f lightColour1 = new Color3f(0.8f, 0.8f, 0.8f);
    Vector3f lightDir1  = new Vector3f(0.0f, 4.0f, -1.0f);
    DirectionalLight light1 = new DirectionalLight(lightColour1, lightDir1);
    light1.setInfluencingBounds(bounds);
    bgLight.addChild(light1);



    //Light no. 2: a point light.
    Color3f lightColour2 = new Color3f(0.3f, 0.3f, 0.3f);
    PointLight light2 = new PointLight(lightColour2,
                                       new Point3f(1.0f,1.0f,1.0f),
                                       new Point3f(0.2f,0.01f,0.01f));
    light2.setInfluencingBounds(bounds);
    bgLight.addChild(light2);


    //Light no. 3: a spotlight.
    Color3f lightColour3 = new Color3f(0.3f, 0.3f, 0.3f);
    SpotLight light3 = new SpotLight(lightColour3,
                                     new Point3f(0.0f,0.0f,1.0f),
                                     new Point3f(0.1f,0.1f,0.01f),
                                     new Vector3f(0.0f,0.0f,-1.0f),
                                     (float) (Math.PI/20),
                                     0.0f);

    light3.setInfluencingBounds(bounds);
    bgLight.addChild(light3);



    //Light no. 4: ambient light.
    Color3f lightColour4 = new Color3f(0.2f, 0.2f, 0.2f);
    AmbientLight light4 = new AmbientLight(lightColour4);
    light4.setInfluencingBounds(bounds);
    bgLight.addChild(light4);


    su.addBranchGraph(bgLight);
  }
View Full Code Here

Examples of org.xith3d.scenegraph.BranchGroup

    getView().lookAt( new Vector3f( 0f, 0f, 1f ), new Vector3f( 0f, 0f, 0f ), new Vector3f( 0f, 1f, 0f ) );
  }
 
  public BranchGroup createScene() {
   
    BranchGroup branchGroup = new BranchGroup();
   
    Rectangle rectangle = new Rectangle(1f, 1f, 0f, ResBag.getTexture( Textures.BACKGROUND_IMAGE.toString() ));
   
    //BackgroundImage backgroundImage = new BackgroundImage( ResBag.getTexture( Textures.BACKGROUND_IMAGE.toString() ), 1f );
   
    branchGroup.addChild( rectangle );
   
    return branchGroup;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.