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.config.AllConfigs;
|
||||||
import com.simibubi.create.foundation.gui.ScreenOpener;
|
import com.simibubi.create.foundation.gui.ScreenOpener;
|
||||||
import com.simibubi.create.foundation.item.TooltipHelper;
|
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.filtering.FilteringHandler;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler;
|
||||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||||
|
@ -68,14 +69,13 @@ public class ClientEvents {
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
ms.translate(-view.getX(), -view.getY(), -view.getZ());
|
ms.translate(-view.getX(), -view.getY(), -view.getZ());
|
||||||
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance()
|
|
||||||
.getBufferBuilders()
|
SuperRenderTypeBuffer buffer = SuperRenderTypeBuffer.getInstance();
|
||||||
.getEntityVertexConsumers();
|
|
||||||
|
|
||||||
CreateClient.schematicHandler.render(ms, buffer);
|
CreateClient.schematicHandler.render(ms, buffer);
|
||||||
CreateClient.outliner.renderOutlines(ms, buffer);
|
CreateClient.outliner.renderOutlines(ms, buffer);
|
||||||
ms.pop();
|
|
||||||
buffer.draw();
|
buffer.draw();
|
||||||
|
|
||||||
|
ms.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -24,7 +24,6 @@ import net.minecraft.inventory.container.ContainerType;
|
||||||
import net.minecraft.item.ItemGroup;
|
import net.minecraft.item.ItemGroup;
|
||||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
import net.minecraft.particles.ParticleType;
|
import net.minecraft.particles.ParticleType;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraftforge.eventbus.api.EventPriority;
|
import net.minecraftforge.eventbus.api.EventPriority;
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.simibubi.create.content.logistics.block.transposer;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.simibubi.create.AllBlocks;
|
import com.simibubi.create.AllBlocks;
|
||||||
import com.simibubi.create.AllTileEntities;
|
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
|
||||||
import com.simibubi.create.content.logistics.block.AttachedLogisticalBlock;
|
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.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.ArmorStandEntity;
|
import net.minecraft.entity.item.ArmorStandEntity;
|
||||||
import net.minecraft.entity.item.ItemFrameEntity;
|
import net.minecraft.entity.item.ItemFrameEntity;
|
||||||
|
@ -39,6 +40,10 @@ public class SchematicWorld extends WrappedWorld {
|
||||||
public BlockPos anchor;
|
public BlockPos anchor;
|
||||||
public boolean renderMode;
|
public boolean renderMode;
|
||||||
|
|
||||||
|
public SchematicWorld() {
|
||||||
|
this(BlockPos.ZERO, Minecraft.getInstance().world);
|
||||||
|
}
|
||||||
|
|
||||||
public SchematicWorld(BlockPos anchor, World original) {
|
public SchematicWorld(BlockPos anchor, World original) {
|
||||||
super(original);
|
super(original);
|
||||||
this.blocks = new HashMap<>();
|
this.blocks = new HashMap<>();
|
||||||
|
@ -82,6 +87,7 @@ public class SchematicWorld extends WrappedWorld {
|
||||||
BlockState blockState = getBlockState(pos);
|
BlockState blockState = getBlockState(pos);
|
||||||
if (blockState.hasTileEntity()) {
|
if (blockState.hasTileEntity()) {
|
||||||
TileEntity tileEntity = blockState.createTileEntity(this);
|
TileEntity tileEntity = blockState.createTileEntity(this);
|
||||||
|
tileEntity.setLocation(this, pos);
|
||||||
tileEntities.put(pos, tileEntity);
|
tileEntities.put(pos, tileEntity);
|
||||||
return tileEntity;
|
return tileEntity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class SchematicAndQuillHandler {
|
||||||
outliner().chaseAABB(outlineSlot, currentSelectionBox)
|
outliner().chaseAABB(outlineSlot, currentSelectionBox)
|
||||||
.colored(0x6886c5)
|
.colored(0x6886c5)
|
||||||
.withFaceTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED)
|
.withFaceTextures(AllSpecialTextures.CHECKERED, AllSpecialTextures.HIGHLIGHT_CHECKERED)
|
||||||
.disableNormals()
|
.lineWidth(1/16f)
|
||||||
.highlightFace(selectedFace);
|
.highlightFace(selectedFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.schematics.client;
|
package com.simibubi.create.content.schematics.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
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.gui.ToolSelectionScreen;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
import com.simibubi.create.foundation.networking.NbtPacket;
|
import com.simibubi.create.foundation.networking.NbtPacket;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -23,6 +25,7 @@ import net.minecraft.entity.player.PlayerInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
|
import net.minecraft.util.Mirror;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
import net.minecraft.world.gen.feature.template.PlacementSettings;
|
||||||
|
@ -43,13 +46,16 @@ public class SchematicHandler {
|
||||||
private ItemStack activeSchematicItem;
|
private ItemStack activeSchematicItem;
|
||||||
private AABBOutline outline;
|
private AABBOutline outline;
|
||||||
|
|
||||||
private SchematicRenderer renderer;
|
private Vector<SchematicRenderer> renderers;
|
||||||
private SchematicHotbarSlotOverlay overlay;
|
private SchematicHotbarSlotOverlay overlay;
|
||||||
private ToolSelectionScreen selectionScreen;
|
private ToolSelectionScreen selectionScreen;
|
||||||
|
|
||||||
public SchematicHandler() {
|
public SchematicHandler() {
|
||||||
|
renderers = new Vector<>(3);
|
||||||
|
for (int i = 0; i < renderers.capacity(); i++)
|
||||||
|
renderers.add(new SchematicRenderer());
|
||||||
|
|
||||||
overlay = new SchematicHotbarSlotOverlay();
|
overlay = new SchematicHotbarSlotOverlay();
|
||||||
renderer = new SchematicRenderer();
|
|
||||||
currentTool = Tools.Deploy;
|
currentTool = Tools.Deploy;
|
||||||
selectionScreen = new ToolSelectionScreen(ImmutableList.of(Tools.Deploy), this::equip);
|
selectionScreen = new ToolSelectionScreen(ImmutableList.of(Tools.Deploy), this::equip);
|
||||||
transformation = new SchematicTransformation();
|
transformation = new SchematicTransformation();
|
||||||
|
@ -68,7 +74,7 @@ public class SchematicHandler {
|
||||||
if (activeSchematicItem != null && itemLost(player)) {
|
if (activeSchematicItem != null && itemLost(player)) {
|
||||||
activeHotbarSlot = 0;
|
activeHotbarSlot = 0;
|
||||||
activeSchematicItem = null;
|
activeSchematicItem = null;
|
||||||
renderer.setActive(false);
|
renderers.forEach(r -> r.setActive(false));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +86,7 @@ public class SchematicHandler {
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
renderer.tick();
|
renderers.forEach(SchematicRenderer::tick);
|
||||||
if (syncCooldown > 0)
|
if (syncCooldown > 0)
|
||||||
syncCooldown--;
|
syncCooldown--;
|
||||||
if (syncCooldown == 1)
|
if (syncCooldown == 1)
|
||||||
|
@ -110,16 +116,30 @@ public class SchematicHandler {
|
||||||
|
|
||||||
private void setupRenderer() {
|
private void setupRenderer() {
|
||||||
Template schematic = SchematicItem.loadSchematic(activeSchematicItem);
|
Template schematic = SchematicItem.loadSchematic(activeSchematicItem);
|
||||||
if (schematic.getSize()
|
BlockPos size = schematic.getSize();
|
||||||
.equals(BlockPos.ZERO))
|
if (size.equals(BlockPos.ZERO))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SchematicWorld w = new SchematicWorld(BlockPos.ZERO, Minecraft.getInstance().world);
|
SchematicWorld w = new SchematicWorld();
|
||||||
schematic.addBlocksToWorld(w, BlockPos.ZERO, new PlacementSettings());
|
SchematicWorld wMirroredFB = new SchematicWorld();
|
||||||
renderer.display(w);
|
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;
|
boolean present = activeSchematicItem != null;
|
||||||
if (!active && !present)
|
if (!active && !present)
|
||||||
return;
|
return;
|
||||||
|
@ -133,10 +153,29 @@ public class SchematicHandler {
|
||||||
|
|
||||||
ms.push();
|
ms.push();
|
||||||
transformation.applyGLTransformations(ms);
|
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)
|
if (active)
|
||||||
currentTool.getTool()
|
currentTool.getTool()
|
||||||
.renderOnSchematic(ms, buffer);
|
.renderOnSchematic(ms, buffer);
|
||||||
|
|
||||||
ms.pop();
|
ms.pop();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -257,8 +296,8 @@ public class SchematicHandler {
|
||||||
bounds = new AxisAlignedBB(BlockPos.ZERO, size);
|
bounds = new AxisAlignedBB(BlockPos.ZERO, size);
|
||||||
outline = new AABBOutline(bounds);
|
outline = new AABBOutline(bounds);
|
||||||
outline.getParams()
|
outline.getParams()
|
||||||
.lineWidth(1 / 16f)
|
.colored(0x6886c5)
|
||||||
.disableNormals();
|
.lineWidth(1 / 16f);
|
||||||
transformation.init(anchor, settings, bounds);
|
transformation.init(anchor, settings, bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +319,7 @@ public class SchematicHandler {
|
||||||
CompoundNBT nbt = activeSchematicItem.getTag();
|
CompoundNBT nbt = activeSchematicItem.getTag();
|
||||||
nbt.putBoolean("Deployed", false);
|
nbt.putBoolean("Deployed", false);
|
||||||
activeSchematicItem.setTag(nbt);
|
activeSchematicItem.setTag(nbt);
|
||||||
renderer.setActive(false);
|
renderers.forEach(r -> r.setActive(false));
|
||||||
active = false;
|
active = false;
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,14 +11,15 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.schematics.SchematicWorld;
|
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.MatrixStacker;
|
||||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||||
|
import com.simibubi.create.foundation.utility.TileEntityRenderHelper;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
@ -66,15 +67,18 @@ public class SchematicRenderer {
|
||||||
changed = false;
|
changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
if (!active)
|
if (!active)
|
||||||
return;
|
return;
|
||||||
|
buffer.getBuffer(RenderType.getSolid());
|
||||||
for (RenderType layer : RenderType.getBlockLayers()) {
|
for (RenderType layer : RenderType.getBlockLayers()) {
|
||||||
if (!usedBlockRenderLayers.contains(layer))
|
if (!usedBlockRenderLayers.contains(layer))
|
||||||
continue;
|
continue;
|
||||||
SuperByteBuffer superByteBuffer = bufferCache.get(layer);
|
SuperByteBuffer superByteBuffer = bufferCache.get(layer);
|
||||||
superByteBuffer.renderInto(ms, buffer.getBuffer(layer));
|
superByteBuffer.renderInto(ms, buffer.getBuffer(layer));
|
||||||
}
|
}
|
||||||
|
TileEntityRenderHelper.renderTileEntities(schematic, schematic.getTileEntities(), ms, new MatrixStack(),
|
||||||
|
buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void redraw(Minecraft minecraft) {
|
private void redraw(Minecraft minecraft) {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simibubi.create.content.schematics.client;
|
package com.simibubi.create.content.schematics.client;
|
||||||
|
|
||||||
|
import static java.lang.Math.abs;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle;
|
||||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
|
||||||
|
@ -34,8 +36,8 @@ public class SchematicTransformation {
|
||||||
public void init(BlockPos anchor, PlacementSettings settings, AxisAlignedBB bounds) {
|
public void init(BlockPos anchor, PlacementSettings settings, AxisAlignedBB bounds) {
|
||||||
int leftRight = settings.getMirror() == Mirror.LEFT_RIGHT ? -1 : 1;
|
int leftRight = settings.getMirror() == Mirror.LEFT_RIGHT ? -1 : 1;
|
||||||
int frontBack = settings.getMirror() == Mirror.FRONT_BACK ? -1 : 1;
|
int frontBack = settings.getMirror() == Mirror.FRONT_BACK ? -1 : 1;
|
||||||
scaleFrontBack.start(frontBack);
|
getScaleFB().start(frontBack);
|
||||||
scaleLeftRight.start(leftRight);
|
getScaleLR().start(leftRight);
|
||||||
xOrigin = bounds.getXSize() / 2f;
|
xOrigin = bounds.getXSize() / 2f;
|
||||||
zOrigin = bounds.getZSize() / 2f;
|
zOrigin = bounds.getZSize() / 2f;
|
||||||
|
|
||||||
|
@ -58,16 +60,23 @@ public class SchematicTransformation {
|
||||||
Vec3d rotationOffset = getRotationOffset(true);
|
Vec3d rotationOffset = getRotationOffset(true);
|
||||||
|
|
||||||
// Rotation & Mirror
|
// 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);
|
ms.translate(xOrigin, 0, zOrigin);
|
||||||
MatrixStacker.of(ms)
|
MatrixStacker.of(ms)
|
||||||
.translate(rotationOffset)
|
.translate(rotationOffset)
|
||||||
.rotateY(rotation.get(pt))
|
.rotateY(rot)
|
||||||
.translateBack(rotationOffset);
|
.translateBack(rotationOffset);
|
||||||
ms.scale(scaleFrontBack.get(pt), 1, scaleLeftRight.get(pt));
|
ms.scale(abs(fb), 1, abs(lr));
|
||||||
ms.translate(-xOrigin, 0, -zOrigin);
|
ms.translate(-xOrigin, 0, -zOrigin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlipped() {
|
||||||
|
return getMirrorModifier(Axis.X) < 0 != getMirrorModifier(Axis.Z) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
public Vec3d getRotationOffset(boolean ignoreMirrors) {
|
public Vec3d getRotationOffset(boolean ignoreMirrors) {
|
||||||
Vec3d rotationOffset = Vec3d.ZERO;
|
Vec3d rotationOffset = Vec3d.ZERO;
|
||||||
if ((int) (zOrigin * 2) % 2 != (int) (xOrigin * 2) % 2) {
|
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 = vec.subtract(xOrigin + rotationOffset.x, 0, zOrigin + rotationOffset.z);
|
||||||
vec = VecHelper.rotate(vec, -rotation.get(pt), Axis.Y);
|
vec = VecHelper.rotate(vec, -rotation.get(pt), Axis.Y);
|
||||||
vec = vec.add(rotationOffset.x, 0, rotationOffset.z);
|
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);
|
vec = vec.add(xOrigin, 0, zOrigin);
|
||||||
|
|
||||||
return vec;
|
return vec;
|
||||||
|
@ -103,8 +112,8 @@ public class SchematicTransformation {
|
||||||
|
|
||||||
int i = (int) rotation.getTarget();
|
int i = (int) rotation.getTarget();
|
||||||
|
|
||||||
boolean mirrorlr = scaleLeftRight.getTarget() < 0;
|
boolean mirrorlr = getScaleLR().getTarget() < 0;
|
||||||
boolean mirrorfb = scaleFrontBack.getTarget() < 0;
|
boolean mirrorfb = getScaleFB().getTarget() < 0;
|
||||||
if (mirrorlr && mirrorfb) {
|
if (mirrorlr && mirrorfb) {
|
||||||
mirrorlr = mirrorfb = false;
|
mirrorlr = mirrorfb = false;
|
||||||
i += 180;
|
i += 180;
|
||||||
|
@ -141,7 +150,7 @@ public class SchematicTransformation {
|
||||||
Vec3d rotationOffset = getRotationOffset(false);
|
Vec3d rotationOffset = getRotationOffset(false);
|
||||||
vec = vec.subtract(xOrigin, 0, zOrigin);
|
vec = vec.subtract(xOrigin, 0, zOrigin);
|
||||||
vec = vec.subtract(rotationOffset.x, 0, rotationOffset.z);
|
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 = VecHelper.rotate(vec, rotation.getTarget(), Axis.Y);
|
||||||
vec = vec.add(xOrigin, 0, zOrigin);
|
vec = vec.add(xOrigin, 0, zOrigin);
|
||||||
|
|
||||||
|
@ -154,7 +163,7 @@ public class SchematicTransformation {
|
||||||
Vec3d rotationOffset = getRotationOffset(false);
|
Vec3d rotationOffset = getRotationOffset(false);
|
||||||
vec = vec.subtract(xOrigin, 0, zOrigin);
|
vec = vec.subtract(xOrigin, 0, zOrigin);
|
||||||
vec = vec.subtract(rotationOffset.x, 0, rotationOffset.z);
|
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 = VecHelper.rotate(vec, rotation.getTarget(), Axis.Y);
|
||||||
vec = vec.add(xOrigin, 0, zOrigin);
|
vec = vec.add(xOrigin, 0, zOrigin);
|
||||||
|
|
||||||
|
@ -167,8 +176,8 @@ public class SchematicTransformation {
|
||||||
|
|
||||||
public int getMirrorModifier(Axis axis) {
|
public int getMirrorModifier(Axis axis) {
|
||||||
if (axis == Axis.Z)
|
if (axis == Axis.Z)
|
||||||
return (int) scaleLeftRight.getTarget();
|
return (int) getScaleLR().getTarget();
|
||||||
return (int) scaleFrontBack.getTarget();
|
return (int) getScaleFB().getTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getCurrentRotation() {
|
public float getCurrentRotation() {
|
||||||
|
@ -181,16 +190,16 @@ public class SchematicTransformation {
|
||||||
x.tick();
|
x.tick();
|
||||||
y.tick();
|
y.tick();
|
||||||
z.tick();
|
z.tick();
|
||||||
scaleLeftRight.tick();
|
getScaleLR().tick();
|
||||||
scaleFrontBack.tick();
|
getScaleFB().tick();
|
||||||
rotation.tick();
|
rotation.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flip(Axis axis) {
|
public void flip(Axis axis) {
|
||||||
if (axis == Axis.X)
|
if (axis == Axis.X)
|
||||||
scaleLeftRight.target(scaleLeftRight.getTarget() * -1);
|
getScaleLR().target(getScaleLR().getTarget() * -1);
|
||||||
if (axis == Axis.Z)
|
if (axis == Axis.Z)
|
||||||
scaleFrontBack.target(scaleFrontBack.getTarget() * -1);
|
getScaleFB().target(getScaleFB().getTarget() * -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotate90(boolean clockwise) {
|
public void rotate90(boolean clockwise) {
|
||||||
|
@ -201,6 +210,13 @@ public class SchematicTransformation {
|
||||||
moveTo(x.getTarget() + xIn, y.getTarget() + yIn, z.getTarget() + zIn);
|
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) {
|
public void moveTo(BlockPos pos) {
|
||||||
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
@ -211,4 +227,12 @@ public class SchematicTransformation {
|
||||||
z.target(zIn);
|
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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllKeys;
|
import com.simibubi.create.AllKeys;
|
||||||
import com.simibubi.create.content.schematics.client.SchematicTransformation;
|
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.MatrixStacker;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -36,7 +36,7 @@ public class DeployTool extends PlacementToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
super.renderTool(ms, buffer);
|
super.renderTool(ms, buffer);
|
||||||
|
|
||||||
if (selectedPos == null)
|
if (selectedPos == null)
|
||||||
|
|
|
@ -2,9 +2,9 @@ package com.simibubi.create.content.schematics.client.tools;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
import com.simibubi.create.AllSpecialTextures;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
import com.simibubi.create.foundation.utility.outliner.AABBOutline;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.AxisDirection;
|
import net.minecraft.util.Direction.AxisDirection;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -48,7 +48,7 @@ public class FlipTool extends PlacementToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
if (!schematicSelected || !selectedFace.getAxis()
|
if (!schematicSelected || !selectedFace.getAxis()
|
||||||
.isHorizontal()) {
|
.isHorizontal()) {
|
||||||
super.renderOnSchematic(ms, buffer);
|
super.renderOnSchematic(ms, buffer);
|
||||||
|
@ -71,7 +71,6 @@ public class FlipTool extends PlacementToolBase {
|
||||||
AllSpecialTextures tex = AllSpecialTextures.CHECKERED;
|
AllSpecialTextures tex = AllSpecialTextures.CHECKERED;
|
||||||
outline.getParams()
|
outline.getParams()
|
||||||
.lineWidth(1 / 16f)
|
.lineWidth(1 / 16f)
|
||||||
.disableCull()
|
|
||||||
.disableNormals()
|
.disableNormals()
|
||||||
.colored(0xdddddd)
|
.colored(0xdddddd)
|
||||||
.withFaceTextures(tex, tex);
|
.withFaceTextures(tex, tex);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.schematics.client.tools;
|
package com.simibubi.create.content.schematics.client.tools;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
|
||||||
|
@ -12,8 +13,8 @@ public interface ISchematicTool {
|
||||||
public boolean handleRightClick();
|
public boolean handleRightClick();
|
||||||
public boolean handleMouseWheel(double delta);
|
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 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;
|
package com.simibubi.create.content.schematics.client.tools;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ public abstract class PlacementToolBase extends SchematicToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
super.renderTool(ms, buffer);
|
super.renderTool(ms, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.content.schematics.client.tools;
|
package com.simibubi.create.content.schematics.client.tools;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
import com.simibubi.create.foundation.utility.outliner.LineOutline;
|
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.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class RotateTool extends PlacementToolBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
AxisAlignedBB bounds = schematicHandler.getBounds();
|
AxisAlignedBB bounds = schematicHandler.getBounds();
|
||||||
double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
double height = bounds.getYSize() + Math.max(20, bounds.getYSize());
|
||||||
Vec3d center = bounds.getCenter()
|
Vec3d center = bounds.getCenter()
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.simibubi.create.AllSpecialTextures;
|
||||||
import com.simibubi.create.CreateClient;
|
import com.simibubi.create.CreateClient;
|
||||||
import com.simibubi.create.content.schematics.client.SchematicHandler;
|
import com.simibubi.create.content.schematics.client.SchematicHandler;
|
||||||
import com.simibubi.create.content.schematics.client.SchematicTransformation;
|
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;
|
||||||
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
|
import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
@ -120,13 +121,13 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTool(MatrixStack ms, IRenderTypeBuffer buffer) {}
|
public void renderTool(MatrixStack ms, SuperRenderTypeBuffer buffer) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer) {}
|
public void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderOnSchematic(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderOnSchematic(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
if (!schematicHandler.isDeployed())
|
if (!schematicHandler.isDeployed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -141,8 +142,7 @@ public abstract class SchematicToolBase implements ISchematicTool {
|
||||||
outline.getParams()
|
outline.getParams()
|
||||||
.colored(0x6886c5)
|
.colored(0x6886c5)
|
||||||
.withFaceTexture(AllSpecialTextures.CHECKERED)
|
.withFaceTexture(AllSpecialTextures.CHECKERED)
|
||||||
.lineWidth(1 / 32f)
|
.lineWidth(1 / 16f);
|
||||||
.disableCull();
|
|
||||||
outline.render(ms, buffer);
|
outline.render(ms, buffer);
|
||||||
outline.getParams()
|
outline.getParams()
|
||||||
.clearTextures();
|
.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.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||||
import com.simibubi.create.foundation.gui.AllIcons;
|
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.ValueBoxTransform.Sided;
|
||||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
|
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions;
|
||||||
import com.simibubi.create.foundation.utility.ColorHelper;
|
import com.simibubi.create.foundation.utility.ColorHelper;
|
||||||
|
@ -72,7 +73,7 @@ public class ValueBox extends ChasingAABBOutline {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
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());
|
||||||
|
|
|
@ -20,14 +20,14 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class TileEntityRenderHelper {
|
public class TileEntityRenderHelper {
|
||||||
|
|
||||||
public static void renderTileEntities(World world, Iterable<TileEntity> customRenderTEs, MatrixStack ms,
|
public static void renderTileEntities(World world, Iterable<TileEntity> customRenderTEs, MatrixStack ms,
|
||||||
MatrixStack localTransform, IRenderTypeBuffer buffer) {
|
MatrixStack localTransform, IRenderTypeBuffer buffer) {
|
||||||
float pt = Minecraft.getInstance()
|
float pt = Minecraft.getInstance()
|
||||||
.getRenderPartialTicks();
|
.getRenderPartialTicks();
|
||||||
Matrix4f matrix = localTransform.peek()
|
Matrix4f matrix = localTransform.peek()
|
||||||
.getModel();
|
.getModel();
|
||||||
|
|
||||||
for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) {
|
for (Iterator<TileEntity> iterator = customRenderTEs.iterator(); iterator.hasNext();) {
|
||||||
TileEntity tileEntity = iterator.next();
|
TileEntity tileEntity = iterator.next();
|
||||||
TileEntityRenderer<TileEntity> renderer = TileEntityRendererDispatcher.instance.getRenderer(tileEntity);
|
TileEntityRenderer<TileEntity> renderer = TileEntityRendererDispatcher.instance.getRenderer(tileEntity);
|
||||||
|
|
|
@ -2,10 +2,10 @@ package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
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.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -22,11 +22,11 @@ public class AABBOutline extends Outline {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
renderBB(ms, buffer, bb);
|
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()
|
Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo()
|
||||||
.getProjectedView();
|
.getProjectedView();
|
||||||
boolean noCull = bb.contains(projectedView);
|
boolean noCull = bb.contains(projectedView);
|
||||||
|
@ -41,29 +41,26 @@ public class AABBOutline extends Outline {
|
||||||
Vec3d XyZ = new Vec3d(bb.maxX, bb.minY, bb.maxZ);
|
Vec3d XyZ = new Vec3d(bb.maxX, bb.minY, bb.maxZ);
|
||||||
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
Vec3d xYZ = new Vec3d(bb.minX, bb.maxY, bb.maxZ);
|
||||||
Vec3d XYZ = new Vec3d(bb.maxX, 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;
|
Vec3d start = xyz;
|
||||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
renderAACuboidLine(ms, buffer, start, xYz);
|
||||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||||
|
|
||||||
start = XyZ;
|
start = XyZ;
|
||||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||||
|
|
||||||
start = XYz;
|
start = XYz;
|
||||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
renderAACuboidLine(ms, buffer, start, xYz);
|
||||||
renderAACuboidLine(ms, buffer, start, Xyz, noCull);
|
renderAACuboidLine(ms, buffer, start, Xyz);
|
||||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||||
|
|
||||||
start = xYZ;
|
start = xYZ;
|
||||||
renderAACuboidLine(ms, buffer, start, XYZ, noCull);
|
renderAACuboidLine(ms, buffer, start, XYZ);
|
||||||
renderAACuboidLine(ms, buffer, start, xyZ, noCull);
|
renderAACuboidLine(ms, buffer, start, xyZ);
|
||||||
renderAACuboidLine(ms, buffer, start, xYz, noCull);
|
renderAACuboidLine(ms, buffer, start, xYz);
|
||||||
|
|
||||||
renderFace(ms, buffer, Direction.NORTH, xYz, XYz, Xyz, xyz, noCull);
|
renderFace(ms, buffer, Direction.NORTH, xYz, XYz, Xyz, xyz, noCull);
|
||||||
renderFace(ms, buffer, Direction.SOUTH, 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) {
|
Vec3d p3, Vec3d p4, boolean noCull) {
|
||||||
if (!params.faceTexture.isPresent())
|
if (!params.faceTexture.isPresent())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ResourceLocation faceTexture = params.faceTexture.get()
|
ResourceLocation faceTexture = params.faceTexture.get()
|
||||||
.getLocation();
|
.getLocation();
|
||||||
if (direction == params.getHighlightedFace() && params.hightlightedFaceTexture.isPresent())
|
float alphaBefore = params.alpha;
|
||||||
faceTexture = params.hightlightedFaceTexture.get()
|
params.alpha =
|
||||||
.getLocation();
|
(direction == params.getHighlightedFace() && params.hightlightedFaceTexture.isPresent()) ? 1 : 0.5f;
|
||||||
|
|
||||||
RenderType translucentType =
|
RenderType translucentType = RenderTypes.getOutlineTranslucent(faceTexture, !noCull);
|
||||||
noCull ? RenderType.getEntityTranslucent(faceTexture) : RenderType.getEntityTranslucentCull(faceTexture);
|
IVertexBuilder builder = buffer.getLateBuffer(translucentType);
|
||||||
IVertexBuilder builder = buffer.getBuffer(translucentType);
|
|
||||||
|
|
||||||
Axis axis = direction.getAxis();
|
Axis axis = direction.getAxis();
|
||||||
Vec3d uDiff = p2.subtract(p1);
|
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 maxU = (float) Math.abs(axis == Axis.X ? uDiff.z : uDiff.x);
|
||||||
float maxV = (float) Math.abs(axis == Axis.Y ? vDiff.z : vDiff.y);
|
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);
|
putQuadUV(ms, builder, p1, p2, p3, p4, 0, 0, maxU, maxV, Direction.UP);
|
||||||
|
params.alpha = alphaBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBounds(AxisAlignedBB bb) {
|
public void setBounds(AxisAlignedBB bb) {
|
||||||
|
|
|
@ -9,9 +9,10 @@ import java.util.Set;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
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 com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
|
@ -29,13 +30,13 @@ public class BlockClusterOutline extends Outline {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
for (MergeEntry edge : cluster.visibleEdges) {
|
for (MergeEntry edge : cluster.visibleEdges) {
|
||||||
Vec3d start = new Vec3d(edge.pos);
|
Vec3d start = new Vec3d(edge.pos);
|
||||||
Direction direction = Direction.getFacingFromAxis(AxisDirection.POSITIVE, edge.axis);
|
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()) {
|
for (MergeEntry face : cluster.visibleFaces.keySet()) {
|
||||||
AxisDirection axisDirection = cluster.visibleFaces.get(face);
|
AxisDirection axisDirection = cluster.visibleFaces.get(face);
|
||||||
Direction direction = Direction.getFacingFromAxis(axisDirection, face.axis);
|
Direction direction = Direction.getFacingFromAxis(axisDirection, face.axis);
|
||||||
|
@ -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;
|
Optional<AllSpecialTextures> faceTexture = params.faceTexture;
|
||||||
if (!faceTexture.isPresent())
|
if (!faceTexture.isPresent())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
RenderType translucentType = RenderType.getEntityTranslucent(faceTexture.get()
|
RenderType translucentType = RenderTypes.getOutlineTranslucent(faceTexture.get()
|
||||||
.getLocation());
|
.getLocation(), true);
|
||||||
IVertexBuilder builder = buffer.getBuffer(translucentType);
|
IVertexBuilder builder = buffer.getLateBuffer(translucentType);
|
||||||
|
|
||||||
Vec3d center = VecHelper.getCenterOf(pos);
|
Vec3d center = VecHelper.getCenterOf(pos);
|
||||||
Vec3d offset = new Vec3d(face.getDirectionVec());
|
Vec3d offset = new Vec3d(face.getDirectionVec());
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.simibubi.create.foundation.utility.outliner;
|
package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class ChasingAABBOutline extends AABBOutline {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance()
|
renderBB(ms, buffer, interpolateBBs(prevBB, bb, Minecraft.getInstance()
|
||||||
.getRenderPartialTicks()));
|
.getRenderPartialTicks()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.simibubi.create.foundation.utility.outliner;
|
package com.simibubi.create.foundation.utility.outliner;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
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;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public class LineOutline extends Outline {
|
public class LineOutline extends Outline {
|
||||||
|
@ -17,8 +17,8 @@ public class LineOutline extends Outline {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
renderAACuboidLine(ms, buffer, start, end, params.disableCull);
|
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.matrix.MatrixStack.Entry;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import com.simibubi.create.AllSpecialTextures;
|
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.ColorHelper;
|
||||||
import com.simibubi.create.foundation.utility.VecHelper;
|
import com.simibubi.create.foundation.utility.VecHelper;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.client.renderer.Matrix3f;
|
import net.minecraft.client.renderer.Matrix3f;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Direction.Axis;
|
import net.minecraft.util.Direction.Axis;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
|
||||||
public abstract class Outline {
|
public abstract class Outline {
|
||||||
|
@ -29,12 +28,10 @@ public abstract class Outline {
|
||||||
params = new OutlineParams();
|
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) {
|
public void renderAACuboidLine(MatrixStack ms, SuperRenderTypeBuffer buffer, Vec3d start, Vec3d end) {
|
||||||
ResourceLocation tex = AllSpecialTextures.BLANK.getLocation();
|
IVertexBuilder builder = buffer.getBuffer(RenderTypes.getOutlineSolid());
|
||||||
IVertexBuilder builder =
|
|
||||||
buffer.getBuffer(noCull ? RenderType.getCutoutNoCull(tex, true) : RenderType.getEntitySolid(tex));
|
|
||||||
|
|
||||||
Vec3d diff = end.subtract(start);
|
Vec3d diff = end.subtract(start);
|
||||||
if (diff.x + diff.y + diff.z < 0) {
|
if (diff.x + diff.y + diff.z < 0) {
|
||||||
|
|
|
@ -7,11 +7,11 @@ import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
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.tileEntity.behaviour.ValueBox;
|
||||||
import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;
|
import com.simibubi.create.foundation.utility.outliner.Outline.OutlineParams;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
@ -115,7 +115,7 @@ public class Outliner {
|
||||||
toClear.forEach(outlines::remove);
|
toClear.forEach(outlines::remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderOutlines(MatrixStack ms, IRenderTypeBuffer buffer) {
|
public void renderOutlines(MatrixStack ms, SuperRenderTypeBuffer buffer) {
|
||||||
outlines.forEach((key, entry) -> {
|
outlines.forEach((key, entry) -> {
|
||||||
Outline outline = entry.getOutline();
|
Outline outline = entry.getOutline();
|
||||||
outline.params.alpha = 1;
|
outline.params.alpha = 1;
|
||||||
|
|
Loading…
Reference in a new issue