From 43edfefa6eda29125e8891139c9f91428f45c6ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Tue, 10 Feb 2015 02:32:55 +0100 Subject: [PATCH] Potential rendering improvements (mostly stuff discovered while porting to 1.8 that didn't seem to have an effect in 1.7, but can't hurt to clean up). --- src/main/scala/li/cil/oc/client/gui/Assembler.scala | 2 +- src/main/scala/li/cil/oc/client/gui/Disassembler.scala | 1 - src/main/scala/li/cil/oc/client/gui/Drone.scala | 10 +--------- .../li/cil/oc/client/gui/DynamicGuiContainer.scala | 5 +++++ src/main/scala/li/cil/oc/client/gui/Raid.scala | 1 - src/main/scala/li/cil/oc/client/gui/Robot.scala | 10 +--------- 6 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/main/scala/li/cil/oc/client/gui/Assembler.scala b/src/main/scala/li/cil/oc/client/gui/Assembler.scala index 5e280ef7c..a92a1e042 100644 --- a/src/main/scala/li/cil/oc/client/gui/Assembler.scala +++ b/src/main/scala/li/cil/oc/client/gui/Assembler.scala @@ -101,12 +101,12 @@ class Assembler(playerInventory: InventoryPlayer, val assembler: tileentity.Asse override def drawGuiContainerBackgroundLayer(dt: Float, mouseX: Int, mouseY: Int) { GL11.glColor3f(1, 1, 1) // Required under Linux. - super.drawGuiContainerBackgroundLayer(dt, mouseX, mouseY) mc.renderEngine.bindTexture(Textures.guiRobotAssembler) drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize) if (assemblerContainer.isAssembling) progress.level = assemblerContainer.assemblyProgress / 100.0 else progress.level = 0 drawWidgets() + drawInventorySlots() } override protected def drawDisabledSlot(slot: ComponentSlot) {} diff --git a/src/main/scala/li/cil/oc/client/gui/Disassembler.scala b/src/main/scala/li/cil/oc/client/gui/Disassembler.scala index 7eb1fe59d..93bb8ebdd 100644 --- a/src/main/scala/li/cil/oc/client/gui/Disassembler.scala +++ b/src/main/scala/li/cil/oc/client/gui/Disassembler.scala @@ -21,7 +21,6 @@ class Disassembler(playerInventory: InventoryPlayer, val disassembler: tileentit override def drawGuiContainerBackgroundLayer(dt: Float, mouseX: Int, mouseY: Int) { GL11.glColor3f(1, 1, 1) // Required under Linux. - super.drawGuiContainerBackgroundLayer(dt, mouseX, mouseY) mc.renderEngine.bindTexture(Textures.guiDisassembler) drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize) progress.level = disassemblerContainer.disassemblyProgress / 100.0 diff --git a/src/main/scala/li/cil/oc/client/gui/Drone.scala b/src/main/scala/li/cil/oc/client/gui/Drone.scala index 1baae4c6b..bc5c81f9c 100644 --- a/src/main/scala/li/cil/oc/client/gui/Drone.scala +++ b/src/main/scala/li/cil/oc/client/gui/Drone.scala @@ -17,7 +17,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiButton import net.minecraft.client.renderer.Tessellator import net.minecraft.entity.player.InventoryPlayer -import net.minecraft.inventory.Slot import org.lwjgl.opengl.GL11 class Drone(playerInventory: InventoryPlayer, val drone: entity.Drone) extends DynamicGuiContainer(new container.Drone(playerInventory, drone)) with traits.DisplayBuffer { @@ -117,14 +116,7 @@ class Drone(playerInventory: InventoryPlayer, val drone: entity.Drone) extends D drawSelection() } - GL11.glPushMatrix() - GL11.glTranslatef(guiLeft, guiTop, 0) - for (slot <- 0 until inventorySlots.inventorySlots.size()) { - drawSlotInventory(inventorySlots.inventorySlots.get(slot).asInstanceOf[Slot]) - } - GL11.glPopMatrix() - - RenderState.makeItBlend() + drawInventorySlots() } protected override def drawGradientRect(par1: Int, par2: Int, par3: Int, par4: Int, par5: Int, par6: Int) { diff --git a/src/main/scala/li/cil/oc/client/gui/DynamicGuiContainer.scala b/src/main/scala/li/cil/oc/client/gui/DynamicGuiContainer.scala index 8e7c76a71..e60106ab8 100644 --- a/src/main/scala/li/cil/oc/client/gui/DynamicGuiContainer.scala +++ b/src/main/scala/li/cil/oc/client/gui/DynamicGuiContainer.scala @@ -55,12 +55,17 @@ abstract class DynamicGuiContainer(container: Container) extends CustomGuiContai RenderState.makeItBlend() GL11.glDisable(GL11.GL_LIGHTING) + drawInventorySlots() + } + + protected def drawInventorySlots(): Unit = { GL11.glPushMatrix() GL11.glTranslatef(guiLeft, guiTop, 0) for (slot <- 0 until inventorySlots.inventorySlots.size()) { drawSlotInventory(inventorySlots.inventorySlots.get(slot).asInstanceOf[Slot]) } GL11.glPopMatrix() + RenderState.makeItBlend() } override def drawScreen(mouseX: Int, mouseY: Int, dt: Float) { diff --git a/src/main/scala/li/cil/oc/client/gui/Raid.scala b/src/main/scala/li/cil/oc/client/gui/Raid.scala index 03693687e..91f1ecf1e 100644 --- a/src/main/scala/li/cil/oc/client/gui/Raid.scala +++ b/src/main/scala/li/cil/oc/client/gui/Raid.scala @@ -21,7 +21,6 @@ class Raid(playerInventory: InventoryPlayer, val raid: tileentity.Raid) extends override def drawGuiContainerBackgroundLayer(dt: Float, mouseX: Int, mouseY: Int) { GL11.glColor3f(1, 1, 1) // Required under Linux. - super.drawGuiContainerBackgroundLayer(dt, mouseX, mouseY) mc.renderEngine.bindTexture(Textures.guiRaid) drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize) } diff --git a/src/main/scala/li/cil/oc/client/gui/Robot.scala b/src/main/scala/li/cil/oc/client/gui/Robot.scala index 6c8244959..4d43867e1 100644 --- a/src/main/scala/li/cil/oc/client/gui/Robot.scala +++ b/src/main/scala/li/cil/oc/client/gui/Robot.scala @@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiButton import net.minecraft.client.renderer.Tessellator import net.minecraft.entity.player.InventoryPlayer -import net.minecraft.inventory.Slot import org.lwjgl.input.Keyboard import org.lwjgl.input.Mouse import org.lwjgl.opengl.GL11 @@ -159,14 +158,7 @@ class Robot(playerInventory: InventoryPlayer, val robot: tileentity.Robot) exten drawSelection() } - GL11.glPushMatrix() - GL11.glTranslatef(guiLeft, guiTop, 0) - for (slot <- 0 until inventorySlots.inventorySlots.size()) { - drawSlotInventory(inventorySlots.inventorySlots.get(slot).asInstanceOf[Slot]) - } - GL11.glPopMatrix() - - RenderState.makeItBlend() + drawInventorySlots() } protected override def drawGradientRect(par1: Int, par2: Int, par3: Int, par4: Int, par5: Int, par6: Int) {