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:
@@ -22,8 +22,6 @@
|
||||
package com.threerings.jme.model;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectOutput;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -31,6 +29,10 @@ import com.jme.math.Quaternion;
|
||||
import com.jme.math.Vector3f;
|
||||
import com.jme.scene.Controller;
|
||||
import com.jme.scene.Spatial;
|
||||
import com.jme.util.export.JMEExporter;
|
||||
import com.jme.util.export.JMEImporter;
|
||||
import com.jme.util.export.InputCapsule;
|
||||
import com.jme.util.export.OutputCapsule;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
@@ -97,24 +99,26 @@ public class Rotator extends ModelController
|
||||
return rstore;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Externalizable
|
||||
public void writeExternal (ObjectOutput out)
|
||||
@Override // documentation inherited
|
||||
public void read (JMEImporter im)
|
||||
throws IOException
|
||||
{
|
||||
super.writeExternal(out);
|
||||
out.writeObject(_axis);
|
||||
out.writeFloat(_velocity);
|
||||
super.read(im);
|
||||
InputCapsule capsule = im.getCapsule(this);
|
||||
_axis = (Vector3f)capsule.readSavable("axis", null);
|
||||
_velocity = capsule.readFloat("velocity", 0f);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Externalizable
|
||||
public void readExternal (ObjectInput in)
|
||||
throws IOException, ClassNotFoundException
|
||||
@Override // documentation inherited
|
||||
public void write (JMEExporter ex)
|
||||
throws IOException
|
||||
{
|
||||
super.readExternal(in);
|
||||
_axis = (Vector3f)in.readObject();
|
||||
_velocity = in.readFloat();
|
||||
super.write(ex);
|
||||
OutputCapsule capsule = ex.getCapsule(this);
|
||||
capsule.write(_axis, "axis", null);
|
||||
capsule.write(_velocity, "velocity", 0f);
|
||||
}
|
||||
|
||||
|
||||
/** The axis about which to rotate. */
|
||||
protected Vector3f _axis;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user