non experimental contraption rendering is back.

schematic rendering is fixed.
both of these are kinda ugly hacks, and there is definitely some rewriting necessary for when it's time to be more opengl compatible.

maybe fix belt lighting, again.
remove old belt assets.
This commit is contained in:
JozsefA 2021-02-09 16:14:44 -08:00
parent 6736577e1b
commit 0cb9094913
20 changed files with 42 additions and 23 deletions

View file

@ -41,7 +41,7 @@ public class KineticTileEntityRenderer extends SafeTileEntityRenderer<KineticTil
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(te.getWorld())) return;
for (RenderType type : RenderType.getBlockLayers())
if (RenderTypeLookup.canRenderInLayer(te.getBlockState(), type))

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.render.FastRenderDispatcher;
import com.simibubi.create.foundation.render.contraption.RenderedContraption;
import com.simibubi.create.foundation.utility.VecHelper;
@ -32,7 +33,8 @@ public class DrillMovementBehaviour extends BlockBreakingMovementBehaviour {
@OnlyIn(value = Dist.CLIENT)
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
//DrillRenderer.renderInContraption(context, ms, msLocal, buffer);
if (!FastRenderDispatcher.available())
DrillRenderer.renderInContraption(context, ms, msLocal, buffer);
}
@Override

View file

