mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-22 04:52:25 +00:00
Consolidated fluid render library, better caching, fixed initial lag
This commit is contained in:
1 parent
7dfc9db949
commit
b52ab65d7a
8 files changed
+347
-642
No files matched your search
@@ -0,0 +1,302 @@
|
||||
package mekanism.client.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public final class FluidRenderer
|
||||
{
|
||||
private static final int BLOCK_STAGES = 1000;
|
||||
|
||||
private static Map<RenderData, DisplayInteger[]> cachedCenterFluids = new HashMap<RenderData, DisplayInteger[]>();
|
||||
private static Map<ValveRenderData, DisplayInteger> cachedValveFluids = new HashMap<ValveRenderData, DisplayInteger>();
|
||||
|
||||
public static void translateToOrigin(Coord4D origin)
|
||||
{
|
||||
GL11.glTranslated(getX(origin.xCoord), getY(origin.yCoord), getZ(origin.zCoord));
|
||||
}
|
||||
|
||||
public static int getStages(RenderData data)
|
||||
{
|
||||
return data.height*BLOCK_STAGES;
|
||||
}
|
||||
|
||||
public static void pop()
|
||||
{
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public static void push()
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
public static DisplayInteger getTankDisplay(RenderData data)
|
||||
{
|
||||
return getTankDisplay(data, 1);
|
||||
}
|
||||
|
||||
public static DisplayInteger getTankDisplay(RenderData data, double scale)
|
||||
{
|
||||
int maxStages = getStages(data);
|
||||
int stage = Math.min(maxStages, (int)(scale*(float)maxStages));
|
||||
|
||||
if(cachedCenterFluids.containsKey(data))
|
||||
{
|
||||
DisplayInteger[] ret = cachedCenterFluids.get(data);
|
||||
|
||||
if(ret[stage] != null)
|
||||
{
|
||||
return ret[stage];
|
||||
}
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
toReturn.setTexture(MekanismRenderer.getFluidTexture(data.fluidType, FluidType.STILL));
|
||||
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
if(!cachedCenterFluids.containsKey(data))
|
||||
{
|
||||
cachedCenterFluids.put(data, new DisplayInteger[maxStages+1]);
|
||||
}
|
||||
|
||||
cachedCenterFluids.get(data)[stage] = display;
|
||||
|
||||
if(maxStages == 0)
|
||||
{
|
||||
maxStages = stage = 1;
|
||||
}
|
||||
|
||||
if(data.fluidType.getStill() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = ((float)stage/(float)maxStages)*data.height - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
display.endList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
public static class RenderData
|
||||
{
|
||||
public Coord4D location;
|
||||
|
||||
public int height;
|
||||
public int length;
|
||||
public int width;
|
||||
|
||||
public Fluid fluidType;
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + location.hashCode();
|
||||
code = 31 * code + height;
|
||||
code = 31 * code + length;
|
||||
code = 31 * code + width;
|
||||
code = 31 * code + fluidType.getName().hashCode();
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object data)
|
||||
{
|
||||
return data instanceof RenderData && ((RenderData)data).height == height &&
|
||||
((RenderData)data).length == length && ((RenderData)data).width == width && ((RenderData)data).fluidType == fluidType;
|
||||
}
|
||||
}
|
||||
|
||||
public static DisplayInteger getValveDisplay(ValveRenderData data)
|
||||
{
|
||||
if(cachedValveFluids.containsKey(data))
|
||||
{
|
||||
return cachedValveFluids.get(data);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
MekanismRenderer.prepFlowing(toReturn, data.fluidType);
|
||||
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
cachedValveFluids.put(data, display);
|
||||
|
||||
switch(data.side)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = 1 + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = 1.4 + .1;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(data.height-2) - .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = -.01;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = 1 + .02;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = 1.4;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = -.4;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = -.02;
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
toReturn.minX = 1 + .02;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = 1.4;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
toReturn.minX = -.4;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = -.02;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(data.fluidType.getFlowing() != null)
|
||||
{
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
display.endList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
private static int getValveFluidHeight(ValveRenderData data)
|
||||
{
|
||||
return data.valveLocation.yCoord - data.location.yCoord;
|
||||
}
|
||||
|
||||
private static double getX(int x)
|
||||
{
|
||||
return x - TileEntityRendererDispatcher.staticPlayerX;
|
||||
}
|
||||
|
||||
private static double getY(int y)
|
||||
{
|
||||
return y - TileEntityRendererDispatcher.staticPlayerY;
|
||||
}
|
||||
|
||||
private static double getZ(int z)
|
||||
{
|
||||
return z - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
}
|
||||
|
||||
public static class ValveRenderData extends RenderData
|
||||
{
|
||||
public EnumFacing side;
|
||||
public Coord4D valveLocation;
|
||||
public Fluid fluidType;
|
||||
|
||||
public static ValveRenderData get(RenderData renderData, ValveData valveData)
|
||||
{
|
||||
ValveRenderData data = new ValveRenderData();
|
||||
|
||||
data.location = renderData.location;
|
||||
data.height = renderData.height;
|
||||
data.length = renderData.length;
|
||||
data.width = renderData.width;
|
||||
data.fluidType = renderData.fluidType;
|
||||
|
||||
data.side = valveData.side;
|
||||
data.valveLocation = valveData.location;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object data)
|
||||
{
|
||||
return data instanceof ValveRenderData && super.equals(data) &&
|
||||
((ValveRenderData)data).side.equals(side) && ((ValveRenderData)data).fluidType == fluidType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + super.hashCode();
|
||||
code = 31 * code + side.ordinal();
|
||||
code = 31 * code + valveLocation.hashCode();
|
||||
code = 31 * code + fluidType.getName().hashCode();
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetDisplayInts()
|
||||
{
|
||||
cachedCenterFluids.clear();
|
||||
cachedValveFluids.clear();
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import mekanism.api.transmitters.TransmissionType;
|
||||
import mekanism.api.util.ReflectionUtils;
|
||||
import mekanism.client.render.obj.TransmitterModel;
|
||||
import mekanism.client.render.tileentity.RenderConfigurableMachine;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank;
|
||||
import mekanism.client.render.tileentity.RenderFluidTank;
|
||||
import mekanism.client.render.tileentity.RenderThermalEvaporationController;
|
||||
import mekanism.client.render.transmitter.RenderLogisticalTransporter;
|
||||
@@ -121,7 +120,7 @@ public class MekanismRenderer
|
||||
type.setIcon(event.getMap().registerSprite(type.iconResource));
|
||||
}
|
||||
|
||||
RenderDynamicTank.resetDisplayInts();
|
||||
FluidRenderer.resetDisplayInts();
|
||||
RenderThermalEvaporationController.resetDisplayInts();
|
||||
RenderFluidTank.resetDisplayInts();
|
||||
}
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
package mekanism.client.render.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.render.FluidRenderer;
|
||||
import mekanism.client.render.FluidRenderer.RenderData;
|
||||
import mekanism.client.render.FluidRenderer.ValveRenderData;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.tile.TileEntityDynamicTank;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -26,9 +15,6 @@ import org.lwjgl.opengl.GL11;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynamicTank>
|
||||
{
|
||||
private static Map<RenderData, HashMap<Fluid, DisplayInteger[]>> cachedCenterFluids = new HashMap<RenderData, HashMap<Fluid, DisplayInteger[]>>();
|
||||
private static Map<ValveRenderData, HashMap<Fluid, DisplayInteger>> cachedValveFluids = new HashMap<ValveRenderData, HashMap<Fluid, DisplayInteger>>();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityDynamicTank tileEntity, double x, double y, double z, float partialTick, int destroyStage)
|
||||
{
|
||||
@@ -37,318 +23,53 @@ public class RenderDynamicTank extends TileEntitySpecialRenderer<TileEntityDynam
|
||||
RenderData data = new RenderData();
|
||||
|
||||
data.location = tileEntity.structure.renderLocation;
|
||||
data.height = tileEntity.structure.volHeight;
|
||||
data.height = tileEntity.structure.volHeight-2;
|
||||
data.length = tileEntity.structure.volLength;
|
||||
data.width = tileEntity.structure.volWidth;
|
||||
data.fluidType = tileEntity.structure.fluidStored.getFluid();
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(data.location != null && data.height >= 3 && tileEntity.structure.fluidStored.getFluid() != null)
|
||||
if(data.location != null && data.height >= 1)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(data.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
|
||||
MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid());
|
||||
|
||||
DisplayInteger[] displayList = getListAndRender(data, tileEntity.structure.fluidStored.getFluid(), tileEntity.getWorld());
|
||||
|
||||
if(tileEntity.structure.fluidStored.getFluid().isGaseous())
|
||||
{
|
||||
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.clientCapacity)+MekanismRenderer.GAS_RENDER_BASE));
|
||||
displayList[getStages(data.height)-1].render();
|
||||
FluidRenderer.getTankDisplay(data).render();
|
||||
}
|
||||
else {
|
||||
displayList[Math.min(getStages(data.height)-1, (int)(tileEntity.prevScale*((float)getStages(data.height)-1)))].render();
|
||||
FluidRenderer.getTankDisplay(data, tileEntity.prevScale).render();
|
||||
}
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
|
||||
for(ValveData valveData : tileEntity.valveViewing)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(valveData.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
|
||||
MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid());
|
||||
|
||||
getValveDisplay(ValveRenderData.get(data, valveData), tileEntity.structure.fluidStored.getFluid(), tileEntity.getWorld()).render();
|
||||
FluidRenderer.getValveDisplay(ValveRenderData.get(data, valveData)).render();
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pop()
|
||||
{
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void push()
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
private DisplayInteger[] getListAndRender(RenderData data, Fluid fluid, World world)
|
||||
{
|
||||
if(cachedCenterFluids.containsKey(data) && cachedCenterFluids.get(data).containsKey(fluid))
|
||||
{
|
||||
return cachedCenterFluids.get(data).get(fluid);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
toReturn.setTexture(MekanismRenderer.getFluidTexture(fluid, FluidType.STILL));
|
||||
|
||||
final int stages = getStages(data.height);
|
||||
DisplayInteger[] displays = new DisplayInteger[stages];
|
||||
|
||||
if(cachedCenterFluids.containsKey(data))
|
||||
{
|
||||
cachedCenterFluids.get(data).put(fluid, displays);
|
||||
}
|
||||
else {
|
||||
HashMap<Fluid, DisplayInteger[]> map = new HashMap<Fluid, DisplayInteger[]>();
|
||||
map.put(fluid, displays);
|
||||
cachedCenterFluids.put(data, map);
|
||||
}
|
||||
|
||||
for(int i = 0; i < stages; i++)
|
||||
{
|
||||
displays[i] = DisplayInteger.createAndStart();
|
||||
|
||||
if(fluid.getStill() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = ((float)i/(float)stages)*(data.height-2) - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
return displays;
|
||||
}
|
||||
|
||||
private DisplayInteger getValveDisplay(ValveRenderData data, Fluid fluid, World world)
|
||||
{
|
||||
if(cachedValveFluids.containsKey(data) && cachedValveFluids.get(data).containsKey(fluid))
|
||||
{
|
||||
return cachedValveFluids.get(data).get(fluid);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
MekanismRenderer.prepFlowing(toReturn, fluid);
|
||||
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
if(cachedValveFluids.containsKey(data))
|
||||
{
|
||||
cachedValveFluids.get(data).put(fluid, display);
|
||||
}
|
||||
else {
|
||||
HashMap<Fluid, DisplayInteger> map = new HashMap<Fluid, DisplayInteger>();
|
||||
map.put(fluid, display);
|
||||
cachedValveFluids.put(data, map);
|
||||
}
|
||||
|
||||
switch(data.side)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = 1 + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = 1.4 + .1;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(data.height-2) - .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = -.01;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = 1 + .02;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = 1.4;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = -.4;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = -.02;
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
toReturn.minX = 1 + .02;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = 1.4;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
toReturn.minX = -.4;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = -.02;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(fluid.getFlowing() != null)
|
||||
{
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
display.endList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
private int getValveFluidHeight(ValveRenderData data)
|
||||
{
|
||||
return data.valveLocation.yCoord - data.location.yCoord;
|
||||
}
|
||||
|
||||
private int getStages(int height)
|
||||
{
|
||||
return (height-2)*(TankUpdateProtocol.FLUID_PER_TANK/10);
|
||||
}
|
||||
|
||||
private double getX(int x)
|
||||
{
|
||||
return x - TileEntityRendererDispatcher.staticPlayerX;
|
||||
}
|
||||
|
||||
private double getY(int y)
|
||||
{
|
||||
return y - TileEntityRendererDispatcher.staticPlayerY;
|
||||
}
|
||||
|
||||
private double getZ(int z)
|
||||
{
|
||||
return z - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
}
|
||||
|
||||
public static class RenderData
|
||||
{
|
||||
public Coord4D location;
|
||||
|
||||
public int height;
|
||||
public int length;
|
||||
public int width;
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + location.hashCode();
|
||||
code = 31 * code + height;
|
||||
code = 31 * code + length;
|
||||
code = 31 * code + width;
|
||||
return code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object data)
|
||||
{
|
||||
return data instanceof RenderData && ((RenderData)data).location.equals(location) && ((RenderData)data).height == height &&
|
||||
((RenderData)data).length == length && ((RenderData)data).width == width;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ValveRenderData extends RenderData
|
||||
{
|
||||
public EnumFacing side;
|
||||
public Coord4D valveLocation;
|
||||
|
||||
public static ValveRenderData get(RenderData renderData, ValveData valveData)
|
||||
{
|
||||
ValveRenderData data = new ValveRenderData();
|
||||
|
||||
data.location = renderData.location;
|
||||
data.height = renderData.height;
|
||||
data.length = renderData.length;
|
||||
data.width = renderData.width;
|
||||
|
||||
data.side = valveData.side;
|
||||
data.valveLocation = valveData.location;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object data)
|
||||
{
|
||||
return data instanceof ValveRenderData && super.equals(data) && ((ValveRenderData)data).side.equals(side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + super.hashCode();
|
||||
code = 31 * code + side.ordinal();
|
||||
code = 31 * code + valveLocation.hashCode();
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetDisplayInts()
|
||||
{
|
||||
cachedCenterFluids.clear();
|
||||
cachedValveFluids.clear();
|
||||
}
|
||||
}
|
||||
+2
-20
@@ -3,7 +3,7 @@ package mekanism.client.render.tileentity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.render.FluidRenderer;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
@@ -11,7 +11,6 @@ import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.tile.TileEntityThermalEvaporationController;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -40,11 +39,9 @@ public class RenderThermalEvaporationController extends TileEntitySpecialRendere
|
||||
|
||||
if(data.height >= 1 && tileEntity.inputTank.getCapacity() > 0)
|
||||
{
|
||||
Coord4D renderLoc = tileEntity.getRenderLocation();
|
||||
|
||||
push();
|
||||
|
||||
GL11.glTranslated(getX(renderLoc.xCoord), getY(renderLoc.yCoord), getZ(renderLoc.zCoord));
|
||||
FluidRenderer.translateToOrigin(tileEntity.getRenderLocation());
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.inputTank.getFluid().getFluid().getLuminosity());
|
||||
|
||||
@@ -163,21 +160,6 @@ public class RenderThermalEvaporationController extends TileEntitySpecialRendere
|
||||
return height*(TankUpdateProtocol.FLUID_PER_TANK/10);
|
||||
}
|
||||
|
||||
private double getX(int x)
|
||||
{
|
||||
return x - TileEntityRendererDispatcher.staticPlayerX;
|
||||
}
|
||||
|
||||
private double getY(int y)
|
||||
{
|
||||
return y - TileEntityRendererDispatcher.staticPlayerY;
|
||||
}
|
||||
|
||||
private double getZ(int z)
|
||||
{
|
||||
return z - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
}
|
||||
|
||||
public static class SalinationRenderData
|
||||
{
|
||||
public int height;
|
||||
|
||||
@@ -3,12 +3,13 @@ package mekanism.client.render.tileentity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.client.render.FluidRenderer.RenderData;
|
||||
import mekanism.client.render.FluidRenderer.ValveRenderData;
|
||||
import mekanism.client.render.FluidRenderer;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank.RenderData;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank.ValveRenderData;
|
||||
import mekanism.common.content.tank.SynchronizedTankData.ValveData;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.common.tile.TileEntityBoilerCasing;
|
||||
@@ -47,48 +48,47 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
|
||||
data.height = (tileEntity.structure.upperRenderLocation.yCoord-1)-tileEntity.structure.renderLocation.yCoord;
|
||||
data.length = tileEntity.structure.volLength;
|
||||
data.width = tileEntity.structure.volWidth;
|
||||
data.fluidType = WATER;
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(data.location != null && data.height >= 1 && tileEntity.structure.waterStored.getFluid() != null)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(data.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.waterStored.getFluid().getLuminosity());
|
||||
MekanismRenderer.colorFluid(tileEntity.structure.waterStored.getFluid());
|
||||
|
||||
DisplayInteger[] displayList = getLowerDisplay(data, tileEntity.structure.waterStored.getFluid(), tileEntity.getWorld());
|
||||
|
||||
if(tileEntity.structure.waterStored.getFluid().isGaseous())
|
||||
{
|
||||
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.waterStored.amount / (float)tileEntity.clientWaterCapacity)+MekanismRenderer.GAS_RENDER_BASE));
|
||||
displayList[getStages(data.height)-1].render();
|
||||
FluidRenderer.getTankDisplay(data).render();
|
||||
}
|
||||
else {
|
||||
displayList[Math.min(getStages(data.height)-1, (int)(tileEntity.prevWaterScale*((float)getStages(data.height)-1)))].render();
|
||||
FluidRenderer.getTankDisplay(data, tileEntity.prevWaterScale).render();
|
||||
}
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
|
||||
for(ValveData valveData : tileEntity.valveViewing)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(valveData.location.xCoord), getY(valveData.location.yCoord), getZ(valveData.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(valveData.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.waterStored.getFluid().getLuminosity());
|
||||
|
||||
getValveDisplay(ValveRenderData.get(data, valveData), tileEntity.structure.waterStored.getFluid(), tileEntity.getWorld()).render();
|
||||
FluidRenderer.getValveDisplay(ValveRenderData.get(data, valveData)).render();
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,19 +101,20 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
|
||||
data.height = (tileEntity.structure.renderLocation.yCoord+tileEntity.structure.volHeight-2)-(tileEntity.structure.upperRenderLocation.yCoord);
|
||||
data.length = tileEntity.structure.volLength;
|
||||
data.width = tileEntity.structure.volWidth;
|
||||
data.fluidType = STEAM;
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(data.location != null && data.height >= 1 && tileEntity.structure.steamStored.getFluid() != null)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(data.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.steamStored.getFluid().getLuminosity());
|
||||
MekanismRenderer.colorFluid(tileEntity.structure.steamStored.getFluid());
|
||||
|
||||
DisplayInteger display = getUpperDisplay(data, tileEntity.structure.steamStored.getFluid(), tileEntity.getWorld());
|
||||
DisplayInteger display = FluidRenderer.getTankDisplay(data);
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.steamStored.amount / (float)tileEntity.clientSteamCapacity)+MekanismRenderer.GAS_RENDER_BASE));
|
||||
display.render();
|
||||
@@ -121,229 +122,14 @@ public class RenderThermoelectricBoiler extends TileEntitySpecialRenderer<TileEn
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pop()
|
||||
{
|
||||
GL11.glPopAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void push()
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
private DisplayInteger[] getLowerDisplay(RenderData data, Fluid fluid, World world)
|
||||
{
|
||||
if(cachedLowerFluids.containsKey(data))
|
||||
{
|
||||
return cachedLowerFluids.get(data);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
toReturn.setTexture(MekanismRenderer.getFluidTexture(fluid, FluidType.STILL));
|
||||
|
||||
final int stages = getStages(data.height);
|
||||
DisplayInteger[] displays = new DisplayInteger[stages];
|
||||
|
||||
cachedLowerFluids.put(data, displays);
|
||||
|
||||
for(int i = 0; i < stages; i++)
|
||||
{
|
||||
displays[i] = DisplayInteger.createAndStart();
|
||||
|
||||
if(fluid.getStill() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = ((float)i/(float)stages)*data.height - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
return displays;
|
||||
}
|
||||
|
||||
private DisplayInteger getUpperDisplay(RenderData data, Fluid fluid, World world)
|
||||
{
|
||||
if(cachedUpperFluids.containsKey(data))
|
||||
{
|
||||
return cachedUpperFluids.get(data);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
toReturn.setTexture(MekanismRenderer.getFluidTexture(fluid, FluidType.STILL));
|
||||
|
||||
final int stages = getStages(data.height);
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
cachedUpperFluids.put(data, display);
|
||||
|
||||
if(STEAM.getStill() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = data.height - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
private DisplayInteger getValveDisplay(ValveRenderData data, Fluid fluid, World world)
|
||||
{
|
||||
if(cachedValveFluids.containsKey(data))
|
||||
{
|
||||
return cachedValveFluids.get(data);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
MekanismRenderer.prepFlowing(toReturn, fluid);
|
||||
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
cachedValveFluids.put(data, display);
|
||||
|
||||
switch(data.side)
|
||||
{
|
||||
case DOWN:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = 1 + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = 1.4 + .1;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case UP:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(data.height-2) - .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = -.01;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case NORTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = 1 + .02;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = 1.4;
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
{
|
||||
toReturn.minX = .3;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = -.4;
|
||||
|
||||
toReturn.maxX = .7;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = -.02;
|
||||
break;
|
||||
}
|
||||
case WEST:
|
||||
{
|
||||
toReturn.minX = 1 + .02;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = 1.4;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
{
|
||||
toReturn.minX = -.4;
|
||||
toReturn.minY = -(getValveFluidHeight(data)) + .01;
|
||||
toReturn.minZ = .3;
|
||||
|
||||
toReturn.maxX = -.02;
|
||||
toReturn.maxY = .7;
|
||||
toReturn.maxZ = .7;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(fluid.getFlowing() != null)
|
||||
{
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
display.endList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
private int getValveFluidHeight(ValveRenderData data)
|
||||
{
|
||||
return data.valveLocation.yCoord - data.location.yCoord;
|
||||
}
|
||||
|
||||
private int getStages(int height)
|
||||
{
|
||||
return height*(TankUpdateProtocol.FLUID_PER_TANK/10);
|
||||
}
|
||||
|
||||
private double getX(int x)
|
||||
{
|
||||
return x - TileEntityRendererDispatcher.staticPlayerX;
|
||||
}
|
||||
|
||||
private double getY(int y)
|
||||
{
|
||||
return y - TileEntityRendererDispatcher.staticPlayerY;
|
||||
}
|
||||
|
||||
private double getZ(int z)
|
||||
{
|
||||
return z - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
}
|
||||
|
||||
public static void resetDisplayInts()
|
||||
{
|
||||
cachedLowerFluids.clear();
|
||||
cachedUpperFluids.clear();
|
||||
cachedValveFluids.clear();
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,6 @@ public class TileEntityLogisticalSorter extends TileEntityElectricBlock implemen
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,8 +188,5 @@ public class GeneratorsClientProxy extends GeneratorsCommonProxy
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onStitch(TextureStitchEvent.Pre event)
|
||||
{
|
||||
RenderIndustrialTurbine.resetDisplayInts();
|
||||
}
|
||||
public void onStitch(TextureStitchEvent.Pre event) {}
|
||||
}
|
||||
@@ -1,24 +1,16 @@
|
||||
package mekanism.generators.client.render;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.render.FluidRenderer;
|
||||
import mekanism.client.render.FluidRenderer.RenderData;
|
||||
import mekanism.client.render.MekanismRenderer;
|
||||
import mekanism.client.render.MekanismRenderer.DisplayInteger;
|
||||
import mekanism.client.render.MekanismRenderer.FluidType;
|
||||
import mekanism.client.render.MekanismRenderer.Model3D;
|
||||
import mekanism.client.render.tileentity.RenderDynamicTank.RenderData;
|
||||
import mekanism.common.content.tank.TankUpdateProtocol;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineCasing;
|
||||
import mekanism.generators.common.tile.turbine.TileEntityTurbineRotor;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -29,8 +21,6 @@ import org.lwjgl.opengl.GL11;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderIndustrialTurbine extends TileEntitySpecialRenderer
|
||||
{
|
||||
private static Map<RenderData, DisplayInteger> cachedFluids = new HashMap<RenderData, DisplayInteger>();
|
||||
|
||||
private Fluid STEAM = FluidRegistry.getFluid("steam");
|
||||
|
||||
@Override
|
||||
@@ -69,104 +59,33 @@ public class RenderIndustrialTurbine extends TileEntitySpecialRenderer
|
||||
data.height = tileEntity.structure.lowerVolume/(tileEntity.structure.volLength*tileEntity.structure.volWidth);
|
||||
data.length = tileEntity.structure.volLength;
|
||||
data.width = tileEntity.structure.volWidth;
|
||||
data.fluidType = STEAM;
|
||||
|
||||
bindTexture(MekanismRenderer.getBlocksTexture());
|
||||
|
||||
if(data.location != null && data.height >= 1 && tileEntity.structure.fluidStored.getFluid() != null)
|
||||
{
|
||||
push();
|
||||
FluidRenderer.push();
|
||||
|
||||
GL11.glTranslated(getX(data.location.xCoord), getY(data.location.yCoord), getZ(data.location.zCoord));
|
||||
FluidRenderer.translateToOrigin(data.location);
|
||||
|
||||
MekanismRenderer.glowOn(tileEntity.structure.fluidStored.getFluid().getLuminosity());
|
||||
MekanismRenderer.colorFluid(tileEntity.structure.fluidStored.getFluid());
|
||||
|
||||
DisplayInteger display = getListAndRender(data, tileEntity.getWorld());
|
||||
|
||||
GL11.glColor4f(1F, 1F, 1F, Math.min(1, ((float)tileEntity.structure.fluidStored.amount / (float)tileEntity.structure.getFluidCapacity())+MekanismRenderer.GAS_RENDER_BASE));
|
||||
display.render();
|
||||
FluidRenderer.getTankDisplay(data).render();
|
||||
|
||||
MekanismRenderer.glowOff();
|
||||
MekanismRenderer.resetColor();
|
||||
|
||||
pop();
|
||||
FluidRenderer.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pop()
|
||||
{
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void push()
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
private int getStages(int height)
|
||||
{
|
||||
return TankUpdateProtocol.FLUID_PER_TANK/10;
|
||||
}
|
||||
|
||||
private double getX(int x)
|
||||
{
|
||||
return x - TileEntityRendererDispatcher.staticPlayerX;
|
||||
}
|
||||
|
||||
private double getY(int y)
|
||||
{
|
||||
return y - TileEntityRendererDispatcher.staticPlayerY;
|
||||
}
|
||||
|
||||
private double getZ(int z)
|
||||
{
|
||||
return z - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
}
|
||||
|
||||
private DisplayInteger getListAndRender(RenderData data, World world)
|
||||
{
|
||||
if(cachedFluids.containsKey(data))
|
||||
{
|
||||
return cachedFluids.get(data);
|
||||
}
|
||||
|
||||
Model3D toReturn = new Model3D();
|
||||
toReturn.baseBlock = Blocks.WATER;
|
||||
toReturn.setTexture(MekanismRenderer.getFluidTexture(STEAM, FluidType.STILL));
|
||||
|
||||
final int stages = getStages(data.height);
|
||||
DisplayInteger display = DisplayInteger.createAndStart();
|
||||
|
||||
cachedFluids.put(data, display);
|
||||
|
||||
if(STEAM.getStill() != null)
|
||||
{
|
||||
toReturn.minX = 0 + .01;
|
||||
toReturn.minY = 0 + .01;
|
||||
toReturn.minZ = 0 + .01;
|
||||
|
||||
toReturn.maxX = data.length - .01;
|
||||
toReturn.maxY = data.height - .01;
|
||||
toReturn.maxZ = data.width - .01;
|
||||
|
||||
MekanismRenderer.renderObject(toReturn);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
public static void resetDisplayInts()
|
||||
{
|
||||
cachedFluids.clear();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user