More rendering; for some reason mech pipes are screwing up cache load

This commit is contained in:
Aidan C. Brady 2013-12-17 15:54:06 -05:00
parent 350ad4c22e
commit a601def4f6
4 changed files with 23 additions and 10 deletions

View file

@ -63,6 +63,11 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
gasScale = net.gasScale;
}
if(net.definedScale > definedScale)
{
definedScale = net.definedScale;
}
if(net.gasStored != null)
{
if(gasStored == null)
@ -344,7 +349,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
public float getScale()
{
return (gasStored == null || getCapacity() == 0 ? 0 : (float)gasStored.amount/getCapacity());
return Math.min(1, (gasStored == null || getCapacity() == 0 ? 0 : (float)gasStored.amount/getCapacity()));
}
@Override
@ -359,6 +364,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
GasNetwork network = new GasNetwork(varTransmitters);
network.refGas = refGas;
network.gasScale = gasScale;
network.definedScale = definedScale;
if(gasStored != null)
{
@ -380,6 +386,7 @@ public class GasNetwork extends DynamicNetwork<IGasHandler, GasNetwork>
GasNetwork network = new GasNetwork(collection);
network.refGas = refGas;
network.gasScale = gasScale;
network.definedScale = definedScale;
if(gasStored != null)
{

View file

@ -124,6 +124,13 @@ public class RenderPartTransmitter implements IIconRegister
public void renderContents(PartMechanicalPipe pipe, Vector3 pos)
{
float targetScale = pipe.getTransmitterNetwork().fluidScale;
if(Math.abs(pipe.currentScale - targetScale) > 0.01)
{
pipe.currentScale = (9 * pipe.currentScale + targetScale) / 10;
}
Fluid fluid = pipe.getTransmitterNetwork().refFluid;
float scale = pipe.currentScale;

View file

@ -68,6 +68,11 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
fluidScale = net.fluidScale;
}
if(net.definedScale > definedScale)
{
definedScale = net.definedScale;
}
if(net.fluidStored != null)
{
if(fluidStored == null)
@ -350,7 +355,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
public float getScale()
{
return (fluidStored == null || getCapacity() == 0 ? 0 : (float)fluidStored.amount/getCapacity());
return Math.min(1, (fluidStored == null || getCapacity() == 0 ? 0 : (float)fluidStored.amount/getCapacity()));
}
@Override
@ -365,6 +370,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
FluidNetwork network = new FluidNetwork(varTransmitters);
network.refFluid = refFluid;
network.fluidScale = fluidScale;
network.definedScale = definedScale;
if(fluidStored != null)
{
@ -386,6 +392,7 @@ public class FluidNetwork extends DynamicNetwork<IFluidHandler, FluidNetwork>
FluidNetwork network = new FluidNetwork(collection);
network.refFluid = refFluid;
network.fluidScale = fluidScale;
network.definedScale = definedScale;
if(fluidStored != null)
{

View file

@ -76,14 +76,6 @@ public class PartMechanicalPipe extends PartTransmitter<FluidNetwork> implements
}
}
}
else {
float targetScale = getTransmitterNetwork().fluidScale;
if(Math.abs(currentScale - targetScale) > 0.01)
{
currentScale = (9 * currentScale + targetScale) / 10;
}
}
super.update();
}