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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package sample3d;
import javafx.application.Application;
import my3d._math3d.*;
import my3d._shape3d;
import my3d._viewer3d4;
import my3d._viewport3d;
import my3d._viewport3d2;
import my3d._viewport3d2.*;
public class _sample08 extends _viewer3d4 {
public static void main(String... args) {
Application.launch(args);
}
private _shape3d box = _shape3d.create_box(0.3, 0.3, 0.3);
private _transform[] tf_list = new _transform[9];
@Override
public void init_scene(_viewport3d vp) {
_viewport3d2 vp2 = (_viewport3d2) vp;
vp2.set_zsort_enable(true);
vp2.set_pick_mode(_pick_mode.Shape);
add_app_menu((index) -> {
switch (index) {
case 0: vp2.set_pick_mode(_pick_mode.Shape); break;
case 1: vp2.set_pick_mode(_pick_mode.Face); break;
}
},
"r形状", "r面"
);
for (int i = 0; i < 9; i++)
tf_list[i] = new _transform(new _vector(i % 3 - 1, 0, i / 3 - 1));
view.setOnMouseClicked((evt) -> {
vp2.pick(evt.getX(), evt.getY(), (shape_index, face_index) -> {});
repaint();
});
}
@Override
public void render(_viewport3d vp) {
for (_transform tf : tf_list) {
vp.push_transform(tf);
vp.render_shape(box);
vp.pop_transform();
}
}
}