我试图用javafx编写obj loader,但是尽管在场景构造函数中启用了deptTest,结果还是透明的
public View() throws Exception {
meshView = createSimplex();
Group axisGroup = buildAxes();
createBoundBoxAndSetBounds( meshView);
Group group = new Group();
group.getTransforms().addAll(rotateZ, rotateY, rotateX);
group.setDepthTest(DepthTest.ENABLE);
scene = new Scene(group, 640, 480,true,SceneAntialiasing.BALANCED);
float w = abs(maxy - miny);
float alpha = (0.5f / (w / (float) scene.getHeight()));
PerspectiveCamera camera = new PerspectiveCamera(true);
camera.setNearClip(0.1);
camera.setFarClip(5000.0);
camera.setTranslateZ(-1000);
scene.setCamera(camera);
group.getChildren().addAll(meshView);
handleMouseEvents();
}
加载结果:
怎么了?