Merge pull request #182 from unpairedbracket/transmitter-render

Transmitter rendering improvements
This commit is contained in:
Aidan 2013-07-08 09:04:02 -07:00
commit 6fc93bb0fd
9 changed files with 171 additions and 120 deletions

View file

@ -10,61 +10,96 @@ import net.minecraftforge.common.ForgeDirection;
@SideOnly(Side.CLIENT)
public class ModelTransmitter extends ModelBase
{
ModelRenderer Center;
ModelRenderer Up;
ModelRenderer Down;
ModelRenderer Front;
ModelRenderer Back;
ModelRenderer Left;
ModelRenderer Right;
ModelRenderer UpOn;
ModelRenderer DownOn;
ModelRenderer FrontOn;
ModelRenderer BackOn;
ModelRenderer LeftOn;
ModelRenderer RightOn;
ModelRenderer UpOff;
ModelRenderer DownOff;
ModelRenderer FrontOff;
ModelRenderer BackOff;
ModelRenderer LeftOff;
ModelRenderer RightOff;
public ModelTransmitter()
{
textureWidth = 64;
textureHeight = 64;
Center = new ModelRenderer(this, 0, 0);
Center.addBox(0F, 0F, 0F, 6, 6, 6);
Center.setRotationPoint(-3F, 13F, -3F);
Center.setTextureSize(64, 64);
Center.mirror = true;
setRotation(Center, 0F, 0F, 0F);
Up = new ModelRenderer(this, 0, 13);
Up.addBox(0F, 0F, 0F, 6, 5, 6);
Up.setRotationPoint(-3F, 8F, -3F);
Up.setTextureSize(64, 64);
Up.mirror = true;
setRotation(Up, 0F, 0F, 0F);
Down = new ModelRenderer(this, 26, 13);
Down.addBox(0F, 0F, 0F, 6, 5, 6);
Down.setRotationPoint(-3F, 19F, -3F);
Down.setTextureSize(64, 64);
Down.mirror = true;
setRotation(Down, 0F, 0F, 0F);
Front = new ModelRenderer(this, 0, 26);
Front.addBox(0F, 0F, 0F, 5, 6, 6);
Front.setRotationPoint(-3F, 13F, -3F);
Front.setTextureSize(64, 64);
Front.mirror = true;
setRotation(Front, 0F, 1.570796F, 0F);
Back = new ModelRenderer(this, 0, 41);
Back.addBox(0F, 0F, 0F, 5, 6, 6);
Back.setRotationPoint(-3F, 13F, 8F);
Back.setTextureSize(64, 64);
Back.mirror = true;
setRotation(Back, 0F, 1.570796F, 0F);
Left = new ModelRenderer(this, 26, 0);
Left.addBox(0F, 0F, 0F, 6, 5, 6);
Left.setRotationPoint(3F, 19F, 3F);
Left.setTextureSize(64, 64);
Left.mirror = true;
setRotation(Left, 1.570796F, 1.570796F, 0F);
Right = new ModelRenderer(this, 26, 26);
Right.addBox(0F, 0F, 0F, 6, 5, 6);
Right.setRotationPoint(-8F, 19F, 3F);
Right.setTextureSize(64, 64);
Right.mirror = true;
setRotation(Right, 1.570796F, 1.570796F, 0F);
UpOn = new ModelRenderer(this, 0, 13);
UpOn.addBox(0F, 0F, 0F, 6, 5, 6);
UpOn.setRotationPoint(-3F, 8F, -3F);
UpOn.setTextureSize(64, 64);
UpOn.mirror = true;
setRotation(UpOn, 0F, 0F, 0F);
DownOn = new ModelRenderer(this, 26, 13);
DownOn.addBox(0F, 0F, 0F, 6, 5, 6);
DownOn.setRotationPoint(-3F, 19F, -3F);
DownOn.setTextureSize(64, 64);
DownOn.mirror = true;
setRotation(DownOn, 0F, 0F, 0F);
FrontOn = new ModelRenderer(this, 0, 26);
FrontOn.addBox(0F, 0F, 0F, 5, 6, 6);
FrontOn.setRotationPoint(-3F, 13F, -3F);
FrontOn.setTextureSize(64, 64);
FrontOn.mirror = true;
setRotation(FrontOn, 0F, 1.570796F, 0F);
BackOn = new ModelRenderer(this, 0, 41);
BackOn.addBox(0F, 0F, 0F, 5, 6, 6);
BackOn.setRotationPoint(-3F, 13F, 8F);
BackOn.setTextureSize(64, 64);
BackOn.mirror = true;
setRotation(BackOn, 0F, 1.570796F, 0F);
LeftOn = new ModelRenderer(this, 26, 0);
LeftOn.addBox(0F, 0F, 0F, 6, 5, 6);
LeftOn.setRotationPoint(3F, 19F, 3F);
LeftOn.setTextureSize(64, 64);
LeftOn.mirror = true;
setRotation(LeftOn, 1.570796F, 1.570796F, 0F);
RightOn = new ModelRenderer(this, 26, 26);
RightOn.addBox(0F, 0F, 0F, 6, 5, 6);
RightOn.setRotationPoint(-8F, 19F, 3F);
RightOn.setTextureSize(64, 64);
RightOn.mirror = true;
setRotation(RightOn, 1.570796F, 1.570796F, 0F);
UpOff = new ModelRenderer(this, 0, 0);
UpOff.addBox(0F, 0F, 0F, 6, 0, 6);
UpOff.setRotationPoint(-3F, 13F, -3F);
UpOff.setTextureSize(64, 64);
UpOff.mirror = true;
setRotation(UpOff, 0F, 0F, 0F);
DownOff = new ModelRenderer(this, 0, 0);
DownOff.addBox(0F, 0F, 0F, 6, 0, 6);
DownOff.setRotationPoint(-3F, 19F, -3F);
DownOff.setTextureSize(64, 64);
DownOff.mirror = true;
setRotation(DownOff, 0F, 0F, 0F);
FrontOff = new ModelRenderer(this, 0, 0);
FrontOff.addBox(0F, 0F, 0F, 0, 6, 6);
FrontOff.setRotationPoint(-3F, 13F, -3F);
FrontOff.setTextureSize(64, 64);
FrontOff.mirror = true;
setRotation(FrontOff, 0F, 1.570796F, 0F);
BackOff = new ModelRenderer(this, 0, 0);
BackOff.addBox(0F, 0F, 0F, 0, 6, 6);
BackOff.setRotationPoint(-3F, 13F, 3F);
BackOff.setTextureSize(64, 64);
BackOff.mirror = true;
setRotation(BackOff, 0F, 1.570796F, 0F);
LeftOff = new ModelRenderer(this, 0, 0);
LeftOff.addBox(0F, 0F, 0F, 6, 0, 6);
LeftOff.setRotationPoint(3F, 19F, 3F);
LeftOff.setTextureSize(64, 64);
LeftOff.mirror = true;
setRotation(LeftOff, 1.570796F, 1.570796F, 0F);
RightOff = new ModelRenderer(this, 0, 0);
RightOff.addBox(0F, 0F, 0F, 6, 0, 6);
RightOff.setRotationPoint(-3F, 19F, 3F);
RightOff.setTextureSize(64, 64);
RightOff.mirror = true;
setRotation(RightOff, 1.570796F, 1.570796F, 0F);
}
@Override
@ -73,38 +108,64 @@ public class ModelTransmitter extends ModelBase
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Center.render(0.0625F);
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
renderSide(orientation);
renderSide(orientation, true);
}
}
public void renderSide(ForgeDirection orientation)
public void renderSide(ForgeDirection orientation, boolean on)
{
switch (orientation)
if(on)
{
case DOWN:
Down.render(0.0625F);
break;
case UP:
Up.render(0.0625F);
break;
case NORTH:
Back.render(0.0625F);
break;
case SOUTH:
Front.render(0.0625F);
break;
case WEST:
Right.render(0.0625F);
break;
case EAST:
Left.render(0.0625F);
break;
default:
return;
switch (orientation)
{
case DOWN:
DownOn.render(0.0625F);
break;
case UP:
UpOn.render(0.0625F);
break;
case NORTH:
BackOn.render(0.0625F);
break;
case SOUTH:
FrontOn.render(0.0625F);
break;
case WEST:
RightOn.render(0.0625F);
break;
case EAST:
LeftOn.render(0.0625F);
break;
default:
return;
}
} else
{
switch (orientation)
{
case DOWN:
DownOff.render(0.0625F);
break;
case UP:
UpOff.render(0.0625F);
break;
case NORTH:
BackOff.render(0.0625F);
break;
case SOUTH:
FrontOff.render(0.0625F);
break;
case WEST:
RightOff.render(0.0625F);
break;
case EAST:
LeftOff.render(0.0625F);
break;
default:
return;
}
}
}

