mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-13 05:54:01 +01:00
fix the rainbow debugger
This commit is contained in:
parent
cfff806df4
commit
6736577e1b
@ -19,7 +19,8 @@ public abstract class KineticTileInstance<T extends KineticTileEntity> extends T
|
||||
|
||||
protected final void updateRotation(InstanceKey<RotatingData> key, Direction.Axis axis) {
|
||||
key.modifyInstance(data -> {
|
||||
data.setRotationalSpeed(tile.getSpeed())
|
||||
data.setColor(tile.network)
|
||||
.setRotationalSpeed(tile.getSpeed())
|
||||
.setRotationOffset(getRotationOffset(axis))
|
||||
.setRotationAxis(axis);
|
||||
});
|
||||
|
@ -82,7 +82,8 @@ public class FanInstance extends KineticTileInstance<EncasedFanTileEntity> {
|
||||
updateRotation(shaft, axis);
|
||||
|
||||
fan.modifyInstance(data -> {
|
||||
data.setRotationalSpeed(getFanSpeed())
|
||||
data.setColor(tile.network)
|
||||
.setRotationalSpeed(getFanSpeed())
|
||||
.setRotationOffset(getRotationOffset(axis))
|
||||
.setRotationAxis(Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis).getUnitVector());
|
||||
});
|
||||
|
@ -83,7 +83,7 @@ public class BeltInstance extends KineticTileInstance<BeltTileEntity> {
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
for (InstanceKey<BeltData> key : keys) {
|
||||
key.modifyInstance(data -> data.setRotationalSpeed(getScrollSpeed()));
|
||||
key.modifyInstance(data -> data.setColor(tile.network).setRotationalSpeed(getScrollSpeed()));
|
||||
}
|
||||
|
||||
if (pulleyKey != null) {
|
||||
|
@ -77,7 +77,8 @@ public class SplitShaftInstance extends KineticTileInstance<SplitShaftTileEntity
|
||||
key.modifyInstance(data -> {
|
||||
Direction.Axis axis = dir.getAxis();
|
||||
|
||||
data.setRotationalSpeed(tile.getSpeed() * tile.getRotationSpeedModifier(dir))
|
||||
data.setColor(tile.network)
|
||||
.setRotationalSpeed(tile.getSpeed() * tile.getRotationSpeedModifier(dir))
|
||||
.setRotationOffset(getRotationOffset(axis))
|
||||
.setRotationAxis(Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis).getUnitVector());
|
||||
});
|
||||
|
@ -90,7 +90,8 @@ public class GearboxInstance extends KineticTileInstance<GearboxTileEntity> {
|
||||
Direction direction = key.getKey();
|
||||
Direction.Axis axis = direction.getAxis();
|
||||
|
||||
data.setRotationalSpeed(getSpeed(direction))
|
||||
data.setColor(tile.network)
|
||||
.setRotationalSpeed(getSpeed(direction))
|
||||
.setRotationOffset(getRotationOffset(axis))
|
||||
.setRotationAxis(Direction.getFacingFromAxis(Direction.AxisDirection.POSITIVE, axis).getUnitVector());
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ package com.simibubi.create.foundation.render;
|
||||
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.foundation.render.contraption.ContraptionRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.gl.backend.Backend;
|
||||
import com.simibubi.create.foundation.render.gl.backend.OptifineHandler;
|
||||
@ -61,6 +62,10 @@ public class FastRenderDispatcher {
|
||||
return Backend.enabled;
|
||||
}
|
||||
|
||||
public static int getDebugMode() {
|
||||
return KineticDebugger.isActive() ? 1 : 0;
|
||||
}
|
||||
|
||||
public static void refresh() {
|
||||
RenderWork.enqueue(() -> {
|
||||
CreateClient.kineticRenderer.invalidate();
|
||||
|
@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Abs
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionHandler;
|
||||
import com.simibubi.create.foundation.render.AllProgramSpecs;
|
||||
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.Minecraft;
|
||||
@ -95,7 +96,7 @@ public class ContraptionRenderDispatcher {
|
||||
GL13.glActiveTexture(GL40.GL_TEXTURE4); // the shaders expect light volumes to be in texture 4
|
||||
|
||||
ContraptionProgram structureShader = Backend.getProgram(AllProgramSpecs.CONTRAPTION_STRUCTURE);
|
||||
structureShader.bind(viewProjection, 0);
|
||||
structureShader.bind(viewProjection, FastRenderDispatcher.getDebugMode());
|
||||
for (RenderedContraption renderer : renderers.values()) {
|
||||
renderer.doRenderLayer(layer, structureShader);
|
||||
}
|
||||
|
@ -64,11 +64,19 @@ public class KineticData<D extends KineticData<D>> extends InstanceData {
|
||||
return (D) this;
|
||||
}
|
||||
|
||||
private void setColor(long l) {
|
||||
public D setColor(Long l) {
|
||||
if (l != null)
|
||||
return setColor(l.longValue());
|
||||
else
|
||||
return setColor(0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
private D setColor(long l) {
|
||||
int color = ColorHelper.colorFromLong(l);
|
||||
r = (byte) ((color >> 16) & 0xFF);
|
||||
g = (byte) ((color >> 8) & 0xFF);
|
||||
b = (byte) (color & 0xFF);
|
||||
byte r = (byte) ((color >> 16) & 0xFF);
|
||||
byte g = (byte) ((color >> 8) & 0xFF);
|
||||
byte b = (byte) (color & 0xFF);
|
||||
return setColor(r, g, b);
|
||||
}
|
||||
|
||||
public D setColor(int r, int g, int b) {
|
||||
|
@ -6,6 +6,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||
import com.simibubi.create.foundation.render.Compartment;
|
||||
import com.simibubi.create.foundation.render.FastRenderDispatcher;
|
||||
import com.simibubi.create.foundation.render.SuperByteBufferCache;
|
||||
import com.simibubi.create.foundation.render.gl.BasicProgram;
|
||||
import com.simibubi.create.foundation.render.gl.backend.Backend;
|
||||
@ -64,7 +65,7 @@ public class RenderMaterial<P extends BasicProgram, MODEL extends InstancedModel
|
||||
|
||||
public void render(RenderType layer, Matrix4f viewProjection, ShaderCallback<P> setup) {
|
||||
P program = Backend.getProgram(programSpec);
|
||||
program.bind(viewProjection, 0);
|
||||
program.bind(viewProjection, FastRenderDispatcher.getDebugMode());
|
||||
|
||||
if (setup != null) setup.call(program);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user