Added getLinearInterpolator() and getCubicInterpolator() methods to KeyframeValue interface to allow for specific Interpolators instead of the Generic Interpolators

Created InterpolationUtils class with a method to fix the Euler Rotation Break problem
Create AdvancedPositionSplineInterpolation and AdvancedPositionLinearInterpolation which always use the shortest possible paths between the Euler Rotation values of the Camera's Yaw and Roll
Remove Position Keyframe filtering when adding the Keyframe. This is now done by the AdvancedPositionInterpolation classes
This commit is contained in:
CrushedPixel
2015-07-21 03:49:20 +02:00
parent ff6b09dcba
commit f5a9723646
15 changed files with 177 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@@ -69,4 +69,14 @@ public class AdvancedPosition extends Position {
public AdvancedPosition newInstance() {
return new AdvancedPosition();
}
@Override
public Interpolation getCubicInterpolator() {
return new AdvancedPositionSplineInterpolation();
}
@Override
public Interpolation getLinearInterpolator() {
return new AdvancedPositionLinearInterpolation();
}
}

View File

@@ -1,5 +1,8 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
import eu.crushedpixel.replaymod.interpolation.Interpolation;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -17,4 +20,14 @@ public class Marker implements KeyframeValue {
public KeyframeValue newInstance() {
return new Marker();
}
@Override
public Interpolation getLinearInterpolator() {
return new GenericLinearInterpolation<Marker>();
}
@Override
public Interpolation getCubicInterpolator() {
return new GenericSplineInterpolation<Marker>();
}
}

View File

@@ -1,7 +1,6 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.interpolation.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
@@ -17,4 +16,14 @@ public class NumberValue implements KeyframeValue {
return new NumberValue();
}
@Override
public Interpolation getLinearInterpolator() {
return new GenericLinearInterpolation<NumberValue>();
}
@Override
public Interpolation getCubicInterpolator() {
return new GenericSplineInterpolation<NumberValue>();
}
}

View File

@@ -1,7 +1,6 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.interpolation.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
@@ -16,4 +15,14 @@ public class Point implements KeyframeValue {
public Point newInstance() {
return new Point();
}
@Override
public Interpolation getLinearInterpolator() {
return new GenericLinearInterpolation<Point>();
}
@Override
public Interpolation getCubicInterpolator() {
return new GenericSplineInterpolation<Point>();
}
}

View File

@@ -1,7 +1,6 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.interpolation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -26,4 +25,13 @@ public class Position implements KeyframeValue {
this.z = pos.getZ();
}
@Override
public Interpolation getLinearInterpolator() {
return new GenericLinearInterpolation<Position>();
}
@Override
public Interpolation getCubicInterpolator() {
return new GenericSplineInterpolation<Position>();
}
}

View File

@@ -1,7 +1,6 @@
package eu.crushedpixel.replaymod.holders;
import eu.crushedpixel.replaymod.interpolation.Interpolate;
import eu.crushedpixel.replaymod.interpolation.KeyframeValue;
import eu.crushedpixel.replaymod.interpolation.*;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
@@ -21,4 +20,13 @@ public class TimestampValue implements KeyframeValue {
return new TimestampValue();
}
@Override
public Interpolation getLinearInterpolator() {
return new GenericLinearInterpolation<TimestampValue>();
}
@Override
public Interpolation getCubicInterpolator() {
return new GenericSplineInterpolation<TimestampValue>();
}
}