|
There is something very basic I think I'm missing about the
Java3D view model. It seems to me that all coordinates must be between -1
and 1 (unless a scale trans form is used to). Meaning if I take a box with
vertices at (-0.5,0.5,0),(0.5,0.5,0),(0.5,-0.5,0), and (-0.5,-0.5,0) and add it
to a transform group than has it's translation set to (2,0,0) the box out of my
viewing volume. Even though my backClipDistnace is 10000, and my front
clip distance is 0.1. Can anyone explain what I'm missing?
Thanks in advance!
Demetrius
Example: check comments for farther
explanation
public void init()
{ setLayout(new BorderLayout()); Canvas3D canvas = new Canvas3D(null); add("Center", canvas); VirtualUniverse universe = new VirtualUniverse(); View view = new View(); view.setPhysicalBody(new PhysicalBody()); view.setPhysicalEnvironment(new PhysicalEnvironment()); ViewPlatform vp = new ViewPlatform(); view.attachViewPlatform(vp); view.addCanvas3D(canvas); view.setCompatibilityModeEnable(true); view.setFrontClipDistance(0.1); view.setProjectionPolicy(View.PERSPECTIVE_PROJECTION); view.setBackClipDistance(10000.0); Locale locale = new Locale(universe); BranchGroup b = new BranchGroup(); TransformGroup trans = new
TransformGroup();
trans.addChild(vp); b.addChild(trans); locale.addBranchGraph(b); QuadArray ta = new
QuadArray(4,QuadArray.COORDINATES);
Point3f cords[] = new Point3f[4]; // HERE if any of these
are greater than 1 I get a white screen!
// If any of the coordinates are less than -1 then I get
nothing on the screen!
cords[0] = new Point3f(0.1f, -0.1f, -0.9f); cords[1] = new Point3f(0.1f, 0.1f, -0.9f); cords[2] = new Point3f(-0.1f, 0.1f, -0.9f); cords[3] = new Point3f(-0.1f, -0.1f, -0.9f); ta.setCoordinates(0,cords); t3d = new Transform3D();
// if I set the transform vector a x or y component of greater
then 1 the box appears off the screen.
t3d.set(new Vector3d(1,0,1)); TransformGroup tgroup = new TransformGroup(t3d); tgroup.addChild(new Shape3D(ta,new Appearance())); b2.addChild(tgroup); locale.addBranchGraph(b2);
}
|
- Re: [JAVA3D] Confusion Demetrius
- Re: [JAVA3D] Confusion Pondrom, Pierre L
