Added Video Export feature with according Options in the Options Menu
Fixed Linear Interpolation
This commit is contained in:
@@ -7,6 +7,10 @@ import akka.japi.Pair;
|
||||
|
||||
public abstract class LinearInterpolation<K> {
|
||||
|
||||
public LinearInterpolation() {
|
||||
points = new ArrayList<K>();
|
||||
}
|
||||
|
||||
protected List<K> points = new ArrayList<K>();
|
||||
|
||||
public abstract K getPoint(float position);
|
||||
@@ -21,9 +25,9 @@ public abstract class LinearInterpolation<K> {
|
||||
|
||||
protected Pair<Float, Pair<K, K>> getCurrentPoints(float position) {
|
||||
if(points.size() == 0) return null;
|
||||
float pos = position * (points.size()-1);
|
||||
int cubicNum = Math.round(pos);
|
||||
float cubicPos = (pos - cubicNum);
|
||||
position = position * (points.size()-1);
|
||||
int cubicNum = (int)Math.min(points.size()-1, position);
|
||||
float cubicPos = (position - cubicNum);
|
||||
|
||||
if(cubicNum == points.size()-1) {
|
||||
cubicNum--;
|
||||
|
||||
@@ -6,11 +6,16 @@ import eu.crushedpixel.replaymod.holders.Position;
|
||||
public class LinearPoint extends LinearInterpolation<Position> {
|
||||
|
||||
@Override
|
||||
public Position getPoint(float position) {
|
||||
Pair<Float, Pair<Position, Position>> pair = getCurrentPoints(position);
|
||||
public Position getPoint(float positionIn) {
|
||||
Pair<Float, Pair<Position, Position>> pair = getCurrentPoints(positionIn);
|
||||
if(pair == null) return null;
|
||||
|
||||
float perc = pair.first();
|
||||
//float position = positionIn * (points.size()-1);
|
||||
//int cubicNum = (int)Math.min(points.size()-1, position);
|
||||
//float perc = (position - cubicNum);
|
||||
|
||||
//System.out.println(cubicNum+" | "+perc+" | "+positionIn);
|
||||
|
||||
Position first = pair.second().first();
|
||||
Position second = pair.second().second();
|
||||
@@ -23,7 +28,7 @@ public class LinearPoint extends LinearInterpolation<Position> {
|
||||
float yaw = (float)getInterpolatedValue(first.getYaw(), second.getYaw(), perc);
|
||||
|
||||
Position inter = new Position(x, y, z, pitch, yaw);
|
||||
//System.out.println(position+" | "+cubicNum+" | "+perc+" | "+first+" | "+second+" | "+inter);
|
||||
return inter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user