add FOV feature
This commit is contained in:
@@ -10,6 +10,7 @@ import com.replaymod.pathing.properties.CameraProperties;
|
||||
import com.replaymod.pathing.properties.SpectatorProperty;
|
||||
import com.replaymod.pathing.properties.TimestampProperty;
|
||||
import com.replaymod.pathing.properties.LensProperties;
|
||||
import com.replaymod.pathing.properties.FovProperty;
|
||||
import com.replaymod.replaystudio.pathing.PathingRegistry;
|
||||
import com.replaymod.replaystudio.pathing.change.AddKeyframe;
|
||||
import com.replaymod.replaystudio.pathing.change.Change;
|
||||
@@ -175,6 +176,7 @@ public class SPTimeline implements PathingRegistry {
|
||||
builder.setValue(CameraProperties.ROTATION, Triple.of(yaw, pitch, roll));
|
||||
builder.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(LensProperties.DEFAULT_FOCAL_DISTANCE, 0f, 0f));
|
||||
builder.setValue(LensProperties.APERTURE_RADIUS, Triple.of(LensProperties.DEFAULT_APERTURE_RADIUS, 0f, 0f));
|
||||
builder.setValue(FovProperty.FOV, Triple.of(FovProperty.DEFAULT_FOV, 0f, 0f));
|
||||
if (spectated != -1) {
|
||||
builder.setValue(SpectatorProperty.PROPERTY, spectated);
|
||||
}
|
||||
@@ -322,6 +324,16 @@ public class SPTimeline implements PathingRegistry {
|
||||
return change;
|
||||
}
|
||||
|
||||
public Change updateFov(long time, float fov) {
|
||||
Keyframe keyframe = positionPath.getKeyframe(time);
|
||||
Preconditions.checkState(keyframe != null, "Keyframe does not exist");
|
||||
Change change = UpdateKeyframeProperties.create(positionPath, keyframe)
|
||||
.setValue(FovProperty.FOV, Triple.of(fov, 0f, 0f))
|
||||
.done();
|
||||
change.apply(timeline);
|
||||
return change;
|
||||
}
|
||||
|
||||
public Change setInterpolatorToDefault(long time) {
|
||||
LOGGER.debug("Setting interpolator of position keyframe at {} to the default", time);
|
||||
|
||||
@@ -468,6 +480,7 @@ public class SPTimeline implements PathingRegistry {
|
||||
interpolator.registerProperty(SpectatorProperty.PROPERTY);
|
||||
interpolator.registerProperty(LensProperties.FOCAL_DISTANCE);
|
||||
interpolator.registerProperty(LensProperties.APERTURE_RADIUS);
|
||||
interpolator.registerProperty(FovProperty.FOV);
|
||||
}
|
||||
// Now that we have an interpolator, set it for the current segment
|
||||
updates.put(segment, interpolator);
|
||||
@@ -588,6 +601,7 @@ public class SPTimeline implements PathingRegistry {
|
||||
interpolator.registerProperty(CameraProperties.ROTATION);
|
||||
interpolator.registerProperty(LensProperties.FOCAL_DISTANCE);
|
||||
interpolator.registerProperty(LensProperties.APERTURE_RADIUS);
|
||||
interpolator.registerProperty(FovProperty.FOV);
|
||||
return interpolator;
|
||||
}
|
||||
|
||||
@@ -612,6 +626,7 @@ public class SPTimeline implements PathingRegistry {
|
||||
timeline.registerProperty(SpectatorProperty.PROPERTY);
|
||||
timeline.registerProperty(LensProperties.FOCAL_DISTANCE);
|
||||
timeline.registerProperty(LensProperties.APERTURE_RADIUS);
|
||||
timeline.registerProperty(FovProperty.FOV);
|
||||
timeline.registerProperty(ExplicitInterpolationProperty.PROPERTY);
|
||||
|
||||
return timeline;
|
||||
|
||||
Reference in New Issue
Block a user