Ok, thanx a lot, i think this will help me greatly !

-----Message d'origine-----
De : Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]] De la part de ZACZEK, MARIUSZ P.
(JSC-DM) (NASA)
Envoy� : mardi 24 septembre 2002 16:51
� : [EMAIL PROTECTED]
Objet : Re: [JAVA3D] Multiple views on screen



Below is one way I put 4 views in one panel. The code is for a
constructor of a class which extends the JPanel. Basically, to do a
multipleview system you have to get away from using the
SimpleUniverse... you need to use a VirtualUniverse instead and then
define all of the steps yourself. I have comments for each step so that
should not be too hard to follow....this will generate a multiwindow
system with one (main) window on the left and 3 small windows on the
right side:

  +-----+--+
  |     +--+    I've attached a picture of what my application looks
like
with those 4 windows.
  |     +--+
  +-----+--+

One thing to note is that you'll have to create other TransformGroup (or
something else) to add to the viewplatforms
        TransformGroup objgrp2 = new TransformGroup();
        objgrp2.addChild(viewplatform2);
and then I added these TransformGroups to my objects
        myObjectImLookingAt.addChild(objgrp2);


I hope that was clear/understandable...I did this a few months back and
I'm not sure if remember everything....plus I'm still new to this Java3D
so it's hard for me to explain it all...



   Mario
Mariusz Zaczek
NASA - Johnson Space Center
Automated Vehicles and Orbit Analysis / DM35
Flight Design and Dynamics Division
Mission Operations Directorate
Bldg: 30A     Room: 3048B
Disclaimer: "The opinions, observations and comments expressed in my
email
                   are strictly my own and do not necessarily reflect
those of NASA."



////////////////////////////////////////////////////////////////////////
////
/////////////////////
 public myPanel() {
    // 1 - Create Canvas3D object.
     canvas3D = new
Canvas3D(SimpleUniverse.getPreferredConfiguration());
     Canvas3D second_canvas3D = new
Canvas3D(SimpleUniverse.getPreferredConfiguration());
     Canvas3D third_canvas3D  = new
Canvas3D(SimpleUniverse.getPreferredConfiguration());
     Canvas3D fourth_canvas3D = new
Canvas3D(SimpleUniverse.getPreferredConfiguration());

    // 2 - Create a VirtualUniverse object.
    VirtualUniverse universe = new VirtualUniverse();

    // 3 - Create a Locale object, attaching it to the VirtualUniverse
object.
    Locale locale = new Locale(universe);

    // 4 - Create a view branch graph.
      // a - create a View object.
      View view = new View();
      View view2 = new View();
      View view3 = new View();
      View view4 = new View();

      // b - create a ViewPlatform object.
      viewplatform = new ViewPlatform();
      viewplatform2 = new ViewPlatform();
      viewplatform3 = new ViewPlatform();
      viewplatform4 = new ViewPlatform();

      // c - Create a PhysicalBody object.
      PhysicalBody physicalbody = new PhysicalBody();
      PhysicalBody physicalbody2 = new PhysicalBody();
      PhysicalBody physicalbody3 = new PhysicalBody();
      PhysicalBody physicalbody4 = new PhysicalBody();

      // d - create a PhysicalEnvironment object.
      PhysicalEnvironment physicalenvironment = new
PhysicalEnvironment();
      PhysicalEnvironment physicalenvironment2 = new
PhysicalEnvironment();
      PhysicalEnvironment physicalenvironment3 = new
PhysicalEnvironment();
      PhysicalEnvironment physicalenvironment4 = new
PhysicalEnvironment();

    // 5 - Contruct content branch graph(s)
    BranchGroup scene = new BranchGroup();

      // Draw the stuff in the scene
      scene = createSceneGraph();

      //  e - attach objects to View object.
      view.attachViewPlatform(viewplatform);
      view.setPhysicalBody(physicalbody);
      view.setPhysicalEnvironment(physicalenvironment);
      view.addCanvas3D(canvas3D);

      view2.attachViewPlatform(viewplatform2);
      view2.setPhysicalBody(physicalbody2);
      view2.setPhysicalEnvironment(physicalenvironment2);
      view2.addCanvas3D(second_canvas3D);

      view3.attachViewPlatform(viewplatform3);
      view3.setPhysicalBody(physicalbody3);
      view3.setPhysicalEnvironment(physicalenvironment3);
      view3.addCanvas3D(third_canvas3D);

      view4.attachViewPlatform(viewplatform4);
      view4.setPhysicalBody(physicalbody4);
      view4.setPhysicalEnvironment(physicalenvironment4);
      view4.addCanvas3D(fourth_canvas3D);


      // Set the viewplatform to the scene
      scene.addChild(viewplatform);

      // Set the view clip planes
      view.setBackClipDistance( 3000.0 );
      view.setFrontClipDistance( 0.001 );
      view2.setBackClipDistance( 300000.0 );
      view2.setFrontClipDistance( 0.1 );
      view3.setBackClipDistance( 300000.0 );
      view3.setFrontClipDistance( 0.1 );
      view4.setBackClipDistance( 3000.0 );
      view4.setFrontClipDistance( 0.001 );


    // 6 - Compile branch graph(s)
    // NOT COMPILING AGAIN...done in 'scene' already

    // 7 - Insert subgraphs into the Locale
    locale.addBranchGraph(scene);

    //
    // FINAL - add the canvases to the main panel so that the original
    //         canvas is in the biggest window, and the other three
canvases
    //         are in 3 side windows on the right
    this.setLayout(new BorderLayout());

    JPanel mainpanel = new JPanel(new BorderLayout());
    JPanel viewpanel2 = new JPanel(new BorderLayout());

    mainpanel.add("Center", canvas3D);
    mainpanel.setBorder(BorderFactory.createEtchedBorder());

      viewpanel2.setPreferredSize(new Dimension(300,400));
      viewpanel2.setLayout(new GridLayout(3,0));
      viewpanel2.add(second_canvas3D);
      viewpanel2.add(third_canvas3D);
      viewpanel2.add(fourth_canvas3D);

    this.add(mainpanel, BorderLayout.CENTER);
    this.add(viewpanel2,BorderLayout.EAST);
  }
////////////////////////////////////////////////////////////////////////
////
/////////////////////







-----Original Message-----
From: Jonathan Smolarski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 8:43 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Multiple views on screen


My question is really simple. I have a scene graph describing a 3d scene
and I want to display it in multiple canvas each having is own point of
view. So if my scene is representing a car, I want one canvas displaying
it from the front, and one where the camera is placed above or behind
the same car. I want to do this using the same scenegraph. How could i
do such a thing ? Cordialement, Jonathan Smolarski. Mail :
[EMAIL PROTECTED]

I watch myself drown
In the blue aura
Of mine and I see
The swans leave the pond
...And Oceans, The Black Vagabond and the Swan of Two Heads

==========================================================================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