Some minor improvements to the Engine Renderer
Note: it still needs to be rewritten to use a single texture sheet.
This commit is contained in:
parent
d2e7279498
commit
52ffd07bb3
1 changed files with 46 additions and 47 deletions
|
@ -1,12 +1,10 @@
|
|||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
|
||||
* 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.energy.render;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
|
@ -25,17 +23,27 @@ import buildcraft.core.IInventoryRenderer;
|
|||
import buildcraft.energy.Engine;
|
||||
import buildcraft.energy.Engine.EnergyStage;
|
||||
import buildcraft.energy.IEngineProvider;
|
||||
import static net.minecraftforge.common.ForgeDirection.*;
|
||||
|
||||
public class RenderEngine extends TileEntitySpecialRenderer implements IInventoryRenderer {
|
||||
|
||||
private ModelBase model = new ModelBase() {
|
||||
};
|
||||
|
||||
private ModelRenderer box;
|
||||
private ModelRenderer trunk;
|
||||
private ModelRenderer movingBox;
|
||||
private ModelRenderer chamber;
|
||||
private String baseTexture;
|
||||
private static final float[] angleMap = new float[6];
|
||||
|
||||
static {
|
||||
angleMap[EAST.ordinal()] = (float) -Math.PI / 2;
|
||||
angleMap[WEST.ordinal()] = (float) Math.PI / 2;
|
||||
angleMap[UP.ordinal()] = 0;
|
||||
angleMap[DOWN.ordinal()] = (float) Math.PI;
|
||||
angleMap[SOUTH.ordinal()] = (float) Math.PI / 2;
|
||||
angleMap[NORTH.ordinal()] = (float) -Math.PI / 2;
|
||||
}
|
||||
|
||||
public RenderEngine() {
|
||||
|
||||
|
@ -88,11 +96,16 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
|||
|
||||
private void render(EnergyStage energy, float progress, ForgeDirection orientation, String baseTexture, double x, double y, double z) {
|
||||
|
||||
if (BuildCraftCore.render == RenderMode.NoDynamic)
|
||||
if (BuildCraftCore.render == RenderMode.NoDynamic) {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(2896 /* GL_LIGHTING */);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
|
||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||
|
||||
|
@ -104,35 +117,21 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
|||
step = progress * 2F * 7.99F;
|
||||
}
|
||||
|
||||
float[] angle = { 0, 0, 0 };
|
||||
float[] translate = { 0, 0, 0 };
|
||||
float translatefact = step / 16;
|
||||
|
||||
float[] angle = {0, 0, 0};
|
||||
float[] translate = {orientation.offsetX, orientation.offsetY, orientation.offsetZ};
|
||||
|
||||
switch (orientation) {
|
||||
case EAST:
|
||||
angle[2] = (float) -Math.PI / 2;
|
||||
translate[0] = 1;
|
||||
break;
|
||||
case WEST:
|
||||
angle[2] = (float) Math.PI / 2;
|
||||
translate[0] = -1;
|
||||
break;
|
||||
case UP:
|
||||
translate[1] = 1;
|
||||
break;
|
||||
case DOWN:
|
||||
angle[2] = (float) Math.PI;
|
||||
translate[1] = -1;
|
||||
angle[2] = angleMap[orientation.ordinal()];
|
||||
break;
|
||||
case SOUTH:
|
||||
angle[0] = (float) Math.PI / 2;
|
||||
translate[2] = 1;
|
||||
break;
|
||||
case NORTH:
|
||||
angle[0] = (float) -Math.PI / 2;
|
||||
translate[2] = -1;
|
||||
angle[0] = angleMap[orientation.ordinal()];
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
box.rotateAngleX = angle[0];
|
||||
|
@ -195,7 +194,7 @@ public class RenderEngine extends TileEntitySpecialRenderer implements IInventor
|
|||
|
||||
trunk.render(factor);
|
||||
|
||||
GL11.glEnable(2896 /* GL_LIGHTING */);
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue