> Date: Sun, 2 Jun 2002 20:51:20 -0600 > From: Furukawa Hiroki <[EMAIL PROTECTED]> > > > Picking is not supported in compatibility mode > > -- you have to use the Java 3D view model. > > I want to change view volume and use picking. > > Is it impossible?
Directly setting the view volume is not supported by the Java 3D view model, but you can set a few parameters to give you the ortho view volume that you want. Use the PARALLEL_PROJECTION projection policy. For near and far, use the VIRTUAL_EYE front and clip policies and then set the front and back clip virtual world distances relative to your eye point. The default screen scale is (PhysicalScreenWidth / 2.0). This maps 2 virtual world units to the physical width of the screen OR window. You can change this by setting the screen scale policy to SCALE_EXPLICIT and then setting the screen scale directly to get the width of the view volume you want. So, to get the effect of: frustum.ortho(-10.0, 10.0, -10.0, 10.0, -1.0, 10.0); You should be able to do: View v = <foo> ; Canvas3D c = <foo> ; Screen3D s = c.getScreen3D() ; double w = s.getPhysicalScreenWidth() ; v.setBackClipPolicy(View.VIRTUAL_EYE) ; v.setFrontClipPolicy(View.VIRTUAL_EYE) ; v.setScreenScalePolicy(View.SCALE_EXPLICIT) ; v.setProjectionPolicy(View.PARALLEL_PROJECTION) ; v.setFrontClipDistance(-1.0) ; v.setBackClipDistance(10.0) ; v.setScreenScale(w/20.0) ; Some potential problems: 1) The API says the front clip distance has to be greater than 0.0 in physical eye coordinates. I don't think this matters for parallel projections, but if this is a problem, move the view platform back appropriately (the origin of the view platform is the eye by default). 2) The screen scale is uniform, so with the above you'll actually get a top and bottom clip that is scaled to the aspect ratio of the window. You should be able to simply call s.setPhysicalScreenHeight(w) to correct this though. 3) The ortho frustum left, right, top, and bottom will be symmetric about the eye. To do an off-axis projection you'll have to delve deeper into the view model and use the RELATIVE_TO_SCREEN eyepoint policy, which is fairly complex to use with moveable windows. (I have an example program that demonstrates off-axis projections if you want it). Hope that helps -- Mark Hood =========================================================================== 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".
