我正在处理导入3D模型(obj文件)并使用JavaFX三角网格将其添加到场景中。
首先,我读取obj文件,解析它并将其内容保存到(float array" Vertices"和整数数组中用于" Faces"。我的网格点:[0.0, 0.0,0.0,0.0,0.0,1.0,0.0,1.0,0.0,0.0,1.0,1.0,1.0,0.0,0.0,1.0,0.0,1.0,1.0,1.0,0.0,1.0,1.0,1.0]和网格面:[1,0,7,0,5,0,1,0,3,0,7,0,1,0,4,0,3,0 ........]
然后我将它添加到我的场景
MeshView cubeMesh = new MeshView(mesh);
cubeMesh.setDrawMode(DrawMode.FILL);
cubeMesh.setTranslateX(20);
cubeMesh.setTranslateY(10);
cubeMesh.setTranslateZ(20);
displayPane.getChildren().add(cubeMesh);
不幸的是,没有任何内容添加到场景中。是否有人能够提出解决方案,教程或书籍?
答案 0 :(得分:0)