So I have gotten jME to import my OBJ files successfully, along with the corresponding UV map. However when I clone the spatial into 3 other nodes the UV map image is lost and the clones only show up as non-textured objects. Am I missing something, I am only setting the converter property so that is probably where I am going wrong.
ObjToJme converter=new ObjToJme();
URL modelUrl= getClass().getResource( "/className/models/outerTable.obj");
converter.setProperty("mtllib",modelUrl);
ByteArrayOutputStream BO=new ByteArrayOutputStream();
Spatial model=null;
try {
long time = System.currentTimeMillis();
converter.convert( modelUrl.openStream(), BO );
} catch (IOException e) {
logger.info("damn exceptions:" + e.getMessage());
}
try {
long time=System.currentTimeMillis();
ByteArrayInputStream stream = new ByteArrayInputStream(BO.toByteArray());
model = (Spatial) BinaryImporter.getInstance().load( stream );
logger.info("Time to convert from .jme to SceneGraph:"+ ( System.currentTimeMillis()-time));
} catch (IOException e) {
logger.info("damn exceptions:" + e.getMessage());
}
CloneImportExport cloner = new CloneImportExport();
cloner.saveClone( model );
Node copy1 = (Node) cloner.loadClone();
Node copy2 = (Node) cloner.loadClone();
Node copy3 = (Node) cloner.loadClone();
copy1.setLocalScale( new Vector3f( -1f, 1f, 1f ) );
copy2.setLocalScale( new Vector3f( 1f, 1f, -1f ) );
copy3.setLocalScale( new Vector3f( -1f, 1f, -1f ) );
rootNode.attachChild(model);
rootNode.attachChild(copy1);
rootNode.attachChild(copy2);
rootNode.attachChild(copy3);
Also, the vertices of my model seem to triple (actually it's like 2.3) when opening with jME, no other model loader seems to do this :|
Model: 478 vertices
jME reports: 1129