mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 04:22:00 +01:00
"Batched" rendering, huh
- Schematic previews can now render TEs - Schematic renderer no longer relies on negative scale and noCull for mirrored previews (fixes a few inconsistencies) - Avoided blending issues with the outliner system when using multiple textures throughout a batch - Introduced SuperRenderTypeBuffer as an attempt to give options for render order in the RWLE context (does not fix the early flushing in the fallback buffer)
This commit is contained in:
parent
c486854b7f
commit
36ab939126
24 changed files with 332 additions and 106 deletions
|
@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.components.turntable.TurntableHa
|
|||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringHandler;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
|
@ -68,14 +69,13 @@ public class ClientEvents {
|
|||
|
||||
ms.push();
|
||||
ms.translate(-view.getX(), -view.getY(), -view.getZ());
|
||||
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance()
|
||||
.getBufferBuilders()
|
||||
.getEntityVertexConsumers();
|
||||
|
||||
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
||||
CreateClient.schematicHandler.render(ms, buffer);
|
||||
CreateClient.outliner.renderOutlines(ms, buffer);
|
||||
ms.pop();
|
||||
buffer.draw();
|
||||
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.inventory.container.ContainerType;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.logistics.block.transposer;
|
|||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ArmorStandEntity;
|
||||
import net.minecraft.entity.item.ItemFrameEntity;
|
||||
|
@ -39,6 +40,10 @@ public class SchematicWorld extends WrappedWorld {
|
|||
public BlockPos anchor;
|
||||
public boolean renderMode;
|
||||
|
||||
public SchematicWorld() {
|
||||
this(BlockPos.ZERO, Minecraft.getInstance().world);
|
||||
}
|
||||
|
||||
public SchematicWorld(BlockPos anchor, World original) {
|
||||
super(original);
|
||||
this.blocks = new HashMap<>();
|
||||
|
@ -82,6 +87,7 @@ public class SchematicWorld extends WrappedWorld {
|
|||
BlockState blockState = getBlockState(pos);
|
||||
if (blockState.hasTileEntity()) {
|
||||
TileEntity tileEntity = blockState.createTileEntity(this);
|
||||
tileEntity.setLocation(this, pos);
|
||||
tileEntities.put(pos, tileEntity);
|
||||
return tileEntity;
|
||||
}
|
||||
|
|
|
@ -177,7 +177,7 @@ public class SchematicAndQuillHandler {
|
|||
outliner().chaseAABB(outlineSlot, currentSelectionBox)
|
||||
.colored(0x6886c5)
|
||||
.withFaceTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED)
|
||||
.disableNormals()
|
||||
.lineWidth(1/16f)
|
||||
.highlightFace(selectedFace);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
@ -13,6 +14,7 @@ import com.simibubi.create.content.schematics.packet.SchematicPlacePacket;
|
|||
import com.simibubi.create.foundation.gui.ToolSelectionScreen;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.networking.NbtPacket;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -23,6 +25,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||
|
@ -43,13 +46,16 @@ public class SchematicHandler {
|
|||
private ItemStack activeSchematicItem;
|
||||
private AABBOutline outline;
|
||||
|
||||
private SchematicRenderer renderer;
|
||||
private Vector<SchematicRenderer> renderers;
|
||||
private SchematicHotbarSlotOverlay overlay;
|
||||
private ToolSelectionScreen selectionScreen;
|
||||
|
||||
public SchematicHandler() {
|
||||
renderers = new Vector<>(3);
|
||||
for (int i = 0; i < renderers.capacity(); i++)
|
||||
renderers.add(new SchematicRenderer());
|
||||
|
||||
overlay = new SchematicHotbarSlotOverlay();
|
||||
renderer = new SchematicRenderer();
|
||||
currentTool = Tools.Deploy;
|
||||
selectionScreen = new ToolSelectionScreen(ImmutableList.of(Tools.Deploy), this::equip);
|
||||
transformation = new SchematicTransformation();
|
||||
|
@ -68,7 +74,7 @@ public class SchematicHandler {
|
|||
if (activeSchematicItem != null && itemLost(player)) {
|
||||
activeHotbarSlot = 0;
|
||||
activeSchematicItem = null;
|
||||
renderer.setActive(false);
|
||||
renderers.forEach(r -> r.setActive(false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -80,7 +86,7 @@ public class SchematicHandler {
|
|||
if (!active)
|
||||
return;
|
||||
|
||||
renderer.tick();
|
||||
renderers.forEach(SchematicRenderer::tick);
|
||||
if (syncCooldown > 0)
|
||||
syncCooldown--;
|
||||
if (syncCooldown == 1)
|
||||
|
@ -110,16 +116,30 @@ public class SchematicHandler {
|
|||
|
||||
private void setupRenderer() {
|
||||
Template schematic = SchematicItem.loadSchematic(activeSchematicItem);
|
||||
if (schematic.getSize()
|
||||
.equals(BlockPos.ZERO))
|
||||
BlockPos size = schematic.getSize();
|
||||
if (size.equals(BlockPos.ZERO))
|
||||
return;
|
||||
|
||||
SchematicWorld w = new SchematicWorld(BlockPos.ZERO, Minecraft.getInstance().world);
|
||||
schematic.addBlocksToWorld(w, BlockPos.ZERO, new PlacementSettings());
|
||||
renderer.display(w);
|
||||
SchematicWorld w = new SchematicWorld();
|
||||
SchematicWorld wMirroredFB = new SchematicWorld();
|
||||
SchematicWorld wMirroredLR = new SchematicWorld();
|
||||
PlacementSettings placementSettings = new PlacementSettings();
|
||||
|
||||
schematic.addBlocksToWorld(w, BlockPos.ZERO, placementSettings);
|
||||
placementSettings.setMirror(Mirror.FRONT_BACK);
|
||||
schematic.addBlocksToWorld(wMirroredFB, BlockPos.ZERO.east(size.getX() - 1), placementSettings);
|
||||
placementSettings.setMirror(Mirror.LEFT_RIGHT);
|
||||
schematic.addBlocksToWorld(wMirroredLR, BlockPos.ZERO.south(size.getZ() - 1), placementSettings);
|
||||
|
||||
renderers.get(0)
|
||||
.display(w);
|
||||
renderers.get(1)
|
||||
.display(wMirroredFB);
|
||||
renderers.get(2)
|
||||
.display(wMirroredLR);
|
||||
}
|
||||
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
boolean present = activeSchematicItem != null;
|
||||
if (!active && !present)
|
||||
return;
|
||||
|
@ -133,10 +153,29 @@ public class SchematicHandler {
|
|||
|
||||
ms.push();
|
||||
transformation.applyGLTransformations(ms);
|
||||
renderer.render(ms, buffer);
|
||||
|
||||
if (!renderers.isEmpty()) {
|
||||
float pt = Minecraft.getInstance()
|
||||
.getRenderPartialTicks();
|
||||
boolean lr = transformation.getScaleLR()
|
||||
.get(pt) < 0;
|
||||
boolean fb = transformation.getScaleFB()
|
||||
.get(pt) < 0;
|
||||
if (lr && !fb)
|
||||
renderers.get(2)
|
||||
.render(ms, buffer);
|
||||
else if (fb && !lr)
|
||||
renderers.get(1)
|
||||
.render(ms, buffer);
|
||||
else
|
||||
renderers.get(0)
|
||||
.render(ms, buffer);
|
||||
}
|
||||
|
||||
if (active)
|
||||
currentTool.getTool()
|
||||
.renderOnSchematic(ms, buffer);
|
||||
.renderOnSchematic(ms, buffer);
|
||||
|
||||
ms.pop();
|
||||
|
||||
}
|
||||
|
@ -257,8 +296,8 @@ public class SchematicHandler {
|
|||
bounds = new AxisAlignedBB(BlockPos.ZERO, size);
|
||||
outline = new AABBOutline(bounds);
|
||||
outline.getParams()
|
||||
.lineWidth(1 / 16f)
|
||||
.disableNormals();
|
||||
.colored(0x6886c5)
|
||||
.lineWidth(1 / 16f);
|
||||
transformation.init(anchor, settings, bounds);
|
||||
}
|
||||
|
||||
|
@ -280,7 +319,7 @@ public class SchematicHandler {
|
|||
CompoundNBT nbt = activeSchematicItem.getTag();
|
||||
nbt.putBoolean("Deployed", false);
|
||||
activeSchematicItem.setTag(nbt);
|
||||
renderer.setActive(false);
|
||||
renderers.forEach(r -> r.setActive(false));
|
||||
active = false;
|
||||
markDirty();
|
||||
}
|
||||
|
|
|
@ -11,14 +11,15 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.content.schematics.SchematicWorld;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.TileEntityRenderHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
|
@ -66,15 +67,18 @@ public class SchematicRenderer {
|
|||
changed = false;
|
||||
}
|
||||
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
if (!active)
|
||||
return;
|
||||
buffer.getBuffer(RenderType.getSolid());
|
||||
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||
if (!usedBlockRenderLayers.contains(layer))
|
||||
continue;
|
||||
SuperByteBuffer superByteBuffer = bufferCache.get(layer);
|
||||
superByteBuffer.renderInto(ms, buffer.getBuffer(layer));
|
||||
}
|
||||
TileEntityRenderHelper.renderTileEntities(schematic, schematic.getTileEntities(), ms, new MatrixStack(),
|
||||
buffer);
|
||||
}
|
||||
|
||||
private void redraw(Minecraft minecraft) {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.client;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||
|
@ -34,8 +36,8 @@ public class SchematicTransformation {
|
|||
public void init(BlockPos anchor, PlacementSettings settings, AxisAlignedBB bounds) {
|
||||
int leftRight = settings.getMirror() == Mirror.LEFT_RIGHT ? -1 : 1;
|
||||
int frontBack = settings.getMirror() == Mirror.FRONT_BACK ? -1 : 1;
|
||||
scaleFrontBack.start(frontBack);
|
||||
scaleLeftRight.start(leftRight);
|
||||
getScaleFB().start(frontBack);
|
||||
getScaleLR().start(leftRight);
|
||||
xOrigin = bounds.getXSize() / 2f;
|
||||
zOrigin = bounds.getZSize() / 2f;
|
||||
|
||||
|
@ -58,16 +60,23 @@ public class SchematicTransformation {
|
|||
Vec3d rotationOffset = getRotationOffset(true);
|
||||
|
||||
// Rotation & Mirror
|
||||
float fb = getScaleFB().get(pt);
|
||||
float lr = getScaleLR().get(pt);
|
||||
float rot = rotation.get(pt) + ((fb < 0 && lr < 0) ? 180 : 0);
|
||||
ms.translate(xOrigin, 0, zOrigin);
|
||||
MatrixStacker.of(ms)
|
||||
.translate(rotationOffset)
|
||||
.rotateY(rotation.get(pt))
|
||||
.rotateY(rot)
|
||||
.translateBack(rotationOffset);
|
||||
ms.scale(scaleFrontBack.get(pt), 1, scaleLeftRight.get(pt));
|
||||
ms.scale(abs(fb), 1, abs(lr));
|
||||
ms.translate(-xOrigin, 0, -zOrigin);
|
||||
|
||||
}
|
||||
|
||||
public boolean isFlipped() {
|
||||
return getMirrorModifier(Axis.X) < 0 != getMirrorModifier(Axis.Z) < 0;
|
||||
}
|
||||
|
||||
public Vec3d getRotationOffset(boolean ignoreMirrors) {
|
||||
Vec3d rotationOffset = Vec3d.ZERO;
|
||||
if ((int) (zOrigin * 2) % 2 != (int) (xOrigin * 2) % 2) {
|
||||
|
@ -92,7 +101,7 @@ public class SchematicTransformation {
|
|||
vec = vec.subtract(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z);
|
||||
vec = VecHelper.rotate(vec, -rotation.get(pt), Axis.Y);
|
||||
vec = vec.add(rotationOffset.x, 0, rotationOffset.z);
|
||||
vec = vec.mul(scaleFrontBack.get(pt), 1, scaleLeftRight.get(pt));
|
||||
vec = vec.mul(getScaleFB().get(pt), 1, getScaleLR().get(pt));
|
||||
vec = vec.add(xOrigin, 0, zOrigin);
|
||||
|
||||
return vec;
|
||||
|
@ -103,8 +112,8 @@ public class SchematicTransformation {
|
|||
|
||||
int i = (int) rotation.getTarget();
|
||||
|
||||
boolean mirrorlr = scaleLeftRight.getTarget() < 0;
|
||||
boolean mirrorfb = scaleFrontBack.getTarget() < 0;
|
||||
boolean mirrorlr = getScaleLR().getTarget() < 0;
|
||||
boolean mirrorfb = getScaleFB().getTarget() < 0;
|
||||
if (mirrorlr && mirrorfb) {
|
||||
mirrorlr = mirrorfb = false;
|
||||
i += 180;
|
||||
|
@ -141,7 +150,7 @@ public class SchematicTransformation {
|
|||
Vec3d rotationOffset = getRotationOffset(false);
|
||||
vec = vec.subtract(xOrigin, 0, zOrigin);
|
||||
vec = vec.subtract(rotationOffset.x, 0, rotationOffset.z);
|
||||
vec = vec.mul(scaleFrontBack.getTarget(), 1, scaleLeftRight.getTarget());
|
||||
vec = vec.mul(getScaleFB().getTarget(), 1, getScaleLR().getTarget());
|
||||
vec = VecHelper.rotate(vec, rotation.getTarget(), Axis.Y);
|
||||
vec = vec.add(xOrigin, 0, zOrigin);
|
||||
|
||||
|
@ -154,7 +163,7 @@ public class SchematicTransformation {
|
|||
Vec3d rotationOffset = getRotationOffset(false);
|
||||
vec = vec.subtract(xOrigin, 0, zOrigin);
|
||||
vec = vec.subtract(rotationOffset.x, 0, rotationOffset.z);
|
||||
vec = vec.mul(scaleFrontBack.getTarget(), 1, scaleLeftRight.getTarget());
|
||||
vec = vec.mul(getScaleFB().getTarget(), 1, getScaleLR().getTarget());
|
||||
vec = VecHelper.rotate(vec, rotation.getTarget(), Axis.Y);
|
||||
vec = vec.add(xOrigin, 0, zOrigin);
|
||||
|
||||
|
@ -167,8 +176,8 @@ public class SchematicTransformation {
|
|||
|
||||
public int getMirrorModifier(Axis axis) {
|
||||
if (axis == Axis.Z)
|
||||
return (int) scaleLeftRight.getTarget();
|
||||
return (int) scaleFrontBack.getTarget();
|
||||
return (int) getScaleLR().getTarget();
|
||||
return (int) getScaleFB().getTarget();
|
||||
}
|
||||
|
||||
public float getCurrentRotation() {
|
||||
|
@ -181,16 +190,16 @@ public class SchematicTransformation {
|
|||
x.tick();
|
||||
y.tick();
|
||||
z.tick();
|
||||
scaleLeftRight.tick();
|
||||
scaleFrontBack.tick();
|
||||
getScaleLR().tick();
|
||||
getScaleFB().tick();
|
||||
rotation.tick();
|
||||
}
|
||||
|
||||
public void flip(Axis axis) {
|
||||
if (axis == Axis.X)
|
||||
scaleLeftRight.target(scaleLeftRight.getTarget() * -1);
|
||||
getScaleLR().target(getScaleLR().getTarget() * -1);
|
||||
if (axis == Axis.Z)
|
||||
scaleFrontBack.target(scaleFrontBack.getTarget() * -1);
|
||||
getScaleFB().target(getScaleFB().getTarget() * -1);
|
||||
}
|
||||
|
||||
public void rotate90(boolean clockwise) {
|
||||
|
@ -201,6 +210,13 @@ public class SchematicTransformation {
|
|||
moveTo(x.getTarget() + xIn, y.getTarget() + yIn, z.getTarget() + zIn);
|
||||
}
|
||||
|
||||
public void startAt(BlockPos pos) {
|
||||
x.start(pos.getX());
|
||||
y.start(0);
|
||||
z.start(pos.getZ());
|
||||
moveTo(pos);
|
||||
}
|
||||
|
||||
public void moveTo(BlockPos pos) {
|
||||
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
@ -211,4 +227,12 @@ public class SchematicTransformation {
|
|||
z.target(zIn);
|
||||
}
|
||||
|
||||
public InterpolatedChasingValue getScaleFB() {
|
||||
return scaleFrontBack;
|
||||
}
|
||||
|
||||
public InterpolatedChasingValue getScaleLR() {
|
||||
return scaleLeftRight;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.simibubi.create.content.schematics.client.tools;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.content.schematics.client.SchematicTransformation;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -36,7 +36,7 @@ public class DeployTool extends PlacementToolBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
super.renderTool(ms, buffer);
|
||||
|
||||
if (selectedPos == null)
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simibubi.create.content.schematics.client.tools;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.AxisDirection;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -48,7 +48,7 @@ public class FlipTool extends PlacementToolBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
if (!schematicSelected || !selectedFace.getAxis()
|
||||
.isHorizontal()) {
|
||||
super.renderOnSchematic(ms, buffer);
|
||||
|
@ -71,7 +71,6 @@ public class FlipTool extends PlacementToolBase {
|
|||
AllSpecialTextures tex = AllSpecialTextures.CHECKERED;
|
||||
outline.getParams()
|
||||
.lineWidth(1 / 16f)
|
||||
.disableCull()
|
||||
.disableNormals()
|
||||
.colored(0xdddddd)
|
||||
.withFaceTextures(tex, tex);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.client.tools;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
|
||||
|
@ -12,8 +13,8 @@ public interface ISchematicTool {
|
|||
public boolean handleRightClick();
|
||||
public boolean handleMouseWheel(double delta);
|
||||
|
||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer);
|
||||
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer);
|
||||
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer);
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer);
|
||||
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.client.tools;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
|
||||
|
@ -17,7 +18,7 @@ public abstract class PlacementToolBase extends SchematicToolBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
super.renderTool(ms, buffer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.simibubi.create.content.schematics.client.tools;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.outliner.LineOutline;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
@ -20,7 +20,7 @@ public class RotateTool extends PlacementToolBase {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
AxisAlignedBB bounds = schematicHandler.getBounds();
|
||||
double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
||||
Vec3d center = bounds.getCenter()
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.AllSpecialTextures;
|
|||
import com.simibubi.create.CreateClient;
|
||||
import com.simibubi.create.content.schematics.client.SchematicHandler;
|
||||
import com.simibubi.create.content.schematics.client.SchematicTransformation;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.RaycastHelper;
|
||||
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
@ -120,13 +121,13 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {}
|
||||
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {}
|
||||
|
||||
@Override
|
||||
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer) {}
|
||||
|
||||
@Override
|
||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
if (!schematicHandler.isDeployed())
|
||||
return;
|
||||
|
||||
|
@ -141,8 +142,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
|||
outline.getParams()
|
||||
.colored(0x6886c5)
|
||||
.withFaceTexture(AllSpecialTextures.CHECKERED)
|
||||
.lineWidth(1 / 32f)
|
||||
.disableCull();
|
||||
.lineWidth(1 / 16f);
|
||||
outline.render(ms, buffer);
|
||||
outline.getParams()
|
||||
.clearTextures();
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.simibubi.create.foundation.renderState;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
|
||||
import net.minecraft.client.renderer.RenderState;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderTypes extends RenderState {
|
||||
|
||||
public static RenderType getOutlineSolid() {
|
||||
return OUTLINE_SOLID;
|
||||
}
|
||||
|
||||
public static RenderType getOutlineTranslucent(ResourceLocation texture, boolean cull) {
|
||||
RenderType.State rendertype$state = RenderType.State.builder()
|
||||
.texture(new RenderState.TextureState(texture, false, false))
|
||||
.transparency(TRANSLUCENT_TRANSPARENCY)
|
||||
.diffuseLighting(ENABLE_DIFFUSE_LIGHTING)
|
||||
.alpha(ONE_TENTH_ALPHA)
|
||||
.cull(cull ? ENABLE_CULLING : DISABLE_CULLING)
|
||||
.lightmap(ENABLE_LIGHTMAP)
|
||||
.overlay(ENABLE_OVERLAY_COLOR)
|
||||
.build(true);
|
||||
return RenderType.of("outline_translucent" + (cull ? "_cull" : ""),
|
||||
DefaultVertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, 7, 256, true, true, rendertype$state);
|
||||
}
|
||||
|
||||
private static final RenderType OUTLINE_SOLID =
|
||||
RenderType.of("outline_solid", DefaultVertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, 7, 256, true,
|
||||
false, RenderType.State.builder()
|
||||
.texture(new RenderState.TextureState(AllSpecialTextures.BLANK.getLocation(), false, false))
|
||||
.transparency(NO_TRANSPARENCY)
|
||||
.diffuseLighting(ENABLE_DIFFUSE_LIGHTING)
|
||||
.lightmap(ENABLE_LIGHTMAP)
|
||||
.overlay(ENABLE_OVERLAY_COLOR)
|
||||
.build(true));
|
||||
|
||||
protected static final RenderState.CullState DISABLE_CULLING = new NoCullState();
|
||||
|
||||
protected static class NoCullState extends RenderState.CullState {
|
||||
public NoCullState() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startDrawing() {
|
||||
RenderSystem.disableCull();
|
||||
}
|
||||
}
|
||||
|
||||
// Mmm gimme those protected fields
|
||||
public RenderTypes() {
|
||||
super(null, null, null);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.simibubi.create.foundation.renderState;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
||||
import net.minecraft.client.renderer.Atlases;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
public class SuperRenderTypeBuffer implements IRenderTypeBuffer {
|
||||
|
||||
static SuperRenderTypeBuffer instance;
|
||||
|
||||
public static SuperRenderTypeBuffer getInstance() {
|
||||
if (instance == null)
|
||||
instance = new SuperRenderTypeBuffer();
|
||||
return instance;
|
||||
}
|
||||
|
||||
SuperRenderTypeBufferPhase earlyBuffer;
|
||||
SuperRenderTypeBufferPhase defaultBuffer;
|
||||
SuperRenderTypeBufferPhase lateBuffer;
|
||||
|
||||
public SuperRenderTypeBuffer() {
|
||||
earlyBuffer = new SuperRenderTypeBufferPhase();
|
||||
defaultBuffer = new SuperRenderTypeBufferPhase();
|
||||
lateBuffer = new SuperRenderTypeBufferPhase();
|
||||
}
|
||||
|
||||
public IVertexBuilder getEarlyBuffer(RenderType type) {
|
||||
return earlyBuffer.getBuffer(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVertexBuilder getBuffer(RenderType type) {
|
||||
return defaultBuffer.getBuffer(type);
|
||||
}
|
||||
|
||||
public IVertexBuilder getLateBuffer(RenderType type) {
|
||||
return lateBuffer.getBuffer(type);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
RenderSystem.disableCull();
|
||||
earlyBuffer.draw();
|
||||
defaultBuffer.draw();
|
||||
lateBuffer.draw();
|
||||
}
|
||||
|
||||
public void draw(RenderType type) {
|
||||
RenderSystem.disableCull();
|
||||
earlyBuffer.draw(type);
|
||||
defaultBuffer.draw(type);
|
||||
lateBuffer.draw(type);
|
||||
}
|
||||
|
||||
private static class SuperRenderTypeBufferPhase extends IRenderTypeBuffer.Impl {
|
||||
|
||||
// Visible clones from net.minecraft.client.renderer.RenderTypeBuffers
|
||||
static final RegionRenderCacheBuilder blockBuilders = new RegionRenderCacheBuilder();
|
||||
static final SortedMap<RenderType, BufferBuilder> createEntityBuilders() {
|
||||
return Util.make(new Object2ObjectLinkedOpenHashMap<>(), (map) -> {
|
||||
map.put(Atlases.getEntitySolid(), blockBuilders.get(RenderType.getSolid()));
|
||||
map.put(Atlases.getEntityCutout(), blockBuilders.get(RenderType.getCutout()));
|
||||
map.put(Atlases.getBannerPatterns(), blockBuilders.get(RenderType.getCutoutMipped()));
|
||||
map.put(Atlases.getEntityTranslucent(), blockBuilders.get(RenderType.getTranslucent()));
|
||||
assign(map, Atlases.getShieldPatterns());
|
||||
assign(map, Atlases.getBeds());
|
||||
assign(map, Atlases.getShulkerBoxes());
|
||||
assign(map, Atlases.getSign());
|
||||
assign(map, Atlases.getChest());
|
||||
assign(map, RenderType.getTranslucentNoCrumbling());
|
||||
assign(map, RenderType.getGlint());
|
||||
assign(map, RenderType.getEntityGlint());
|
||||
assign(map, RenderType.getWaterMask());
|
||||
ModelBakery.BLOCK_DESTRUCTION_RENDER_LAYERS.forEach((p_228488_1_) -> {
|
||||
assign(map, p_228488_1_);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private static void assign(Object2ObjectLinkedOpenHashMap<RenderType, BufferBuilder> map, RenderType type) {
|
||||
map.put(type, new BufferBuilder(type.getExpectedBufferSize()));
|
||||
}
|
||||
|
||||
protected SuperRenderTypeBufferPhase() {
|
||||
super(new BufferBuilder(256), createEntityBuilders());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.simibubi.create.foundation.tileEntity.behaviour;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform.Sided;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
|
@ -72,7 +73,7 @@ public class ValueBox extends ChasingAABBOutline {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
boolean hasTransform = transform != null;
|
||||
if (transform instanceof Sided && params.getHighlightedFace() != null)
|
||||
((Sided) transform).fromSide(params.getHighlightedFace());
|
||||
|
|
|
@ -2,10 +2,10 @@ package com.simibubi.create.foundation.utility.outliner;
|
|||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.renderState.RenderTypes;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -22,11 +22,11 @@ public class AABBOutline extends Outline {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
renderBB(ms, buffer, bb);
|
||||
}
|
||||
|
||||
public void renderBB(MatrixStack ms, IRenderTypeBuffer buffer, AxisAlignedBB bb) {
|
||||
public void renderBB(MatrixStack ms, SuperRenderTypeBuffer buffer, AxisAlignedBB bb) {
|
||||
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
||||
.getProjectedView();
|
||||
boolean noCull = bb.contains(projectedView);
|
||||
|
@ -42,28 +42,25 @@ public class AABBOutline extends Outline {
|
|||
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
||||
Vec3d XYZ = new Vec3d(bb.maxX, bb.maxY, bb.maxZ);
|
||||
|
||||
// Buffers with no Culling only seem to work right with when this line is present
|
||||
buffer.getBuffer(RenderType.getEntityCutout(AllSpecialTextures.BLANK.getLocation()));
|
||||
|
||||
Vec3d start = xyz;
|
||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||
renderAACuboidLine(ms, buffer, start, xYz);
|
||||
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||
|
||||
start = XyZ;
|
||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||
|
||||
start = XYz;
|
||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xYz);
|
||||
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||
|
||||
start = xYZ;
|
||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
||||
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||
renderAACuboidLine(ms, buffer, start, xYz);
|
||||
|
||||
renderFace(ms, buffer, Direction.NORTH, xYz, XYz, Xyz, xyz, noCull);
|
||||
renderFace(ms, buffer, Direction.SOUTH, XYZ, xYZ, xyZ, XyZ, noCull);
|
||||
|
@ -74,20 +71,19 @@ public class AABBOutline extends Outline {
|
|||
|
||||
}
|
||||
|
||||
protected void renderFace(MatrixStack ms, IRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2,
|
||||
protected void renderFace(MatrixStack ms, SuperRenderTypeBuffer buffer, Direction direction, Vec3d p1, Vec3d p2,
|
||||
Vec3d p3, Vec3d p4, boolean noCull) {
|
||||
if (!params.faceTexture.isPresent())
|
||||
return;
|
||||
|
||||
ResourceLocation faceTexture = params.faceTexture.get()
|
||||
.getLocation();
|
||||
if (direction == params.getHighlightedFace() && params.hightlightedFaceTexture.isPresent())
|
||||
faceTexture = params.hightlightedFaceTexture.get()
|
||||
.getLocation();
|
||||
float alphaBefore = params.alpha;
|
||||
params.alpha =
|
||||
(direction == params.getHighlightedFace() && params.hightlightedFaceTexture.isPresent()) ? 1 : 0.5f;
|
||||
|
||||
RenderType translucentType =
|
||||
noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture);
|
||||
IVertexBuilder builder = buffer.getBuffer(translucentType);
|
||||
RenderType translucentType = RenderTypes.getOutlineTranslucent(faceTexture, !noCull);
|
||||
IVertexBuilder builder = buffer.getLateBuffer(translucentType);
|
||||
|
||||
Axis axis = direction.getAxis();
|
||||
Vec3d uDiff = p2.subtract(p1);
|
||||
|
@ -95,6 +91,7 @@ public class AABBOutline extends Outline {
|
|||
float maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
||||
float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
||||
putQuadUV(ms, builder, p1, p2, p3, p4, 0, 0, maxU, maxV, Direction.UP);
|
||||
params.alpha = alphaBefore;
|
||||
}
|
||||
|
||||
public void setBounds(AxisAlignedBB bb) {
|
||||
|
|
|
@ -9,9 +9,10 @@ import java.util.Set;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.renderState.RenderTypes;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
|
@ -29,11 +30,11 @@ public class BlockClusterOutline extends Outline {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
for (MergeEntry edge : cluster.visibleEdges) {
|
||||
Vec3d start = new Vec3d(edge.pos);
|
||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, edge.axis);
|
||||
renderAACuboidLine(ms, buffer, start, new Vec3d(edge.pos.offset(direction)), false);
|
||||
renderAACuboidLine(ms, buffer, start, new Vec3d(edge.pos.offset(direction)));
|
||||
}
|
||||
|
||||
for (MergeEntry face : cluster.visibleFaces.keySet()) {
|
||||
|
@ -46,14 +47,14 @@ public class BlockClusterOutline extends Outline {
|
|||
}
|
||||
}
|
||||
|
||||
protected void renderBlockFace(MatrixStack ms, IRenderTypeBuffer buffer, BlockPos pos, Direction face) {
|
||||
protected void renderBlockFace(MatrixStack ms, SuperRenderTypeBuffer buffer, BlockPos pos, Direction face) {
|
||||
Optional<AllSpecialTextures> faceTexture = params.faceTexture;
|
||||
if (!faceTexture.isPresent())
|
||||
return;
|
||||
|
||||
RenderType translucentType = RenderType.getEntityTranslucent(faceTexture.get()
|
||||
.getLocation());
|
||||
IVertexBuilder builder = buffer.getBuffer(translucentType);
|
||||
RenderType translucentType = RenderTypes.getOutlineTranslucent(faceTexture.get()
|
||||
.getLocation(), true);
|
||||
IVertexBuilder builder = buffer.getLateBuffer(translucentType);
|
||||
|
||||
Vec3d center = VecHelper.getCenterOf(pos);
|
||||
Vec3d offset = new Vec3d(face.getDirectionVec());
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.simibubi.create.foundation.utility.outliner;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class ChasingAABBOutline extends AABBOutline {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance()
|
||||
.getRenderPartialTicks()));
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.simibubi.create.foundation.utility.outliner;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public class LineOutline extends Outline {
|
||||
|
@ -17,8 +17,8 @@ public class LineOutline extends Outline {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
renderAACuboidLine(ms, buffer, start, end, params.disableCull);
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
renderAACuboidLine(ms, buffer, start, end);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,16 +8,15 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack.Entry;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.AllSpecialTextures;
|
||||
import com.simibubi.create.foundation.renderState.RenderTypes;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix3f;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public abstract class Outline {
|
||||
|
@ -29,12 +28,10 @@ public abstract class Outline {
|
|||
params = new OutlineParams();
|
||||
}
|
||||
|
||||
public abstract void render(MatrixStack ms, IRenderTypeBuffer buffer);
|
||||
public abstract void render(MatrixStack ms, SuperRenderTypeBuffer buffer);
|
||||
|
||||
public void renderAACuboidLine(MatrixStack ms, IRenderTypeBuffer buffer, Vec3d start, Vec3d end, boolean noCull) {
|
||||
ResourceLocation tex = AllSpecialTextures.BLANK.getLocation();
|
||||
IVertexBuilder builder =
|
||||
buffer.getBuffer(noCull ? RenderType.getCutoutNoCull(tex, true) : RenderType.getEntitySolid(tex));
|
||||
public void renderAACuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vec3d start, Vec3d end) {
|
||||
IVertexBuilder builder = buffer.getBuffer(RenderTypes.getOutlineSolid());
|
||||
|
||||
Vec3d diff = end.subtract(start);
|
||||
if (diff.x + diff.y + diff.z < 0) {
|
||||
|
|
|
@ -7,11 +7,11 @@ import java.util.Optional;
|
|||
import java.util.Set;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox;
|
||||
import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -115,7 +115,7 @@ public class Outliner {
|
|||
toClear.forEach(outlines::remove);
|
||||
}
|
||||
|
||||
public void renderOutlines(MatrixStack ms, IRenderTypeBuffer buffer) {
|
||||
public void renderOutlines(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||
outlines.forEach((key, entry) -> {
|
||||
Outline outline = entry.getOutline();
|
||||
outline.params.alpha = 1;
|
||||
|
|
Loading…
Reference in a new issue