Add transformation compacting.

This commit is contained in:
Chicken Bones committed 2013-08-29 11:10:33 +10:00
1 parent 0941845227
commit 5ef9f6174d
7 files changed
+133 -66

No files matched your search

+13
View File
@@ -58,6 +58,19 @@ public class Scale extends Transformation
return new Scale(1/factor.x, 1/factor.y, 1/factor.z);
}
@Override
public Transformation merge(Transformation next) {
if(next instanceof Scale) {
Vector3 vec = factor.copy().multiply(((Scale) next).factor);
if(vec.equalsT(Vector3.one))
return new RedundantTransformation();
return new Scale(vec);
}
return null;
}
@Override
public String toString()
{