mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 20:13:42 +01:00
Fully fix GuiGameElements
- Replace all GUI y-flip scalings to not scale normals - Rotate CustomLightingSettings along XN instead of XP - Apply custom lighting to all fluids in JEI scenes - Fix fluid rendering: fix normals, normal scaling, and color
This commit is contained in:
parent
4909546457
commit
ad9a6272c2
10 changed files with 35 additions and 21 deletions
|
@ -2,6 +2,7 @@ package com.simibubi.create.compat.jei.category;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.foundation.gui.GuiGameElement;
|
||||
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -26,6 +27,7 @@ public class FanBlastingCategory extends ProcessingViaFanCategory<AbstractCookin
|
|||
GuiGameElement.of(Fluids.LAVA)
|
||||
.scale(24)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe;
|
||||
import com.simibubi.create.content.contraptions.processing.ProcessingOutput;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
|
@ -91,6 +92,7 @@ public class FanWashingCategory extends ProcessingViaFanCategory<SplashingRecipe
|
|||
GuiGameElement.of(Fluids.WATER)
|
||||
.scale(24)
|
||||
.atLocal(0, 0, 2)
|
||||
.lighting(AnimatedKinetics.DEFAULT_LIGHTING)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.popPose();
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.mojang.blaze3d.vertex.Tesselator;
|
|||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -35,7 +36,8 @@ public class AnimatedItemDrain extends AnimatedKinetics {
|
|||
BufferSource buffer = MultiBufferSource.immediate(Tesselator.getInstance()
|
||||
.getBuilder());
|
||||
PoseStack ms = new PoseStack();
|
||||
ms.scale(scale, -scale, scale);
|
||||
UIRenderHelper.flipForGuiRender(ms);
|
||||
ms.scale(scale, scale, scale);
|
||||
float from = 2/16f;
|
||||
float to = 1f - from;
|
||||
FluidRenderer.renderTiledFluidBB(fluid, from, from, from, to, 3/4f, to, buffer, ms, LightTexture.FULL_BRIGHT, false);
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.simibubi.create.compat.jei.category.animations;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.platform.Lighting;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.Tesselator;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.fluid.FluidRenderer;
|
||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
|
@ -63,10 +65,12 @@ public class AnimatedSpout extends AnimatedKinetics {
|
|||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
AnimatedKinetics.DEFAULT_LIGHTING.applyLighting();
|
||||
BufferSource buffer = MultiBufferSource.immediate(Tesselator.getInstance()
|
||||
.getBuilder());
|
||||
matrixStack.pushPose();
|
||||
matrixStack.scale(16, -16, 16);
|
||||
UIRenderHelper.flipForGuiRender(matrixStack);
|
||||
matrixStack.scale(16, 16, 16);
|
||||
float from = 2/16f;
|
||||
float to = 1f - from;
|
||||
FluidRenderer.renderTiledFluidBB(fluids.get(0), from, from, from, to, to, to, buffer, matrixStack, LightTexture.FULL_BRIGHT, false);
|
||||
|
@ -74,11 +78,13 @@ public class AnimatedSpout extends AnimatedKinetics {
|
|||
|
||||
float width = 1 / 128f * squeeze;
|
||||
matrixStack.translate(scale / 2f, scale * 1.5f, scale / 2f);
|
||||
matrixStack.scale(16, -16, 16);
|
||||
UIRenderHelper.flipForGuiRender(matrixStack);
|
||||
matrixStack.scale(16, 16, 16);
|
||||
matrixStack.translate(-width / 2, 0, -width / 2);
|
||||
FluidRenderer.renderTiledFluidBB(fluids.get(0), 0, -0.001f, 0, width, 2.001f, width, buffer, matrixStack, LightTexture.FULL_BRIGHT,
|
||||
false);
|
||||
buffer.endBatch();
|
||||
Lighting.setupFor3DItems();
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.mojang.blaze3d.vertex.PoseStack.Pose;
|
|||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.simibubi.create.foundation.render.RenderTypes;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.Color;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -125,15 +124,16 @@ public class FluidRenderer {
|
|||
.isHorizontal()) {
|
||||
ms.pushPose();
|
||||
|
||||
if (side.getAxisDirection() == AxisDirection.NEGATIVE)
|
||||
if (side.getAxisDirection() == AxisDirection.NEGATIVE) {
|
||||
msr.translate(center)
|
||||
.rotateY(180)
|
||||
.translateBack(center);
|
||||
side = Direction.get(AxisDirection.POSITIVE, side.getAxis());
|
||||
}
|
||||
|
||||
boolean X = side.getAxis() == Axis.X;
|
||||
int darkColor = Color.mixColors(color, 0xff000011, 1 / 4f);
|
||||
renderTiledHorizontalFace(X ? xMax : zMax, side, X ? zMin : xMin, yMin, X ? zMax : xMax, yMax, builder,
|
||||
ms, light, darkColor, fluidTexture);
|
||||
ms, light, color, fluidTexture);
|
||||
|
||||
ms.popPose();
|
||||
continue;
|
||||
|
@ -222,7 +222,7 @@ public class FluidRenderer {
|
|||
.uv(u, v)
|
||||
.overlayCoords(OverlayTexture.NO_OVERLAY)
|
||||
.uv2(light)
|
||||
.normal(n.getX(), n.getY(), n.getZ())
|
||||
.normal(peek.normal(), n.getX(), n.getY(), n.getZ())
|
||||
.endVertex();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ public class CustomLightingSettings implements ILightingSettings {
|
|||
protected void init(float yRot1, float xRot1, float yRot2, float xRot2, boolean doubleLight) {
|
||||
light1 = Vector3f.ZP.copy();
|
||||
light1.transform(Vector3f.YP.rotationDegrees(yRot1));
|
||||
light1.transform(Vector3f.XP.rotationDegrees(xRot1));
|
||||
light1.transform(Vector3f.XN.rotationDegrees(xRot1));
|
||||
|
||||
if (doubleLight) {
|
||||
light2 = Vector3f.ZP.copy();
|
||||
light2.transform(Vector3f.YP.rotationDegrees(yRot2));
|
||||
light2.transform(Vector3f.XP.rotationDegrees(xRot2));
|
||||
light2.transform(Vector3f.XN.rotationDegrees(xRot2));
|
||||
} else {
|
||||
light2 = VecHelper.ZERO_3F;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class GuiGameElement {
|
|||
matrixStack.translate(x, y, z);
|
||||
matrixStack.scale((float) scale, (float) scale, (float) scale);
|
||||
matrixStack.translate(xLocal, yLocal, zLocal);
|
||||
matrixStack.scale(1, -1, 1);
|
||||
UIRenderHelper.flipForGuiRender(matrixStack);
|
||||
matrixStack.translate(rotationOffset.x, rotationOffset.y, rotationOffset.z);
|
||||
matrixStack.mulPose(Vector3f.ZP.rotationDegrees((float) zRot));
|
||||
matrixStack.mulPose(Vector3f.XP.rotationDegrees((float) xRot));
|
||||
|
@ -271,19 +271,15 @@ public class GuiGameElement {
|
|||
matrixStack.scale(16.0F, 16.0F, 16.0F);
|
||||
MultiBufferSource.BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
boolean flatLighting = !bakedModel.usesBlockLight();
|
||||
if (useDefaultLighting) {
|
||||
if (flatLighting) {
|
||||
Lighting.setupForFlatItems();
|
||||
}
|
||||
if (useDefaultLighting && flatLighting) {
|
||||
Lighting.setupForFlatItems();
|
||||
}
|
||||
|
||||
renderer.render(stack, ItemTransforms.TransformType.GUI, false, matrixStack, buffer, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, bakedModel);
|
||||
buffer.endBatch();
|
||||
RenderSystem.enableDepthTest();
|
||||
if (useDefaultLighting) {
|
||||
if (flatLighting) {
|
||||
Lighting.setupFor3DItems();
|
||||
}
|
||||
if (useDefaultLighting && flatLighting) {
|
||||
Lighting.setupFor3DItems();
|
||||
}
|
||||
|
||||
matrixStack.popPose();
|
||||
|
|
|
@ -249,6 +249,10 @@ public class UIRenderHelper {
|
|||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
public static void flipForGuiRender(PoseStack poseStack) {
|
||||
poseStack.mulPoseMatrix(Matrix4f.createScaleMatrix(1, -1, 1));
|
||||
}
|
||||
|
||||
public static class CustomRenderTarget extends RenderTarget {
|
||||
|
||||
public CustomRenderTarget(boolean pUseDepth) {
|
||||
|
|
|
@ -22,6 +22,7 @@ import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import com.mojang.math.Vector4f;
|
||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
||||
import com.simibubi.create.foundation.ponder.content.PonderTag;
|
||||
import com.simibubi.create.foundation.ponder.elements.PonderOverlayElement;
|
||||
|
@ -468,7 +469,8 @@ public class PonderScene {
|
|||
float f = 30 * scaleFactor;
|
||||
|
||||
if (!overlayCompatible) {
|
||||
ms.scale(f, -f, f);
|
||||
UIRenderHelper.flipForGuiRender(ms);
|
||||
ms.scale(f, f, f);
|
||||
ms.translate((basePlateSize + basePlateOffsetX) / -2f, -1f + yOffset,
|
||||
(basePlateSize + basePlateOffsetZ) / -2f);
|
||||
} else {
|
||||
|
|
|
@ -450,7 +450,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
|||
RenderSystem.enableDepthTest();
|
||||
ms.pushPose();
|
||||
ms.translate(story.basePlateOffsetX, 0, story.basePlateOffsetZ);
|
||||
ms.scale(1, -1, 1);
|
||||
UIRenderHelper.flipForGuiRender(ms);
|
||||
|
||||
float flash = finishingFlash.getValue(partialTicks) * .9f;
|
||||
float alpha = flash;
|
||||
|
|
Loading…
Reference in a new issue