I exported my model from blender with ogre meshes and it game me a .xml and a .material
I can get it to make the model tnx for a quick copy and paste of a tutorial. but when i run the app my model is all red.
I think its because im not useing my material but i tryed to load it and it wont work
It says com.jme3.scene.plugins.ogre.OgreMaterialList cannot be cast to com.jme3.material.Material
this is the code please help me.
package mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.light.DirectionalLight;
import com.jme3.scene.Spatial;
import com.jme3.material.Material;
/**
* test
* @author normenhansen
*/
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
// Load a model from test_data (OgreXML + material + texture)
Spatial ninja = assetManager.loadModel("Models/Cube.mesh.xml");
Material mat = assetManager.loadMaterial("Materials/Scene.material");
ninja.setMaterial(mat);
ninja.scale(0.05f, 0.05f, 0.05f);
ninja.rotate(0.0f, -3.0f, 0.0f);
ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);
rootNode.attachChild(ninja);
// You must add a light to make the model visible
DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
rootNode.addLight(sun);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}