View file

@ -45,13 +45,9 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
for(int i = 0; i < 6; i++)
{
if(connectable[i])
{
model.renderSide(ForgeDirection.getOrientation(i));
}
model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
}
model.Center.render(0.0625F);
GL11.glPopMatrix();
if(tileEntity.liquidScale > 0 && tileEntity.refLiquid != null)

View file

@ -66,46 +66,42 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
{
for(int i = 0; i < 6; i++)
{
if(connectable[i])
TileEntity sideTile = Object3D.get(tileEntity).getFromSide(ForgeDirection.getOrientation(i)).getTileEntity(tileEntity.worldObj);
if(sideTile instanceof TileEntityGasTank && i != 0 && i != 1)
{
TileEntity sideTile = Object3D.get(tileEntity).getFromSide(ForgeDirection.getOrientation(i)).getTileEntity(tileEntity.worldObj);
GL11.glPushMatrix();
if(sideTile instanceof TileEntityGasTank && i != 0 && i != 1)
switch(ForgeDirection.getOrientation(i))
{
GL11.glPushMatrix();
switch(ForgeDirection.getOrientation(i))
{
case NORTH:
GL11.glScalef(1, 1, 1.63f);
GL11.glTranslatef(0, 0, -.073f);
break;
case SOUTH:
GL11.glScalef(1, 1, 1.63f);
GL11.glTranslatef(0, 0, .073f);
break;
case WEST:
GL11.glScalef(1.63f, 1, 1);
GL11.glTranslatef(.073f, 0, 0);
break;
case EAST:
GL11.glScalef(1.63f, 1, 1);
GL11.glTranslatef(-.073f, 0, 0);
break;
}
model.renderSide(ForgeDirection.getOrientation(i));
GL11.glPopMatrix();
}
else {
model.renderSide(ForgeDirection.getOrientation(i));
case NORTH:
GL11.glScalef(1, 1, 1.63f);
GL11.glTranslatef(0, 0, -.073f);
break;
case SOUTH:
GL11.glScalef(1, 1, 1.63f);
GL11.glTranslatef(0, 0, .073f);
break;
case WEST:
GL11.glScalef(1.63f, 1, 1);
GL11.glTranslatef(.073f, 0, 0);
break;
case EAST:
GL11.glScalef(1.63f, 1, 1);
GL11.glTranslatef(-.073f, 0, 0);
break;
}
model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
GL11.glPopMatrix();
}
else {
model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
}
}
}
model.Center.render(0.0625F);
GL11.glPopMatrix();
if(tileEntity.gasScale > 0 && tileEntity.refGas != null && tileEntity.refGas.hasTexture())

View file

@ -42,14 +42,9 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
for(int i = 0; i < 6; i++)
{
if(connectable[i])
{
model.renderSide(ForgeDirection.getOrientation(i));
}
model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
}
model.Center.render(0.0625F);
GL11.glPopMatrix();
if(Mekanism.fancyUniversalCableRender)

View file

@ -36,9 +36,12 @@ public class TransmitterRenderer implements ISimpleBlockRenderingHandler
break;
}
transmitter.Center.render(0.0625F);
transmitter.Up.render(0.0625F);
transmitter.Down.render(0.0625F);
transmitter.UpOn.render(0.0625F);
transmitter.DownOn.render(0.0625F);
transmitter.BackOff.render(0.0625F);
transmitter.FrontOff.render(0.0625F);
transmitter.LeftOff.render(0.0625F);
transmitter.RightOff.render(0.0625F);
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB