Mercurial > hg > jslab
view src/samer/j3d/ViewGroup.java @ 8:5e3cbbf173aa tip
Reorganise some more
author | samer |
---|---|
date | Fri, 05 Apr 2019 22:41:58 +0100 |
parents | bf79fb79ee13 |
children |
line wrap: on
line source
/** ViewGroup.java A View branch group containing a ViewPlatform and associated Views, Canvas3Ds and Windows to hold the canvases. Can be added dynamically to a live universe. Parameters: initial placement autostart canvas? autostart view? keyboard navigator? various view policies Requirements: must be placable (hence TransformGroup and ViewPlatform) must be Node so addable to universe renderable: view.renderOnce() view.startView() view.stopView() canvas.startRenderer() canvas.stopRenderer() ... ? disposable: cleans up properly must have accessible View and Canvas objects must manage multiple canvases for stereo */ package samer.j3d; import samer.core.*; import javax.media.j3d.*; import javax.vecmath.*; public class ViewGroup extends BranchGroup { TransformGroup VT; ViewPlatform VP; ViewBase V; public void lookFrom(Point3d eye, Vector3d up) { // view platform placement Transform3D t=new Transform3D(); t.lookAt(eye, new Point3d(0,0,0), up); t.invert(); VT.setTransform(t); } public ViewGroup() { VT=new TransformGroup(); VP=new ViewPlatform(); lookFrom( new Point3d(X.doubleArray(Shell.getString("lookfrom","(0,1,8)"),3)), new Vector3d(0,1,0) ); VT.addChild(VP); addChild(VT); // addChild(new FPS(200)); // setCapability(ALLOW_DETACH); // setCapability(ALLOW_CHILDREN_WRITE); } public void attachView(View v) { v.attachViewPlatform(VP); } }