1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package sample3d;
import javafx.application.Application;
import my3d._shape3d;
import my3d._viewer3d2;
import my3d._viewport3d;
public class _sample05 extends _viewer3d2 {
	public static void main(String... args) {
		Application.launch(args);
	}
	private int shape_index = 0;
	private _shape3d[] shapes = new _shape3d[4];
	@Override
	public void init_scene(_viewport3d vp) {
		add_app_menu((index) -> {
			shape_index = index;
			repaint();
		},
			"r立方体", "r球", "r円柱", "r円錐"
		);
		shapes[0] = _shape3d.create_box(1, 1, 1);
		shapes[1] = _shape3d.create_ball(1.2, 8);
		shapes[2] = _shape3d.create_tube(0.8, 1.2, 16);
		shapes[3] = _shape3d.create_corn(1.2, 1.2, 16);
	}
	@Override
	public void render(_viewport3d vp) {
		vp.render_shape(shapes[shape_index]);
	}
}