Create in the far lands

- Fixed couplings, schematics and in-world overlays not rendering correctly at coordinates far from the origin
This commit is contained in:
simibubi 2023-05-08 13:05:16 +02:00
parent 85a53f6966
commit 2e3c906ce0
32 changed files with 267 additions and 227 deletions

View file

@ -38,6 +38,7 @@ import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.OverlayRegistry; import net.minecraftforge.client.gui.OverlayRegistry;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;

View file

@ -5,7 +5,6 @@ import static net.minecraft.util.Mth.lerp;
import com.jozufozu.flywheel.util.transform.TransformStack; import com.jozufozu.flywheel.util.transform.TransformStack;
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.mojang.math.Vector3f;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.CreateClient; import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.KineticDebugger; import com.simibubi.create.content.contraptions.KineticDebugger;
@ -32,13 +31,13 @@ import net.minecraft.world.phys.Vec3;
public class CouplingRenderer { public class CouplingRenderer {
public static void renderAll(PoseStack ms, MultiBufferSource buffer) { public static void renderAll(PoseStack ms, MultiBufferSource buffer, Vec3 camera) {
CouplingHandler.forEachLoadedCoupling(Minecraft.getInstance().level, CouplingHandler.forEachLoadedCoupling(Minecraft.getInstance().level, c -> {
c -> { if (c.getFirst()
if (c.getFirst().hasContraptionCoupling(true)) .hasContraptionCoupling(true))
return; return;
CouplingRenderer.renderCoupling(ms, buffer, c.map(MinecartController::cart)); CouplingRenderer.renderCoupling(ms, buffer, camera, c.map(MinecartController::cart));
}); });
} }
public static void tickDebugModeRenders() { public static void tickDebugModeRenders() {
@ -46,21 +45,20 @@ public class CouplingRenderer {
CouplingHandler.forEachLoadedCoupling(Minecraft.getInstance().level, CouplingRenderer::doDebugRender); CouplingHandler.forEachLoadedCoupling(Minecraft.getInstance().level, CouplingRenderer::doDebugRender);
} }
public static void renderCoupling(PoseStack ms, MultiBufferSource buffer, Couple<AbstractMinecart> carts) { public static void renderCoupling(PoseStack ms, MultiBufferSource buffer, Vec3 camera, Couple<AbstractMinecart> carts) {
ClientLevel world = Minecraft.getInstance().level; ClientLevel world = Minecraft.getInstance().level;
if (carts.getFirst() == null || carts.getSecond() == null) if (carts.getFirst() == null || carts.getSecond() == null)
return; return;
Couple<Integer> lightValues = Couple<Integer> lightValues = carts.map(c -> LevelRenderer.getLightColor(world, new BlockPos(c.getBoundingBox()
carts.map(c -> LevelRenderer.getLightColor(world, new BlockPos(c.getBoundingBox() .getCenter())));
.getCenter())));
Vec3 center = carts.getFirst() Vec3 center = carts.getFirst()
.position() .position()
.add(carts.getSecond() .add(carts.getSecond()
.position()) .position())
.scale(.5f); .scale(.5f);
Couple<CartEndpoint> transforms = carts.map(c -> getSuitableCartEndpoint(c, center)); Couple<CartEndpoint> transforms = carts.map(c -> getSuitableCartEndpoint(c, center));
@ -72,20 +70,20 @@ public class CouplingRenderer {
Vec3 zero = Vec3.ZERO; Vec3 zero = Vec3.ZERO;
Vec3 firstEndpoint = transforms.getFirst() Vec3 firstEndpoint = transforms.getFirst()
.apply(zero); .apply(zero);
Vec3 secondEndpoint = transforms.getSecond() Vec3 secondEndpoint = transforms.getSecond()
.apply(zero); .apply(zero);
Vec3 endPointDiff = secondEndpoint.subtract(firstEndpoint); Vec3 endPointDiff = secondEndpoint.subtract(firstEndpoint);
double connectorYaw = -Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI; double connectorYaw = -Math.atan2(endPointDiff.z, endPointDiff.x) * 180.0D / Math.PI;
double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.multiply(1, 0, 1) double connectorPitch = Math.atan2(endPointDiff.y, endPointDiff.multiply(1, 0, 1)
.length()) * 180 / Math.PI; .length()) * 180 / Math.PI;
TransformStack msr = TransformStack.cast(ms); TransformStack msr = TransformStack.cast(ms);
carts.forEachWithContext((cart, isFirst) -> { carts.forEachWithContext((cart, isFirst) -> {
CartEndpoint cartTransform = transforms.get(isFirst); CartEndpoint cartTransform = transforms.get(isFirst);
ms.pushPose(); ms.pushPose();
cartTransform.apply(ms); cartTransform.apply(ms, camera);
attachment.light(lightValues.get(isFirst)) attachment.light(lightValues.get(isFirst))
.renderInto(ms, builder); .renderInto(ms, builder);
msr.rotateY(connectorYaw - cartTransform.yaw); msr.rotateY(connectorYaw - cartTransform.yaw);
@ -100,7 +98,7 @@ public class CouplingRenderer {
int meanSkyLight = (((l1 >> 20) & 0xf) + ((l2 >> 20) & 0xf)) / 2; int meanSkyLight = (((l1 >> 20) & 0xf) + ((l2 >> 20) & 0xf)) / 2;
ms.pushPose(); ms.pushPose();
msr.translate(firstEndpoint) msr.translate(firstEndpoint.subtract(camera))
.rotateY(connectorYaw) .rotateY(connectorYaw)
.rotateZ(connectorPitch); .rotateZ(connectorPitch);
ms.scale((float) endPointDiff.length(), 1, 1); ms.scale((float) endPointDiff.length(), 1, 1);
@ -113,9 +111,9 @@ public class CouplingRenderer {
private static CartEndpoint getSuitableCartEndpoint(AbstractMinecart cart, Vec3 centerOfCoupling) { private static CartEndpoint getSuitableCartEndpoint(AbstractMinecart cart, Vec3 centerOfCoupling) {
long i = cart.getId() * 493286711L; long i = cart.getId() * 493286711L;
i = i * i * 4392167121L + i * 98761L; i = i * i * 4392167121L + i * 98761L;
float x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; double x = (((float) (i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float y = (((float) (i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F + 0.375F; double y = (((float) (i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F + 0.375F;
float z = (((float) (i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; double z = (((float) (i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F;
float pt = AnimationTickHolder.getPartialTicks(); float pt = AnimationTickHolder.getPartialTicks();
@ -164,8 +162,7 @@ public class CouplingRenderer {
} }
final float offsetMagnitude = 13 / 16f; final float offsetMagnitude = 13 / 16f;
boolean isBackFaceCloser = boolean isBackFaceCloser = frontVec.distanceToSqr(centerOfCoupling) > backVec.distanceToSqr(centerOfCoupling);
frontVec.distanceToSqr(centerOfCoupling) > backVec.distanceToSqr(centerOfCoupling);
flip = isBackFaceCloser; flip = isBackFaceCloser;
float offset = isBackFaceCloser ? -offsetMagnitude : offsetMagnitude; float offset = isBackFaceCloser ? -offsetMagnitude : offsetMagnitude;
@ -174,16 +171,16 @@ public class CouplingRenderer {
static class CartEndpoint { static class CartEndpoint {
float x; double x;
float y; double y;
float z; double z;
float yaw; float yaw;
float pitch; float pitch;
float roll; float roll;
float offset; float offset;
boolean flip; boolean flip;
public CartEndpoint(float x, float y, float z, float yaw, float pitch, float roll, float offset, boolean flip) { public CartEndpoint(double x, double y, double z, float yaw, float pitch, float roll, float offset, boolean flip) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
@ -202,14 +199,15 @@ public class CouplingRenderer {
return vec.add(x, y, z); return vec.add(x, y, z);
} }
public void apply(PoseStack ms) { public void apply(PoseStack ms, Vec3 camera) {
ms.translate(x, y, z); TransformStack.cast(ms)
ms.mulPose(Vector3f.YP.rotationDegrees(yaw)); .translate(camera.scale(-1)
ms.mulPose(Vector3f.ZP.rotationDegrees(pitch)); .add(x, y, z))
ms.mulPose(Vector3f.XP.rotationDegrees(roll)); .rotateY(yaw)
ms.translate(offset, 0, 0); .rotateZ(pitch)
if (flip) .rotateX(roll)
ms.mulPose(Vector3f.YP.rotationDegrees(180)); .translate(offset, 0, 0)
.rotateY(flip ? 180 : 0);
} }
} }
@ -219,24 +217,24 @@ public class CouplingRenderer {
MinecartController first = c.getFirst(); MinecartController first = c.getFirst();
AbstractMinecart mainCart = first.cart(); AbstractMinecart mainCart = first.cart();
Vec3 mainCenter = mainCart.position() Vec3 mainCenter = mainCart.position()
.add(0, yOffset, 0); .add(0, yOffset, 0);
Vec3 connectedCenter = c.getSecond() Vec3 connectedCenter = c.getSecond()
.cart() .cart()
.position() .position()
.add(0, yOffset, 0); .add(0, yOffset, 0);
int color = Color.mixColors(0xabf0e9, 0xee8572, (float) Mth int color = Color.mixColors(0xabf0e9, 0xee8572, (float) Mth
.clamp(Math.abs(first.getCouplingLength(true) - connectedCenter.distanceTo(mainCenter)) * 8, 0, 1)); .clamp(Math.abs(first.getCouplingLength(true) - connectedCenter.distanceTo(mainCenter)) * 8, 0, 1));
CreateClient.OUTLINER.showLine(mainCart.getId() + "", mainCenter, connectedCenter) CreateClient.OUTLINER.showLine(mainCart.getId() + "", mainCenter, connectedCenter)
.colored(color) .colored(color)
.lineWidth(1 / 8f); .lineWidth(1 / 8f);
Vec3 point = mainCart.position() Vec3 point = mainCart.position()
.add(0, yOffset, 0); .add(0, yOffset, 0);
CreateClient.OUTLINER.showLine(mainCart.getId() + "_dot", point, point.add(0, 1 / 128f, 0)) CreateClient.OUTLINER.showLine(mainCart.getId() + "_dot", point, point.add(0, 1 / 128f, 0))
.colored(0xffffff) .colored(0xffffff)
.lineWidth(1 / 4f); .lineWidth(1 / 4f);
} }
} }

View file

@ -111,8 +111,7 @@ public class SymmetryHandler {
PoseStack ms = event.getPoseStack(); PoseStack ms = event.getPoseStack();
ms.pushPose(); ms.pushPose();
ms.translate(-view.x(), -view.y(), -view.z()); ms.translate(pos.getX() - view.x(), pos.getY() - view.y(), pos.getZ() - view.z());
ms.translate(pos.getX(), pos.getY(), pos.getZ());
ms.translate(0, yShift + .2f, 0); ms.translate(0, yShift + .2f, 0);
mirror.applyModelTransform(ms); mirror.applyModelTransform(ms);
BakedModel model = mirror.getModel() BakedModel model = mirror.getModel()

View file

@ -26,17 +26,12 @@ import net.minecraft.world.phys.Vec3;
public class CarriageCouplingRenderer { public class CarriageCouplingRenderer {
public static void renderAll(PoseStack ms, MultiBufferSource buffer) { public static void renderAll(PoseStack ms, MultiBufferSource buffer, Vec3 camera) {
Collection<Train> trains = CreateClient.RAILWAYS.trains.values(); Collection<Train> trains = CreateClient.RAILWAYS.trains.values();
VertexConsumer vb = buffer.getBuffer(RenderType.solid()); VertexConsumer vb = buffer.getBuffer(RenderType.solid());
BlockState air = Blocks.AIR.defaultBlockState(); BlockState air = Blocks.AIR.defaultBlockState();
float partialTicks = AnimationTickHolder.getPartialTicks(); float partialTicks = AnimationTickHolder.getPartialTicks();
Entity cameraEntity = Minecraft.getInstance().cameraEntity; Level level = Minecraft.getInstance().level;
if (cameraEntity == null)
return;
Vec3 camera = cameraEntity.getPosition(partialTicks);
Level level = cameraEntity.level;
for (Train train : trains) { for (Train train : trains) {
List<Carriage> carriages = train.carriages; List<Carriage> carriages = train.carriages;
@ -72,42 +67,48 @@ public class CarriageCouplingRenderer {
Vec3 position2 = entity2.getPosition(partialTicks); Vec3 position2 = entity2.getPosition(partialTicks);
ms.pushPose(); ms.pushPose();
ms.pushPose();
ms.translate(anchor.x, anchor.y, anchor.z);
CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_HEAD, air)
.rotateY(-yRot)
.rotateX(xRot)
.light(lightCoords)
.renderInto(ms, vb);
float margin = 3 / 16f; {
double couplingDistance = train.carriageSpacing.get(i) - 2 * margin ms.pushPose();
- bogey1.type.getConnectorAnchorOffset().z - bogey2.type.getConnectorAnchorOffset().z; ms.translate(anchor.x - camera.x, anchor.y - camera.y, anchor.z - camera.z);
int couplingSegments = (int) Math.round(couplingDistance * 4); CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_HEAD, air)
double stretch = ((anchor2.distanceTo(anchor) - 2 * margin) * 4) / couplingSegments; .rotateY(-yRot)
for (int j = 0; j < couplingSegments; j++) { .rotateX(xRot)
CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_CABLE, air)
.rotateY(-yRot + 180)
.rotateX(-xRot)
.translate(0, 0, margin + 2 / 16f)
.scale(1, 1, (float) stretch)
.translate(0, 0, j / 4f)
.light(lightCoords) .light(lightCoords)
.renderInto(ms, vb); .renderInto(ms, vb);
float margin = 3 / 16f;
double couplingDistance = train.carriageSpacing.get(i) - 2 * margin
- bogey1.type.getConnectorAnchorOffset().z - bogey2.type.getConnectorAnchorOffset().z;
int couplingSegments = (int) Math.round(couplingDistance * 4);
double stretch = ((anchor2.distanceTo(anchor) - 2 * margin) * 4) / couplingSegments;
for (int j = 0; j < couplingSegments; j++) {
CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_CABLE, air)
.rotateY(-yRot + 180)
.rotateX(-xRot)
.translate(0, 0, margin + 2 / 16f)
.scale(1, 1, (float) stretch)
.translate(0, 0, j / 4f)
.light(lightCoords)
.renderInto(ms, vb);
}
ms.popPose();
} }
ms.popPose(); {
ms.pushPose();
Vec3 translation = position2.subtract(position)
.add(anchor2)
.subtract(camera);
ms.translate(translation.x, translation.y, translation.z);
CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_HEAD, air)
.rotateY(-yRot + 180)
.rotateX(-xRot)
.light(lightCoords2)
.renderInto(ms, vb);
ms.popPose();
}
ms.pushPose();
ms.translate(-position.x, -position.y, -position.z);
ms.translate(position2.x, position2.y, position2.z);
ms.translate(anchor2.x, anchor2.y, anchor2.z);
CachedBufferer.partial(AllBlockPartials.TRAIN_COUPLING_HEAD, air)
.rotateY(-yRot + 180)
.rotateX(-xRot)
.light(lightCoords2)
.renderInto(ms, vb);
ms.popPose();
ms.popPose(); ms.popPose();
} }

View file

@ -322,8 +322,6 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
return; return;
ms.pushPose(); ms.pushPose();
ms.translate(pos.getX(), pos.getY(), pos.getZ());
ITrackBlock track = (ITrackBlock) block; ITrackBlock track = (ITrackBlock) block;
PartialModel partial = track.prepareTrackOverlay(level, pos, trackState, bezier, direction, ms, type); PartialModel partial = track.prepareTrackOverlay(level, pos, trackState, bezier, direction, ms, type);
if (partial != null) if (partial != null)
@ -333,7 +331,6 @@ public class TrackTargetingBehaviour<T extends TrackEdgePoint> extends TileEntit
.translate(-.5, 0, -.5) .translate(-.5, 0, -.5)
.light(LevelRenderer.getLightColor(level, pos)) .light(LevelRenderer.getLightColor(level, pos))
.renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped())); .renderInto(ms, buffer.getBuffer(RenderType.cutoutMipped()));
ms.popPose(); ms.popPose();
} }

View file

@ -1,6 +1,7 @@
package com.simibubi.create.content.logistics.trains.management.edgePoint; package com.simibubi.create.content.logistics.trains.management.edgePoint;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.Create; import com.simibubi.create.Create;
import com.simibubi.create.content.logistics.trains.GraphLocation; import com.simibubi.create.content.logistics.trains.GraphLocation;
@ -116,7 +117,7 @@ public class TrackTargetingClient {
}); });
} }
public static void render(PoseStack ms, SuperRenderTypeBuffer buffer) { public static void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {
if (lastLocation == null || lastResult.feedback != null) if (lastLocation == null || lastResult.feedback != null)
return; return;
@ -128,8 +129,13 @@ public class TrackTargetingClient {
RenderedTrackOverlayType type = lastType == EdgePointType.SIGNAL ? RenderedTrackOverlayType.SIGNAL RenderedTrackOverlayType type = lastType == EdgePointType.SIGNAL ? RenderedTrackOverlayType.SIGNAL
: lastType == EdgePointType.OBSERVER ? RenderedTrackOverlayType.OBSERVER : RenderedTrackOverlayType.STATION; : lastType == EdgePointType.OBSERVER ? RenderedTrackOverlayType.OBSERVER : RenderedTrackOverlayType.STATION;
ms.pushPose();
TransformStack.cast(ms)
.translate(Vec3.atLowerCornerOf(pos)
.subtract(camera));
TrackTargetingBehaviour.render(mc.level, pos, direction, lastHoveredBezierSegment, ms, buffer, light, TrackTargetingBehaviour.render(mc.level, pos, direction, lastHoveredBezierSegment, ms, buffer, light,
OverlayTexture.NO_OVERLAY, type, 1 + 1 / 16f); OverlayTexture.NO_OVERLAY, type, 1 + 1 / 16f);
ms.popPose();
} }
} }

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.logistics.trains.management.edgePoint.observer; package com.simibubi.create.content.logistics.trains.management.edgePoint.observer;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.content.logistics.trains.ITrackBlock; import com.simibubi.create.content.logistics.trains.ITrackBlock;
import com.simibubi.create.content.logistics.trains.management.edgePoint.TrackTargetingBehaviour; import com.simibubi.create.content.logistics.trains.management.edgePoint.TrackTargetingBehaviour;
@ -35,7 +36,8 @@ public class TrackObserverRenderer extends SmartTileEntityRenderer<TrackObserver
return; return;
ms.pushPose(); ms.pushPose();
ms.translate(-pos.getX(), -pos.getY(), -pos.getZ()); TransformStack.cast(ms)
.translate(targetPosition.subtract(pos));
RenderedTrackOverlayType type = RenderedTrackOverlayType.OBSERVER; RenderedTrackOverlayType type = RenderedTrackOverlayType.OBSERVER;
TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(), ms, TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(), ms,
buffer, light, overlay, type, 1); buffer, light, overlay, type, 1);

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.logistics.trains.management.edgePoint.signal; package com.simibubi.create.content.logistics.trains.management.edgePoint.signal;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.content.logistics.trains.ITrackBlock; import com.simibubi.create.content.logistics.trains.ITrackBlock;
@ -52,7 +53,8 @@ public class SignalRenderer extends SafeTileEntityRenderer<SignalTileEntity> {
return; return;
ms.pushPose(); ms.pushPose();
ms.translate(-pos.getX(), -pos.getY(), -pos.getZ()); TransformStack.cast(ms)
.translate(targetPosition.subtract(pos));
RenderedTrackOverlayType type = RenderedTrackOverlayType type =
overlayState == OverlayState.DUAL ? RenderedTrackOverlayType.DUAL_SIGNAL : RenderedTrackOverlayType.SIGNAL; overlayState == OverlayState.DUAL ? RenderedTrackOverlayType.DUAL_SIGNAL : RenderedTrackOverlayType.SIGNAL;
TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(), ms, TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(), ms,

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.trains.management.edgePoint.statio
import com.jozufozu.flywheel.core.PartialModel; import com.jozufozu.flywheel.core.PartialModel;
import com.jozufozu.flywheel.util.transform.Transform; import com.jozufozu.flywheel.util.transform.Transform;
import com.jozufozu.flywheel.util.transform.TransformStack;
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;
@ -48,13 +49,14 @@ public class StationRenderer extends SafeTileEntityRenderer<StationTileEntity> {
GlobalStation station = te.getStation(); GlobalStation station = te.getStation();
boolean isAssembling = te.getBlockState() boolean isAssembling = te.getBlockState()
.getValue(StationBlock.ASSEMBLING); .getValue(StationBlock.ASSEMBLING);
if (!isAssembling || (station == null || station.getPresentTrain() != null) && !te.isVirtual()) { if (!isAssembling || (station == null || station.getPresentTrain() != null) && !te.isVirtual()) {
renderFlag( renderFlag(
te.flag.getValue(partialTicks) > 0.75f ? AllBlockPartials.STATION_ON : AllBlockPartials.STATION_OFF, te, te.flag.getValue(partialTicks) > 0.75f ? AllBlockPartials.STATION_ON : AllBlockPartials.STATION_OFF, te,
partialTicks, ms, buffer, light, overlay); partialTicks, ms, buffer, light, overlay);
ms.pushPose(); ms.pushPose();
ms.translate(-pos.getX(), -pos.getY(), -pos.getZ()); TransformStack.cast(ms)
.translate(targetPosition.subtract(pos));
TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(), TrackTargetingBehaviour.render(level, targetPosition, target.getTargetDirection(), target.getTargetBezier(),
ms, buffer, light, overlay, RenderedTrackOverlayType.STATION, 1); ms, buffer, light, overlay, RenderedTrackOverlayType.STATION, 1);
ms.popPose(); ms.popPose();
@ -68,7 +70,7 @@ public class StationRenderer extends SafeTileEntityRenderer<StationTileEntity> {
if (te.isVirtual() && te.bogeyLocations == null) if (te.isVirtual() && te.bogeyLocations == null)
te.refreshAssemblyInfo(); te.refreshAssemblyInfo();
if (direction == null || te.assemblyLength == 0 || te.bogeyLocations == null) if (direction == null || te.assemblyLength == 0 || te.bogeyLocations == null)
return; return;

View file

@ -142,7 +142,7 @@ public class TrackBlockOutline {
} }
} }
public static void drawCurveSelection(PoseStack ms, MultiBufferSource buffer) { public static void drawCurveSelection(PoseStack ms, MultiBufferSource buffer, Vec3 camera) {
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR) if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
return; return;
@ -152,7 +152,8 @@ public class TrackBlockOutline {
return; return;
VertexConsumer vb = buffer.getBuffer(RenderType.lines()); VertexConsumer vb = buffer.getBuffer(RenderType.lines());
Vec3 vec = result.vec(); Vec3 vec = result.vec()
.subtract(camera);
Vec3 angles = result.angles(); Vec3 angles = result.angles();
TransformStack.cast(ms) TransformStack.cast(ms)
.pushPose() .pushPose()

View file

@ -45,6 +45,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlac
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.ForgeIngameGui;
import net.minecraftforge.client.gui.IIngameOverlay; import net.minecraftforge.client.gui.IIngameOverlay;
@ -193,7 +194,7 @@ public class SchematicHandler {
.display(wMirroredLR); .display(wMirroredLR);
} }
public void render(PoseStack ms, SuperRenderTypeBuffer buffer) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {
boolean present = activeSchematicItem != null; boolean present = activeSchematicItem != null;
if (!active && !present) if (!active && !present)
return; return;
@ -201,12 +202,12 @@ public class SchematicHandler {
if (active) { if (active) {
ms.pushPose(); ms.pushPose();
currentTool.getTool() currentTool.getTool()
.renderTool(ms, buffer); .renderTool(ms, buffer, camera);
ms.popPose(); ms.popPose();
} }
ms.pushPose(); ms.pushPose();
transformation.applyGLTransformations(ms); transformation.applyTransformations(ms, camera);
if (!renderers.isEmpty()) { if (!renderers.isEmpty()) {
float pt = AnimationTickHolder.getPartialTicks(); float pt = AnimationTickHolder.getPartialTicks();

View file

@ -19,15 +19,19 @@ import net.minecraft.world.phys.Vec3;
public class SchematicTransformation { public class SchematicTransformation {
private LerpedFloat x, y, z, scaleFrontBack, scaleLeftRight; private Vec3 chasingPos;
private Vec3 prevChasingPos;
private BlockPos target;
private LerpedFloat scaleFrontBack, scaleLeftRight;
private LerpedFloat rotation; private LerpedFloat rotation;
private double xOrigin; private double xOrigin;
private double zOrigin; private double zOrigin;
public SchematicTransformation() { public SchematicTransformation() {
x = LerpedFloat.linear(); chasingPos = Vec3.ZERO;
y = LerpedFloat.linear(); prevChasingPos = Vec3.ZERO;
z = LerpedFloat.linear(); target = BlockPos.ZERO;
scaleFrontBack = LerpedFloat.linear(); scaleFrontBack = LerpedFloat.linear();
scaleLeftRight = LerpedFloat.linear(); scaleLeftRight = LerpedFloat.linear();
rotation = LerpedFloat.angular(); rotation = LerpedFloat.angular();
@ -48,20 +52,18 @@ public class SchematicTransformation {
rotation.chase(0, 0.45f, Chaser.EXP) rotation.chase(0, 0.45f, Chaser.EXP)
.startWithValue(r); .startWithValue(r);
Vec3 vec = fromAnchor(anchor); target = fromAnchor(anchor);
x.chase(0, 0.45f, Chaser.EXP) chasingPos = Vec3.atLowerCornerOf(target);
.startWithValue((float) vec.x); prevChasingPos = chasingPos;
y.chase(0, 0.45f, Chaser.EXP)
.startWithValue((float) vec.y);
z.chase(0, 0.45f, Chaser.EXP)
.startWithValue((float) vec.z);
} }
public void applyGLTransformations(PoseStack ms) { public void applyTransformations(PoseStack ms, Vec3 camera) {
float pt = AnimationTickHolder.getPartialTicks(); float pt = AnimationTickHolder.getPartialTicks();
// Translation // Translation
ms.translate(x.getValue(pt), y.getValue(pt), z.getValue(pt)); TransformStack.cast(ms)
.translate(VecHelper.lerp(pt, prevChasingPos, chasingPos)
.subtract(camera));
Vec3 rotationOffset = getRotationOffset(true); Vec3 rotationOffset = getRotationOffset(true);
// Rotation & Mirror // Rotation & Mirror
@ -101,7 +103,7 @@ public class SchematicTransformation {
float pt = AnimationTickHolder.getPartialTicks(); float pt = AnimationTickHolder.getPartialTicks();
Vec3 rotationOffset = getRotationOffset(true); Vec3 rotationOffset = getRotationOffset(true);
vec = vec.subtract(x.getValue(pt), y.getValue(pt), z.getValue(pt)); vec = vec.subtract(VecHelper.lerp(pt, prevChasingPos, chasingPos));
vec = vec.subtract(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z); vec = vec.subtract(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z);
vec = VecHelper.rotate(vec, -rotation.getValue(pt), Axis.Y); vec = VecHelper.rotate(vec, -rotation.getValue(pt), Axis.Y);
vec = vec.add(rotationOffset.x, 0, rotationOffset.z); vec = vec.add(rotationOffset.x, 0, rotationOffset.z);
@ -157,12 +159,11 @@ public class SchematicTransformation {
vec = vec.multiply(getScaleFB().getChaseTarget(), 1, getScaleLR().getChaseTarget()); vec = vec.multiply(getScaleFB().getChaseTarget(), 1, getScaleLR().getChaseTarget());
vec = VecHelper.rotate(vec, rotation.getChaseTarget(), Axis.Y); vec = VecHelper.rotate(vec, rotation.getChaseTarget(), Axis.Y);
vec = vec.add(xOrigin, 0, zOrigin); vec = vec.add(xOrigin, 0, zOrigin);
vec = vec.add(target.getX(), target.getY(), target.getZ());
vec = vec.add(x.getChaseTarget(), y.getChaseTarget(), z.getChaseTarget());
return new BlockPos(vec.x, vec.y, vec.z); return new BlockPos(vec.x, vec.y, vec.z);
} }
public Vec3 fromAnchor(BlockPos pos) { public BlockPos fromAnchor(BlockPos pos) {
Vec3 vec = Vec3.ZERO.add(.5, 0, .5); Vec3 vec = Vec3.ZERO.add(.5, 0, .5);
Vec3 rotationOffset = getRotationOffset(false); Vec3 rotationOffset = getRotationOffset(false);
vec = vec.subtract(xOrigin, 0, zOrigin); vec = vec.subtract(xOrigin, 0, zOrigin);
@ -170,8 +171,7 @@ public class SchematicTransformation {
vec = vec.multiply(getScaleFB().getChaseTarget(), 1, getScaleLR().getChaseTarget()); vec = vec.multiply(getScaleFB().getChaseTarget(), 1, getScaleLR().getChaseTarget());
vec = VecHelper.rotate(vec, rotation.getChaseTarget(), Axis.Y); vec = VecHelper.rotate(vec, rotation.getChaseTarget(), Axis.Y);
vec = vec.add(xOrigin, 0, zOrigin); vec = vec.add(xOrigin, 0, zOrigin);
return pos.subtract(new BlockPos(vec.x, vec.y, vec.z));
return Vec3.atLowerCornerOf(pos.subtract(new BlockPos(vec.x, vec.y, vec.z)));
} }
public int getRotationTarget() { public int getRotationTarget() {
@ -190,9 +190,8 @@ public class SchematicTransformation {
} }
public void tick() { public void tick() {
x.tickChaser(); prevChasingPos = chasingPos;
y.tickChaser(); chasingPos = VecHelper.lerp(0.45f, chasingPos, Vec3.atLowerCornerOf(target));
z.tickChaser();
getScaleLR().tickChaser(); getScaleLR().tickChaser();
getScaleFB().tickChaser(); getScaleFB().tickChaser();
rotation.tickChaser(); rotation.tickChaser();
@ -209,25 +208,22 @@ public class SchematicTransformation {
rotation.updateChaseTarget(rotation.getChaseTarget() + (clockwise ? -90 : 90)); rotation.updateChaseTarget(rotation.getChaseTarget() + (clockwise ? -90 : 90));
} }
public void move(float xIn, float yIn, float zIn) { public void move(int xIn, int yIn, int zIn) {
moveTo(x.getChaseTarget() + xIn, y.getChaseTarget() + yIn, z.getChaseTarget() + zIn); moveTo(target.offset(xIn, yIn, zIn));
} }
public void startAt(BlockPos pos) { public void startAt(BlockPos pos) {
x.startWithValue(pos.getX()); chasingPos = Vec3.atLowerCornerOf(pos);
y.startWithValue(pos.getY() - 10); prevChasingPos = chasingPos;
z.startWithValue(pos.getZ());
moveTo(pos); moveTo(pos);
} }
public void moveTo(BlockPos pos) { public void moveTo(BlockPos pos) {
moveTo(pos.getX(), pos.getY(), pos.getZ()); target = pos;
} }
public void moveTo(float xIn, float yIn, float zIn) { public void moveTo(int xIn, int yIn, int zIn) {
x.updateChaseTarget(xIn); moveTo(new BlockPos(xIn, yIn, zIn));
y.updateChaseTarget(yIn);
z.updateChaseTarget(zIn);
} }
public LerpedFloat getScaleFB() { public LerpedFloat getScaleFB() {

View file

@ -36,8 +36,8 @@ public class DeployTool extends PlacementToolBase {
} }
@Override @Override
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer) { public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {
super.renderTool(ms, buffer); super.renderTool(ms, buffer, camera);
if (selectedPos == null) if (selectedPos == null)
return; return;
@ -58,7 +58,7 @@ public class DeployTool extends PlacementToolBase {
double zOrigin = bounds.getZsize() / 2f; double zOrigin = bounds.getZsize() / 2f;
Vec3 origin = new Vec3(xOrigin, 0, zOrigin); Vec3 origin = new Vec3(xOrigin, 0, zOrigin);
ms.translate(x - centerX, y, z - centerZ); ms.translate(x - centerX - camera.x, y - camera.y, z - centerZ - camera.z);
TransformStack.cast(ms) TransformStack.cast(ms)
.translate(origin) .translate(origin)
.translate(rotationOffset) .translate(rotationOffset)
@ -67,7 +67,7 @@ public class DeployTool extends PlacementToolBase {
.translateBack(origin); .translateBack(origin);
AABBOutline outline = schematicHandler.getOutline(); AABBOutline outline = schematicHandler.getOutline();
outline.render(ms, buffer, pt); outline.render(ms, buffer, Vec3.ZERO, pt);
outline.getParams() outline.getParams()
.clearTextures(); .clearTextures();
ms.popPose(); ms.popPose();

View file

@ -75,7 +75,7 @@ public class FlipTool extends PlacementToolBase {
.disableLineNormals() .disableLineNormals()
.colored(0xdddddd) .colored(0xdddddd)
.withFaceTextures(tex, tex); .withFaceTextures(tex, tex);
outline.render(ms, buffer, AnimationTickHolder.getPartialTicks()); outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks());
super.renderOnSchematic(ms, buffer); super.renderOnSchematic(ms, buffer);
} }

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.ForgeIngameGui;
public interface ISchematicTool { public interface ISchematicTool {
@ -13,7 +14,7 @@ public interface ISchematicTool {
public boolean handleRightClick(); public boolean handleRightClick();
public boolean handleMouseWheel(double delta); public boolean handleMouseWheel(double delta);
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer); public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera);
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height); public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height);
public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer); public void renderOnSchematic(PoseStack ms, SuperRenderTypeBuffer buffer);

View file

@ -28,7 +28,7 @@ public class MoveTool extends PlacementToolBase {
Vec3 vec = Vec3.atLowerCornerOf(selectedFace.getNormal()).scale(-Math.signum(delta)); Vec3 vec = Vec3.atLowerCornerOf(selectedFace.getNormal()).scale(-Math.signum(delta));
vec = vec.multiply(transformation.getMirrorModifier(Axis.X), 1, transformation.getMirrorModifier(Axis.Z)); vec = vec.multiply(transformation.getMirrorModifier(Axis.X), 1, transformation.getMirrorModifier(Axis.Z));
vec = VecHelper.rotate(vec, transformation.getRotationTarget(), Axis.Y); vec = VecHelper.rotate(vec, transformation.getRotationTarget(), Axis.Y);
transformation.move((float) vec.x, 0, (float) vec.z); transformation.move((int) vec.x, 0, (int) vec.z);
schematicHandler.markDirty(); schematicHandler.markDirty();
return true; return true;

View file

@ -1,11 +1,13 @@
package com.simibubi.create.content.schematics.client.tools; package com.simibubi.create.content.schematics.client.tools;
import net.minecraft.util.Mth;
public class MoveVerticalTool extends PlacementToolBase { public class MoveVerticalTool extends PlacementToolBase {
@Override @Override
public boolean handleMouseWheel(double delta) { public boolean handleMouseWheel(double delta) {
if (schematicHandler.isDeployed()) { if (schematicHandler.isDeployed()) {
schematicHandler.getTransformation().move(0, (float) Math.signum(delta), 0); schematicHandler.getTransformation().move(0, Mth.sign(delta), 0);
schematicHandler.markDirty(); schematicHandler.markDirty();
} }
return true; return true;

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.schematics.client.tools;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.gui.ForgeIngameGui; import net.minecraftforge.client.gui.ForgeIngameGui;
public abstract class PlacementToolBase extends SchematicToolBase { public abstract class PlacementToolBase extends SchematicToolBase {
@ -18,8 +19,8 @@ public abstract class PlacementToolBase extends SchematicToolBase {
} }
@Override @Override
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer) { public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {
super.renderTool(ms, buffer); super.renderTool(ms, buffer, camera);
} }
@Override @Override

View file

@ -36,7 +36,7 @@ public class RotateTool extends PlacementToolBase {
.colored(0xdddddd) .colored(0xdddddd)
.lineWidth(1 / 16f); .lineWidth(1 / 16f);
line.set(start, end) line.set(start, end)
.render(ms, buffer, AnimationTickHolder.getPartialTicks()); .render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks());
super.renderOnSchematic(ms, buffer); super.renderOnSchematic(ms, buffer);
} }

View file

@ -121,7 +121,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
} }
@Override @Override
public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer) {} public void renderTool(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {}
@Override @Override
public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {} public void renderOverlay(ForgeIngameGui gui, PoseStack poseStack, float partialTicks, int width, int height) {}
@ -143,7 +143,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
.colored(0x6886c5) .colored(0x6886c5)
.withFaceTexture(AllSpecialTextures.CHECKERED) .withFaceTexture(AllSpecialTextures.CHECKERED)
.lineWidth(1 / 16f); .lineWidth(1 / 16f);
outline.render(ms, buffer, AnimationTickHolder.getPartialTicks()); outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks());
outline.getParams() outline.getParams()
.clearTextures(); .clearTextures();
ms.popPose(); ms.popPose();

View file

@ -204,26 +204,23 @@ public class ClientEvents {
@SubscribeEvent @SubscribeEvent
public static void onRenderWorld(RenderLevelLastEvent event) { public static void onRenderWorld(RenderLevelLastEvent event) {
Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera()
.getPosition();
float pt = AnimationTickHolder.getPartialTicks();
PoseStack ms = event.getPoseStack(); PoseStack ms = event.getPoseStack();
ms.pushPose(); ms.pushPose();
ms.translate(-cameraPos.x(), -cameraPos.y(), -cameraPos.z());
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance(); SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
float partialTicks = AnimationTickHolder.getPartialTicks();
Vec3 camera = Minecraft.getInstance().gameRenderer.getMainCamera()
.getPosition();
TrackBlockOutline.drawCurveSelection(ms, buffer); TrackBlockOutline.drawCurveSelection(ms, buffer, camera);
TrackTargetingClient.render(ms, buffer); TrackTargetingClient.render(ms, buffer, camera);
CouplingRenderer.renderAll(ms, buffer); CouplingRenderer.renderAll(ms, buffer, camera);
CarriageCouplingRenderer.renderAll(ms, buffer); CarriageCouplingRenderer.renderAll(ms, buffer, camera);
CreateClient.SCHEMATIC_HANDLER.render(ms, buffer); CreateClient.SCHEMATIC_HANDLER.render(ms, buffer, camera);
CreateClient.GHOST_BLOCKS.renderAll(ms, buffer); CreateClient.GHOST_BLOCKS.renderAll(ms, buffer, camera);
CreateClient.OUTLINER.renderOutlines(ms, buffer, camera, partialTicks);
CreateClient.OUTLINER.renderOutlines(ms, buffer, pt);
buffer.draw(); buffer.draw();
RenderSystem.enableCull(); RenderSystem.enableCull();
ms.popPose(); ms.popPose();
} }
@ -322,14 +319,14 @@ public class ClientEvents {
if (AllFluids.CHOCOLATE.get() if (AllFluids.CHOCOLATE.get()
.isSame(fluid)) { .isSame(fluid)) {
event.scaleFarPlaneDistance(1f/32f); event.scaleFarPlaneDistance(1f / 32f);
event.setCanceled(true); event.setCanceled(true);
return; return;
} }
if (AllFluids.HONEY.get() if (AllFluids.HONEY.get()
.isSame(fluid)) { .isSame(fluid)) {
event.scaleFarPlaneDistance(1f/8f); event.scaleFarPlaneDistance(1f / 8f);
event.setCanceled(true); event.setCanceled(true);
return; return;
} }

View file

@ -249,7 +249,7 @@ public class PonderScene {
camera.set(transform.xRotation.getValue(pt) + 90, transform.yRotation.getValue(pt) + 180); camera.set(transform.xRotation.getValue(pt) + 90, transform.yRotation.getValue(pt) + 180);
world.renderEntities(ms, buffer, camera, pt); world.renderEntities(ms, buffer, camera, pt);
world.renderParticles(ms, buffer, camera, pt); world.renderParticles(ms, buffer, camera, pt);
outliner.renderOutlines(ms, buffer, pt); outliner.renderOutlines(ms, buffer, Vec3.ZERO, pt);
ms.popPose(); ms.popPose();
ForcedDiffuseState.popCalculator(); ForcedDiffuseState.popCalculator();

View file

@ -399,7 +399,7 @@ public class WorldSectionElement extends AnimatedSceneElement {
.lineWidth(1 / 64f) .lineWidth(1 / 64f)
.colored(0xefefef) .colored(0xefefef)
.disableLineNormals(); .disableLineNormals();
aabbOutline.render(ms, (SuperRenderTypeBuffer) buffer, pt); aabbOutline.render(ms, (SuperRenderTypeBuffer) buffer, Vec3.ZERO, pt);
ms.popPose(); ms.popPose();
} }

View file

@ -76,7 +76,7 @@ public class ValueBox extends ChasingAABBOutline {
} }
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
boolean hasTransform = transform != null; boolean hasTransform = transform != null;
if (transform instanceof Sided && params.getHighlightedFace() != null) if (transform instanceof Sided && params.getHighlightedFace() != null)
((Sided) transform).fromSide(params.getHighlightedFace()); ((Sided) transform).fromSide(params.getHighlightedFace());
@ -84,11 +84,11 @@ public class ValueBox extends ChasingAABBOutline {
return; return;
ms.pushPose(); ms.pushPose();
ms.translate(pos.getX(), pos.getY(), pos.getZ()); ms.translate(pos.getX() - camera.x, pos.getY() - camera.y, pos.getZ() - camera.z);
if (hasTransform) if (hasTransform)
transform.transform(blockState, ms); transform.transform(blockState, ms);
params.colored(isPassive ? passiveColor : highlightColor); params.colored(isPassive ? passiveColor : highlightColor);
super.render(ms, buffer, pt); super.render(ms, buffer, Vec3.ZERO, pt);
float fontScale = hasTransform ? -transform.getFontScale() : -1 / 64f; float fontScale = hasTransform ? -transform.getFontScale() : -1 / 64f;
ms.scale(fontScale, fontScale, fontScale); ms.scale(fontScale, fontScale, fontScale);

View file

@ -24,6 +24,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.client.model.data.IModelData; import net.minecraftforge.client.model.data.IModelData;
public abstract class GhostBlockRenderer { public abstract class GhostBlockRenderer {
@ -40,12 +41,12 @@ public abstract class GhostBlockRenderer {
return TRANSPARENT; return TRANSPARENT;
} }
public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params); public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, GhostBlockParams params);
private static class DefaultGhostBlockRenderer extends GhostBlockRenderer { private static class DefaultGhostBlockRenderer extends GhostBlockRenderer {
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, GhostBlockParams params) {
ms.pushPose(); ms.pushPose();
BlockRenderDispatcher dispatcher = Minecraft.getInstance() BlockRenderDispatcher dispatcher = Minecraft.getInstance()
@ -57,7 +58,7 @@ public abstract class GhostBlockRenderer {
VertexConsumer vb = buffer.getEarlyBuffer(layer); VertexConsumer vb = buffer.getEarlyBuffer(layer);
BlockPos pos = params.pos; BlockPos pos = params.pos;
ms.translate(pos.getX(), pos.getY(), pos.getZ()); ms.translate(pos.getX() - camera.x, pos.getY() - camera.y, pos.getZ() - camera.z);
dispatcher.getModelRenderer() dispatcher.getModelRenderer()
.renderModel(ms.last(), vb, params.state, model, 1f, 1f, 1f, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, .renderModel(ms.last(), vb, params.state, model, 1f, 1f, 1f, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY,
@ -71,7 +72,7 @@ public abstract class GhostBlockRenderer {
private static class TransparentGhostBlockRenderer extends GhostBlockRenderer { private static class TransparentGhostBlockRenderer extends GhostBlockRenderer {
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, GhostBlockParams params) {
ms.pushPose(); ms.pushPose();
Minecraft mc = Minecraft.getInstance(); Minecraft mc = Minecraft.getInstance();
@ -83,7 +84,7 @@ public abstract class GhostBlockRenderer {
VertexConsumer vb = buffer.getEarlyBuffer(layer); VertexConsumer vb = buffer.getEarlyBuffer(layer);
BlockPos pos = params.pos; BlockPos pos = params.pos;
ms.translate(pos.getX(), pos.getY(), pos.getZ()); ms.translate(pos.getX() - camera.x, pos.getY() - camera.y, pos.getZ() - camera.z);
ms.translate(.5, .5, .5); ms.translate(.5, .5, .5);
ms.scale(.85f, .85f, .85f); ms.scale(.85f, .85f, .85f);

View file

@ -8,6 +8,7 @@ import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
public class GhostBlocks { public class GhostBlocks {
@ -54,10 +55,10 @@ public class GhostBlocks {
ghosts.entrySet().removeIf(e -> !e.getValue().isAlive()); ghosts.entrySet().removeIf(e -> !e.getValue().isAlive());
} }
public void renderAll(PoseStack ms, SuperRenderTypeBuffer buffer) { public void renderAll(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera) {
ghosts.forEach((slot, entry) -> { ghosts.forEach((slot, entry) -> {
GhostBlockRenderer ghost = entry.ghost; GhostBlockRenderer ghost = entry.ghost;
ghost.render(ms, buffer, entry.params); ghost.render(ms, buffer, camera, entry.params);
}); });
} }

View file

@ -10,7 +10,6 @@ import com.simibubi.create.AllSpecialTextures;
import com.simibubi.create.foundation.render.RenderTypes; import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
@ -44,24 +43,23 @@ public class AABBOutline extends Outline {
} }
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
params.loadColor(colorTemp); params.loadColor(colorTemp);
Vector4f color = colorTemp; Vector4f color = colorTemp;
int lightmap = params.lightmap; int lightmap = params.lightmap;
boolean disableLineNormals = params.disableLineNormals; boolean disableLineNormals = params.disableLineNormals;
renderBox(ms, buffer, camera, bb, color, lightmap, disableLineNormals);
renderBox(ms, buffer, bb, color, lightmap, disableLineNormals);
} }
protected void renderBox(PoseStack ms, SuperRenderTypeBuffer buffer, AABB box, Vector4f color, int lightmap, boolean disableLineNormals) { protected void renderBox(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, AABB box, Vector4f color, int lightmap, boolean disableLineNormals) {
Vector3f minPos = minPosTemp1; Vector3f minPos = minPosTemp1;
Vector3f maxPos = maxPosTemp1; Vector3f maxPos = maxPosTemp1;
Vec3 cameraPos = Minecraft.getInstance().gameRenderer.getMainCamera() boolean cameraInside = box.contains(camera);
.getPosition();
boolean cameraInside = box.contains(cameraPos);
boolean cull = !cameraInside && !params.disableCull; boolean cull = !cameraInside && !params.disableCull;
float inflate = cameraInside ? -1 / 128f : 1 / 128f; float inflate = cameraInside ? -1 / 128f : 1 / 128f;
box = box.move(camera.scale(-1));
minPos.set((float) box.minX - inflate, (float) box.minY - inflate, (float) box.minZ - inflate); minPos.set((float) box.minX - inflate, (float) box.minY - inflate, (float) box.minZ - inflate);
maxPos.set((float) box.maxX + inflate, (float) box.maxY + inflate, (float) box.maxZ + inflate); maxPos.set((float) box.maxX + inflate, (float) box.maxY + inflate, (float) box.maxZ + inflate);

View file

@ -20,6 +20,7 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Axis; import net.minecraft.core.Direction.Axis;
import net.minecraft.core.Direction.AxisDirection; import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.world.phys.Vec3;
public class BlockClusterOutline extends Outline { public class BlockClusterOutline extends Outline {
@ -38,22 +39,28 @@ public class BlockClusterOutline extends Outline {
} }
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
params.loadColor(colorTemp); params.loadColor(colorTemp);
Vector4f color = colorTemp; Vector4f color = colorTemp;
int lightmap = params.lightmap; int lightmap = params.lightmap;
boolean disableLineNormals = params.disableLineNormals; boolean disableLineNormals = params.disableLineNormals;
renderFaces(ms, buffer, pt, color, lightmap); renderFaces(ms, buffer, camera, pt, color, lightmap);
renderEdges(ms, buffer, pt, color, lightmap, disableLineNormals); renderEdges(ms, buffer, camera, pt, color, lightmap, disableLineNormals);
} }
protected void renderFaces(PoseStack ms, SuperRenderTypeBuffer buffer, float pt, Vector4f color, int lightmap) { protected void renderFaces(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt, Vector4f color, int lightmap) {
Optional<AllSpecialTextures> optionalFaceTexture = params.faceTexture; Optional<AllSpecialTextures> optionalFaceTexture = params.faceTexture;
if (!optionalFaceTexture.isPresent()) if (!optionalFaceTexture.isPresent())
return; return;
AllSpecialTextures faceTexture = optionalFaceTexture.get(); if (cluster.isEmpty())
return;
ms.pushPose();
ms.translate(cluster.anchor.getX() - camera.x, cluster.anchor.getY() - camera.y,
cluster.anchor.getZ() - camera.z);
AllSpecialTextures faceTexture = optionalFaceTexture.get();
PoseStack.Pose pose = ms.last(); PoseStack.Pose pose = ms.last();
RenderType renderType = RenderTypes.getOutlineTranslucent(faceTexture.getLocation(), true); RenderType renderType = RenderTypes.getOutlineTranslucent(faceTexture.getLocation(), true);
VertexConsumer consumer = buffer.getLateBuffer(renderType); VertexConsumer consumer = buffer.getLateBuffer(renderType);
@ -65,12 +72,20 @@ public class BlockClusterOutline extends Outline {
pos = pos.relative(direction.getOpposite()); pos = pos.relative(direction.getOpposite());
bufferBlockFace(pose, consumer, pos, direction, color, lightmap); bufferBlockFace(pose, consumer, pos, direction, color, lightmap);
}); });
ms.popPose();
} }
protected void renderEdges(PoseStack ms, SuperRenderTypeBuffer buffer, float pt, Vector4f color, int lightmap, boolean disableNormals) { protected void renderEdges(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt, Vector4f color, int lightmap, boolean disableNormals) {
float lineWidth = params.getLineWidth(); float lineWidth = params.getLineWidth();
if (lineWidth == 0) if (lineWidth == 0)
return; return;
if (cluster.isEmpty())
return;
ms.pushPose();
ms.translate(cluster.anchor.getX() - camera.x, cluster.anchor.getY() - camera.y,
cluster.anchor.getZ() - camera.z);
PoseStack.Pose pose = ms.last(); PoseStack.Pose pose = ms.last();
VertexConsumer consumer = buffer.getBuffer(RenderTypes.getOutlineSolid()); VertexConsumer consumer = buffer.getBuffer(RenderTypes.getOutlineSolid());
@ -82,6 +97,8 @@ public class BlockClusterOutline extends Outline {
Direction direction = Direction.get(AxisDirection.POSITIVE, edge.axis); Direction direction = Direction.get(AxisDirection.POSITIVE, edge.axis);
bufferCuboidLine(pose, consumer, origin, direction, 1, lineWidth, color, lightmap, disableNormals); bufferCuboidLine(pose, consumer, origin, direction, 1, lineWidth, color, lightmap, disableNormals);
}); });
ms.popPose();
} }
public static void loadFaceData(Direction face, Vector3f pos0, Vector3f pos1, Vector3f pos2, Vector3f pos3, Vector3f normal) { public static void loadFaceData(Direction face, Vector3f pos0, Vector3f pos1, Vector3f pos2, Vector3f pos3, Vector3f normal) {
@ -162,6 +179,7 @@ public class BlockClusterOutline extends Outline {
private static class Cluster { private static class Cluster {
private BlockPos anchor;
private Map<MergeEntry, AxisDirection> visibleFaces; private Map<MergeEntry, AxisDirection> visibleFaces;
private Set<MergeEntry> visibleEdges; private Set<MergeEntry> visibleEdges;
@ -169,8 +187,16 @@ public class BlockClusterOutline extends Outline {
visibleEdges = new HashSet<>(); visibleEdges = new HashSet<>();
visibleFaces = new HashMap<>(); visibleFaces = new HashMap<>();
} }
public boolean isEmpty() {
return anchor == null;
}
public void include(BlockPos pos) { public void include(BlockPos pos) {
if (anchor == null)
anchor = pos;
pos = pos.subtract(anchor);
// 6 FACES // 6 FACES
for (Axis axis : Iterate.axes) { for (Axis axis : Iterate.axes) {

View file

@ -6,6 +6,7 @@ import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
public class ChasingAABBOutline extends AABBOutline { public class ChasingAABBOutline extends AABBOutline {
@ -29,20 +30,18 @@ public class ChasingAABBOutline extends AABBOutline {
} }
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
params.loadColor(colorTemp); params.loadColor(colorTemp);
Vector4f color = colorTemp; Vector4f color = colorTemp;
int lightmap = params.lightmap; int lightmap = params.lightmap;
boolean disableLineNormals = params.disableLineNormals; boolean disableLineNormals = params.disableLineNormals;
renderBox(ms, buffer, camera, interpolateBBs(prevBB, bb, pt), color, lightmap, disableLineNormals);
renderBox(ms, buffer, interpolateBBs(prevBB, bb, pt), color, lightmap, disableLineNormals);
} }
private static AABB interpolateBBs(AABB current, AABB target, float pt) { private static AABB interpolateBBs(AABB current, AABB target, float pt) {
return new AABB(Mth.lerp(pt, current.minX, target.minX), return new AABB(Mth.lerp(pt, current.minX, target.minX), Mth.lerp(pt, current.minY, target.minY),
Mth.lerp(pt, current.minY, target.minY), Mth.lerp(pt, current.minZ, target.minZ), Mth.lerp(pt, current.minZ, target.minZ), Mth.lerp(pt, current.maxX, target.maxX),
Mth.lerp(pt, current.maxX, target.maxX), Mth.lerp(pt, current.maxY, target.maxY), Mth.lerp(pt, current.maxY, target.maxY), Mth.lerp(pt, current.maxZ, target.maxZ));
Mth.lerp(pt, current.maxZ, target.maxZ));
} }
} }

View file

@ -2,7 +2,7 @@ package com.simibubi.create.foundation.utility.outliner;
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.mojang.math.Vector3f; import com.mojang.math.Vector3d;
import com.mojang.math.Vector4f; import com.mojang.math.Vector4f;
import com.simibubi.create.foundation.render.RenderTypes; import com.simibubi.create.foundation.render.RenderTypes;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
@ -12,23 +12,23 @@ import net.minecraft.world.phys.Vec3;
public class LineOutline extends Outline { public class LineOutline extends Outline {
protected final Vector3f start = new Vector3f(); protected final Vector3d start = new Vector3d(0, 0, 0);
protected final Vector3f end = new Vector3f(); protected final Vector3d end = new Vector3d(0, 0, 0);
public LineOutline set(Vector3f start, Vector3f end) { public LineOutline set(Vector3d start, Vector3d end) {
this.start.load(start); this.start.set(start.x, start.y, start.z);
this.start.load(end); this.end.set(end.x, end.y, end.z);
return this; return this;
} }
public LineOutline set(Vec3 start, Vec3 end) { public LineOutline set(Vec3 start, Vec3 end) {
this.start.set((float) start.x, (float) start.y, (float) start.z); this.start.set(start.x, start.y, start.z);
this.end.set((float) end.x, (float) end.y, (float) end.z); this.end.set(end.x, end.y, end.z);
return this; return this;
} }
@Override @Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
float width = params.getLineWidth(); float width = params.getLineWidth();
if (width == 0) if (width == 0)
return; return;
@ -38,11 +38,12 @@ public class LineOutline extends Outline {
Vector4f color = colorTemp; Vector4f color = colorTemp;
int lightmap = params.lightmap; int lightmap = params.lightmap;
boolean disableLineNormals = params.disableLineNormals; boolean disableLineNormals = params.disableLineNormals;
renderInner(ms, consumer, pt, width, color, lightmap, disableLineNormals); renderInner(ms, consumer, camera, pt, width, color, lightmap, disableLineNormals);
} }
protected void renderInner(PoseStack ms, VertexConsumer consumer, float pt, float width, Vector4f color, int lightmap, boolean disableNormals) { protected void renderInner(PoseStack ms, VertexConsumer consumer, Vec3 camera, float pt, float width,
bufferCuboidLine(ms, consumer, start, end, width, color, lightmap, disableNormals); Vector4f color, int lightmap, boolean disableNormals) {
bufferCuboidLine(ms, consumer, camera, start, end, width, color, lightmap, disableNormals);
} }
public static class EndChasingLineOutline extends LineOutline { public static class EndChasingLineOutline extends LineOutline {
@ -50,7 +51,7 @@ public class LineOutline extends Outline {
private float prevProgress = 0; private float prevProgress = 0;
private boolean lockStart; private boolean lockStart;
private final Vector3f startTemp = new Vector3f(); private final Vector3d startTemp = new Vector3d(0, 0, 0);
public EndChasingLineOutline(boolean lockStart) { public EndChasingLineOutline(boolean lockStart) {
this.lockStart = lockStart; this.lockStart = lockStart;
@ -63,9 +64,11 @@ public class LineOutline extends Outline {
} }
@Override @Override
protected void renderInner(PoseStack ms, VertexConsumer consumer, float pt, float width, Vector4f color, int lightmap, boolean disableNormals) { protected void renderInner(PoseStack ms, VertexConsumer consumer, Vec3 camera, float pt, float width,
Vector4f color, int lightmap, boolean disableNormals) {
float distanceToTarget = Mth.lerp(pt, prevProgress, progress); float distanceToTarget = Mth.lerp(pt, prevProgress, progress);
Vector3f end;
Vector3d end;
if (lockStart) { if (lockStart) {
end = this.start; end = this.start;
} else { } else {
@ -73,13 +76,12 @@ public class LineOutline extends Outline {
distanceToTarget = 1 - distanceToTarget; distanceToTarget = 1 - distanceToTarget;
} }
Vector3f start = this.startTemp; Vector3d start = this.startTemp;
start.load(this.start); double x = (this.start.x - end.x) * distanceToTarget + end.x;
start.sub(end); double y = (this.start.y - end.y) * distanceToTarget + end.y;
start.mul(distanceToTarget); double z = (this.start.z - end.z) * distanceToTarget + end.z;
start.add(end); start.set((float) x, (float) y, (float) z);
bufferCuboidLine(ms, consumer, camera, start, end, width, color, lightmap, disableNormals);
bufferCuboidLine(ms, consumer, start, end, width, color, lightmap, disableNormals);
} }
} }

View file

@ -9,6 +9,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f; import com.mojang.math.Matrix3f;
import com.mojang.math.Matrix4f; import com.mojang.math.Matrix4f;
import com.mojang.math.Vector3d;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
import com.mojang.math.Vector4f; import com.mojang.math.Vector4f;
import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.AllSpecialTextures;
@ -20,6 +21,7 @@ import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.Mth; import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;
public abstract class Outline { public abstract class Outline {
@ -40,14 +42,14 @@ public abstract class Outline {
return params; return params;
} }
public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt); public abstract void render(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt);
public void tick() {} public void tick() {}
public void bufferCuboidLine(PoseStack poseStack, VertexConsumer consumer, Vector3f start, Vector3f end, float width, Vector4f color, int lightmap, boolean disableNormals) { public void bufferCuboidLine(PoseStack poseStack, VertexConsumer consumer, Vec3 camera, Vector3d start, Vector3d end,
float width, Vector4f color, int lightmap, boolean disableNormals) {
Vector3f diff = this.diffPosTemp; Vector3f diff = this.diffPosTemp;
diff.load(end); diff.set((float) (end.x - start.x), (float) (end.y - start.y), (float) (end.z - start.z));
diff.sub(start);
float length = Mth.sqrt(diff.x() * diff.x() + diff.y() * diff.y() + diff.z() * diff.z()); float length = Mth.sqrt(diff.x() * diff.x() + diff.y() * diff.y() + diff.z() * diff.z());
float hAngle = AngleHelper.deg(Mth.atan2(diff.x(), diff.z())); float hAngle = AngleHelper.deg(Mth.atan2(diff.x(), diff.z()));
@ -56,7 +58,7 @@ public abstract class Outline {
poseStack.pushPose(); poseStack.pushPose();
TransformStack.cast(poseStack) TransformStack.cast(poseStack)
.translate(start) .translate(start.x - camera.x, start.y - camera.y, start.z - camera.z)
.rotateY(hAngle) .rotateY(hAngle)
.rotateX(vAngle); .rotateX(vAngle);
bufferCuboidLine(poseStack.last(), consumer, Vector3f.ZERO, Direction.SOUTH, length, width, color, lightmap, bufferCuboidLine(poseStack.last(), consumer, Vector3f.ZERO, Direction.SOUTH, length, width, color, lightmap,
@ -64,7 +66,8 @@ public abstract class Outline {
poseStack.popPose(); poseStack.popPose();
} }
public void bufferCuboidLine(PoseStack.Pose pose, VertexConsumer consumer, Vector3f origin, Direction direction, float length, float width, Vector4f color, int lightmap, boolean disableNormals) { public void bufferCuboidLine(PoseStack.Pose pose, VertexConsumer consumer, Vector3f origin, Direction direction,
float length, float width, Vector4f color, int lightmap, boolean disableNormals) {
Vector3f minPos = minPosTemp; Vector3f minPos = minPosTemp;
Vector3f maxPos = maxPosTemp; Vector3f maxPos = maxPosTemp;
@ -96,7 +99,8 @@ public abstract class Outline {
bufferCuboid(pose, consumer, minPos, maxPos, color, lightmap, disableNormals); bufferCuboid(pose, consumer, minPos, maxPos, color, lightmap, disableNormals);
} }
public void bufferCuboid(PoseStack.Pose pose, VertexConsumer consumer, Vector3f minPos, Vector3f maxPos, Vector4f color, int lightmap, boolean disableNormals) { public void bufferCuboid(PoseStack.Pose pose, VertexConsumer consumer, Vector3f minPos, Vector3f maxPos,
Vector4f color, int lightmap, boolean disableNormals) {
Vector4f posTransformTemp = this.posTransformTemp; Vector4f posTransformTemp = this.posTransformTemp;
Vector3f normalTransformTemp = this.normalTransformTemp; Vector3f normalTransformTemp = this.normalTransformTemp;
@ -425,11 +429,13 @@ public abstract class Outline {
.endVertex(); .endVertex();
} }
public void bufferQuad(PoseStack.Pose pose, VertexConsumer consumer, Vector3f pos0, Vector3f pos1, Vector3f pos2, Vector3f pos3, Vector4f color, int lightmap, Vector3f normal) { public void bufferQuad(PoseStack.Pose pose, VertexConsumer consumer, Vector3f pos0, Vector3f pos1, Vector3f pos2,
Vector3f pos3, Vector4f color, int lightmap, Vector3f normal) {
bufferQuad(pose, consumer, pos0, pos1, pos2, pos3, color, 0, 0, 1, 1, lightmap, normal); bufferQuad(pose, consumer, pos0, pos1, pos2, pos3, color, 0, 0, 1, 1, lightmap, normal);
} }
public void bufferQuad(PoseStack.Pose pose, VertexConsumer consumer, Vector3f pos0, Vector3f pos1, Vector3f pos2, Vector3f pos3, Vector4f color, float minU, float minV, float maxU, float maxV, int lightmap, Vector3f normal) { public void bufferQuad(PoseStack.Pose pose, VertexConsumer consumer, Vector3f pos0, Vector3f pos1, Vector3f pos2,
Vector3f pos3, Vector4f color, float minU, float minV, float maxU, float maxV, int lightmap, Vector3f normal) {
Vector4f posTransformTemp = this.posTransformTemp; Vector4f posTransformTemp = this.posTransformTemp;
Vector3f normalTransformTemp = this.normalTransformTemp; Vector3f normalTransformTemp = this.normalTransformTemp;

View file

@ -139,7 +139,7 @@ public class Outliner {
} }
} }
public void renderOutlines(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) { public void renderOutlines(PoseStack ms, SuperRenderTypeBuffer buffer, Vec3 camera, float pt) {
outlines.forEach((key, entry) -> { outlines.forEach((key, entry) -> {
Outline outline = entry.getOutline(); Outline outline = entry.getOutline();
OutlineParams params = outline.getParams(); OutlineParams params = outline.getParams();
@ -155,7 +155,7 @@ public class Outliner {
if (params.alpha < 1 / 8f) if (params.alpha < 1 / 8f)
return; return;
} }
outline.render(ms, buffer, pt); outline.render(ms, buffer, camera, pt);
}); });
} }