test worked

This commit is contained in:
2026-06-30 11:44:24 +04:00
parent a4c8dafa07
commit 646577e97f
9 changed files with 302 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
package com.replaymod.render.capturer;
public final class RealLensCameraContext {
private static final ThreadLocal<RealLensOpenGlFrameCapturer.Data> CURRENT =
new ThreadLocal<>();
private RealLensCameraContext() {}
public static void set(RealLensOpenGlFrameCapturer.Data data) {
CURRENT.set(data);
}
public static RealLensOpenGlFrameCapturer.Data get() {
return CURRENT.get();
}
public static void clear() {
CURRENT.remove();
}
}

View File

@@ -0,0 +1,70 @@
package com.replaymod.render.capturer;
import com.replaymod.render.frame.OpenGlFrame;
import com.replaymod.render.frame.RealLensOpenGlFrame;
import com.replaymod.render.rendering.Channel;
import java.util.Collections;
import java.util.Map;
public class RealLensOpenGlFrameCapturer
extends OpenGlFrameCapturer<RealLensOpenGlFrame, RealLensOpenGlFrameCapturer.Data> {
public static class Data implements CaptureData {
public final float dx, dy, dz;
public final float yaw, pitch;
public Data(float dx, float dy, float dz,
float yaw, float pitch) {
this.dx = dx;
this.dy = dy;
this.dz = dz;
this.yaw = yaw;
this.pitch = pitch;
}
}
private static final Data[] CAMERAS = {
new Data( 0.25f, 0.00f, 0f, 0f, 0f),
new Data( 0.00f, 0.25f, 0f, 0f, 0f),
new Data(-0.25f, 0.00f, 0f, 0f, 0f),
new Data( 0.00f, -0.25f, 0f, 0f, 0f)
};
public RealLensOpenGlFrameCapturer(
WorldRenderer worldRenderer,
RenderInfo renderInfo
) {
super(worldRenderer, renderInfo);
}
@Override
public Map<Channel, RealLensOpenGlFrame> process() {
float partialTicks = renderInfo.updateForNextFrame();
int frameId = framesDone++;
OpenGlFrame[] frames = new OpenGlFrame[CAMERAS.length];
try {
for (int i = 0; i < CAMERAS.length; i++) {
RealLensCameraContext.set(CAMERAS[i]);
frames[i] = renderFrame(
frameId,
partialTicks,
CAMERAS[i]
);
}
} finally {
RealLensCameraContext.clear();
}
return Collections.singletonMap(
Channel.BRGA,
new RealLensOpenGlFrame(frames)
);
}
}