Smoothly lit tracks

- Fix diffuse lighting on tracks
- Minor tweaks to schedule and station screens
This commit is contained in:
PepperCode1 2022-02-04 18:41:30 -08:00
parent 0a931a77ef
commit 66b6304fd3
3 changed files with 13 additions and 14 deletions

View file

@ -37,7 +37,6 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen {
@Override @Override
protected void init() { protected void init() {
setWindowSize(background.width, background.height); setWindowSize(background.width, background.height);
setWindowOffset(-20, 0);
super.init(); super.init();
clearWidgets(); clearWidgets();
@ -78,7 +77,7 @@ public abstract class AbstractStationScreen extends AbstractSimiScreen {
ms.pushPose(); ms.pushPose();
TransformStack.cast(ms) TransformStack.cast(ms)
.pushPose() .pushPose()
.translate(x + 200, y + background.height + 20, 100) .translate(x + background.width + 4, y + background.height + 4, 100)
.scale(40) .scale(40)
.rotateX(-22) .rotateX(-22)
.rotateY(63); .rotateY(63);

View file

@ -99,7 +99,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContaine
@Override @Override
protected void init() { protected void init() {
AllGuiTextures bg = AllGuiTextures.SCHEDULE; AllGuiTextures bg = AllGuiTextures.SCHEDULE;
setWindowSize(bg.width, bg.height + 22); setWindowSize(bg.width, bg.height);
super.init(); super.init();
clearWidgets(); clearWidgets();
@ -126,7 +126,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContaine
addRenderableWidget(cyclicButton); addRenderableWidget(cyclicButton);
stopEditing(); stopEditing();
extraAreas = ImmutableList.of(new Rect2i(leftPos + 255, topPos + 182, 45, 45)); extraAreas = ImmutableList.of(new Rect2i(leftPos + bg.width, topPos + bg.height - 56, 48, 48));
horizontalScrolls.clear(); horizontalScrolls.clear();
for (int i = 0; i < schedule.entries.size(); i++) for (int i = 0; i < schedule.entries.size(); i++)
horizontalScrolls.add(LerpedFloat.linear() horizontalScrolls.add(LerpedFloat.linear()
@ -858,7 +858,7 @@ public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContaine
protected void renderForeground(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) { protected void renderForeground(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.renderForeground(matrixStack, mouseX, mouseY, partialTicks); super.renderForeground(matrixStack, mouseX, mouseY, partialTicks);
GuiGameElement.of(menu.contentHolder).<GuiGameElement GuiGameElement.of(menu.contentHolder).<GuiGameElement
.GuiRenderBuilder>at(leftPos + 251, topPos + 187, -200) .GuiRenderBuilder>at(leftPos + AllGuiTextures.SCHEDULE.width, topPos + AllGuiTextures.SCHEDULE.height - 56, -200)
.scale(3) .scale(3)
.render(matrixStack); .render(matrixStack);
action(matrixStack, mouseX, mouseY, -1); action(matrixStack, mouseX, mouseY, -1);

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.trains.track; package com.simibubi.create.content.logistics.trains.track;
import com.jozufozu.flywheel.repack.joml.Math; 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.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
@ -91,18 +90,18 @@ public class TrackRenderer extends SafeTileEntityRenderer<TrackTileEntity> {
Vec3 diff = railMiddle.subtract(prevMiddle); Vec3 diff = railMiddle.subtract(prevMiddle);
Vec3 angles = getModelAngles(normal, diff); 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) .rotateYRadians(angles.y)
.rotateXRadians(angles.x) .rotateXRadians(angles.x)
.rotateZRadians(angles.z) .rotateZRadians(angles.z)
.translate(-1 / 2f, -2 / 16f - 1 / 1024f, 0); .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, sbb.light(LevelRenderer.getLightColor(Minecraft.getInstance().level,
new BlockPos(railMiddle).offset(tePosition))); new BlockPos(railMiddle).offset(tePosition)));
sbb.renderInto(ms, vb); sbb.renderInto(ms, vb);
} }
ms.popPose(); ms.popPose();
@ -115,16 +114,17 @@ public class TrackRenderer extends SafeTileEntityRenderer<TrackTileEntity> {
Vec3 diff = railI.subtract(prevI); Vec3 diff = railI.subtract(prevI);
Vec3 angles = getModelAngles(normal, diff); 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) .rotateYRadians(angles.y)
.rotateXRadians(angles.x) .rotateXRadians(angles.x)
.rotateZRadians(angles.z) .rotateZRadians(angles.z)
.translate(0, -2 / 16f + 1 / 1024f, 0) .translate(0, -2 / 16f + 1 / 1024f, 0)
.scale(1, 1, (float) diff.length() * 2.1f); .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, sbb.light(LevelRenderer.getLightColor(Minecraft.getInstance().level,
new BlockPos(prevI).offset(tePosition))); new BlockPos(prevI).offset(tePosition)));
sbb.renderInto(ms, vb); sbb.renderInto(ms, vb);