Almost done with part one of tank render

I have still yet to code the tank merging for the render which will be a
pain since either A) have to move around dozens of liquid block to
render a full rank, or B) render one large block which will take calcing
out the size and pos of the cube... B will also not work with odd
shapped cubes unless multi are used hmm...
This commit is contained in:
Robert Seifert 2013-06-03 07:53:57 -04:00
parent 097e46a43e
commit 561ecfea74
4 changed files with 95 additions and 114 deletions

Binary file not shown.

View file

@ -13,7 +13,6 @@ import net.minecraft.entity.Entity;
public class ModelTankSide extends ModelBase
{
// fields
ModelRenderer tankBack;
ModelRenderer backRightSiding;
ModelRenderer backLeftSiding;
ModelRenderer backTopSiding;
@ -26,109 +25,89 @@ public class ModelTankSide extends ModelBase
ModelRenderer botLeftOut;
ModelRenderer topRightOut;
ModelRenderer topLeftOut;
ModelRenderer tankBackRight;
ModelRenderer tankBackLeft;
public ModelTankSide()
{
textureWidth = 128;
textureHeight = 128;
tankBack = new ModelRenderer(this, 21, 43);
tankBack.addBox(-6F, 8F, 5F, 12, 16, 1);
tankBack.setRotationPoint(0F, 0F, 0F);
tankBack.setTextureSize(128, 128);
tankBack.mirror = true;
setRotation(tankBack, 0F, 0F, 0F);
backRightSiding = new ModelRenderer(this, 0, 19);
backRightSiding.addBox(-6F, 10F, 6F, 2, 12, 1);
backRightSiding.setRotationPoint(0F, 0F, 0F);
backRightSiding.setTextureSize(128, 128);
backRightSiding.mirror = true;
setRotation(backRightSiding, 0F, 0F, 0F);
backLeftSiding = new ModelRenderer(this, 0, 19);
backLeftSiding.addBox(4F, 10F, 6F, 2, 12, 1);
backLeftSiding.setRotationPoint(0F, 0F, 0F);
backLeftSiding.setTextureSize(128, 128);
backLeftSiding.mirror = true;
setRotation(backLeftSiding, 0F, 0F, 0F);
backTopSiding = new ModelRenderer(this, 7, 8);
backTopSiding.addBox(-4F, 8F, 6F, 8, 2, 1);
backTopSiding.setRotationPoint(0F, 0F, 0F);
backTopSiding.setTextureSize(128, 128);
backTopSiding.mirror = true;
setRotation(backTopSiding, 0F, 0F, 0F);
backBotSiding = new ModelRenderer(this, 7, 8);
backBotSiding.addBox(-4F, 22F, 6F, 8, 2, 1);
backBotSiding.setRotationPoint(0F, 0F, 0F);
backBotSiding.setTextureSize(128, 128);
backBotSiding.mirror = true;
setRotation(backBotSiding, 0F, 0F, 0F);
topLeft = new ModelRenderer(this, 0, 0);
topLeft.addBox(4F, 8F, 6F, 2, 2, 1);
topLeft.setRotationPoint(0F, 0F, 0F);
topLeft.setTextureSize(128, 128);
topLeft.mirror = true;
setRotation(topLeft, 0F, 0F, 0F);
topRight = new ModelRenderer(this, 0, 0);
topRight.addBox(-6F, 8F, 6F, 2, 2, 1);
topRight.setRotationPoint(0F, 0F, 0F);
topRight.setTextureSize(128, 128);
topRight.mirror = true;
setRotation(topRight, 0F, 0F, 0F);
botRight = new ModelRenderer(this, 0, 0);
botRight.addBox(-6F, 22F, 6F, 2, 2, 1);
botRight.setRotationPoint(0F, 0F, 0F);
botRight.setTextureSize(128, 128);
botRight.mirror = true;
setRotation(botRight, 0F, 0F, 0F);
botLeft = new ModelRenderer(this, 0, 0);
botLeft.addBox(4F, 22F, 6F, 2, 2, 1);
botLeft.setRotationPoint(0F, 0F, 0F);
botLeft.setTextureSize(128, 128);
botLeft.mirror = true;
setRotation(botLeft, 0F, 0F, 0F);
botRightOut = new ModelRenderer(this, 0, 0);
botRightOut.addBox(-8F, 22F, 6F, 2, 2, 1);
botRightOut.setRotationPoint(0F, 0F, 0F);
botRightOut.setTextureSize(128, 128);
botRightOut.mirror = true;
setRotation(botRightOut, 0F, 0F, 0F);
botLeftOut = new ModelRenderer(this, 0, 0);
botLeftOut.addBox(6F, 22F, 6F, 2, 2, 1);
botLeftOut.setRotationPoint(0F, 0F, 0F);
botLeftOut.setTextureSize(128, 128);
botLeftOut.mirror = true;
setRotation(botLeftOut, 0F, 0F, 0F);
topRightOut = new ModelRenderer(this, 0, 0);
topRightOut.addBox(-8F, 8F, 6F, 2, 2, 1);
topRightOut.setRotationPoint(0F, 0F, 0F);
topRightOut.setTextureSize(128, 128);
topRightOut.mirror = true;
setRotation(topRightOut, 0F, 0F, 0F);
topLeftOut = new ModelRenderer(this, 0, 0);
topLeftOut.addBox(6F, 8F, 6F, 2, 2, 1);
topLeftOut.setRotationPoint(0F, 0F, 0F);
topLeftOut.setTextureSize(128, 128);
topLeftOut.mirror = true;
setRotation(topLeftOut, 0F, 0F, 0F);
tankBackRight = new ModelRenderer(this, 49, 43);
tankBackRight.addBox(-8F, 8F, 5F, 2, 16, 1);
tankBackRight.setRotationPoint(0F, 0F, 0F);
tankBackRight.setTextureSize(128, 128);
tankBackRight.mirror = true;
setRotation(tankBackRight, 0F, 0F, 0F);
tankBackLeft = new ModelRenderer(this, 12, 43);
tankBackLeft.addBox(6F, 8F, 5F, 2, 16, 1);
tankBackLeft.setRotationPoint(0F, 0F, 0F);
tankBackLeft.setTextureSize(128, 128);
tankBackLeft.mirror = true;
setRotation(tankBackLeft, 0F, 0F, 0F);
backRightSiding = new ModelRenderer(this, 0, 19);
backRightSiding.addBox(-7F, 10F, 7F, 2, 12, 1);
backRightSiding.setRotationPoint(0F, 0F, 0F);
backRightSiding.setTextureSize(128, 128);
backRightSiding.mirror = true;
setRotation(backRightSiding, 0F, 0F, 0F);
backLeftSiding = new ModelRenderer(this, 0, 19);
backLeftSiding.addBox(5F, 10F, 7F, 2, 12, 1);
backLeftSiding.setRotationPoint(0F, 0F, 0F);
backLeftSiding.setTextureSize(128, 128);
backLeftSiding.mirror = true;
setRotation(backLeftSiding, 0F, 0F, 0F);
backTopSiding = new ModelRenderer(this, 7, 8);
backTopSiding.addBox(-4F, 8F, 7F, 8, 2, 1);
backTopSiding.setRotationPoint(0F, 0F, 0F);
backTopSiding.setTextureSize(128, 128);
backTopSiding.mirror = true;
setRotation(backTopSiding, 0F, 0F, 0F);
backBotSiding = new ModelRenderer(this, 7, 8);
backBotSiding.addBox(-4F, 22F, 7F, 8, 2, 1);
backBotSiding.setRotationPoint(0F, 0F, 0F);
backBotSiding.setTextureSize(128, 128);
backBotSiding.mirror = true;
setRotation(backBotSiding, 0F, 0F, 0F);
topLeft = new ModelRenderer(this, 0, 0);
topLeft.addBox(4F, 8F, 7F, 2, 2, 1);
topLeft.setRotationPoint(0F, 0F, 0F);
topLeft.setTextureSize(128, 128);
topLeft.mirror = true;
setRotation(topLeft, 0F, 0F, 0F);
topRight = new ModelRenderer(this, 0, 0);
topRight.addBox(-6F, 8F, 7F, 2, 2, 1);
topRight.setRotationPoint(0F, 0F, 0F);
topRight.setTextureSize(128, 128);
topRight.mirror = true;
setRotation(topRight, 0F, 0F, 0F);
botRight = new ModelRenderer(this, 0, 0);
botRight.addBox(-6F, 22F, 7F, 2, 2, 1);
botRight.setRotationPoint(0F, 0F, 0F);
botRight.setTextureSize(128, 128);
botRight.mirror = true;
setRotation(botRight, 0F, 0F, 0F);
botLeft = new ModelRenderer(this, 0, 0);
botLeft.addBox(4F, 22F, 7F, 2, 2, 1);
botLeft.setRotationPoint(0F, 0F, 0F);
botLeft.setTextureSize(128, 128);
botLeft.mirror = true;
setRotation(botLeft, 0F, 0F, 0F);
botRightOut = new ModelRenderer(this, 0, 0);
botRightOut.addBox(-7F, 22F, 7F, 2, 2, 1);
botRightOut.setRotationPoint(0F, 0F, 0F);
botRightOut.setTextureSize(128, 128);
botRightOut.mirror = true;
setRotation(botRightOut, 0F, 0F, 0F);
botLeftOut = new ModelRenderer(this, 0, 0);
botLeftOut.addBox(5F, 22F, 7F, 2, 2, 1);
botLeftOut.setRotationPoint(0F, 0F, 0F);
botLeftOut.setTextureSize(128, 128);
botLeftOut.mirror = true;
setRotation(botLeftOut, 0F, 0F, 0F);
topRightOut = new ModelRenderer(this, 0, 0);
topRightOut.addBox(-7F, 8F, 7F, 2, 2, 1);
topRightOut.setRotationPoint(0F, 0F, 0F);
topRightOut.setTextureSize(128, 128);
topRightOut.mirror = true;
setRotation(topRightOut, 0F, 0F, 0F);
topLeftOut = new ModelRenderer(this, 0, 0);
topLeftOut.addBox(5F, 8F, 7F, 2, 2, 1);
topLeftOut.setRotationPoint(0F, 0F, 0F);
topLeftOut.setTextureSize(128, 128);
topLeftOut.mirror = true;
setRotation(topLeftOut, 0F, 0F, 0F);
}
public void render(float f5, boolean left, boolean right, boolean bot, boolean top)
{
tankBack.render(f5);
//tankBack.render(f5);
if (!top)
{
backTopSiding.render(f5);
@ -155,7 +134,7 @@ public class ModelTankSide extends ModelBase
}
else
{
tankBackRight.render(f5);
//tankBackRight.render(f5);
}
if (!left)
@ -164,7 +143,7 @@ public class ModelTankSide extends ModelBase
}
else
{
tankBackLeft.render(f5);
//tankBackLeft.render(f5);
}
}

