fix speed controllers not rendering shafts

switch around render layers for contraptions
This commit is contained in:
JozsefA 2021-01-11 12:08:13 -08:00
parent 1bc99f5224
commit c567437ede
2 changed files with 16 additions and 14 deletions

View file

@ -19,17 +19,17 @@ public class SpeedControllerRenderer extends SmartTileEntityRenderer<SpeedContro
protected void renderSafe(SpeedControllerTileEntity tileEntityIn, float partialTicks, MatrixStack ms,
IRenderTypeBuffer buffer, int light, int overlay) {
super.renderSafe(tileEntityIn, partialTicks, ms, buffer, light, overlay);
addInstanceData(new InstanceContext.World<>(tileEntityIn));
}
@Override
public void addInstanceData(InstanceContext<SpeedControllerTileEntity> ctx) {
KineticTileEntityRenderer.renderRotatingBuffer(ctx, getRotatedModel(ctx.te));
KineticTileEntityRenderer.renderRotatingBuffer(ctx, getRotatedModel(ctx));
}
private InstanceBuffer<RotatingData> getRotatedModel(SpeedControllerTileEntity te) {
return CreateClient.kineticRenderer.renderBlockInstanced(KineticTileEntityRenderer.KINETIC_TILE,
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(te)));
private InstanceBuffer<RotatingData> getRotatedModel(InstanceContext<SpeedControllerTileEntity> ctx) {
return ctx.getKinetics().renderBlockInstanced(KineticTileEntityRenderer.KINETIC_TILE,
KineticTileEntityRenderer.shaft(KineticTileEntityRenderer.getRotationAxisOf(ctx.te)));
}
}

View file

@ -3,6 +3,8 @@ package com.simibubi.create.foundation.utility.render;
import com.mojang.blaze3d.platform.GlStateManager;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionRenderer;
import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerRenderer;
import com.simibubi.create.content.schematics.client.SchematicRenderer;
import com.simibubi.create.foundation.utility.render.instancing.IInstanceRendered;
import com.simibubi.create.foundation.utility.render.instancing.IInstancedTileEntityRenderer;
import com.simibubi.create.foundation.utility.render.shader.Shader;
@ -174,15 +176,6 @@ public class FastContraptionRenderer extends ContraptionRenderer {
ShaderCallback callback = ShaderHelper.getViewProjectionCallback(projectionMat, viewMat);
int structureShader = ShaderHelper.useShader(Shader.CONTRAPTION_STRUCTURE, callback);
for (FastContraptionRenderer renderer : renderers.values()) {
renderer.setup(structureShader);
for (ContraptionBuffer layer : renderer.renderLayers) {
layer.render();
}
renderer.teardown();
}
int rotatingShader = ShaderHelper.useShader(Shader.CONTRAPTION_ROTATING, callback);
for (FastContraptionRenderer renderer : renderers.values()) {
renderer.setup(rotatingShader);
@ -197,6 +190,15 @@ public class FastContraptionRenderer extends ContraptionRenderer {
renderer.teardown();
}
int structureShader = ShaderHelper.useShader(Shader.CONTRAPTION_STRUCTURE, callback);
for (FastContraptionRenderer renderer : renderers.values()) {
renderer.setup(structureShader);
for (ContraptionBuffer layer : renderer.renderLayers) {
layer.render();
}
renderer.teardown();
}
ShaderHelper.releaseShader();
GL11.glDisable(GL13.GL_TEXTURE_3D);