I'm using the FXyz library to import models (obj format) into my program as Trianglemeshes. I would like to convert these Trianglemesh objects into PolygonMeshes so that they may be used as SkinningMeshes. Is there a specific workflow for this process?
EDIT: I'm using org.fxyz3d.importers.obj.ObjImporter as my OBJ loader. I'm creating and exporting my models in Blender 2.65. Blender 2.65 uses Wavefront as the format.
I had originally tried loading the models in a ThreeJS format, using the HandImporter method, but it was giving me unexpected results. However, the OBJImporter seems to be working perfectly. I figured that if I can load obj models and display them, then I could as a last resort manually attach bones to them and animate them.
Because the PolygonMesh doesn't use a Trianglemesh in any of its constructors, I'm assuming something under the hood is happening which may require some conversions to take place beforehand.
Here's a snippit of my code that I'm using:
private void Load_Model3D(int i) throws MalformedURLException, IOException {
String S = "data\\models\\" + i + "\\" + i + ".obj";
File F = new File(S);
if(F.exists()){
//Load the Model:
URL url = F.toURI().toURL();
this.Model_3D_Arr[i] = FXYZ_Loader.load(url);
//Grab the Trianglemesh from the Model3D using casting:
MeshView mv = (MeshView) this.Model_3D_Arr[i].getMeshViews().get(0);
TriangleMesh T = (TriangleMesh) mv.getMesh();
//Convert Trianglemesh into PolygonMesh here:
}else{
System.err.println("File F does not exist! FXYZ: " + S);
}
}
Thanks again. :)