aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-extras
diff options
context:
space:
mode:
authorJulien Gouesse <[email protected]>2013-11-07 22:32:06 +0100
committerJulien Gouesse <[email protected]>2013-11-07 22:32:06 +0100
commite44aae403b1fc99a681c4d539b4fa014b4ae62ea (patch)
treef1b1d57995539c338637ffd371fa06b686ff2be6 /ardor3d-extras
parentaabb1a2ce211a29e902fabef5a3327abc14925eb (diff)
Uses the 'legacy' code path when there is no useful transform in KeyframeController.update()
Diffstat (limited to 'ardor3d-extras')
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
index c16db8e..15c810a 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/model/util/KeyframeController.java
@@ -513,25 +513,33 @@ public class KeyframeController<T extends Spatial> extends ComplexSpatialControl
newcolors.rewind(); // reset to start
}
- final Vector3 trOldverts = new Vector3();
- final Vector3 trNewverts = new Vector3();
final ReadOnlyTransform oldtransform = oldShape.getTransform();
final ReadOnlyTransform newtransform = newShape.getTransform();
- for (int i = 0; i < vertQuantity; i++) {
- for (int x = 0; x < 3; x++) {
- trOldverts.setValue(x, oldverts.get(i * 3 + x));
- trNewverts.setValue(x, newverts.get(i * 3 + x));
- }
- if (oldtransform != null) {
+ if (!oldtransform.isIdentity() || !newtransform.isIdentity()) {
+ final Vector3 trOldverts = new Vector3();
+ final Vector3 trNewverts = new Vector3();
+ for (int i = 0; i < vertQuantity; i++) {
+ for (int x = 0; x < 3; x++) {
+ trOldverts.setValue(x, oldverts.get(i * 3 + x));
+ trNewverts.setValue(x, newverts.get(i * 3 + x));
+ }
oldtransform.applyForward(trOldverts);
- }
- if (newtransform != null) {
newtransform.applyForward(trNewverts);
+ for (int x = 0; x < 3; x++) {
+ verts.put(i * 3 + x,
+ (float) ((1f - delta) * trOldverts.getValue(x) + delta * trNewverts.getValue(x)));
+ }
}
- for (int x = 0; x < 3; x++) {
- verts.put(i * 3 + x, (float) ((1f - delta) * trOldverts.getValue(x) + delta * trNewverts.getValue(x)));
+ } else {
+ for (int i = 0; i < vertQuantity; i++) {
+ for (int x = 0; x < 3; x++) {
+ verts.put(i * 3 + x,
+ (float) ((1f - delta) * oldverts.get(i * 3 + x) + delta * newverts.get(i * 3 + x)));
+ }
}
+ }
+ for (int i = 0; i < vertQuantity; i++) {
if (norms != null && oldnorms != null && newnorms != null) {
for (int x = 0; x < 3; x++) {
norms.put(i * 3 + x,