Hello,
I get the following exception by loading a material:
[java]
Jul 16, 2014 6:51:42 PM com.jme3.app.Application handleError
Schwerwiegend: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.ClassCastException: com.jme3.material.MaterialDef cannot be cast to com.jme3.asset.CloneableSmartAsset
at com.jme3.asset.cache.WeakRefCloneAssetCache.addToCache(WeakRefCloneAssetCache.java:127)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:309)
at com.jme3.asset.DesktopAssetManager.loadMaterial(DesktopAssetManager.java:350)
at de.gamebasislib.building.BuildingGrid.loadBuildingGrid(BuildingGrid.java:46)
at de.gamebasis.client.Main.simpleInitApp(Main.java:159)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:744)
[/java]
This exception belows to the following code:
[java]
Mesh mesh = new Mesh();
mesh.setMode(Mesh.Mode.Lines);
mesh.setBuffer(VertexBuffer.Type.Position, 3, new float[]{ x, 0f, -300f, x, 0f, 300f});
mesh.setBuffer(VertexBuffer.Type.Index, 2, new short[]{ 0, 1 });
//Die Linie soll auch gezeichnet werden, wenn sie nicht im Fenster sichtbar wäre
mesh.updateBound();
mesh.updateCounts();
Geometry lineGeometry = new Geometry("xline", mesh);
Material lineMaterial = this.app.getAssetManager().loadMaterial("Materials/Lighting.j3md").clone();
lineMaterial.setColor("Color", ColorRGBA.LightGray);
lineGeometry.setMaterial(lineMaterial);
this.lineNode.attachChild(lineGeometry);
[/java]
What is the problem?