Canvas3D canvas=new Canvas3D(null); SimpleUniverse universe=new SimpleUniverse(canvas); canvas.stopRenderer(); universe.getViewingPlatform().setNominalViewingTransform(); // 視点を適当な位置に設定 GraphicsContext3D g=canvas.getGraphicsContext3D();
Transform3D translation=new Transform3D(); Transform3D rotation=new Transform3D(); translation.setTranslation(new Vector3d(0.0,1.0,0.0)); rotation.rotX(Math.PI/4.0); g.clear(); g.setModelTransform(translation); g.draw(new ColorCube()); // 座標 (0.0,1.0,0.0) に色付き立方体の描画 g.setModelTransform(rotation); g.draw(new ColorCube()); // x 軸を中心に 45°回転した色付き立方体の描画 canvas.swap();
Appearance appearance=new Appearance(); g.clear(); g.setAppearance(appearance); g.draw(new Sphere().getShape()); // 球 canvas.swap();
戻る