moved all textures to stack-based system

This commit is contained in:
MachineMuse 2013-05-20 19:04:56 -06:00
parent dd1ff05c9f
commit 8001699495
9 changed files with 19 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

View file

@ -105,7 +105,7 @@ public class RadialIndicator {
// Draw background
GL11.glDrawArrays(GL11.GL_QUAD_STRIP, 0, textures.limit() / 2);
MuseRenderer.getRenderEngine().bindTexture(textureFile);
MuseRenderer.pushTexture(textureFile);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glColorPointer(4, 0, foreground);
@ -115,6 +115,7 @@ public class RadialIndicator {
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
MuseRenderer.arraysOff();
MuseRenderer.popTexture();
MuseRenderer.blendingOff();
GL11.glEnable(GL11.GL_CULL_FACE);

View file

@ -4,7 +4,6 @@ import net.machinemuse.general.geometry.Colour;
import net.machinemuse.powersuits.common.Config;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Icon;
import org.lwjgl.opengl.GL11;
@ -39,7 +38,7 @@ public class HeatMeter {
}
public void drawGlass(double xpos, double ypos) {
Minecraft.getMinecraft().renderEngine.bindTexture(Config.GLASS_TEXTURE);
MuseRenderer.pushTexture(Config.GLASS_TEXTURE);
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2d(0, 0);
GL11.glVertex2d(xpos, ypos);
@ -50,5 +49,6 @@ public class HeatMeter {
GL11.glTexCoord2d(1, 0);
GL11.glVertex2d(xpos + xsize, ypos);
GL11.glEnd();
MuseRenderer.popTexture();
}
}

View file

@ -28,7 +28,7 @@ public class ClickableKeybinding extends ClickableButton {
super(parseName(keybind), position, true);
this.keybind = keybind;
this.position = position;
this.boundModules = new ArrayList();
this.boundModules = new ArrayList<ClickableModule>();
this.enabled = free;
}

View file

@ -40,7 +40,7 @@ public class RenderLuxCapacitorTESR extends TileEntitySpecialRenderer implements
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
MuseRenderer.getRenderEngine().bindTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
this.bindTextureByName(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
glPushMatrix();
glTranslated(x + 0.5, y + 0.5, z + 0.5);
double scale = 0.0625;
@ -82,11 +82,10 @@ public class RenderLuxCapacitorTESR extends TileEntitySpecialRenderer implements
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
this.bindTextureByName(Config.TINKERTABLE_TEXTURE_PATH);
this.bindTextureByName(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
GL11.glPushMatrix();
GL11.glTranslated(-0.5, -0.5 + -1.0 / 16.0, -0.5);
MuseRenderer.getRenderEngine().bindTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
glPushMatrix();
double scale = 0.0625;
glScaled(scale, scale, scale);

View file

@ -29,7 +29,7 @@ public class RenderLuxCapacitorEntity extends Render {
@Override
public void doRender(Entity entity, double x, double y, double z, float yaw, float partialTickTime) {
MuseRenderer.getRenderEngine().bindTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
MuseRenderer.pushTexture(Config.TEXTURE_PREFIX + "models/thusters_uvw_2.png");
glPushMatrix();
glTranslated(x, y, z);
double scale = 0.0625;
@ -39,6 +39,7 @@ public class RenderLuxCapacitorEntity extends Render {
getLightModel().renderAll();
MuseRenderer.glowOff();
glPopMatrix();
MuseRenderer.popTexture();
}
}

View file

@ -15,7 +15,7 @@ public class RenderSpinningBlade extends Render {
glPushMatrix();
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_CULL_FACE);
MuseRenderer.getRenderEngine().bindTexture(Config.TEXTURE_PREFIX + "items/spinningblade.png");
MuseRenderer.pushTexture(Config.TEXTURE_PREFIX + "items/spinningblade.png");
glTranslated(x, y, z);
double motionscale = Math.sqrt(entity.motionZ * entity.motionZ + entity.motionX * entity.motionX);
glRotatef(90, 1, 0, 0);
@ -36,6 +36,7 @@ public class RenderSpinningBlade extends Render {
glVertex3d(1, -1, 0);
glEnd();
MuseRenderer.popTexture();
glPopAttrib();
glPopMatrix();
}

View file

@ -13,7 +13,6 @@ import net.machinemuse.powersuits.common.Config;
import net.machinemuse.powersuits.powermodule.weapon.PlasmaCannonModule;
import net.machinemuse.utils.MuseItemUtils;
import net.machinemuse.utils.render.MuseRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
@ -368,7 +367,8 @@ public class ToolModel extends ModelBase {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
GL11.glDisable(GL11.GL_CULL_FACE);
Minecraft.getMinecraft().renderEngine.bindTexture(Config.SEBK_TOOL_TEXTURE);
MuseRenderer.pushTexture(Config.SEBK_TOOL_TEXTURE);
if (c1 != null) {
c1.doGL();
@ -455,6 +455,7 @@ public class ToolModel extends ModelBase {
GL11.glPopMatrix();
}
MuseRenderer.glowOff();
MuseRenderer.popTexture();
GL11.glPopMatrix();
GL11.glPopAttrib();
GL11.glPopMatrix();

View file

@ -65,10 +65,12 @@ public abstract class MuseRenderer {
public static void pushTexture(String filename) {
texturestack.push(TEXTURE_MAP);
TEXTURE_MAP = filename;
getRenderEngine().bindTexture(TEXTURE_MAP);
}
public static void popTexture() {
TEXTURE_MAP = texturestack.pop();
getRenderEngine().bindTexture(TEXTURE_MAP);
}
/**
@ -321,7 +323,6 @@ public abstract class MuseRenderer {
if (colour != null) {
colour.doGL();
}
getRenderEngine().bindTexture(TEXTURE_MAP);
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
float u1 = icon.getMinU();
@ -599,7 +600,7 @@ public abstract class MuseRenderer {
double jagfactor = 0.3;
on2D();
GL11.glEnable(GL11.GL_DEPTH_TEST);
getRenderEngine().bindTexture(Config.LIGHTNING_TEXTURE);
pushTexture(Config.LIGHTNING_TEXTURE);
blendingOn();
colour.doGL();
GL11.glBegin(GL11.GL_QUADS);
@ -624,7 +625,7 @@ public abstract class MuseRenderer {
}
public static void drawLightningBetweenPoints(double x1, double y1, double z1, double x2, double y2, double z2, int index) {
getRenderEngine().bindTexture(Config.LIGHTNING_TEXTURE);
pushTexture(Config.LIGHTNING_TEXTURE);
double u1 = index / 50.0;
double u2 = u1 + 0.02;
double px = (y1 - y2) * 0.125;
@ -637,6 +638,7 @@ public abstract class MuseRenderer {
GL11.glVertex3d(x2 - px, y2 - py, z2);
GL11.glTexCoord2d(u2, 1);
GL11.glVertex3d(x2 + px, y2 + py, z2);
popTexture();
}
public static void drawLightningBetweenPointsFast(double x1, double y1, double z1, double x2, double y2, double z2, int index) {