Switch to using JME's serialization mechanism, which promises a degree

of version safety (meaning we won't necessarily have to recompile all 
the models when we add a new field) and should help avoid the frequent 
binary changes to which Java serialization is prone.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@71 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Andrzej Kapolka
2006-11-07 03:14:35 +00:00
parent 04a833f169
commit 09627624c6
10 changed files with 350 additions and 482 deletions
@@ -199,23 +199,17 @@ public class ModelDef
// set the various buffers
int vsize = vertices.size();
ByteOrder no = ByteOrder.nativeOrder();
ByteBuffer vbbuf = ByteBuffer.allocateDirect(vsize*3*4).order(no),
nbbuf = ByteBuffer.allocateDirect(vsize*3*4).order(no),
tbbuf = tcoords ?
ByteBuffer.allocateDirect(vsize*2*4).order(no) : null,
ibbuf = ByteBuffer.allocateDirect(indices.size()*4).order(no);
FloatBuffer vbuf = vbbuf.asFloatBuffer(),
nbuf = nbbuf.asFloatBuffer(),
tbuf = tcoords ? tbbuf.asFloatBuffer() : null;
FloatBuffer vbuf = BufferUtils.createVector3Buffer(vsize),
nbuf = BufferUtils.createVector3Buffer(vsize),
tbuf = tcoords ? BufferUtils.createVector2Buffer(vsize) : null;
for (int ii = 0; ii < vsize; ii++) {
vertices.get(ii).setInBuffers(vbuf, nbuf, tbuf);
}
IntBuffer ibuf = ibbuf.asIntBuffer();
IntBuffer ibuf = BufferUtils.createIntBuffer(indices.size());
for (int ii = 0, nn = indices.size(); ii < nn; ii++) {
ibuf.put(indices.get(ii));
}
_mesh.reconstruct(vbbuf, nbbuf, null, tbbuf, ibbuf);
_mesh.reconstruct(vbuf, nbuf, null, tbuf, ibuf);
_mesh.setModelBound("sphere".equals(props.getProperty("bound")) ?
new BoundingSphere() : new BoundingBox());
@@ -624,7 +624,7 @@ public class ModelViewer extends JmeCanvasApp
throws IOException
{
_status.setText(_msg.get("m.loading_model", file));
setModel(Model.readFromFile(file, false), file);
setModel(Model.readFromFile(file), file);
}
/**