javafx中的obj文件加载器提供了透明的网格

时间:2018-06-22 08:10:17

标签: javafx-8

我试图用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();

}

加载结果:

enter image description here

怎么了?

0 个答案:

没有答案