DOF polished

This commit is contained in:
2026-07-07 05:04:16 +04:00
parent 6024227716
commit 9f51c59508
6 changed files with 86 additions and 52 deletions

View File

@@ -159,12 +159,6 @@ 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);
@@ -179,8 +173,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));
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));
if (spectated != -1) {
builder.setValue(SpectatorProperty.PROPERTY, spectated);
}
@@ -210,13 +204,7 @@ public class SPTimeline implements PathingRegistry {
}
public Change updatePositionKeyframe(long time, double posX, double posY, double posZ,
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) {
float yaw, float pitch, float roll) {
LOGGER.debug("Updating position keyframe at {} to pos {}/{}/{} rot {}/{}/{}",
time, posX, posY, posZ, yaw, pitch, roll);
@@ -228,8 +216,6 @@ 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;
@@ -324,6 +310,18 @@ public class SPTimeline implements PathingRegistry {
timeline.pushChange(change);
}
public Change updateLensProperties(long time, float focalDistance, float apertureRadius) {
Keyframe keyframe = positionPath.getKeyframe(time);
Preconditions.checkState(keyframe != null, "Keyframe does not exist");
Change change = UpdateKeyframeProperties.create(positionPath, keyframe)
.setValue(LensProperties.FOCAL_DISTANCE, Triple.of(focalDistance, 0f, 0f))
.setValue(LensProperties.APERTURE_RADIUS, Triple.of(apertureRadius, 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 +466,8 @@ public class SPTimeline implements PathingRegistry {
// otherwise create a new interpolator
interpolator = new LinearInterpolator();
interpolator.registerProperty(SpectatorProperty.PROPERTY);
interpolator.registerProperty(LensProperties.FOCAL_DISTANCE);
interpolator.registerProperty(LensProperties.APERTURE_RADIUS);
}
// Now that we have an interpolator, set it for the current segment
updates.put(segment, interpolator);
@@ -610,9 +610,9 @@ public class SPTimeline implements PathingRegistry {
timeline.registerProperty(CameraProperties.POSITION);
timeline.registerProperty(CameraProperties.ROTATION);
timeline.registerProperty(SpectatorProperty.PROPERTY);
timeline.registerProperty(ExplicitInterpolationProperty.PROPERTY);
timeline.registerProperty(LensProperties.FOCAL_DISTANCE);
timeline.registerProperty(LensProperties.APERTURE_RADIUS);
timeline.registerProperty(ExplicitInterpolationProperty.PROPERTY);
return timeline;
}