TransformGroup transform=new TransformGroup(); transform.addChild(new ColorCube()); // 色付き立方体 root.addChild(transform); MouseBehavior behavior1=new MouseRotate(); behavior1.setTransformGroup(transform); root.addChild(behavior1); MouseBehavior behavior2=new MouseTranslate(); behavior2.setTransformGroup(transform); root.addChild(behavior2); MouseBehavior behavior3=new MouseZoom(); behavior3.setTransformGroup(transform); root.addChild(behavior3);
BoundingSphere bounds=new BoundingSphere( new Point3d(0.0,0.0,0.0),100.0); // 原点を中心とする半径 100.0 の範囲 behavior1.setSchedulingBounds(bounds); behavior2.setSchedulingBounds(bounds); behavior3.setSchedulingBounds(bounds);
transform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); transform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
TransformGroup transform=new TransformGroup(); transform.addChild(new ColorCube()); // 色付き立方体 root.addChild(transform); BoundingSphere bounds=new BoundingSphere(new Point3d(0.0,0.0,0.0),100.0); // 原点を中心とする半径 100.0 の範囲 PickMouseBehavior behavior1=new PickRotateBehavior(root,canvas,bounds); root.addChild(behavior1); PickMouseBehavior behavior2=new PickTranslateBehavior(root,canvas,bounds); root.addChild(behavior2); PickMouseBehavior behavior3=new PickZoomBehavior(root,canvas,bounds); root.addChild(behavior3);
transform.setCapability(TransformGroup.ALLOW_TRANSFORM_READ); transform.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); transform.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
戻る