From 66b6304fd3e82fb79916ffb5ec24f6be2c8fb5c2 Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Fri, 4 Feb 2022 18:41:30 -0800 Subject: [PATCH] Smoothly lit tracks - Fix diffuse lighting on tracks - Minor tweaks to schedule and station screens --- .../management/AbstractStationScreen.java | 3 +-- .../trains/management/ScheduleScreen.java | 6 +++--- .../logistics/trains/track/TrackRenderer.java | 18 +++++++++--------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/management/AbstractStationScreen.java b/src/main/java/com/simibubi/create/content/logistics/trains/management/AbstractStationScreen.java index 66d1037ac..692075037 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/management/AbstractStationScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/management/AbstractStationScreen.java @@ -37,7 +37,6 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen { @Override protected void init() { setWindowSize(background.width, background.height); - setWindowOffset(-20, 0); super.init(); clearWidgets(); @@ -78,7 +77,7 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen { ms.pushPose(); TransformStack.cast(ms) .pushPose() - .translate(x + 200, y + background.height + 20, 100) + .translate(x + background.width + 4, y + background.height + 4, 100) .scale(40) .rotateX(-22) .rotateY(63); diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/management/ScheduleScreen.java b/src/main/java/com/simibubi/create/content/logistics/trains/management/ScheduleScreen.java index fa75d6acc..aaa14f03b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/management/ScheduleScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/management/ScheduleScreen.java @@ -99,7 +99,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreenat(leftPos + 251, topPos + 187, -200) + .GuiRenderBuilder>at(leftPos + AllGuiTextures.SCHEDULE.width, topPos + AllGuiTextures.SCHEDULE.height - 56, -200) .scale(3) .render(matrixStack); action(matrixStack, mouseX, mouseY, -1); diff --git a/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackRenderer.java b/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackRenderer.java index aa921a315..4f4f7b03e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/trains/track/TrackRenderer.java @@ -1,7 +1,6 @@ package com.simibubi.create.content.logistics.trains.track; import com.jozufozu.flywheel.repack.joml.Math; -import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.simibubi.create.AllBlockPartials; @@ -91,18 +90,18 @@ public class TrackRenderer extends SafeTileEntityRenderer { Vec3 diff = railMiddle.subtract(prevMiddle); Vec3 angles = getModelAngles(normal, diff); - new MatrixTransformStack(ms).translate(prevMiddle) + SuperByteBuffer sbb = + CachedBufferer.partial(AllBlockPartials.TRACK_TIE, Blocks.AIR.defaultBlockState()); + + sbb.translate(prevMiddle) .rotateYRadians(angles.y) .rotateXRadians(angles.x) .rotateZRadians(angles.z) .translate(-1 / 2f, -2 / 16f - 1 / 1024f, 0); - SuperByteBuffer sbb = - CachedBufferer.partial(AllBlockPartials.TRACK_TIE, Blocks.AIR.defaultBlockState()); sbb.light(LevelRenderer.getLightColor(Minecraft.getInstance().level, new BlockPos(railMiddle).offset(tePosition))); sbb.renderInto(ms, vb); - } ms.popPose(); @@ -115,16 +114,17 @@ public class TrackRenderer extends SafeTileEntityRenderer { Vec3 diff = railI.subtract(prevI); Vec3 angles = getModelAngles(normal, diff); - new MatrixTransformStack(ms).translate(prevI) + SuperByteBuffer sbb = CachedBufferer.partial( + first ? AllBlockPartials.TRACK_SEGMENT_LEFT : AllBlockPartials.TRACK_SEGMENT_RIGHT, + Blocks.AIR.defaultBlockState()); + + sbb.translate(prevI) .rotateYRadians(angles.y) .rotateXRadians(angles.x) .rotateZRadians(angles.z) .translate(0, -2 / 16f + 1 / 1024f, 0) .scale(1, 1, (float) diff.length() * 2.1f); - SuperByteBuffer sbb = CachedBufferer.partial( - first ? AllBlockPartials.TRACK_SEGMENT_LEFT : AllBlockPartials.TRACK_SEGMENT_RIGHT, - Blocks.AIR.defaultBlockState()); sbb.light(LevelRenderer.getLightColor(Minecraft.getInstance().level, new BlockPos(prevI).offset(tePosition))); sbb.renderInto(ms, vb);