|
@@ -40,7 +40,13 @@ public class AnimatedMesh {
|
|
private int currentFrame;
|
|
private int currentFrame;
|
|
private boolean loopAction = false;
|
|
private boolean loopAction = false;
|
|
private boolean reverseAction = false;
|
|
private boolean reverseAction = false;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * start play an animation (action)
|
|
|
|
+ * @param actionName name in the AMSH file
|
|
|
|
+ * @param loop loop the animation
|
|
|
|
+ * @param reverse play the animation backwards
|
|
|
|
+ */
|
|
public void startAction(String actionName, boolean loop, boolean reverse) {
|
|
public void startAction(String actionName, boolean loop, boolean reverse) {
|
|
if (!(currentAction != null && currentAction.name.equals(actionName) && reverse)) // keep the current frame
|
|
if (!(currentAction != null && currentAction.name.equals(actionName) && reverse)) // keep the current frame
|
|
currentFrame = 0;
|
|
currentFrame = 0;
|
|
@@ -58,7 +64,10 @@ public class AnimatedMesh {
|
|
if (!(currentAction != null && currentAction.name.equals(actionName) && reverse)) // keep the current frame
|
|
if (!(currentAction != null && currentAction.name.equals(actionName) && reverse)) // keep the current frame
|
|
currentFrame = currentAction.numFrames - 1;
|
|
currentFrame = currentAction.numFrames - 1;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @return true if completed OR hasn't started yet.
|
|
|
|
+ */
|
|
public boolean isActionDone() {
|
|
public boolean isActionDone() {
|
|
if (currentAction == null)
|
|
if (currentAction == null)
|
|
return true;
|
|
return true;
|
|
@@ -70,7 +79,9 @@ public class AnimatedMesh {
|
|
return currentFrame >= currentAction.numFrames - 1;
|
|
return currentFrame >= currentAction.numFrames - 1;
|
|
*/
|
|
*/
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // private classes. don't use these.
|
|
|
|
+
|
|
private class Bone {
|
|
private class Bone {
|
|
@SuppressWarnings("unused")
|
|
@SuppressWarnings("unused")
|
|
public String name; // 15 bytes
|
|
public String name; // 15 bytes
|
|
@@ -194,7 +205,11 @@ public class AnimatedMesh {
|
|
return matrix;
|
|
return matrix;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * create an animmesh from an inputstream
|
|
|
|
+ * @param is the inputstream
|
|
|
|
+ */
|
|
public AnimatedMesh(InputStream is) {
|
|
public AnimatedMesh(InputStream is) {
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
try {
|
|
try {
|
|
@@ -281,7 +296,7 @@ public class AnimatedMesh {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * animate the mesh for one frame
|
|
|
|
|
|
+ * update the bone transforms of the mesh and advance one frame
|
|
*/
|
|
*/
|
|
public void tick() {
|
|
public void tick() {
|
|
// empty pose
|
|
// empty pose
|