Fixed up transformer render

This commit is contained in:
Calclavia 2014-01-30 22:27:54 +08:00
parent 98dc4cd0f0
commit adf6fd9127
3 changed files with 27 additions and 9 deletions

View file

@ -49,10 +49,13 @@ public class PartTransformer extends JCuboidPart implements JNormalOcclusion, TF
/** Side of the block this is placed on. */
public ForgeDirection placementSide;
/** The relative direction this block faces. */
public byte facing = 0;
/** Step the voltage up */
private boolean stepUp;
/** Amount to mulitply the step by (up x2. down /2) */
public int multiplier = 2;

View file

@ -18,21 +18,15 @@ public class RenderTransformer
public static final RenderTransformer INSTANCE = new RenderTransformer();
public static final WavefrontObject MODEL = (WavefrontObject) AdvancedModelLoader.loadModel(Reference.MODEL_DIRECTORY + "transformer.obj");
public static final ResourceLocation TEXTURE_COIL = new ResourceLocation(Reference.DOMAIN, Reference.BLOCK_TEXTURE_DIRECTORY + "models/wire.png");
public static final ResourceLocation TEXTURE_COIL = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "transformer_winding.png");
public static final ResourceLocation TEXTURE_STONE = new ResourceLocation(Reference.BLOCK_TEXTURE_DIRECTORY + "stone.png");
public static final ResourceLocation TEXTURE_IRON = new ResourceLocation(Reference.BLOCK_TEXTURE_DIRECTORY + "iron_block.png");
public void doRender()
{
GL11.glScalef(0.5f, 0.5f, 0.5f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_COIL);
GL11.glColor4f(0.72f, .45f, 0.2f, 1);
MODEL.renderOnly("InsulatorLayerHigh", "InsulatorLayerMed", "InsulatorLayerLow");
MODEL.renderOnly("OuterWindingConnector", "OuterWindingHigh", "OuterWindingMed", "OuterWindingLow");
MODEL.renderOnly("InnerWindingConnector", "InnerWindingHigh", "InnerWindingMed", "InnerWindingLow");
GL11.glColor4f(1, 1, 1, 1);
MODEL.renderAllExcept("core", "base");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_IRON);
MODEL.renderOnly("core");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_STONE);
@ -46,7 +40,28 @@ public class RenderTransformer
RenderUtility.rotateFaceBlockToSide(part.placementSide);
GL11.glRotatef(90, 0, 1, 0);
RenderUtility.rotateBlockBasedOnDirection(part.getFacing());
doRender();
GL11.glScalef(0.5f, 0.5f, 0.5f);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_COIL);
switch (part.multiplier)
{
case 0:
MODEL.renderOnly("InsulatorLayerLow", "OuterWindingLowBox", "InnerWindingLowBox");
break;
case 1:
MODEL.renderOnly("InsulatorLayerMed", "OuterWindingMedBox", "InnerWindingMedBox");
break;
case 2:
MODEL.renderOnly("InnerWindingHighBox", "InsulatorLayerHigh", "OuterWindingHighBox");
break;
}
MODEL.renderOnly("OuterWindingConnector", "InnerWindingConnector");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_IRON);
MODEL.renderOnly("core");
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE_STONE);
MODEL.renderOnly("base");
GL11.glPopMatrix();
}
}