Helloooo. Could anybody explain to me how to load a 3d object, i have investigated through all the forum, i have proved several methods, and all do "NOTHING". I am getting crazy please help me!!!.
Node loadedModel = null;
URL model = null;
model = Model.class.getClassLoader().getResource(fileName);
if(model==null)
System.out.println("OOOOOOOOOOOOOO");
else
System.out.println(model);
try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new SimpleResourceLocator(Model.class.getClassLoader().getResource(
"res/cajon/")));
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
FormatConverter converter = new ObjToJme();
try {
converter.setProperty("mtllib", new File("src/res/cajon/").toURI().toURL());
System.out.println(converter.getProperty("mtllib"));
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ByteArrayOutputStream BO = new ByteArrayOutputStream();
try {
converter.convert(model.openStream(), BO);
loadedModel = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
} catch (IOException e) {
e.printStackTrace();
System.exit(0);
}
return loadedModel;