Since some days I’ve joined the development of @david_bernard_31’s xbuf.
After obtaining the permission, I started migrating the loader from xtend to java8.
Now we have two loaders: the original xtend one, and the java loader whose temporary name is loader2 and will eventually replace the other one in the future.
While I was at it, I’ve also added the support for physics that now can be easily imported (only with loader2) from blender (similar of what i did for the ogre importer).
Yes, if it were for me i would have ported it directly to java7… but there are people complaining about verbosity i don’t see
It is not impossible that it will be ported to java7 though, actually there is just the 1% of code that is benefiting of the features of j8…
We are working/experimenting a more configurable loader. That should allow dev to say don’t “use additionnal lib for runtime” like jme3_xbuf_rt, jme3-bullet-vhacd. But in this case some feature will not be available. We are experimenting way to allow dev to easily customize the loader.
Right now there shouldn’t be any required runtime dependency for the scenes loaded with loader2 if you use default settings.
With the xbuf model key you can toggle various options, the ones that will need runtime dependencies are
useLightControl: that uses a custom light control, that does something useful i don’t remember.
useEnhancedRigidbodies: that will use a custom rigidbody that allows the spatial to be moved normally when not attached to physics spaces
And possibly more in the future.
I have to amend what i said yesterday do david, vhacd doesn’t require runtime dependencies for the generated j3o.
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import jme3_ext_xbuf.XbufLoader;
public class testXbuf extends SimpleApplication{
@Override
public void simpleInitApp() {
flyCam.setEnabled(true);
assetManager.registerLoader(XbufLoader.class,"xbuf");
Spatial xbuf_scene=assetManager.loadModel("Models/Models/Players/Doha/Doha.xbuf");
rootNode.attachChild(xbuf_scene);
/** A white, directional light source */
DirectionalLight sun = new DirectionalLight();
sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
sun.setColor(ColorRGBA.White);
rootNode.addLight(sun);
}
public static void main(String[] args) {
new testXbuf().start();
}
}
but got some errors
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NoClassDefFoundError: com/google/protobuf/ExtensionRegistryLite
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at com.jme3.asset.ImplHandler$ImplThreadLocal.initialValue(ImplHandler.java:117)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
at java.lang.ThreadLocal.get(ThreadLocal.java:170)
at com.jme3.asset.ImplHandler.aquireLoader(ImplHandler.java:203)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:255)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
at mygame.testXbuf.simpleInitApp(testXbuf.java:22)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.ExtensionRegistryLite
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 17 more
there are some differences with your PhysicsLoaderTest.java
Spatial xbuf_scene=assetManager.loadModel(
new XbufKey("models/physicsScene2/physicsScene2.xbuf"));
in my case assetManager.loadModel does not accept XbufKey …
I am using jme3_xbuf_loader2.jar.
Should I build my jmonkeyengine from your github fork?
java.lang.NoClassDefFoundError: com/jme3/physicsloader/impl/PhysicsLoaderModelKey
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at jme3_ext_xbuf.XbufLoader.load(XbufLoader.java:27)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:259)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:373)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:416)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:420)
at mygame.testXbuf.simpleInitApp(testXbuf.java:22)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.jme3.physicsloader.impl.PhysicsLoaderModelKey
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 22 more
think it is because of Spatial xbuf_scene=assetManager.loadModel("Models/Models/Players/Doha/Doha.xbuf");
It seems that the blender addons replace the paths to be relative to Textures/ inside your asset root.
I don’t know if there is a way to configure this. ( i didn’t touch this part of the code )
Open an issue on github repo, please.
For the moment, even thought it’s a bit annoying, you can move your texture in Textures/