I probably forgot to mentioned that I also got a class
with the canvas3D and the SceneGraph…. This is the
code:

public class Panel1 extends JPanel {
  private BorderLayout borderLayout1 = new
BorderLayout();

  private BranchGroup objRoot;
  private BoundingSphere Bounds;
  private TransformGroup vpTrans;
  private BoundingSphere mouseBounds;

  public Panel1() {

    GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
    setLayout(new BorderLayout());
    Canvas3D canvas3D = new Canvas3D(config);
    canvas3D.setSize(545, 200);
    add("Center", canvas3D);

    SimpleUniverse simpleU = new
SimpleUniverse(canvas3D);

    BranchGroup scene = createSceneGraph(canvas3D,
simpleU);

simpleU.getViewingPlatform().setNominalViewingTransform();
    simpleU.addBranchGraph(scene);

    try {
      jbInit();
    }
    catch(Exception ex) {
      ex.printStackTrace();
    }
  }
  void jbInit() throws Exception {
    this.setLayout(borderLayout1);
  }

  //Main Branch group from the application
  public BranchGroup createSceneGraph(Canvas3D
canvas3D, SimpleUniverse su){
    // Create the root of the branch graph
    objRoot = new BranchGroup();
    Bounds = new BoundingSphere();
    BranchGroup scene = new BranchGroup();

    TransformGroup vpTrans = null;
    BoundingSphere mouseBounds = null;

    //Background properties
    Background bg = new Background();
    bg.setColor(0.0f, 0.7f, 1.0f);
    bg.setApplicationBounds(new BoundingSphere());
    objRoot.addChild(bg);

    //Ligth properties
    AmbientLight lightA = new AmbientLight();
    lightA.setInfluencingBounds(new BoundingSphere());
    objRoot.addChild(lightA);

    DirectionalLight lightD1 = new DirectionalLight();
    lightD1.setInfluencingBounds(new
BoundingSphere());
    Vector3f direction = new Vector3f(-1.0f, -1.0f,
-1.0f);
    direction.normalize();
    lightD1.setDirection(direction);
    lightD1.setColor(new Color3f(1.0f, 1.0f, 1.0f));
    objRoot.addChild(lightD1);

    //Mouse properties
    vpTrans =
su.getViewingPlatform().getViewPlatformTransform();
    mouseBounds = new BoundingSphere(new Point3d(),
1000.0);

    MouseZoom myMouseZoom = new
MouseZoom(MouseBehavior.INVERT_INPUT);
    myMouseZoom.setTransformGroup(vpTrans);
    myMouseZoom.setSchedulingBounds(mouseBounds);

    //Adding Picking behavior
    PickZoomBehavior pickZoom= new
PickZoomBehavior(objRoot, canvas3D, Bounds,
PickObject.USE_BOUNDS);
    objRoot.addChild(pickZoom);


    objRoot.addChild(new Movil2D().getLeg1BG());
    objRoot.addChild(myMouseZoom);

    //Let the java3D perform optimizations on this
scene
    objRoot.compile();

    repaint();

    return objRoot;
  }
}

Please any help I will apreciate!!!

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to