add FOV feature

This commit is contained in:
2026-07-07 06:35:07 +04:00
parent 9f51c59508
commit 0fae99c535
7 changed files with 122 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package com.replaymod.simplepathing.gui;
import com.replaymod.pathing.properties.LensProperties;
import com.replaymod.pathing.properties.FovProperty;
import com.replaymod.replaystudio.pathing.path.Keyframe;
import de.johni0702.minecraft.gui.container.AbstractGuiContainer;
import de.johni0702.minecraft.gui.element.GuiLabel;
@@ -13,12 +14,15 @@ public class GuiLensKeyframePanel extends AbstractGuiContainer<GuiLensKeyframePa
new GuiNumberField().setValidateOnFocusChange(true).setSize(60, 20).setPrecision(3).setMinValue(0);
public final GuiNumberField apertureRadiusField =
new GuiNumberField().setValidateOnFocusChange(true).setSize(60, 20).setPrecision(4).setMinValue(0);
public final GuiNumberField fovField =
new GuiNumberField().setValidateOnFocusChange(true).setSize(60, 20).setPrecision(1).setMinValue(1).setMaxValue(179);
public GuiLensKeyframePanel() {
setLayout(new GridLayout().setCellsEqualSize(false).setColumns(2).setSpacingX(3).setSpacingY(5));
addElements(new GridLayout.Data(1, 0.5),
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.focalDistance"), focalDistanceField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.apertureRadius"), apertureRadiusField);
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.apertureRadius"), apertureRadiusField,
new GuiLabel().setI18nText("replaymod.gui.editkeyframe.fov"), fovField);
}
public GuiLensKeyframePanel load(Keyframe keyframe) {
@@ -26,11 +30,14 @@ public class GuiLensKeyframePanel extends AbstractGuiContainer<GuiLensKeyframePa
.map(Triple::getLeft).orElse(LensProperties.DEFAULT_FOCAL_DISTANCE));
apertureRadiusField.setValue(keyframe.getValue(LensProperties.APERTURE_RADIUS)
.map(Triple::getLeft).orElse(LensProperties.DEFAULT_APERTURE_RADIUS));
fovField.setValue(keyframe.getValue(FovProperty.FOV)
.map(Triple::getLeft).orElse(FovProperty.DEFAULT_FOV));
return this;
}
public float getFocalDistance() { return focalDistanceField.getFloat(); }
public float getApertureRadius() { return apertureRadiusField.getFloat(); }
public float getFov() { return fovField.getFloat(); }
@Override
protected GuiLensKeyframePanel getThis() { return this; }