Drop lombok, it has been causing too much confusion

Basically the result of the Delombok function, except we use IntelliJ's equals,
hashCode and toString and don't re-organize imports (cause that breaks the
preprocessor) and a bunch of manual cleanup was necessary (and half the classes
weren't even converted).
This commit is contained in:
Jonas Herzig
2020-08-28 13:18:23 +02:00
parent 23e51d7099
commit 16c759f1dd
32 changed files with 400 additions and 103 deletions

View File

@@ -3,9 +3,6 @@ package com.replaymod.render;
import com.google.gson.annotations.SerializedName;
import com.replaymod.core.versions.MCVer;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.Util;
@@ -26,7 +23,6 @@ import org.apache.maven.artifact.versioning.ComparableVersion;
//#endif
//#endif
@Data
public class RenderSettings {
public enum RenderMethod {
DEFAULT, STEREOSCOPIC, CUBIC, EQUIRECTANGULAR, ODS, BLEND;
@@ -119,13 +115,19 @@ public class RenderSettings {
}
}
@AllArgsConstructor
public enum AntiAliasing {
NONE(1), X2(2), X4(4), X8(8);
@Getter
private final int factor;
AntiAliasing(int factor) {
this.factor = factor;
}
public int getFactor() {
return factor;
}
@Override
public String toString() {
return I18n.translate("replaymod.gui.rendersettings.antialiasing." + name().toLowerCase());
@@ -162,6 +164,48 @@ public class RenderSettings {
private final boolean highPerformance;
public RenderSettings(
RenderMethod renderMethod,
EncodingPreset encodingPreset,
int videoWidth,
int videoHeight,
int framesPerSecond,
int bitRate,
File outputFile,
boolean renderNameTags,
boolean stabilizeYaw,
boolean stabilizePitch,
boolean stabilizeRoll,
ReadableColor chromaKeyingColor,
int sphericalFovX,
int sphericalFovY,
boolean injectSphericalMetadata,
AntiAliasing antiAliasing,
String exportCommand,
String exportArguments,
boolean highPerformance
) {
this.renderMethod = renderMethod;
this.encodingPreset = encodingPreset;
this.videoWidth = videoWidth;
this.videoHeight = videoHeight;
this.framesPerSecond = framesPerSecond;
this.bitRate = bitRate;
this.outputFile = outputFile;
this.renderNameTags = renderNameTags;
this.stabilizeYaw = stabilizeYaw;
this.stabilizePitch = stabilizePitch;
this.stabilizeRoll = stabilizeRoll;
this.chromaKeyingColor = chromaKeyingColor;
this.sphericalFovX = sphericalFovX;
this.sphericalFovY = sphericalFovY;
this.injectSphericalMetadata = injectSphericalMetadata;
this.antiAliasing = antiAliasing;
this.exportCommand = exportCommand;
this.exportArguments = exportArguments;
this.highPerformance = highPerformance;
}
/**
* @return the width of the output video during rendering, including the upscale for Anti-Aliasing.
*/
@@ -253,4 +297,71 @@ public class RenderSettings {
return "ffmpeg";
}
public RenderMethod getRenderMethod() {
return renderMethod;
}
public EncodingPreset getEncodingPreset() {
return encodingPreset;
}
public int getFramesPerSecond() {
return framesPerSecond;
}
public int getBitRate() {
return bitRate;
}
public File getOutputFile() {
return outputFile;
}
public boolean isRenderNameTags() {
return renderNameTags;
}
public boolean isStabilizeYaw() {
return stabilizeYaw;
}
public boolean isStabilizePitch() {
return stabilizePitch;
}
public boolean isStabilizeRoll() {
return stabilizeRoll;
}
public ReadableColor getChromaKeyingColor() {
return chromaKeyingColor;
}
public int getSphericalFovX() {
return sphericalFovX;
}
public int getSphericalFovY() {
return sphericalFovY;
}
public boolean isInjectSphericalMetadata() {
return injectSphericalMetadata;
}
public AntiAliasing getAntiAliasing() {
return antiAliasing;
}
public String getExportCommand() {
return exportCommand;
}
public String getExportArguments() {
return exportArguments;
}
public boolean isHighPerformance() {
return highPerformance;
}
}

View File

@@ -1,11 +1,9 @@
package com.replaymod.render.frame;
import com.replaymod.render.rendering.Frame;
import lombok.Getter;
import org.apache.commons.lang3.Validate;
public class CubicOpenGlFrame implements Frame {
@Getter
private final OpenGlFrame left, right, front, back, top, bottom;
public CubicOpenGlFrame(OpenGlFrame left, OpenGlFrame right, OpenGlFrame front, OpenGlFrame back, OpenGlFrame top, OpenGlFrame bottom) {
@@ -31,4 +29,28 @@ public class CubicOpenGlFrame implements Frame {
public int getFrameId() {
return left.getFrameId();
}
public OpenGlFrame getLeft() {
return this.left;
}
public OpenGlFrame getRight() {
return this.right;
}
public OpenGlFrame getFront() {
return this.front;
}
public OpenGlFrame getBack() {
return this.back;
}
public OpenGlFrame getTop() {
return this.top;
}
public OpenGlFrame getBottom() {
return this.bottom;
}
}

View File

@@ -1,11 +1,9 @@
package com.replaymod.render.frame;
import com.replaymod.render.rendering.Frame;
import lombok.Getter;
import org.apache.commons.lang3.Validate;
public class ODSOpenGlFrame implements Frame {
@Getter
private final CubicOpenGlFrame left, right;
public ODSOpenGlFrame(CubicOpenGlFrame left, CubicOpenGlFrame right) {
@@ -18,4 +16,12 @@ public class ODSOpenGlFrame implements Frame {
public int getFrameId() {
return left.getFrameId();
}
public CubicOpenGlFrame getLeft() {
return this.left;
}
public CubicOpenGlFrame getRight() {
return this.right;
}
}

View File

@@ -2,19 +2,31 @@ package com.replaymod.render.frame;
import com.replaymod.render.rendering.Frame;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.nio.ByteBuffer;
@RequiredArgsConstructor
public class OpenGlFrame implements Frame {
@Getter
private final int frameId;
@Getter
private final ReadableDimension size;
@Getter
private final ByteBuffer byteBuffer;
public OpenGlFrame(int frameId, ReadableDimension size, ByteBuffer byteBuffer) {
this.frameId = frameId;
this.size = size;
this.byteBuffer = byteBuffer;
}
public int getFrameId() {
return this.frameId;
}
public ReadableDimension getSize() {
return this.size;
}
public ByteBuffer getByteBuffer() {
return this.byteBuffer;
}
}

View File

@@ -2,19 +2,15 @@ package com.replaymod.render.frame;
import com.replaymod.render.rendering.Frame;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import lombok.Getter;
import org.apache.commons.lang3.Validate;
import java.nio.ByteBuffer;
public class RGBFrame implements Frame {
@Getter
private final int frameId;
@Getter
private final ReadableDimension size;
@Getter
private final ByteBuffer byteBuffer;
public RGBFrame(int frameId, ReadableDimension size, ByteBuffer byteBuffer) {
@@ -25,4 +21,16 @@ public class RGBFrame implements Frame {
this.size = size;
this.byteBuffer = byteBuffer;
}
public int getFrameId() {
return this.frameId;
}
public ReadableDimension getSize() {
return this.size;
}
public ByteBuffer getByteBuffer() {
return this.byteBuffer;
}
}

View File

@@ -1,11 +1,9 @@
package com.replaymod.render.frame;
import com.replaymod.render.rendering.Frame;
import lombok.Getter;
import org.apache.commons.lang3.Validate;
public class StereoscopicOpenGlFrame implements Frame {
@Getter
private final OpenGlFrame left, right;
public StereoscopicOpenGlFrame(OpenGlFrame left, OpenGlFrame right) {
@@ -19,4 +17,12 @@ public class StereoscopicOpenGlFrame implements Frame {
public int getFrameId() {
return left.getFrameId();
}
public OpenGlFrame getLeft() {
return this.left;
}
public OpenGlFrame getRight() {
return this.right;
}
}

View File

@@ -13,11 +13,9 @@ import de.johni0702.minecraft.gui.element.GuiLabel;
import de.johni0702.minecraft.gui.layout.CustomLayout;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import de.johni0702.minecraft.gui.layout.VerticalLayout;
import lombok.RequiredArgsConstructor;
import java.io.File;
@RequiredArgsConstructor
public class GuiRenderingDone extends GuiScreen {
public final ReplayModRender mod;
public final File videoFile;
@@ -72,6 +70,13 @@ public class GuiRenderingDone extends GuiScreen {
setBackground(Background.DIRT);
}
public GuiRenderingDone(ReplayModRender mod, File videoFile, int videoFrames, RenderSettings settings) {
this.mod = mod;
this.videoFile = videoFile;
this.videoFrames = videoFrames;
this.settings = settings;
}
@Override
public void display() {
if (mod.getCore().getSettingsRegistry().get(Setting.SKIP_POST_RENDER_GUI)) {

View File

@@ -6,7 +6,6 @@ import com.replaymod.render.capturer.CaptureData;
import com.replaymod.render.capturer.RenderInfo;
import com.replaymod.render.capturer.WorldRenderer;
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import lombok.Getter;
import net.minecraft.client.MinecraftClient;
//#if MC>=11500
@@ -30,10 +29,8 @@ import java.io.IOException;
public class EntityRendererHandler extends EventRegistrations implements WorldRenderer {
public final MinecraftClient mc = MCVer.getMinecraft();
@Getter
protected final RenderSettings settings;
@Getter
private final RenderInfo renderInfo;
public CaptureData data;
@@ -99,6 +96,14 @@ public class EntityRendererHandler extends EventRegistrations implements WorldRe
this.omnidirectional = omnidirectional;
}
public RenderSettings getSettings() {
return this.settings;
}
public RenderInfo getRenderInfo() {
return this.renderInfo;
}
public interface IEntityRenderer {
void replayModRender_setHandler(EntityRendererHandler handler);
EntityRendererHandler replayModRender_getHandler();

View File

@@ -4,7 +4,6 @@ import com.replaymod.render.frame.CubicOpenGlFrame;
import com.replaymod.render.frame.RGBFrame;
import com.replaymod.render.utils.ByteBufferPool;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import lombok.Getter;
import org.apache.commons.lang3.Validate;
import java.nio.ByteBuffer;
@@ -19,7 +18,6 @@ public class EquirectangularToRGBProcessor extends AbstractFrameProcessor<CubicO
private static final byte IMAGE_TOP = 4;
private static final byte IMAGE_BOTTOM = 5;
@Getter
private final int frameSize;
private final int width;
private final int height;
@@ -138,4 +136,8 @@ public class EquirectangularToRGBProcessor extends AbstractFrameProcessor<CubicO
ByteBufferPool.release(rawFrame.getBottom().getByteBuffer());
return new RGBFrame(rawFrame.getFrameId(), new Dimension(width, height), result);
}
public int getFrameSize() {
return frameSize;
}
}

View File

@@ -2,7 +2,6 @@ package com.replaymod.render.rendering;
import com.replaymod.core.mixin.MinecraftAccessor;
import com.replaymod.core.versions.MCVer;
import lombok.RequiredArgsConstructor;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.crash.CrashException;
@@ -95,10 +94,13 @@ public class Pipeline<R extends Frame, P extends Frame> implements Runnable {
abort = true;
}
@RequiredArgsConstructor
private class ProcessTask implements Runnable {
private final R rawFrame;
public ProcessTask(R rawFrame) {
this.rawFrame = rawFrame;
}
@Override
public void run() {
try {

View File

@@ -23,11 +23,7 @@ import com.replaymod.render.processor.ODSToRGBProcessor;
import com.replaymod.render.processor.OpenGlToRGBProcessor;
import com.replaymod.render.processor.StereoscopicToRGBProcessor;
import com.replaymod.render.utils.PixelBufferObject;
import lombok.experimental.UtilityClass;
import java.io.IOException;
@UtilityClass
public class Pipelines {
public static Pipeline newPipeline(RenderSettings.RenderMethod method, RenderInfo renderInfo, FrameConsumer<RGBFrame> consumer) {
switch (method) {

View File

@@ -2,7 +2,6 @@ package com.replaymod.render.utils;
import com.google.common.base.Objects;
import com.replaymod.core.ReplayMod;
import lombok.RequiredArgsConstructor;
import org.apache.logging.log4j.LogManager;
//#if MC>=11400
@@ -25,13 +24,17 @@ import static org.lwjgl.opengl.ARBVertexBufferObject.*;
//#endif
public class PixelBufferObject {
@RequiredArgsConstructor
public enum Usage {
COPY(GL_STREAM_COPY_ARB, GL_STREAM_COPY),
DRAW(GL_STREAM_DRAW_ARB, GL_STREAM_DRAW),
READ(GL_STREAM_READ_ARB, GL_STREAM_READ);
private final int arb, gl15;
Usage(int arb, int gl15) {
this.arb = arb;
this.gl15 = gl15;
}
}
//#if MC>=11400

View File

@@ -2,11 +2,62 @@ package com.replaymod.render.utils;
import com.replaymod.render.RenderSettings;
import com.replaymod.replaystudio.pathing.path.Timeline;
import lombok.Data;
@Data
import java.util.Objects;
public class RenderJob {
private String name;
private Timeline timeline;
private RenderSettings settings;
public RenderJob() {
}
public String getName() {
return this.name;
}
public Timeline getTimeline() {
return this.timeline;
}
public RenderSettings getSettings() {
return this.settings;
}
public void setName(String name) {
this.name = name;
}
public void setTimeline(Timeline timeline) {
this.timeline = timeline;
}
public void setSettings(RenderSettings settings) {
this.settings = settings;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RenderJob renderJob = (RenderJob) o;
return name.equals(renderJob.name) &&
timeline.equals(renderJob.timeline) &&
settings.equals(renderJob.settings);
}
@Override
public int hashCode() {
return Objects.hash(name, timeline, settings);
}
@Override
public String toString() {
return "RenderJob{" +
"name='" + name + '\'' +
", timeline=" + timeline +
", settings=" + settings +
'}';
}
}