@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.actors;
import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING;
import com.simibubi.create.foundation.render.FastRenderDispatcher;
import com.simibubi.create.foundation.render.contraption.RenderedContraption;
import org.apache.commons.lang3.mutable.MutableBoolean;
@ -49,7 +50,8 @@ public class HarvesterMovementBehaviour extends MovementBehaviour {
@Override
public void renderInContraption(MovementContext context, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffers) {
//HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers);
if (!FastRenderDispatcher.available())
HarvesterRenderer.renderInContraption(context, ms, msLocal, buffers);
}
@Override

View file

@ -153,7 +153,7 @@ public class MechanicalCrafterRenderer extends SafeTileEntityRenderer<Mechanical
BlockState blockState = te.getBlockState();
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
if (!FastRenderDispatcher.available()) {
if (!FastRenderDispatcher.available(te.getWorld())) {
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
standardKineticRotationTransform(superBuffer, te, light);
superBuffer.rotateCentered(Direction.UP, (float) (blockState.get(HORIZONTAL_FACING).getAxis() != Direction.Axis.X ? 0 : Math.PI / 2));

View file

@ -104,7 +104,7 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
protected void renderComponents(DeployerTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
if (!FastRenderDispatcher.available()) {
if (!FastRenderDispatcher.available(te.getWorld())) {
KineticTileEntityRenderer.renderRotatingKineticBlock(te, getRenderedBlockState(te), ms, vb, light);
}

View file

@ -28,7 +28,7 @@ public class EncasedFanRenderer extends KineticTileEntityRenderer {
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(te.getWorld())) return;
Direction direction = te.getBlockState()
.get(FACING);

View file

@ -38,7 +38,7 @@ public class MechanicalMixerRenderer extends KineticTileEntityRenderer {
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
if (!FastRenderDispatcher.available()) {
if (!FastRenderDispatcher.available(te.getWorld())) {
SuperByteBuffer superBuffer = AllBlockPartials.SHAFTLESS_COGWHEEL.renderOn(blockState);
standardKineticRotationTransform(superBuffer, te, light).renderInto(ms, vb);
}

View file

@ -45,7 +45,7 @@ public class SawRenderer extends SafeTileEntityRenderer<SawTileEntity> {
renderItems(te, partialTicks, ms, buffer, light, overlay);
FilteringRenderer.renderOnTileEntity(te, partialTicks, ms, buffer, light, overlay);
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(te.getWorld())) return;
renderShaft(te, ms, buffer, light, overlay);
}

View file

@ -1,6 +1,8 @@
package com.simibubi.create.content.contraptions.components.structureMovement;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.render.FastRenderDispatcher;
import com.simibubi.create.foundation.render.gl.backend.Backend;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
@ -55,8 +57,11 @@ public abstract class AbstractContraptionEntityRenderer<C extends AbstractContra
transform(entity, partialTicks, matrixStacks);
Contraption contraption = entity.getContraption();
if (contraption != null) {
ContraptionRenderer.renderDynamic(entity.world, contraption, ms, msLocal, buffers);
//ContraptionRenderDispatcher.markForRendering(entity.world, contraption, msLocal);
if (!FastRenderDispatcher.available()) {
ContraptionRenderer.render(entity.world, contraption, ms, msLocal, buffers);
} else {
ContraptionRenderer.renderDynamic(entity.world, contraption, ms, msLocal, buffers);
}
}
ms.pop();

View file

@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement;
import java.util.List;
import java.util.Random;
import com.simibubi.create.foundation.render.*;
import net.minecraft.world.lighting.WorldLightManager;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.opengl.GL11;
@ -11,10 +12,6 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.CreateClient;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.render.SuperByteBuffer;
import com.simibubi.create.foundation.render.SuperByteBufferCache;
import com.simibubi.create.foundation.render.Compartment;
import com.simibubi.create.foundation.render.TileEntityRenderHelper;
import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld;
import net.minecraft.block.BlockRenderType;
@ -77,7 +74,11 @@ public class ContraptionRenderer {
protected static void renderTileEntities(World world, Contraption c, MatrixStack ms, MatrixStack msLocal,
IRenderTypeBuffer buffer) {
TileEntityRenderHelper.renderTileEntities(world, c.specialRenderedTileEntities, ms, msLocal, buffer);
if (FastRenderDispatcher.available()) {
TileEntityRenderHelper.renderTileEntities(world, c.specialRenderedTileEntities, ms, msLocal, buffer);
} else {
TileEntityRenderHelper.renderTileEntities(world, c.maybeInstancedTileEntities, ms, msLocal, buffer);
}
}
private static SuperByteBuffer buildStructureBuffer(Contraption c, RenderType layer) {

View file

@ -22,7 +22,7 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
IRenderTypeBuffer buffer, int light, int overlay) {
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(tileEntityIn.getWorld())) return;
KineticTileEntityRenderer.renderRotatingBuffer(tileEntityIn, getRotatedModel(tileEntityIn), ms,
buffer.getBuffer(RenderType.getSolid()), light);

View file

@ -50,7 +50,7 @@ public class BeltRenderer extends SafeTileEntityRenderer<BeltTileEntity> {
protected void renderSafe(BeltTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (!FastRenderDispatcher.available()) {
if (!FastRenderDispatcher.available(te.getWorld())) {
BlockState blockState = te.getBlockState();
if (!AllBlocks.BELT.has(blockState)) return;

View file

@ -99,6 +99,9 @@ public class BeltTileEntity extends KineticTileEntity {
initializeItemHandler();
if (blockLight == -1)
updateLight();
// Move Items
if (!isController())
return;
@ -125,9 +128,6 @@ public class BeltTileEntity extends KineticTileEntity {
BeltMovementHandler.transportEntity(this, entity, info);
});
toRemove.forEach(passengers::remove);
if (blockLight == -1)
updateLight();
}
@Override

View file

@ -28,7 +28,7 @@ public class SplitShaftRenderer extends KineticTileEntityRenderer {
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(te.getWorld())) return;
Block block = te.getBlockState().getBlock();
final Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState());

View file

@ -26,7 +26,7 @@ public class GearboxRenderer extends KineticTileEntityRenderer {
@Override
protected void renderSafe(KineticTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) {
if (FastRenderDispatcher.available()) return;
if (FastRenderDispatcher.available(te.getWorld())) return;
final Axis boxAxis = te.getBlockState().get(BlockStateProperties.AXIS);
final BlockPos pos = te.getPos();

View file

@ -56,7 +56,7 @@ public class SchematicHandler {
public SchematicHandler() {
renderers = new Vector<>(3);
for (int i = 0; i < renderers.capacity(); i++)
renderers.add(new SchematicRendererWithInstancing());
renderers.add(new SchematicRenderer());
overlay = new SchematicHotbarSlotOverlay();
currentTool = Tools.Deploy;

View file

@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.KineticDebugger;
import com.simibubi.create.content.schematics.SchematicWorld;
import com.simibubi.create.foundation.render.contraption.ContraptionRenderDispatcher;
import com.simibubi.create.foundation.render.gl.backend.Backend;
import com.simibubi.create.foundation.render.gl.backend.OptifineHandler;
@ -24,6 +25,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.SectionPos;
import net.minecraft.world.ILightReader;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
@ -62,6 +64,10 @@ public class FastRenderDispatcher {
return Backend.enabled;
}
public static boolean available(World world) {
return Backend.enabled && !(world instanceof SchematicWorld);
}
public static int getDebugMode() {
return KineticDebugger.isActive() ? 1 : 0;
}

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.render.instancing;
import com.simibubi.create.foundation.render.FastRenderDispatcher;
import com.simibubi.create.foundation.render.gl.BasicProgram;
import com.simibubi.create.foundation.render.gl.backend.Backend;
import com.simibubi.create.foundation.render.gl.shader.ShaderCallback;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.renderer.Matrix4f;
@ -37,6 +38,8 @@ public abstract class InstancedTileRenderer<P extends BasicProgram> {
@SuppressWarnings("unchecked")
@Nullable
public <T extends TileEntity> TileEntityInstance<? super T> getInstance(T tile, boolean create) {
if (!Backend.enabled) return null;
TileEntityInstance<?> instance = instances.get(tile);
if (instance != null) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB