Hi,
This is a bug that is fixed in the latest v1.2beta1 release.
Please download the latest version and try again.
Thanks.
- Kelvin
-----------
Java 3D Team
Sun Microsystems
>X-Accept-Language: en
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>Date: Tue, 8 Feb 2000 17:14:10 +0100
>From: Heiko Gottschling <[EMAIL PROTECTED]>
>Subject: [JAVA3D] ??? Two Locales and Behavior bug (sample code) ???
>To: [EMAIL PROTECTED]
>
>Hi,
>
>I'm facing a problem using two different Locales with different scenes.
>It seems like the position of the first Locale influences a behavior in
>the other one.
>In my sample program (see code below), I create a VirtualUniverse with
>two Locales, each with its own view. The MainFrame displays two
>(overlapping) Canvas3D objects with the two scenes.
>
>The first scene (=Locale 1) contains a cube which is rotated by a
>MouseRotator. The funny thing is, the position of Locale2 seems to
>influence the function of the mouse rotator. If I place the Locales 10m
>apart, everything works fine. If I place them apart 1000m, the
>MouseRotator doesn't work anymore. This has got something to do with the
>scheduling bounds of the MouseRotator, since if I increase the radius of
>its BoundingSphere to 1000, everything works again.
>
>So, is this a bug? I don't think the function of a behavior should be
>influenced by the position of a completly different locale...?
>
>Maybe I should add that I'm trying this on a Linux machine with the J3D
>1.1-pre-release. It would be nice if some of you could check whether the
>code runs on your machines (in the version below, on my machine the
>program displays the cube, but doesn't rotate it, although it should in
>my opinion).
>
>Please forgive me for the messy code, but this is a quick-and-dirty
>approach.(I have included some comments in places related to the bug,
>though :-)) - compile and start with "java MainFrame"
>
>thx
>Heiko
>
>
>//------------------------ 8X cut here X8
>-----------------------------
>
>import javax.swing.*;
>import javax.media.j3d.*;
>import java.awt.*;
>
>import com.sun.j3d.utils.universe.*;
>import com.sun.j3d.utils.geometry.*;
>import com.sun.j3d.utils.behaviors.mouse.*;
>import javax.vecmath.*;
>
>public class MainFrame extends JFrame {
> public final static int WIDTH = 600;
> public final static int HEIGHT = 600;
> public final static int WIDTH_SMALL = 300;
> public final static int HEIGHT_SMALL = 300;
>
> VirtualUniverse universe;
> Locale locale1;
> Canvas3D canvas1;
> Viewer viewer1;
> Locale locale2;
> Canvas3D canvas2;
> Viewer viewer2;
> TransformGroup tgRotate;
>
> public MainFrame() {
> super("Test");
>
> init();
>
> setVisible(true);
> setSize(WIDTH, HEIGHT);
> }
>
> public void init() {
> getContentPane().setLayout(null);
>
> universe = new VirtualUniverse();
>
> int[] x = {0, 0, 0, 0, 0, 0, 0, 0};
> int[] y = {0, 0, 0, 0, 0, 0, 0, 0};
> int[] z = {0, 0, 0, 0, 0, 0, 0, 0};
>
> //the first locale
> locale1 = new Locale(universe, x, y, z);
>
> //place second locale 1000m away from first one
> int[] x2 = {0, 0, 0, 1000, 0, 0, 0, 0};
> //if you replace the preceeding line by the next one, it works!!
> //int[] x2 = {0, 0, 0, 10, 0, 0, 0, 0};
>
> int[] y2 = {0, 0, 0, 0, 0, 0, 0, 0};
> int[] z2 = {0, 0, 0, 0, 0, 0, 0, 0};
>
> locale2 = new Locale(universe, x2, y2, z2);
>
> Panel border = new Panel() {
> public void paint(Graphics g) {
> g.setColor(Color.blue);
> g.fillRect(0, 0, getWidth(), getHeight());
> }
> };
>
> border.setBounds(WIDTH - WIDTH_SMALL,
> HEIGHT - HEIGHT_SMALL,
> WIDTH_SMALL,
> HEIGHT_SMALL);
>
> canvas1 = new Canvas3D(null);
> canvas1.setBounds(0, 0, WIDTH, HEIGHT);
>
> viewer1 = new Viewer(canvas1);
> ViewingPlatform vp1 = new ViewingPlatform();
> vp1.setNominalViewingTransform();
> viewer1.setViewingPlatform(vp1);
>
> locale1.addBranchGraph(vp1);
>
> ColorCube cube = new ColorCube(0.1);
> tgRotate = new TransformGroup();
> tgRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
> tgRotate.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>
> //the offending behavior
> MouseRotate mouseRotate = new MouseRotate(tgRotate);
>
> //if you change the sphere radius to 1000 it works!
> mouseRotate.setSchedulingBounds(new BoundingSphere(
> new Point3d(0, 0, 0), 400));
>
> BranchGroup bgCube = new BranchGroup();
>
> tgRotate.addChild(cube);
> bgCube.addChild(tgRotate);
>
> //bgCube will be assigned to locale1, so the behavior should work there
> bgCube.addChild(mouseRotate);
>
> canvas2 = new Canvas3D(null);
> canvas2.setBounds(WIDTH - WIDTH_SMALL + 10,
> HEIGHT - HEIGHT_SMALL + 10,
> WIDTH_SMALL - 20,
> HEIGHT_SMALL - 20);
>
> viewer2 = new Viewer(canvas2);
> ViewingPlatform vp2 = new ViewingPlatform();
> vp2.setNominalViewingTransform();
> viewer2.setViewingPlatform(vp2);
>
> locale2.addBranchGraph(vp2);
>
> ColorCube model = new ColorCube(0.1);
>
> BranchGroup bgModel = new BranchGroup();
>
> bgModel.addChild(model);
>
> locale1.addBranchGraph(bgCube);
> locale2.addBranchGraph(bgModel);
>
> getContentPane().add(canvas2);
> getContentPane().add(border);
> getContentPane().add(canvas1);
>
> }
>
> static public void main(String[] args) {
> new MainFrame();
> }
>}
>
>//--------------- 8X cut here X8 -----------------------------
>
>===========================================================================
>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".
===========================================================================
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".