working DOF

This commit is contained in:
2026-07-01 04:48:45 +04:00
parent 3b070a7efc
commit 69013c2124
8 changed files with 131 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ import com.google.gson.stream.JsonWriter;
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.replaystudio.pathing.PathingRegistry;
import com.replaymod.replaystudio.pathing.change.AddKeyframe;
import com.replaymod.replaystudio.pathing.change.Change;
@@ -158,6 +159,12 @@ public class SPTimeline implements PathingRegistry {
public void addPositionKeyframe(long time, double posX, double posY, double posZ,
float yaw, float pitch, float roll, int spectated) {
addPositionKeyframe(time, posX, posY, posZ, yaw, pitch, roll, spectated, 5.0f, 0.05f);
}
public void addPositionKeyframe(long time, double posX, double posY, double posZ,
float yaw, float pitch, float roll, int spectated,
float focalDistance, float apertureRadius) {
LOGGER.debug("Adding position keyframe at {} pos {}/{}/{} rot {}/{}/{} entId {}",
time, posX, posY, posZ, yaw, pitch, roll, spectated);
@@ -172,6 +179,8 @@ public class SPTimeline implements PathingRegistry {
UpdateKeyframeProperties.Builder builder = UpdateKeyframeProperties.create(path, keyframe);
builder.setValue(CameraProperties.POSITION, Triple.of(posX, posY, posZ));
builder.setValue(CameraProperties.ROTATION, Triple.of(yaw, pitch, roll));
builder.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(focalDistance, 0f, 0f));
builder.setValue(LensProperties.APERTURE_RADIUS, Triple.of(apertureRadius, 0f, 0f));
if (spectated != -1) {
builder.setValue(SpectatorProperty.PROPERTY, spectated);
}
@@ -201,7 +210,13 @@ public class SPTimeline implements PathingRegistry {
}
public Change updatePositionKeyframe(long time, double posX, double posY, double posZ,
float yaw, float pitch, float roll) {
float yaw, float pitch, float roll) {
return updatePositionKeyframe(time, posX, posY, posZ, yaw, pitch, roll, 5.0f, 0.05f);
}
public Change updatePositionKeyframe(long time, double posX, double posY, double posZ,
float yaw, float pitch, float roll,
float focalDistance, float apertureRadius) {
LOGGER.debug("Updating position keyframe at {} to pos {}/{}/{} rot {}/{}/{}",
time, posX, posY, posZ, yaw, pitch, roll);
@@ -213,6 +228,8 @@ public class SPTimeline implements PathingRegistry {
Change change = UpdateKeyframeProperties.create(positionPath, keyframe)
.setValue(CameraProperties.POSITION, Triple.of(posX, posY, posZ))
.setValue(CameraProperties.ROTATION, Triple.of(yaw, pitch, roll))
.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(focalDistance, 0f, 0f))
.setValue(LensProperties.APERTURE_RADIUS, Triple.of(apertureRadius, 0f, 0f))
.done();
change.apply(timeline);
return change;
@@ -569,6 +586,8 @@ public class SPTimeline implements PathingRegistry {
private Interpolator registerPositionInterpolatorProperties(Interpolator interpolator) {
interpolator.registerProperty(CameraProperties.POSITION);
interpolator.registerProperty(CameraProperties.ROTATION);
interpolator.registerProperty(LensProperties.FOCAL_DISTANCE);
interpolator.registerProperty(LensProperties.APERTURE_RADIUS);
return interpolator;
}
@@ -592,6 +611,8 @@ public class SPTimeline implements PathingRegistry {
timeline.registerProperty(CameraProperties.ROTATION);
timeline.registerProperty(SpectatorProperty.PROPERTY);
timeline.registerProperty(ExplicitInterpolationProperty.PROPERTY);
timeline.registerProperty(LensProperties.FOCAL_DISTANCE);
timeline.registerProperty(LensProperties.APERTURE_RADIUS);
return timeline;
}