|
|
|
@ -288,6 +288,29 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable |
|
|
|
|
rot.set(0, 0, 0, 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int hashCode() { |
|
|
|
|
int hash = 7; |
|
|
|
|
hash = 89 * hash + rot.hashCode(); |
|
|
|
|
hash = 89 * hash + translation.hashCode(); |
|
|
|
|
hash = 89 * hash + scale.hashCode(); |
|
|
|
|
return hash; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean equals(Object obj) { |
|
|
|
|
if (obj == null) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (getClass() != obj.getClass()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
final Transform other = (Transform) obj; |
|
|
|
|
return this.translation.equals(other.translation) |
|
|
|
|
&& this.scale.equals(other.scale) |
|
|
|
|
&& this.rot.equals(other.rot); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String toString(){ |
|
|
|
|
return getClass().getSimpleName() + "[ " + translation.x + ", " + translation.y + ", " + translation.z + "]\n" |
|
|
|
@ -307,22 +330,21 @@ public final class Transform implements Savable, Cloneable, java.io.Serializable |
|
|
|
|
return this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void write(JmeExporter e) throws IOException { |
|
|
|
|
OutputCapsule capsule = e.getCapsule(this); |
|
|
|
|
capsule.write(rot, "rot", new Quaternion()); |
|
|
|
|
capsule.write(rot, "rot", Quaternion.IDENTITY); |
|
|
|
|
capsule.write(translation, "translation", Vector3f.ZERO); |
|
|
|
|
capsule.write(scale, "scale", Vector3f.UNIT_XYZ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void read(JmeImporter e) throws IOException { |
|
|
|
|
InputCapsule capsule = e.getCapsule(this); |
|
|
|
|
|
|
|
|
|
rot = (Quaternion)capsule.readSavable("rot", new Quaternion()); |
|
|
|
|
translation = (Vector3f)capsule.readSavable("translation", null); |
|
|
|
|
if( translation == null ) { |
|
|
|
|
translation = new Vector3f(); |
|
|
|
|
} |
|
|
|
|
scale = (Vector3f)capsule.readSavable("scale", Vector3f.UNIT_XYZ); |
|
|
|
|
rot.set((Quaternion)capsule.readSavable("rot", Quaternion.IDENTITY)); |
|
|
|
|
translation.set((Vector3f)capsule.readSavable("translation", Vector3f.ZERO)); |
|
|
|
|
scale.set((Vector3f)capsule.readSavable("scale", Vector3f.UNIT_XYZ)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|