mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-23 19:37:53 +01:00
fix view -IMS
This commit is contained in:
parent
68393d11bb
commit
475b1d8d7d
4 changed files with 10 additions and 12 deletions
|
@ -16,7 +16,7 @@ public interface RenderContext {
|
||||||
|
|
||||||
RenderBuffers buffers();
|
RenderBuffers buffers();
|
||||||
|
|
||||||
PoseStack stack();
|
Matrix4fc modelView();
|
||||||
|
|
||||||
Matrix4fc projection();
|
Matrix4fc projection();
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public final class FrameUniforms extends UniformWriter {
|
||||||
var camY = (float) (cameraPos.y - renderOrigin.getY());
|
var camY = (float) (cameraPos.y - renderOrigin.getY());
|
||||||
var camZ = (float) (cameraPos.z - renderOrigin.getZ());
|
var camZ = (float) (cameraPos.z - renderOrigin.getZ());
|
||||||
|
|
||||||
VIEW.set(context.stack().last().pose());
|
VIEW.set(context.modelView());
|
||||||
VIEW.translate(-camX, -camY, -camZ);
|
VIEW.translate(-camX, -camY, -camZ);
|
||||||
PROJECTION.set(context.projection());
|
PROJECTION.set(context.projection());
|
||||||
VIEW_PROJECTION.set(context.viewProjection());
|
VIEW_PROJECTION.set(context.viewProjection());
|
||||||
|
|
|
@ -11,14 +11,13 @@ import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.renderer.LevelRenderer;
|
import net.minecraft.client.renderer.LevelRenderer;
|
||||||
import net.minecraft.client.renderer.RenderBuffers;
|
import net.minecraft.client.renderer.RenderBuffers;
|
||||||
|
|
||||||
public record RenderContextImpl(LevelRenderer renderer, ClientLevel level, RenderBuffers buffers, PoseStack stack,
|
public record RenderContextImpl(LevelRenderer renderer, ClientLevel level, RenderBuffers buffers, Matrix4fc modelView,
|
||||||
Matrix4fc projection, Matrix4fc viewProjection, Camera camera,
|
Matrix4fc projection, Matrix4fc viewProjection, Camera camera,
|
||||||
float partialTick) implements RenderContext {
|
float partialTick) implements RenderContext {
|
||||||
public static RenderContextImpl create(LevelRenderer renderer, ClientLevel level, RenderBuffers buffers, PoseStack stack, Matrix4f projection, Camera camera, float partialTick) {
|
public static RenderContextImpl create(LevelRenderer renderer, ClientLevel level, RenderBuffers buffers, Matrix4fc modelView, Matrix4f projection, Camera camera, float partialTick) {
|
||||||
Matrix4f viewProjection = new Matrix4f(projection);
|
Matrix4f viewProjection = new Matrix4f(projection);
|
||||||
viewProjection.mul(stack.last()
|
viewProjection.mul(modelView);
|
||||||
.pose());
|
|
||||||
|
|
||||||
return new RenderContextImpl(renderer, level, buffers, stack, projection, viewProjection, camera, partialTick);
|
return new RenderContextImpl(renderer, level, buffers, modelView, projection, viewProjection, camera, partialTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,8 @@ abstract class LevelRendererMixin {
|
||||||
|
|
||||||
// @Inject(method = "renderLevel", at = @At("HEAD"))
|
// @Inject(method = "renderLevel", at = @At("HEAD"))
|
||||||
@Inject(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"))
|
@Inject(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/level/lighting/LevelLightEngine;runLightUpdates()I"))
|
||||||
private void flywheel$beginRender(DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f frustumMatrix, Matrix4f projectionMatrix, CallbackInfo ci, @Share("flywheel$poseStack") LocalRef<PoseStack> poseStack) {
|
private void flywheel$beginRender(DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f modelMatrix, Matrix4f projectionMatrix, CallbackInfo ci) {
|
||||||
PoseStack flywheel$poseStack = new PoseStack();
|
flywheel$renderContext = RenderContextImpl.create((LevelRenderer) (Object) this, level, renderBuffers, modelMatrix, projectionMatrix, camera, deltaTracker.getGameTimeDeltaTicks());
|
||||||
flywheel$renderContext = RenderContextImpl.create((LevelRenderer) (Object) this, level, renderBuffers, flywheel$poseStack, projectionMatrix, camera, deltaTracker.getGameTimeDeltaTicks());
|
|
||||||
|
|
||||||
VisualizationManager manager = VisualizationManager.get(level);
|
VisualizationManager manager = VisualizationManager.get(level);
|
||||||
if (manager != null) {
|
if (manager != null) {
|
||||||
|
@ -114,8 +113,8 @@ abstract class LevelRendererMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Group(name = "afterParticles")
|
//@Group(name = "afterParticles")
|
||||||
@Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/culling/Frustum;Ljava/util/function/Predicate;)V", shift = Shift.AFTER))
|
//@Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/particle/ParticleEngine;render(Lnet/minecraft/client/renderer/LightTexture;Lnet/minecraft/client/Camera;FLnet/minecraft/client/renderer/culling/Frustum;Ljava/util/function/Predicate;)V", shift = Shift.AFTER))
|
||||||
private void flywheel$afterParticles$forge(CallbackInfo ci) {
|
private void flywheel$afterParticles$forge(CallbackInfo ci) {
|
||||||
if (flywheel$renderContext != null) {
|
if (flywheel$renderContext != null) {
|
||||||
VisualizationManager manager = VisualizationManager.get(level);
|
VisualizationManager manager = VisualizationManager.get(level);
|
||||||
|
|
Loading…
Reference in a new issue