Fix a couple bugs with DM filter gui rendering, and remove need for color masking support

This commit is contained in:
pupnewfster committed 2019-07-08 11:48:11 -04:00
1 parent 0408a2f479
commit afbfe802ef
4 files changed
+10 -31

No files matched your search

@@ -1,7 +1,6 @@
package mekanism.client.gui.filter;
import mekanism.api.EnumColor;
import mekanism.client.render.MekanismRenderHelper;
import mekanism.client.sound.SoundHandler;
import mekanism.common.content.filter.IFilter;
import mekanism.common.content.miner.MinerFilter;
@@ -43,13 +42,11 @@ public abstract class GuiFilterBase<FILTER extends IFilter, TILE extends TileEnt
}
}
protected void drawRect(boolean doDraw) {
if (doDraw) {
MekanismRenderHelper renderHelper = new MekanismRenderHelper(true).disableLighting().disableDepth().colorMaskAlpha();
int x = guiLeft + 149;
int y = guiTop + 19;
protected void drawRect(int xAxis, int yAxis, int xMin, int xMax, int yMin, int yMax) {
if (xAxis >= xMin && xAxis <= xMax && yAxis >= yMin && yAxis <= yMax) {
int x = guiLeft + xMin;
int y = guiTop + yMin;
drawRect(x, y, x + 16, y + 16, 0x80FFFFFF);
renderHelper.cleanup();
}
}
@@ -73,7 +73,7 @@ public abstract class GuiTextFilter<FILTER extends IFilter, TILE extends TileEnt
if (tileEntity instanceof TileEntityDigitalMiner) {
drawTexturedModalRect(guiLeft + 148, guiTop + 45, 199, xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59, 14);
text.drawTextBox();
drawRect(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35);
drawRect(xAxis, yAxis, 149, 165, 19, 35);
} else if (tileEntity instanceof TileEntityLogisticalSorter) {
drawTexturedModalRect(guiLeft + 11, guiTop + 64, 199, xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75, 11);
text.drawTextBox();
@@ -22,14 +22,13 @@ public abstract class GuiTypeFilter<FILTER extends IFilter, TILE extends TileEnt
protected void drawGuiContainerBackgroundLayer(int xAxis, int yAxis) {
drawTexturedModalRect(guiLeft + 5, guiTop + 5, 176, xAxis >= 5 && xAxis <= 16 && yAxis >= 5 && yAxis <= 16, 11);
if (tileEntity instanceof TileEntityDigitalMiner) {
drawTexturedModalRect(guiLeft + 148, guiTop + 45, 199, xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59, 11);
drawRect(xAxis >= 149 && xAxis <= 165 && yAxis >= 19 && yAxis <= 35);
drawTexturedModalRect(guiLeft + 148, guiTop + 45, 199, xAxis >= 148 && xAxis <= 162 && yAxis >= 45 && yAxis <= 59, 14);
drawItemStackBackground(xAxis, yAxis);
drawRect(xAxis, yAxis, 149, 165, 19, 35);
} else if (tileEntity instanceof TileEntityLogisticalSorter) {
drawTexturedModalRect(guiLeft + 11, guiTop + 64, 198, xAxis >= 11 && xAxis <= 22 && yAxis >= 64 && yAxis <= 75, 11);
drawItemStackBackground(xAxis, yAxis);
}
//Draw the itemstack specific background
drawItemStackBackground(xAxis, yAxis);
drawRect(xAxis >= 12 && xAxis <= 28 && yAxis >= 19 && yAxis <= 35);
drawRect(xAxis, yAxis, 12, 28, 19, 35);
}
}
@@ -22,7 +22,6 @@ public class MekanismRenderHelper extends GLSMHelper<MekanismRenderHelper> {
private Map<KnownStates, Boolean> changedStates = new EnumMap<>(KnownStates.class);
private boolean hasMatrix;
private boolean colorSet;
private boolean colorMasked;
private boolean glowEnabled;
private float lightmapLastX;
private float lightmapLastY;
@@ -43,10 +42,6 @@ public class MekanismRenderHelper extends GLSMHelper<MekanismRenderHelper> {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapLastX, lightmapLastY);
glowEnabled = false;
}
if (colorMasked) {
GlStateManager.colorMask(true, true, true, true);
colorMasked = false;
}
if (colorSet) {
resetColor();
}
@@ -122,18 +117,6 @@ public class MekanismRenderHelper extends GLSMHelper<MekanismRenderHelper> {
return fluid == null ? this : enableGlow(fluid.getLuminosity());
}
//Color
public MekanismRenderHelper colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
//If they are all being set to true, then we don't need the colorMasked boolean to be true
colorMasked = !red || !green || !blue || !alpha;
GlStateManager.colorMask(red, green, blue, alpha);
return this;
}
public MekanismRenderHelper colorMaskAlpha() {
return colorMask(true, true, true, false);
}
@Override
public MekanismRenderHelper color(float red, float green, float blue, float alpha) {
//If the color is our default color then we do not need to have colorSet be called