mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-31 17:36:43 +01:00
Chipped away too much
- Fix formatting and tooltip depth regressions - Fix outline rendering
This commit is contained in:
parent
a8f422030c
commit
ab8f6a01ce
7 changed files with 67 additions and 53 deletions
|
@ -121,7 +121,7 @@ public class UIRenderHelper {
|
||||||
/**
|
/**
|
||||||
* x and y specify the middle point of the starting edge
|
* x and y specify the middle point of the starting edge
|
||||||
*
|
*
|
||||||
* @param angle the angle of the gradient in degrees; 0° means from left to right
|
* @param angle the angle of the gradient in degrees; 0° means from left to right
|
||||||
* @param color1 the color at the starting edge
|
* @param color1 the color at the starting edge
|
||||||
* @param color2 the color at the ending edge
|
* @param color2 the color at the ending edge
|
||||||
* @param breadth the total width of the gradient
|
* @param breadth the total width of the gradient
|
||||||
|
@ -153,13 +153,13 @@ public class UIRenderHelper {
|
||||||
private static void breadcrumbArrow(PoseStack ms, int width, int height, int indent, Color c1, Color c2) {
|
private static void breadcrumbArrow(PoseStack ms, int width, int height, int indent, Color c1, Color c2) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 0,0 x1,y1 ********************* x4,y4 ***** x7,y7
|
* 0,0 x1,y1 ********************* x4,y4 ***** x7,y7
|
||||||
* **** ****
|
* **** ****
|
||||||
* **** ****
|
* **** ****
|
||||||
* x0,y0 x2,y2 x5,y5
|
* x0,y0 x2,y2 x5,y5
|
||||||
* **** ****
|
* **** ****
|
||||||
* **** ****
|
* **** ****
|
||||||
* x3,y3 ********************* x6,y6 ***** x8,y8
|
* x3,y3 ********************* x6,y6 ***** x8,y8
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -429,6 +429,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
||||||
RenderSystem.enableDepthTest();
|
RenderSystem.enableDepthTest();
|
||||||
|
|
||||||
// RenderSystem.pushMatrix();
|
// RenderSystem.pushMatrix();
|
||||||
|
// TODO 1.17: is the following still true?
|
||||||
// has to be outside of MS transforms, important for vertex sorting
|
// has to be outside of MS transforms, important for vertex sorting
|
||||||
// RenderSystem.translated(0, 0, 800);
|
// RenderSystem.translated(0, 0, 800);
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.Window;
|
import com.mojang.blaze3d.platform.Window;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.foundation.gui.AllIcons;
|
import com.simibubi.create.foundation.gui.AllIcons;
|
||||||
|
@ -205,12 +206,19 @@ public class PonderTagIndexScreen extends NavigatableSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
RenderSystem.disableDepthTest();
|
||||||
|
ms.pushPose();
|
||||||
|
ms.translate(0, 0, 200);
|
||||||
|
|
||||||
if (hoveredItem != null) {
|
if (hoveredItem != null) {
|
||||||
List<Component> list = TooltipHelper.cutStringTextComponent(hoveredItem.getDescription(),
|
List<Component> list = TooltipHelper.cutStringTextComponent(hoveredItem.getDescription(),
|
||||||
ChatFormatting.GRAY, ChatFormatting.GRAY);
|
ChatFormatting.GRAY, ChatFormatting.GRAY);
|
||||||
list.add(0, new TextComponent(hoveredItem.getTitle()));
|
list.add(0, new TextComponent(hoveredItem.getTitle()));
|
||||||
renderComponentTooltip(ms, list, mouseX, mouseY);
|
renderComponentTooltip(ms, list, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ms.popPose();
|
||||||
|
RenderSystem.enableDepthTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.Window;
|
import com.mojang.blaze3d.platform.Window;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
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.foundation.gui.BoxElement;
|
import com.simibubi.create.foundation.gui.BoxElement;
|
||||||
|
@ -293,9 +294,16 @@ public class PonderTagScreen extends NavigatableSimiScreen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
protected void renderWindowForeground(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||||
|
RenderSystem.disableDepthTest();
|
||||||
|
ms.pushPose();
|
||||||
|
ms.translate(0, 0, 200);
|
||||||
|
|
||||||
if (!hoveredItem.isEmpty()) {
|
if (!hoveredItem.isEmpty()) {
|
||||||
renderTooltip(ms, hoveredItem, mouseX, mouseY);
|
renderTooltip(ms, hoveredItem, mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ms.popPose();
|
||||||
|
RenderSystem.enableDepthTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,6 +35,7 @@ public class RenderTypes extends RenderStateShard {
|
||||||
.setCullState(cull ? CULL : NO_CULL)
|
.setCullState(cull ? CULL : NO_CULL)
|
||||||
.setLightmapState(LIGHTMAP)
|
.setLightmapState(LIGHTMAP)
|
||||||
.setOverlayState(OVERLAY)
|
.setOverlayState(OVERLAY)
|
||||||
|
.setWriteMaskState(COLOR_WRITE)
|
||||||
.createCompositeState(true));
|
.createCompositeState(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,15 @@ import net.minecraft.client.resources.model.ModelBakery;
|
||||||
|
|
||||||
public class SuperRenderTypeBuffer implements MultiBufferSource {
|
public class SuperRenderTypeBuffer implements MultiBufferSource {
|
||||||
|
|
||||||
static SuperRenderTypeBuffer instance;
|
private static final SuperRenderTypeBuffer INSTANCE = new SuperRenderTypeBuffer();;
|
||||||
|
|
||||||
public static SuperRenderTypeBuffer getInstance() {
|
public static SuperRenderTypeBuffer getInstance() {
|
||||||
if (instance == null)
|
return INSTANCE;
|
||||||
instance = new SuperRenderTypeBuffer();
|
|
||||||
return instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperRenderTypeBufferPhase earlyBuffer;
|
private SuperRenderTypeBufferPhase earlyBuffer;
|
||||||
SuperRenderTypeBufferPhase defaultBuffer;
|
private SuperRenderTypeBufferPhase defaultBuffer;
|
||||||
SuperRenderTypeBufferPhase lateBuffer;
|
private SuperRenderTypeBufferPhase lateBuffer;
|
||||||
|
|
||||||
public SuperRenderTypeBuffer() {
|
public SuperRenderTypeBuffer() {
|
||||||
earlyBuffer = new SuperRenderTypeBufferPhase();
|
earlyBuffer = new SuperRenderTypeBufferPhase();
|
||||||
|
@ -34,65 +32,64 @@ public class SuperRenderTypeBuffer implements MultiBufferSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
public VertexConsumer getEarlyBuffer(RenderType type) {
|
public VertexConsumer getEarlyBuffer(RenderType type) {
|
||||||
return earlyBuffer.getBuffer(type);
|
return earlyBuffer.bufferSource.getBuffer(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VertexConsumer getBuffer(RenderType type) {
|
public VertexConsumer getBuffer(RenderType type) {
|
||||||
return defaultBuffer.getBuffer(type);
|
return defaultBuffer.bufferSource.getBuffer(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VertexConsumer getLateBuffer(RenderType type) {
|
public VertexConsumer getLateBuffer(RenderType type) {
|
||||||
return lateBuffer.getBuffer(type);
|
return lateBuffer.bufferSource.getBuffer(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw() {
|
public void draw() {
|
||||||
earlyBuffer.endBatch();
|
earlyBuffer.bufferSource.endBatch();
|
||||||
defaultBuffer.endBatch();
|
defaultBuffer.bufferSource.endBatch();
|
||||||
lateBuffer.endBatch();
|
lateBuffer.bufferSource.endBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(RenderType type) {
|
public void draw(RenderType type) {
|
||||||
earlyBuffer.endBatch(type);
|
earlyBuffer.bufferSource.endBatch(type);
|
||||||
defaultBuffer.endBatch(type);
|
defaultBuffer.bufferSource.endBatch(type);
|
||||||
lateBuffer.endBatch(type);
|
lateBuffer.bufferSource.endBatch(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SuperRenderTypeBufferPhase extends MultiBufferSource.BufferSource {
|
private static class SuperRenderTypeBufferPhase {
|
||||||
|
|
||||||
// Visible clones from net.minecraft.client.renderer.RenderTypeBuffers
|
// Visible clones from RenderBuffers
|
||||||
static final ChunkBufferBuilderPack blockBuilders = new ChunkBufferBuilderPack();
|
private final ChunkBufferBuilderPack fixedBufferPack = new ChunkBufferBuilderPack();
|
||||||
|
private final SortedMap<RenderType, BufferBuilder> fixedBuffers = Util.make(new Object2ObjectLinkedOpenHashMap<>(), map -> {
|
||||||
static final SortedMap<RenderType, BufferBuilder> createEntityBuilders() {
|
map.put(Sheets.solidBlockSheet(), fixedBufferPack.builder(RenderType.solid()));
|
||||||
return Util.make(new Object2ObjectLinkedOpenHashMap<>(), (map) -> {
|
map.put(Sheets.cutoutBlockSheet(), fixedBufferPack.builder(RenderType.cutout()));
|
||||||
map.put(Sheets.solidBlockSheet(), blockBuilders.builder(RenderType.solid()));
|
map.put(Sheets.bannerSheet(), fixedBufferPack.builder(RenderType.cutoutMipped()));
|
||||||
assign(map, RenderTypes.getOutlineSolid());
|
map.put(Sheets.translucentCullBlockSheet(), fixedBufferPack.builder(RenderType.translucent()));
|
||||||
map.put(Sheets.cutoutBlockSheet(), blockBuilders.builder(RenderType.cutout()));
|
put(map, Sheets.shieldSheet());
|
||||||
map.put(Sheets.bannerSheet(), blockBuilders.builder(RenderType.cutoutMipped()));
|
put(map, Sheets.bedSheet());
|
||||||
map.put(Sheets.translucentCullBlockSheet(), blockBuilders.builder(RenderType.translucent())); // FIXME new equivalent of getEntityTranslucent() ?
|
put(map, Sheets.shulkerBoxSheet());
|
||||||
assign(map, Sheets.shieldSheet());
|
put(map, Sheets.signSheet());
|
||||||
assign(map, Sheets.bedSheet());
|
put(map, Sheets.chestSheet());
|
||||||
assign(map, Sheets.shulkerBoxSheet());
|
put(map, RenderType.translucentNoCrumbling());
|
||||||
assign(map, Sheets.signSheet());
|
put(map, RenderType.armorGlint());
|
||||||
assign(map, Sheets.chestSheet());
|
put(map, RenderType.armorEntityGlint());
|
||||||
assign(map, RenderType.translucentNoCrumbling());
|
put(map, RenderType.glint());
|
||||||
assign(map, RenderType.glint());
|
put(map, RenderType.glintDirect());
|
||||||
assign(map, RenderType.entityGlint());
|
put(map, RenderType.glintTranslucent());
|
||||||
assign(map, RenderType.waterMask());
|
put(map, RenderType.entityGlint());
|
||||||
ModelBakery.DESTROY_TYPES.forEach((p_228488_1_) -> {
|
put(map, RenderType.entityGlintDirect());
|
||||||
assign(map, p_228488_1_);
|
put(map, RenderType.waterMask());
|
||||||
|
put(map, RenderTypes.getOutlineSolid());
|
||||||
|
ModelBakery.DESTROY_TYPES.forEach((p_173062_) -> {
|
||||||
|
put(map, p_173062_);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
private final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediateWithBuffers(fixedBuffers, new BufferBuilder(256));
|
||||||
|
|
||||||
private static void assign(Object2ObjectLinkedOpenHashMap<RenderType, BufferBuilder> map, RenderType type) {
|
private static void put(Object2ObjectLinkedOpenHashMap<RenderType, BufferBuilder> map, RenderType type) {
|
||||||
map.put(type, new BufferBuilder(type.bufferSize()));
|
map.put(type, new BufferBuilder(type.bufferSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SuperRenderTypeBufferPhase() {
|
|
||||||
super(new BufferBuilder(256), createEntityBuilders());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ public class WrappedChunkProvider extends ChunkSource {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLoadedChunksCount() {
|
public int getLoadedChunksCount() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue