Hi,
I’m just trying to build a full initialized Geometry-instance cause i need to manipulate it.
BUT, I don’t need an instance of Simpleapplication, cause later the extended code has to run on a server and servers didn’t have Gui’s for their own(neither visible nor invisible).
My problem lies in getting a full initialized (Desktop-)Assetmanager.
Only after that I can give a material to the geometry.
Til now my testcode looks like this:
[java]
package own;
import java.net.MalformedURLException;
import java.net.URL;
import com.jme3.asset.AssetManager;
import com.jme3.material.Material;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.AppSettings;
import com.jme3.system.JmeSystem;
public class AssetmanagerTest {
/**
-
@param args
*/
public static void main(String[] args) {
Box box = new Box(1, 1, 1);
Geometry geometry = new Geometry("boxGeo", box);
AppSettings settings = new AppSettings(true);
AssetManager assetManager = null;
URL url = null;
try {
String string = settings.getString("AssetConfigURL");
System.out.println(">>"+string+"<<");
url = new URL(string);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
assetManager = JmeSystem.newAssetManager(url);
Material material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
geometry.setMaterial(material);
System.out.println(geometry);
}
}
[/java]
and i get this:
null<<
java.net.MalformedURLException
at java.net.URL.(URL.java:601)
at java.net.URL.(URL.java:464)
at java.net.URL.(URL.java:413)
at own.AssetmanagerTest.main(AssetmanagerTest.java:27)
05.12.2010 15:21:11 com.jme3.asset.DesktopAssetManager
INFO: DesktopAssetManager created.
05.12.2010 15:21:11 com.jme3.asset.DesktopAssetManager loadAsset
WARNUNG: No loader registered for type j3md.
Exception in thread “main” java.lang.NullPointerException: Material definition cannot be null
at com.jme3.material.Material.(Material.java:143)
at com.jme3.material.Material.(Material.java:149)
at own.AssetmanagerTest.main(AssetmanagerTest.java:33)