Hi, this is my first message. I started learning jmonkeyengine from the exemples and tutorials. And know I have a situation: I created a model in Blender (starting from the default cube), putted a texture (basically changed the color), set it to be smooth, and then exported it as a OBJ file. When I load it from my code it is not smoothed. How to smooth it? Below is the code I use to load the OBJ.
package jmeteste;
import com.jme.scene.Node;
import com.jme.scene.TriMesh;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.ObjToJme;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URL;
/**
*
* @author leomcabral
*/
public class PernaObj extends Node {
public PernaObj() {
URL url = PernaObj.class.getClassLoader().getResource("jmeteste/perna.obj");
ObjToJme converter = new ObjToJme();
converter.setProperty("mtllib", url);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
try {
converter.convert(url.openStream(), bo);
TriMesh model = (TriMesh) BinaryImporter.getInstance().load(new ByteArrayInputStream(bo.toByteArray()));
this.attachChild(model);
} catch(IOException ex) {
System.out.println("Falhou!!!");
}
}
}
P.S.: Why I can not load my OBJ file as a Node like the examples? I have to load it as a TriMesh.