View file

@ -32,26 +32,14 @@ public class RenderTank extends TileEntitySpecialRenderer
LiquidStack liquid = tank.getLiquid();
ColorCode color = tileEntityTank.getColor();
GL11.glPushMatrix();
bindTextureByName(FluidMech.MODEL_TEXTURE_DIRECTORY + "TankSide.png");
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 5F);
GL11.glScalef(1.0F, -1F, -1F);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(90f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(180f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(270f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
boolean lre = false;
if (liquid != null && liquid.amount > 0)
{
int[] displayList = LiquidRenderer.getLiquidDisplayLists(liquid, tileEntity.worldObj, false);
if (displayList != null)
{
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_LIGHTING);
@ -59,15 +47,29 @@ public class RenderTank extends TileEntitySpecialRenderer
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTextureByName(LiquidRenderer.getLiquidSheet(liquid));
// GL11.glTranslatef((float) -0.475F, (float) -1.5F, (float) -0.475F);
GL11.glScalef(0.6F, 0.999F, 0.6F);
GL11.glTranslatef((float) x + 0.025F, (float) y, (float) z + 0.025F);
GL11.glScalef(0.87F, 0.999F, 0.87F);
GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getCapacity()) * (LiquidRenderer.DISPLAY_STAGES - 1))]);
GL11.glPopAttrib();
GL11.glPopMatrix();
lre = true;
}
}
bindTextureByName(FluidMech.MODEL_TEXTURE_DIRECTORY + "TankSide.png");
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(90f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(180f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
GL11.glRotatef(270f, 0f, 1f, 0f);
model.render(0.0625F, false, false, false, false);
GL11.glPopMatrix();
}

View file

@ -226,7 +226,7 @@ public class TileEntityTank extends TileEntityFluidDevice implements ITankContai
int[] previousConnections = this.renderConnection.clone();
this.connectedBlocks = new TileEntity[6];
for (int i = 2; i < 6; i++)
for (int i = 0; i < 6; i++)
{
ForgeDirection dir = ForgeDirection.getOrientation(i);
this.validateConnectionSide(this.worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ), dir);