Hi,
When i try to export my scene with JmeBinaryWriter and jbw.writeScene(), the software catches a BufferUnderflowException (see code and Excepion output):
- The scene uses some jpg files for the textures (Mesh).
- i am working with the last cvs version of jme.
- When i simplify the scene, it creates both files (binary and xml).
I would like to know if it exists a description of the binary format and as well a description of the xml format (with DTD)?
I did not see it but is it possible to export a scene node in a xml file directly without using "JmeBinaryWriter" and "BinaryToXml"?
Many thanks,
cj
Here is my code:
private void saveScene(File file , Node scenenode)
{
// Send a jME SceneGraph to jME Binary
JmeBinaryWriter jbw = new JmeBinaryWriter();
File fbin = new File(file.getParent(), new String(file.getName() + ".jme"));
File fxml = new File(file.getParent(), new String(file.getName() + ".xml")) ;
try
{
FileOutputStream fos = new FileOutputStream(fbin);
jbw.writeScene(scenenode, fos);
ByteArrayOutputStream BO2 = new ByteArrayOutputStream();
jbw.writeScene(scenenode, BO2);
BinaryToXML btx = new BinaryToXML();
btx.sendBinarytoXML(new ByteArrayInputStream(BO2.toByteArray()), new FileWriter(fxml));
} catch (IOException e)
{
...
e.printStackTrace();
}
}
Here is the output:
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:851)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1257)
at com.jmex.awt.swingui.JMEDesktop.onButton(Unknown Source)
at com.jmex.awt.swingui.JMEDesktop$ButtonAction.performAction(Unknown Source)
at com.jme.input.ActionTrigger.performAction(Unknown Source)
at com.jme.input.InputHandler.update(Unknown Source)
at com.jme.input.InputHandler.update(Unknown Source)
...
Caused by: java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:398)
at java.nio.DirectFloatBufferU.get(DirectFloatBufferU.java:205)
at com.jme.util.geom.BufferUtils.getColorArray(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeTriMeshTags(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeMesh(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeSpatial(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeChildren(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeNode(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeSpatial(Unknown Source)
at com.jmex.model.XMLparser.JmeBinaryWriter.writeScene(Unknown Source)