Hi everyone,
Since some days now, I try to understand how jMonkeyEngine works.
Today, I try to load some mesh using ogreLoader.
Everything works fine using the exemple (like ninja mesh with material).
But, for now on, I try to load other mesh. I use some mesh from one of my favourite game (sin of a solar empire).
Everything load correctly. No stack trace or error. But nothing shows on sceen. I try to scale it over jMonkey or directly in the xml, but nothing more.
Do you have some idea ? I use the same code like the exemple.
Thanks everyone for your help
Stephan
@Override
protected void simpleInitGame() {
display.getRenderer().setBackgroundColor(ColorRGBA.white);
Node node = loadMeshModel();
node.setModelBound(new BoundingBox());
node.updateModelBound();
rootNode.attachChild(node);
rootNode.updateRenderState();
if(DEBUG_MODE) {
Node grid = createGrid();
rootNode.attachChild(grid);
}
}
protected Node loadMeshModel(){
OgreLoader loader = new OgreLoader();
MaterialLoader matLoader = new MaterialLoader();
Node model;
try {
URL matURL = Lesson1.class.getClassLoader().getResource("ogre/planet.material");
URL meshURL = Lesson1.class.getClassLoader().getResource("ogre/planet.xml");
if (meshURL == null)
throw new IllegalStateException(
"Required runtime resource missing: mesh "
);
if (matURL == null)
throw new IllegalStateException(
"Required runtime resource missing: meterial" );
try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new RelativeResourceLocator(matURL));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
if (matURL != null){
System.out.println(matURL.openStream());
matLoader.load(matURL.openStream());
if (matLoader.getMaterials().size() > 0)
loader.setMaterials(matLoader.getMaterials());
}
model = (Node) loader.loadModel(meshURL);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
return model;
}