Public Methods | |
| ImageSpace3dPanel () | |
| void | addImage (BufferedImage img, Point3f pos, Action ac) |
|
|
00029 {
00030 setLayout(new BorderLayout());
00031 GraphicsConfiguration config =
00032 SimpleUniverse.getPreferredConfiguration();
00033
00034 _canvas = new Canvas3D(config);
00035 add(_canvas, BorderLayout.CENTER);
00036
00037 // Create a simple scene and attach it to the virtual universe
00038 BranchGroup scene = createSceneGraph();
00039 SimpleUniverse u = new SimpleUniverse(_canvas);
00040
00041 // This will move the ViewPlatform back a bit so the
00042 // objects in the scene can be viewed.
00043 u.getViewingPlatform().setNominalViewingTransform();
00044 u.addBranchGraph(scene);
00045 }
|
|
||||||||||||||||
|
00048 {
00049 int width = img.getWidth();
00050 int height = img.getHeight();
00051
00052 Texture tex = new Texture2D(Texture.BASE_LEVEL, Texture.RGB, width, height);
00053 tex.setMagFilter(Texture.FASTEST);
00054 tex.setMinFilter(Texture.FASTEST);
00055 tex.setImage(0, new ImageComponent2D(ImageComponent.FORMAT_RGB, img));
00056
00057 ImageNode node = new ImageNode(width, height, tex, ac);
00058 PickTool.setCapabilities(node, PickTool.INTERSECT_FULL);
00059
00060 Transform3D t = new Transform3D();
00061 t.set(0.1, new Vector3d(pos));
00062 TransformGroup trans = new TransformGroup(t);
00063 trans.addChild(node);
00064
00065 BranchGroup g = new BranchGroup();
00066 g.addChild(trans);
00067
00068 _imageGroup.addChild(g);
00069 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001