Hi Chien,
I spent the morning writing a simple test program. I noticed, that the
behavior fails only if the first Link node is switched off by a Switch
node. But try yourself.
Ingo
===File ~/OS3DTest.java=====================================
import java.awt.Font;
import javax.swing.JFrame;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.behaviors.mouse.*;
import com.sun.j3d.utils.geometry.Text2D;
import com.sun.j3d.utils.geometry.Sphere;
public class OS3DTest extends JFrame {
public static void main(String[] args) {
OS3DTest frame = new OS3DTest();
Canvas3D canvas = new Canvas3D(
SimpleUniverse.getPreferredConfiguration());
SimpleUniverse universe = new SimpleUniverse(canvas);
universe.addBranchGraph(frame.createSceneGraph());
Transform3D vpLocation = new Transform3D();
TransformGroup vptg = universe.getViewingPlatform(
).getViewPlatformTransform();
vptg.getTransform(vpLocation);
vpLocation.setTranslation(new Vector3d(0.0, 0.0, 8.0));
vptg.setTransform(vpLocation);
canvas.setSize(300, 300);
frame.getContentPane().add(canvas);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.pack();
frame.show();
}
private BranchGroup createSceneGraph() {
BranchGroup branch = new BranchGroup();
TransformGroup tg = new TransformGroup();
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
branch.addChild(tg);
MouseRotate myMouseRotate = new MouseRotate();
myMouseRotate.setTransformGroup(tg);
myMouseRotate.setSchedulingBounds(new BoundingSphere());
branch.addChild(myMouseRotate);
DirectionalLight light = new DirectionalLight();
light.setInfluencingBounds(new BoundingSphere());
branch.addChild(light);
Switch switchGroup = new Switch();
tg.addChild(switchGroup);
/*
Change the following line to display either of the two children
of the Switch with an argument of 0 or 1. If only the second child
is displayed, the label is not adjusted to the view.
*/
switchGroup.setWhichChild(Switch.CHILD_ALL);
// Rotate a sample text about the points (-1, 0, 0) and (1, 0, 0)
Point3f rotationPoint = new Point3f(-0.02f, -0.02f, -0.02f);
Text2D text2D = new Text2D(
"Sample Text", new Color3f(0.0f, 1.0f, 0.0f), "Monospaced",
64, Font.BOLD);
OrientedShape3D orientedShape = new OrientedShape3D(
text2D.getGeometry(), text2D.getAppearance(),
OrientedShape3D.ROTATE_ABOUT_POINT, rotationPoint);
SharedGroup sharedLabel = new SharedGroup();
sharedLabel.addChild(orientedShape);
sharedLabel.compile();
Transform3D t1 = new Transform3D();
t1.setTranslation(new Vector3f(-0.98f, 0.02f, 0.02f));
TransformGroup tg1 = new TransformGroup(t1);
tg1.addChild(new Link(sharedLabel));
switchGroup.addChild(tg1);
Transform3D t2 = new Transform3D();
t2.setTranslation(new Vector3f(1.02f, 0.02f, 0.02f));
TransformGroup tg2 = new TransformGroup(t2);
tg2.addChild(new Link(sharedLabel));
switchGroup.addChild(tg2);
return branch;
}
}
============================================================
> John and Ingo,
> Did we get back to you with a bug id ? If no, can you provide us
> with a test program ?
>
> thanks,
> Chien Yang
> Java 3D Team.
>
>
> > Delivered-To: [EMAIL PROTECTED] X-Accept-Language: en
> > MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Date: Wed, 2 Jan
> > 2002 11:16:30 -0600 From: John Wright <[EMAIL PROTECTED]>
> > Subject: Re: [JAVA3D] OrientedShape3D and SharedGroup again To:
> > [EMAIL PROTECTED]
> >
> > Ingo,
> >
> > Yes, we noticed this and reported it to Sun months ago with Java
> > 3D 1.2.1 - we are still waiting for a fix.
> >
> > - John Wright
> > Starfire Research
> >
> > Ingo Brunberg wrote:
> > >
> > > I have just tested j3d 1.3b1 with my Applet. There seems to be a
> > > new bug concerning the operation of an OrientedShape3D attached
> > > to a SharedGroup. Only the first Link node referring to the
> > > SharedGroup is handled correctly, the other ones show no
> > > response to rotations of the scene. I am using jdk 1.4.0b3 on
> > > Linux.
> > >
> > > Anyone else seen this, too?
> > >
> > > Regards,
> > >
> > > Ingo Brunberg
===========================================================================
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".