* Committed fixes to mesh animation classes (not currently used). See http://jmonkeyengine.org/groups/contribution-depot-jme3/forum/topic/fix-to-ogre-mesh-animations-deserializing
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9534 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
8d7b054b31
commit
fd9f274049
@ -59,6 +59,13 @@ public final class Pose implements Savable, Cloneable {
|
|||||||
this.indices = indices;
|
this.indices = indices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialization-only. Do not use.
|
||||||
|
*/
|
||||||
|
public Pose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public int getTargetMeshIndex(){
|
public int getTargetMeshIndex(){
|
||||||
return targetMeshIndex;
|
return targetMeshIndex;
|
||||||
}
|
}
|
||||||
@ -92,13 +99,14 @@ public final class Pose implements Savable, Cloneable {
|
|||||||
* This method creates a clone of the current object.
|
* This method creates a clone of the current object.
|
||||||
* @return a clone of the current object
|
* @return a clone of the current object
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Pose clone() {
|
public Pose clone() {
|
||||||
try {
|
try {
|
||||||
Pose result = (Pose) super.clone();
|
Pose result = (Pose) super.clone();
|
||||||
result.indices = this.indices.clone();
|
result.indices = this.indices.clone();
|
||||||
if(this.offsets!=null) {
|
if (this.offsets != null) {
|
||||||
result.offsets = new Vector3f[this.offsets.length];
|
result.offsets = new Vector3f[this.offsets.length];
|
||||||
for(int i=0;i<this.offsets.length;++i) {
|
for (int i = 0; i < this.offsets.length; ++i) {
|
||||||
result.offsets[i] = this.offsets[i].clone();
|
result.offsets[i] = this.offsets[i].clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +128,12 @@ public final class Pose implements Savable, Cloneable {
|
|||||||
InputCapsule in = i.getCapsule(this);
|
InputCapsule in = i.getCapsule(this);
|
||||||
name = in.readString("name", "");
|
name = in.readString("name", "");
|
||||||
targetMeshIndex = in.readInt("meshIndex", -1);
|
targetMeshIndex = in.readInt("meshIndex", -1);
|
||||||
offsets = (Vector3f[]) in.readSavableArray("offsets", null);
|
|
||||||
indices = in.readIntArray("indices", null);
|
indices = in.readIntArray("indices", null);
|
||||||
|
|
||||||
|
Savable[] readSavableArray = in.readSavableArray("offsets", null);
|
||||||
|
if (readSavableArray != null) {
|
||||||
|
offsets = new Vector3f[readSavableArray.length];
|
||||||
|
System.arraycopy(readSavableArray, 0, offsets, 0, readSavableArray.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,13 @@ public final class PoseTrack implements Track {
|
|||||||
this.weights = weights;
|
this.weights = weights;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialization-only. Do not use.
|
||||||
|
*/
|
||||||
|
public PoseFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method creates a clone of the current object.
|
* This method creates a clone of the current object.
|
||||||
* @return a clone of the current object
|
* @return a clone of the current object
|
||||||
@ -89,8 +96,13 @@ public final class PoseTrack implements Track {
|
|||||||
|
|
||||||
public void read(JmeImporter i) throws IOException {
|
public void read(JmeImporter i) throws IOException {
|
||||||
InputCapsule in = i.getCapsule(this);
|
InputCapsule in = i.getCapsule(this);
|
||||||
poses = (Pose[]) in.readSavableArray("poses", null);
|
|
||||||
weights = in.readFloatArray("weights", null);
|
weights = in.readFloatArray("weights", null);
|
||||||
|
|
||||||
|
Savable[] readSavableArray = in.readSavableArray("poses", null);
|
||||||
|
if (readSavableArray != null) {
|
||||||
|
poses = new Pose[readSavableArray.length];
|
||||||
|
System.arraycopy(readSavableArray, 0, poses, 0, readSavableArray.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +112,13 @@ public final class PoseTrack implements Track {
|
|||||||
this.frames = frames;
|
this.frames = frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialization-only. Do not use.
|
||||||
|
*/
|
||||||
|
public PoseTrack()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void applyFrame(Mesh target, int frameIndex, float weight){
|
private void applyFrame(Mesh target, int frameIndex, float weight){
|
||||||
PoseFrame frame = frames[frameIndex];
|
PoseFrame frame = frames[frameIndex];
|
||||||
VertexBuffer pb = target.getBuffer(Type.Position);
|
VertexBuffer pb = target.getBuffer(Type.Position);
|
||||||
@ -180,7 +199,12 @@ public final class PoseTrack implements Track {
|
|||||||
public void read(JmeImporter i) throws IOException {
|
public void read(JmeImporter i) throws IOException {
|
||||||
InputCapsule in = i.getCapsule(this);
|
InputCapsule in = i.getCapsule(this);
|
||||||
targetMeshIndex = in.readInt("meshIndex", 0);
|
targetMeshIndex = in.readInt("meshIndex", 0);
|
||||||
frames = (PoseFrame[]) in.readSavableArray("frames", null);
|
|
||||||
times = in.readFloatArray("times", null);
|
times = in.readFloatArray("times", null);
|
||||||
|
|
||||||
|
Savable[] readSavableArray = in.readSavableArray("frames", null);
|
||||||
|
if (readSavableArray != null) {
|
||||||
|
frames = new PoseFrame[readSavableArray.length];
|
||||||
|
System.arraycopy(readSavableArray, 0, frames, 0, readSavableArray.length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user