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

@@ -5,8 +5,9 @@ import eu.crushedpixel.replaymod.chat.ChatMessageHandler.ChatMessageType;
import eu.crushedpixel.replaymod.holders.AdvancedPosition;
import eu.crushedpixel.replaymod.holders.Keyframe;
import eu.crushedpixel.replaymod.holders.TimestampValue;
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionLinearInterpolation;
import eu.crushedpixel.replaymod.interpolation.AdvancedPositionSplineInterpolation;
import eu.crushedpixel.replaymod.interpolation.GenericLinearInterpolation;
import eu.crushedpixel.replaymod.interpolation.GenericSplineInterpolation;
import eu.crushedpixel.replaymod.settings.RenderOptions;
import eu.crushedpixel.replaymod.timer.EnchantmentTimer;
import eu.crushedpixel.replaymod.timer.ReplayTimer;
@@ -31,8 +32,8 @@ public class ReplayProcess {
private static boolean linear = false;
private static GenericSplineInterpolation<AdvancedPosition> motionSpline = null;
private static GenericLinearInterpolation<AdvancedPosition> motionLinear = null;
private static AdvancedPositionSplineInterpolation motionSpline = null;
private static AdvancedPositionLinearInterpolation motionLinear = null;
private static GenericLinearInterpolation<TimestampValue> timeLinear = null;
private static double previousReplaySpeed = 0;
@@ -176,7 +177,7 @@ public class ReplayProcess {
if(!linear && motionSpline == null) {
//set up spline path
motionSpline = new GenericSplineInterpolation<AdvancedPosition>();
motionSpline = new AdvancedPositionSplineInterpolation();
for(Keyframe<AdvancedPosition> kf : ReplayHandler.getPositionKeyframes()) {
motionSpline.addPoint(kf.getValue());
}
@@ -184,7 +185,7 @@ public class ReplayProcess {
if(linear && motionLinear == null) {
//set up linear path
motionLinear = new GenericLinearInterpolation<AdvancedPosition>();
motionLinear = new AdvancedPositionLinearInterpolation();
for(Keyframe<AdvancedPosition> kf : ReplayHandler.getPositionKeyframes()) {
motionLinear.addPoint(kf.getValue());
}