Compare commits
2 Commits
e2e04fa86f
...
4fce67a560
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fce67a560 | |||
| 088fb3bb30 |
@@ -16,6 +16,9 @@ import com.replaymod.replay.ReplayModReplay;
|
|||||||
import com.replaymod.replaystudio.pathing.path.Timeline;
|
import com.replaymod.replaystudio.pathing.path.Timeline;
|
||||||
import com.replaymod.simplepathing.SPTimeline;
|
import com.replaymod.simplepathing.SPTimeline;
|
||||||
|
|
||||||
|
import com.replaymod.core.mixin.MinecraftAccessor;
|
||||||
|
import com.replaymod.pathing.player.ReplayTimer;
|
||||||
|
|
||||||
import org.apache.commons.lang3.tuple.Triple;
|
import org.apache.commons.lang3.tuple.Triple;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -111,6 +114,7 @@ public class RealLensOpenGlFrameCapturer
|
|||||||
private final Timeline timeline;
|
private final Timeline timeline;
|
||||||
private final ReplayHandler replayHandler;
|
private final ReplayHandler replayHandler;
|
||||||
private final AccumulationBuffer accum = new AccumulationBuffer();
|
private final AccumulationBuffer accum = new AccumulationBuffer();
|
||||||
|
private long lastConsumedTime = -1;
|
||||||
|
|
||||||
public RealLensOpenGlFrameCapturer(
|
public RealLensOpenGlFrameCapturer(
|
||||||
WorldRenderer worldRenderer,
|
WorldRenderer worldRenderer,
|
||||||
@@ -160,6 +164,16 @@ public class RealLensOpenGlFrameCapturer
|
|||||||
tSub = (long) (frameId * dt);
|
tSub = (long) (frameId * dt);
|
||||||
}
|
}
|
||||||
long replayTime = replayHandler.getReplaySender().currentTimeStamp();
|
long replayTime = replayHandler.getReplaySender().currentTimeStamp();
|
||||||
|
if (lastConsumedTime < 0) lastConsumedTime = replayTime;
|
||||||
|
int pendingTicks = (int) (replayTime / 50L - lastConsumedTime / 50L);
|
||||||
|
if (pendingTicks > 0) {
|
||||||
|
ReplayTimer timer = (ReplayTimer) ((MinecraftAccessor) mc).getTimer();
|
||||||
|
while (pendingTicks-- > 0) {
|
||||||
|
mc.tick(); // двигает prev/cur частиц через границу тика
|
||||||
|
timer.tickDelta -= 1f; // компенсация: VideoRenderer не должен тикнуть повторно
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (replayTime > lastConsumedTime) lastConsumedTime = replayTime;
|
||||||
float subPartialTicks = (float) ((replayTime % 50L) / 50.0);
|
float subPartialTicks = (float) ((replayTime % 50L) / 50.0);
|
||||||
|
|
||||||
float focal = positionPath.getValue(LensProperties.FOCAL_DISTANCE, tSub).map(Triple::getLeft).orElse(5.0f);
|
float focal = positionPath.getValue(LensProperties.FOCAL_DISTANCE, tSub).map(Triple::getLeft).orElse(5.0f);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.joml.Matrix4f;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
import org.lwjgl.opengl.GL30;
|
import org.lwjgl.opengl.GL30;
|
||||||
|
import org.lwjgl.opengl.GL33;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.FloatBuffer;
|
import java.nio.FloatBuffer;
|
||||||
@@ -77,6 +78,11 @@ public class AccumulationBuffer {
|
|||||||
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
|
||||||
RenderSystem.setShaderTexture(0, srcColorTex);
|
RenderSystem.setShaderTexture(0, srcColorTex);
|
||||||
|
|
||||||
|
int prevTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||||
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, srcColorTex);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL33.GL_TEXTURE_SWIZZLE_A, GL11.GL_ONE);
|
||||||
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, prevTex);
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
BufferBuilder bb = tessellator.getBuffer();
|
BufferBuilder bb = tessellator.getBuffer();
|
||||||
bb.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE);
|
bb.begin(GL11.GL_QUADS, VertexFormats.POSITION_TEXTURE);
|
||||||
@@ -86,12 +92,19 @@ public class AccumulationBuffer {
|
|||||||
bb.vertex(-1f, 1f, 0f).texture(0f, 1f).next();
|
bb.vertex(-1f, 1f, 0f).texture(0f, 1f).next();
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
|
|
||||||
|
prevTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||||
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, srcColorTex);
|
||||||
|
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL33.GL_TEXTURE_SWIZZLE_A, GL11.GL_ALPHA);
|
||||||
|
GL11.glBindTexture(GL11.GL_TEXTURE_2D, prevTex);
|
||||||
|
|
||||||
RenderSystem.getModelViewStack().pop();
|
RenderSystem.getModelViewStack().pop();
|
||||||
RenderSystem.applyModelViewMatrix();
|
RenderSystem.applyModelViewMatrix();
|
||||||
RenderSystem.setProjectionMatrix(savedProj, savedSorter);
|
RenderSystem.setProjectionMatrix(savedProj, savedSorter);
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
RenderSystem.depthMask(true);
|
RenderSystem.depthMask(true);
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
|
|
||||||
|
RenderSystem.defaultBlendFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer finishAveraged(int samples) {
|
public ByteBuffer finishAveraged(int samples) {
|
||||||
|
|||||||
Reference in New Issue
Block a user