From 2006e31a715391312d110d9ff68dcebe7638502f Mon Sep 17 00:00:00 2001 From: Sen Date: Sat, 30 Aug 2025 21:00:34 +0200 Subject: [PATCH] experimental new rendering --- client/src/main/java/client/Client.java | 271 ++++---- client/src/main/java/client/gui/Font.java | 6 +- client/src/main/java/client/gui/Gui.java | 12 +- client/src/main/java/client/gui/GuiMenu.java | 12 +- .../java/client/gui/character/GuiChar.java | 28 +- .../client/gui/container/GuiContainer.java | 22 +- .../client/gui/container/GuiMerchant.java | 6 +- .../main/java/client/gui/element/Element.java | 6 +- .../main/java/client/gui/element/Textbox.java | 6 +- .../main/java/client/init/RenderRegistry.java | 1 - .../client/renderer/DefaultVertexFormats.java | 63 -- .../main/java/client/renderer/Drawing.java | 316 +++++---- .../java/client/renderer/EffectRenderer.java | 16 +- .../main/java/client/renderer/Frustum.java | 6 +- .../main/java/client/renderer/GlState.java | 437 ++----------- .../java/client/renderer/ItemRenderer.java | 263 ++------ .../java/client/renderer/MatrixState.java | 8 +- .../main/java/client/renderer/Project.java | 8 +- .../client/renderer/RegionRenderCache.java | 2 +- .../renderer/RegionRenderCacheBuilder.java | 11 - .../java/client/renderer/RenderBuffer.java | 612 ++++++------------ .../main/java/client/renderer/Renderer.java | 593 +++++++---------- .../src/main/java/client/renderer/Shader.java | 163 +++-- .../java/client/renderer/Tessellator.java | 93 --- .../java/client/renderer/VertexBuffer.java | 56 +- .../java/client/renderer/VertexFormat.java | 200 ------ .../client/renderer/VertexFormatElement.java | 84 --- .../renderer/blockmodel/FaceBakery.java | 15 +- .../renderer/chunk/ChunkRenderDispatcher.java | 5 +- .../client/renderer/chunk/RenderChunk.java | 31 +- .../renderer/entity/RenderArachnoid.java | 8 +- .../client/renderer/entity/RenderArrow.java | 34 +- .../client/renderer/entity/RenderBat.java | 8 +- .../renderer/entity/RenderBlockEntity.java | 12 +- .../client/renderer/entity/RenderBoat.java | 18 +- .../client/renderer/entity/RenderBullet.java | 32 +- .../client/renderer/entity/RenderCat.java | 4 +- .../client/renderer/entity/RenderCrystal.java | 8 +- .../client/renderer/entity/RenderDie.java | 12 +- .../client/renderer/entity/RenderEntity.java | 69 +- .../renderer/entity/RenderEntityItem.java | 30 +- .../renderer/entity/RenderFallingBlock.java | 12 +- .../renderer/entity/RenderFireball.java | 16 +- .../client/renderer/entity/RenderFish.java | 18 +- .../renderer/entity/RenderFlyingBox.java | 12 +- .../client/renderer/entity/RenderHorse.java | 4 +- .../renderer/entity/RenderHumanoid.java | 4 +- .../client/renderer/entity/RenderItem.java | 118 ++-- .../renderer/entity/RenderItemEntity.java | 14 +- .../renderer/entity/RenderLeashKnot.java | 10 +- .../renderer/entity/RenderLightning.java | 6 +- .../client/renderer/entity/RenderLiving.java | 8 +- .../client/renderer/entity/RenderManager.java | 38 +- .../renderer/entity/RenderMinecart.java | 30 +- .../client/renderer/entity/RenderSlime.java | 7 +- .../renderer/entity/RenderSpaceMarine.java | 4 +- .../renderer/entity/RenderTntMinecart.java | 51 -- .../renderer/entity/RenderTntPrimed.java | 16 +- .../java/client/renderer/entity/RenderXp.java | 18 +- .../renderer/entity/RendererLivingEntity.java | 87 +-- .../client/renderer/layers/LayerArmor.java | 43 +- .../client/renderer/layers/LayerArrow.java | 8 +- .../client/renderer/layers/LayerCape.java | 18 +- .../client/renderer/layers/LayerCharge.java | 22 +- .../renderer/layers/LayerEntityBreak.java | 76 --- .../client/renderer/layers/LayerExtra.java | 46 +- .../client/renderer/layers/LayerHeldItem.java | 10 +- .../client/renderer/layers/LayerSlimeGel.java | 40 -- .../client/renderer/model/ModelArachnoid.java | 12 +- .../client/renderer/model/ModelBiped.java | 8 +- .../java/client/renderer/model/ModelCat.java | 18 +- .../client/renderer/model/ModelChicken.java | 16 +- .../client/renderer/model/ModelCrystal.java | 28 +- .../client/renderer/model/ModelDragon.java | 34 +- .../java/client/renderer/model/ModelFox.java | 16 +- .../client/renderer/model/ModelHorse.java | 28 +- .../client/renderer/model/ModelHumanoid.java | 8 +- .../client/renderer/model/ModelMouse.java | 10 +- .../client/renderer/model/ModelQuadruped.java | 16 +- .../client/renderer/model/ModelRabbit.java | 16 +- .../client/renderer/model/ModelRenderer.java | 70 +- .../java/client/renderer/model/ModelWolf.java | 16 +- .../client/renderer/model/TexturedQuad.java | 4 +- .../java/client/renderer/texture/Texture.java | 4 +- .../client/renderer/texture/TextureMap.java | 4 +- .../client/renderer/texture/TextureUtil.java | 18 +- .../renderer/tileentity/DisplayRenderer.java | 14 +- .../renderer/tileentity/ItemPipeRenderer.java | 14 +- .../renderer/tileentity/SignRenderer.java | 32 +- .../renderer/tileentity/SpecialRenderer.java | 4 +- .../src/main/resources/shaders/ui_color.fsh | 7 + .../src/main/resources/shaders/ui_color.vsh | 13 + .../src/main/resources/shaders/ui_texture.fsh | 10 + .../src/main/resources/shaders/ui_texture.vsh | 15 + .../main/java/common/world/IWorldAccess.java | 2 +- common/src/main/java/common/world/World.java | 2 +- 96 files changed, 1658 insertions(+), 3104 deletions(-) delete mode 100755 client/src/main/java/client/renderer/DefaultVertexFormats.java delete mode 100755 client/src/main/java/client/renderer/RegionRenderCacheBuilder.java delete mode 100755 client/src/main/java/client/renderer/Tessellator.java delete mode 100755 client/src/main/java/client/renderer/VertexFormat.java delete mode 100755 client/src/main/java/client/renderer/VertexFormatElement.java delete mode 100755 client/src/main/java/client/renderer/entity/RenderTntMinecart.java delete mode 100755 client/src/main/java/client/renderer/layers/LayerEntityBreak.java delete mode 100755 client/src/main/java/client/renderer/layers/LayerSlimeGel.java create mode 100644 client/src/main/resources/shaders/ui_color.fsh create mode 100644 client/src/main/resources/shaders/ui_color.vsh create mode 100644 client/src/main/resources/shaders/ui_texture.fsh create mode 100644 client/src/main/resources/shaders/ui_texture.vsh diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index 3f5a9e80..937d2fe0 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -30,7 +30,7 @@ import javax.imageio.ImageIO; import javax.swing.JFileChooser; import org.lwjgl.opengl.GL; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.audio.AudioInterface; import client.audio.MidiBank; @@ -428,8 +428,8 @@ public class Client implements IThreadListener { Client.this.renderer.checkBlockLight(pos); } - public int getCombinedLight(BlockPos pos) { - return Client.this.renderer.getCombinedLight(pos); + public int getWorldLight(BlockPos pos) { + return Client.this.renderer.getWorldLight(pos); } } @@ -889,20 +889,21 @@ public class Client implements IThreadListener { this.textureManager = new TextureManager(); this.textureManager.onReload(); this.soundManager = new SoundManager(this); - Log.RENDER.debug("Maximale Anisotropie: %.1f", this.anisotropyMax = GL46.glGetFloat(GL46.GL_MAX_TEXTURE_MAX_ANISOTROPY)); - Log.RENDER.debug("Maximale Texturgröße: %d", GL46.glGetInteger(GL46.GL_MAX_TEXTURE_SIZE)); - GlState.enableTexture2D(); - GlState.shadeModel(GL46.GL_SMOOTH); - GL46.glClearDepth(1.0D); - GlState.enableDepth(); - GlState.depthFunc(GL46.GL_LEQUAL); - GlState.enableAlpha(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); - GlState.cullFace(GL46.GL_BACK); - GlState.enableCull(); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + Log.RENDER.debug("Maximale Anisotropie: %.1f", this.anisotropyMax = GL46C.glGetFloat(GL46C.GL_MAX_TEXTURE_MAX_ANISOTROPY)); + Log.RENDER.debug("Maximale Texturgröße: %d", GL46C.glGetInteger(GL46C.GL_MAX_TEXTURE_SIZE)); +// GlState.enableTexture2D(); +// GlState.shadeModel(GL46C.GL_SMOOTH); + GL46C.glActiveTexture(GL46C.GL_TEXTURE0); + GL46C.glClearDepth(1.0D); +// GlState.enableDepth(); + GlState.depthFunc(GL46C.GL_LEQUAL); +// GlState.enableAlpha(); +// GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); + GlState.cullFace(GL46C.GL_BACK); +// GlState.enableCull(); +// GL46C.glMatrixMode(GL46C.GL_PROJECTION); +// GL46C.glLoadIdentity(); +// GL46C.glMatrixMode(GL46C.GL_MODELVIEW); this.textureMap = new TextureMap(); this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap); this.updateTexture(); @@ -1131,13 +1132,13 @@ public class Client implements IThreadListener { } public void render() { - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA); GlState.enableDepth(); GlState.clearColor(0.0f, 0.0f, 0.0f, 1.0f); - GL46.glClear(GL46.GL_COLOR_BUFFER_BIT | GL46.GL_DEPTH_BUFFER_BIT); + GL46C.glClear(GL46C.GL_COLOR_BUFFER_BIT | GL46C.GL_DEPTH_BUFFER_BIT); if(this.wireframe) { - GL46.glLineWidth(1.0f); - GL46.glPolygonMode(GL46.GL_FRONT_AND_BACK, GL46.GL_LINE); + GL46C.glLineWidth(1.0f); + GL46C.glPolygonMode(GL46C.GL_FRONT_AND_BACK, GL46C.GL_LINE); } if(this.open == null) { if(this.player != null && this.viewEntity == this.player) @@ -1150,18 +1151,18 @@ public class Client implements IThreadListener { this.soundManager.setListener(this.player, (float)this.tickFraction); if(this.player != null && (this.player.isEntityInsideOpaqueBlock() || this.viewEntity != this.player)) this.thirdPersonView = 0; - GL46.glPushMatrix(); - GL46.glClear(16640); - GlState.enableTexture2D(); +// GL46C.glPushMatrix(); + GL46C.glClear(GL46C.GL_COLOR_BUFFER_BIT | GL46C.GL_DEPTH_BUFFER_BIT); +// GlState.enableTexture2D(); if(this.world != null) this.renderer.renderWorld((float)this.tickFraction, System.nanoTime() - this.tickStart); - GL46.glPopMatrix(); - - GlState.disableTexture2D(); +// GL46C.glPopMatrix(); +// +// GlState.disableTexture2D(); GlState.disableCull(); GlState.enableBlend(); if(this.wireframe) - GL46.glPolygonMode(GL46.GL_FRONT_AND_BACK, GL46.GL_FILL); + GL46C.glPolygonMode(GL46C.GL_FRONT_AND_BACK, GL46C.GL_FILL); } private int drawStat(int x, int y, String name, int value, int max, int color) { @@ -1179,6 +1180,23 @@ public class Client implements IThreadListener { Drawing.drawGradient(x + 2, y + 20 + 2, (int)(246.0f * fill), 6, color | 0xff000000, Util.mixColor(color | 0xff000000, 0xff000000)); return y + 40; } + + private boolean isVisionObscured() { + if(this.player.isEntityInsideOpaqueBlock()) { + State state = this.world.getState(new BlockPos(this.player)); + for(int i = 0; i < 8; ++i) { + double d0 = this.player.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * this.player.width * 0.8F); + double d1 = this.player.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); + double d2 = this.player.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * this.player.width * 0.8F); + BlockPos blockpos = new BlockPos(d0, d1 + (double)this.player.getEyeHeight(), d2); + State bstate = this.world.getState(blockpos); + if(bstate.getBlock().isVisuallyOpaque()) + state = bstate; + } + return state.getBlock() != Blocks.air; + } + return false; + } public void renderHud() { final int selected = this.world != null && this.player != null && this.viewEntity == this.player ? this.player.getSelectedIndex() : -1; @@ -1189,11 +1207,13 @@ public class Client implements IThreadListener { final int by = this.fbY - 20 * scale; final int xoff = (this.fbX / scale - (width < 20 ? ((size - 2) * width + 40 + width / 2) : (size * 20 - 2))) / 2 + (width < 20 && selected == 0 ? 20 - width : 0) - 2; this.setupOverlay(); + if(this.world != null && this.player != null && this.viewEntity == this.player && this.isVisionObscured()) + Drawing.drawGradient(0, 0, this.fbX, this.fbY, 0xff2f2f2f, 0xff000000); if(this.world != null && !(this.open instanceof GuiConsole) && this.player != null && this.viewEntity == this.player) { if(this.open == null) { if(this.thirdPersonView == 0) { if(this.drawDebug) { - this.renderWorldDirections((float)this.tickFraction); +// this.renderWorldDirections((float)this.tickFraction); } else if(this.crosshairSize > 0) { final int color = this.pointed != null && this.pointed.type != ObjectType.MISS ? this.crosshairColorTarget : this.crosshairColorBase; @@ -1202,8 +1222,8 @@ public class Client implements IThreadListener { Drawing.drawRect(this.fbX / 2 - this.crosshairSize, this.fbY / 2 - 1, this.crosshairSize * 2, 2, color); } else { - GlState.color(color); - Drawing.drawTexturedRect(this, "textures/crosshair.png", 32, 32, this.fbX / 2 - 16, this.fbY / 2 - 16, 0, 0, 32, 32); +// GlState.color(color); +// Drawing.drawTexturedRect(this, "textures/crosshair.png", 32, 32, this.fbX / 2 - 16, this.fbY / 2 - 16, 0, 0, 32, 32); } } } @@ -1357,61 +1377,61 @@ public class Client implements IThreadListener { } } - GlState.bindTexture(0); - GlState.setActiveTexture(GL46.GL_TEXTURE0); - GlState.enableTexture2D(); - if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) { - GlState.enableRescaleNormal(); - GlState.enableBlend(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - ItemRenderer.enableGUIStandardItemLighting(); - GL46.glPushMatrix(); - GL46.glTranslatef(0.0f, (float)by, 0.0f); - if(this.scaleHotbar) - GL46.glScalef(2.0f, 2.0f, 2.0f); - - int xPos = xoff; - for(int index = 0; index < size; ++index) { - ItemStack itemstack = this.player.getStackInSlot(index); - if(itemstack != null) { - if(width < 20 && selected != index && selected != index + 1 && index != size - 1) { - this.scissor(xPos * scale, this.fbY - (by + 16 * scale), (width - 1) * scale, 16 * scale); - GL46.glEnable(GL46.GL_SCISSOR_TEST); - } - GlState.enableDepth(); - this.renderItem.renderItemAndEffectIntoGUI(itemstack, xPos, 0); - if(width < 20 && selected != index && selected != index + 1 && index != size - 1) - GL46.glDisable(GL46.GL_SCISSOR_TEST); - } - xPos += width >= 20 || selected == index || selected == index + 1 ? 20 : width; - } - - if(this.infoOverlay) { - Item item = null; - if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) - item = this.pointedLiquid != null ? (this.world.getState(this.pointedLiquid).getBlock() instanceof BlockLiquid liquid ? ItemBucket.getByFluid(liquid) : null) : this.world.getState(this.pointed.block).getBlock().getItem(); - else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) - item = this.pointed.entity.getItem(); - if(item != null) { - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(this.hudMargin + 20 + 1), 0.0f); - GL46.glScalef(2.0f, 2.0f, 2.0f); - GlState.enableDepth(); - this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0); - } - } - - GL46.glPopMatrix(); - ItemRenderer.disableStandardItemLighting(); - GlState.disableRescaleNormal(); - GlState.disableBlend(); - } - - GlState.disableTexture2D(); - GlState.disableCull(); - GlState.enableBlend(); - GlState.disableDepth(); +// GlState.bindTexture(0); +// GlState.setActiveTexture(GL46C.GL_TEXTURE0); +// GlState.enableTexture2D(); +// if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) { +// GlState.enableRescaleNormal(); +// GlState.enableBlend(); +// GlState.color(1.0F, 1.0F, 1.0F, 1.0F); +// ItemRenderer.enableGUIStandardItemLighting(); +// GL46C.glPushMatrix(); +// GL46C.glTranslatef(0.0f, (float)by, 0.0f); +// if(this.scaleHotbar) +// GL46C.glScalef(2.0f, 2.0f, 2.0f); +// +// int xPos = xoff; +// for(int index = 0; index < size; ++index) { +// ItemStack itemstack = this.player.getStackInSlot(index); +// if(itemstack != null) { +// if(width < 20 && selected != index && selected != index + 1 && index != size - 1) { +// this.scissor(xPos * scale, this.fbY - (by + 16 * scale), (width - 1) * scale, 16 * scale); +// GL46C.glEnable(GL46C.GL_SCISSOR_TEST); +// } +// GlState.enableDepth(); +// this.renderItem.renderItemAndEffectIntoGUI(itemstack, xPos, 0); +// if(width < 20 && selected != index && selected != index + 1 && index != size - 1) +// GL46C.glDisable(GL46C.GL_SCISSOR_TEST); +// } +// xPos += width >= 20 || selected == index || selected == index + 1 ? 20 : width; +// } +// +// if(this.infoOverlay) { +// Item item = null; +// if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) +// item = this.pointedLiquid != null ? (this.world.getState(this.pointedLiquid).getBlock() instanceof BlockLiquid liquid ? ItemBucket.getByFluid(liquid) : null) : this.world.getState(this.pointed.block).getBlock().getItem(); +// else if(this.pointed != null && this.pointed.type == ObjectType.ENTITY && this.pointed.entity != null) +// item = this.pointed.entity.getItem(); +// if(item != null) { +// GL46C.glPopMatrix(); +// GL46C.glPushMatrix(); +// GL46C.glTranslatef((float)(this.fbX / 2 - 180 + 4 + 1), (float)(this.hudMargin + 20 + 1), 0.0f); +// GL46C.glScalef(2.0f, 2.0f, 2.0f); +// GlState.enableDepth(); +// this.renderItem.renderItemAndEffectIntoGUI(new ItemStack(item), 0, 0); +// } +// } +// +// GL46C.glPopMatrix(); +// ItemRenderer.disableStandardItemLighting(); +// GlState.disableRescaleNormal(); +// GlState.disableBlend(); +// } +// +// GlState.disableTexture2D(); +// GlState.disableCull(); +// GlState.enableBlend(); +// GlState.disableDepth(); if(this.world != null && this.open == null && this.player != null && this.viewEntity == this.player) { int xPos = xoff * scale; for(int index = 0; index < size; ++index) { @@ -1471,8 +1491,8 @@ public class Client implements IThreadListener { "Tickrate: %s%.2f" + Color.RESET + " %s [" + Color.GREEN + "%.1f" + Color.RESET + "], %.3f ms, E %d ms" + "%s%s" , - GL46.glGetString(GL46.GL_VERSION), - GL46.glGetString(GL46.GL_RENDERER), GL46.glGetString(GL46.GL_VENDOR), + GL46C.glGetString(GL46C.GL_VERSION), + GL46C.glGetString(GL46C.GL_RENDERER), GL46C.glGetString(GL46C.GL_VENDOR), this.framecode(), this.framerate < 1.0f ? 1.0f / this.framerate : this.framerate, this.framerate < 1.0f ? "SPF" : "FPS", this.vsync ? Color.DARK_GRAY + "VSYNC" : (this.syncLimited ? Color.GREEN + "" + this.syncLimit : Color.RED + "UNL"), (float)PerfSection.getTotal(false) / 1000.0f, this.fbRawX, this.fbRawY, @@ -2158,7 +2178,7 @@ public class Client implements IThreadListener { } private void fbsize(int x, int y) { - GL46.glViewport(0, 0, x, y); + GL46C.glViewport(0, 0, x, y); this.fbRawX = x; this.fbRawY = y; this.rescale(); @@ -2340,23 +2360,19 @@ public class Client implements IThreadListener { } public void setupOverlay() { - GlState.disableDepth(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ONE_MINUS_SRC_ALPHA); - GlState.setActiveTexture(GL46.GL_TEXTURE0); - GlState.color(1.0f, 1.0f, 1.0f, 1.0f); - GL46.glClear(256); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); - GL46.glOrtho(0.0D, (double)this.fbRawX, (double)this.fbRawY, 0.0D, 1000.0D, 3000.0D); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glLoadIdentity(); - GL46.glTranslatef(0.0F, 0.0F, -2000.0F); - if(this.scale != 1) - GL46.glScalef((float)this.scale, (float)this.scale, 1.0f); +// GlState.disableCull(); +// GlState.disableDepth(); +// GlState.enableBlend(); +// GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE_MINUS_SRC_ALPHA); + GL46C.glClear(GL46C.GL_DEPTH_BUFFER_BIT); +// GL46C.glOrtho(0.0D, (double)this.fbRawX, (double)this.fbRawY, 0.0D, 1000.0D, 3000.0D); +// GL46C.glTranslatef(0.0F, 0.0F, -2000.0F); +// if(this.scale != 1) +// GL46C.glScalef((float)this.scale, (float)this.scale, 1.0f); } public void scissor(int x, int y, int width, int height) { - GL46.glScissor(x * this.scale, y * this.scale, width * this.scale, height * this.scale); + GL46C.glScissor(x * this.scale, y * this.scale, width * this.scale, height * this.scale); } private void addFrame(long runningTime) @@ -2400,9 +2416,9 @@ public class Client implements IThreadListener { Window.destroyWindow(); Util.panic("Inkompatible OpenGL-Version", "OpenGL 4.6 oder höher ist erforderlich, um dieses Programm auszuführen."); } - Log.SYSTEM.info("OpenGL %s", GL46.glGetString(GL46.GL_VERSION)); - Log.SYSTEM.info("GL_VENDOR: %s", GL46.glGetString(GL46.GL_VENDOR)); - Log.SYSTEM.info("GL_RENDERER: %s", GL46.glGetString(GL46.GL_RENDERER)); + Log.SYSTEM.info("OpenGL %s", GL46C.glGetString(GL46C.GL_VERSION)); + Log.SYSTEM.info("GL_VENDOR: %s", GL46C.glGetString(GL46C.GL_VENDOR)); + Log.SYSTEM.info("GL_RENDERER: %s", GL46C.glGetString(GL46C.GL_RENDERER)); Log.SYSTEM.info("Starte ..."); this.init(); @@ -2411,8 +2427,8 @@ public class Client implements IThreadListener { System.gc(); Font.loadFonts(); Font.select(this.font); - GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); +// GlState.enableBlend(); +// GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA); this.initConsole(); Shader.loadShaders(); this.startSound(true); @@ -2443,7 +2459,6 @@ public class Client implements IThreadListener { Bind.updateBinds(); this.input(); Bind.enableInput(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); GlState.bindTexture(0); this.inputGui(); if(this.open != null) @@ -2460,7 +2475,7 @@ public class Client implements IThreadListener { this.finish(); PerfSection.SWAP.enter(); if(this.glFlush) - GL46.glFlush(); + GL46C.glFlush(); Window.swapBuffers(); PerfSection.EVENTS.enter(); Log.flushLog(); @@ -2555,7 +2570,7 @@ public class Client implements IThreadListener { this.saving = true; final int stride = ((this.fbRawX * 3) & 3) != 0 ? 4 + ((this.fbRawX * 3) & ~3) : (this.fbRawX * 3); final ByteBuffer data = ByteBuffer.allocateDirect(stride * this.fbRawY).order(ByteOrder.nativeOrder()); - GL46.glReadPixels(0, 0, this.fbRawX, this.fbRawY, GL46.GL_RGB, GL46.GL_UNSIGNED_BYTE, data); + GL46C.glReadPixels(0, 0, this.fbRawX, this.fbRawY, GL46C.GL_RGB, GL46C.GL_UNSIGNED_BYTE, data); new Thread(new Runnable() { public void run() { byte[] pixels = new byte[stride * Client.this.fbRawY]; @@ -3293,23 +3308,23 @@ public class Client implements IThreadListener { } } - private void renderWorldDirections(float partialTicks) { - GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glLineWidth(1.0F); - GlState.disableTexture2D(); - GlState.depthMask(false); - GL46.glPushMatrix(); - GL46.glTranslatef((float)(this.fbX / 2), (float)(this.fbY / 2), 0.0F); - this.renderer.rotateCamera(this.viewEntity, partialTicks, true); - Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 24D, 1D, 1D), 255, 0, 0, 255); - Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, 1D, 24D), 0, 0, 255, 255); - Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, -20D, 1D), 0, 255, 0, 255); - GL46.glPopMatrix(); - GlState.depthMask(true); - GlState.enableTexture2D(); - GlState.disableBlend(); - } +// private void renderWorldDirections(float partialTicks) { +// GlState.enableBlend(); +// GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); +// GL46C.glLineWidth(1.0F); +// GlState.disableTexture2D(); +// GlState.depthMask(false); +// GL46C.glPushMatrix(); +// GL46C.glTranslatef((float)(this.fbX / 2), (float)(this.fbY / 2), 0.0F); +// this.renderer.rotateCamera(this.viewEntity, partialTicks, true); +// Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 24D, 1D, 1D), 255, 0, 0, 255); +// Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, 1D, 24D), 0, 0, 255, 255); +// Renderer.drawOutlinedBoundingBox(new BoundingBox(0.0D, 0.0D, 0.0D, 1D, -20D, 1D), 0, 255, 0, 255); +// GL46C.glPopMatrix(); +// GlState.depthMask(true); +// GlState.enableTexture2D(); +// GlState.disableBlend(); +// } private int blendColors(int color1, int color2, float value) { int i = color1 >> 24 & 255; diff --git a/client/src/main/java/client/gui/Font.java b/client/src/main/java/client/gui/Font.java index 7516f31a..b8125050 100644 --- a/client/src/main/java/client/gui/Font.java +++ b/client/src/main/java/client/gui/Font.java @@ -4,7 +4,7 @@ import java.awt.image.BufferedImage; import java.io.FileNotFoundException; import java.io.IOException; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.texture.TextureUtil; @@ -110,7 +110,7 @@ public enum Font implements Identifyable, Displayable { int[] data = new int[width * 16 * height * 16]; img.getRGB(0, 0, width * 16, height * 16, data, 0, width * 16); calculate(data, font.sizes, width, height, 0); - font.texture = GL46.glGenTextures(); + font.texture = GL46C.glGenTextures(); TextureUtil.uploadImage(font.texture, img); Log.RENDER.debug("Font-Textur wurde mit ID #%d geladen", font.texture); } @@ -141,7 +141,7 @@ public enum Font implements Identifyable, Displayable { public static void unloadFonts() { for(Font font : values()) { if(font.texture != 0) { - GL46.glDeleteTextures(font.texture); + GL46C.glDeleteTextures(font.texture); Log.RENDER.debug("Font-Textur mit ID #%d wurde gelöscht", font.texture); font.texture = 0; } diff --git a/client/src/main/java/client/gui/Gui.java b/client/src/main/java/client/gui/Gui.java index e9fc01da..1ae100fa 100644 --- a/client/src/main/java/client/gui/Gui.java +++ b/client/src/main/java/client/gui/Gui.java @@ -2,7 +2,7 @@ package client.gui; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.gui.element.Dropdown; @@ -229,12 +229,12 @@ public abstract class Gui { this.drawBackground(); if(this.gm.fbX != 0 && this.gm.fbY != 0) this.draw(); - GlState.bindTexture(0); - GlState.setActiveTexture(GL46.GL_TEXTURE0); - GlState.enableTexture2D(); - GlState.disableDepth(); +// GlState.bindTexture(0); +// GlState.setActiveTexture(GL46C.GL_TEXTURE0); +// GlState.enableTexture2D(); +// GlState.disableDepth(); this.drawPost(); - GlState.disableDepth(); +// GlState.disableDepth(); this.drawOverlays(); if(Bind.isWindowActive()) this.drawOverlay(); diff --git a/client/src/main/java/client/gui/GuiMenu.java b/client/src/main/java/client/gui/GuiMenu.java index 01d7a6a8..9871e066 100644 --- a/client/src/main/java/client/gui/GuiMenu.java +++ b/client/src/main/java/client/gui/GuiMenu.java @@ -22,12 +22,12 @@ public class GuiMenu extends Gui { private GuiMenu() { } - public void drawMainBackground() { - if(this.gm.world != null) - super.drawMainBackground(); - else - this.gm.renderer.renderStarField(this.gm.fbX, this.gm.fbY, 0x000000, 0xffffff, (float)this.ticks + this.gm.getTickFraction(), this.rand); - } +// public void drawMainBackground() { +// if(this.gm.world != null) +// super.drawMainBackground(); +// else +// this.gm.renderer.renderStarField(this.gm.fbX, this.gm.fbY, 0x000000, 0xffffff, (float)this.ticks + this.gm.getTickFraction(), this.rand); +// } private final Random rand = new Random(); diff --git a/client/src/main/java/client/gui/character/GuiChar.java b/client/src/main/java/client/gui/character/GuiChar.java index c476178c..960e456e 100755 --- a/client/src/main/java/client/gui/character/GuiChar.java +++ b/client/src/main/java/client/gui/character/GuiChar.java @@ -12,7 +12,7 @@ import java.util.List; import javax.imageio.ImageIO; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.Client.FileMode; @@ -613,41 +613,41 @@ public class GuiChar extends GuiList GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.enableDepth(); GlState.enableColorMaterial(); - GL46.glPushMatrix(); - GL46.glTranslatef((float)posX, (float)posY, 200.0F); - GL46.glScalef(-scale, scale, scale); - GL46.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)posX, (float)posY, 200.0F); + GL46C.glScalef(-scale, scale, scale); + GL46C.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.yawOffset; float f1 = ent.rotYaw; float f2 = ent.rotPitch; float f3 = ent.prevHeadYaw; float f4 = ent.headYaw; - GL46.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); ItemRenderer.enableStandardItemLighting(); - GL46.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, ent.height / 2, 0.0F); - GL46.glRotatef(-pitch, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, ent.height / 2, 0.0F); + GL46C.glRotatef(-pitch, 1.0F, 0.0F, 0.0F); ent.yawOffset = yaw; ent.rotYaw = yaw; ent.rotPitch = 0.0f; ent.headYaw = ent.rotYaw; ent.prevHeadYaw = ent.rotYaw; - GL46.glTranslatef(0.0F, -(ent.height / 2), 0.0F); + GL46C.glTranslatef(0.0F, -(ent.height / 2), 0.0F); RenderManager rendermanager = Client.CLIENT.getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.renderEntity(ent, 0.0D, 0.0D, 0.0D, 1.0F); -// GL46.glTranslatef(0.0F, 0.0F, 0.0F); +// GL46C.glTranslatef(0.0F, 0.0F, 0.0F); ent.yawOffset = f; ent.rotYaw = f1; ent.rotPitch = f2; ent.prevHeadYaw = f3; ent.headYaw = f4; - GL46.glPopMatrix(); + GL46C.glPopMatrix(); ItemRenderer.disableStandardItemLighting(); GlState.disableRescaleNormal(); - GlState.setActiveTexture(GL46.GL_TEXTURE1); + GlState.setActiveTexture(GL46C.GL_TEXTURE1); GlState.disableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); GlState.disableDepth(); } } diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index f140c5c9..bcbeda9c 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -7,7 +7,7 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.gui.Font; @@ -332,10 +332,10 @@ public abstract class GuiContainer extends Gui } if(this.gm.itemCheat) { - GL46.glPushMatrix(); - GL46.glTranslatef(-(float)((this.gm.fbX - this.xSize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), -(float)((this.gm.fbY - this.ySize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), 0.0f); + GL46C.glPushMatrix(); + GL46C.glTranslatef(-(float)((this.gm.fbX - this.xSize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), -(float)((this.gm.fbY - this.ySize * this.container_scale) / 2) * (1.0f / (float)this.container_scale), 0.0f); if(this.container_scale != 1) - GL46.glScalef(1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale); + GL46C.glScalef(1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale, 1.0f / (float)this.container_scale); int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); @@ -366,7 +366,7 @@ public abstract class GuiContainer extends Gui { this.drawTab(tabs); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } @@ -421,7 +421,7 @@ public abstract class GuiContainer extends Gui this.theSlot = null; int k = 240; int l = 240; - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)k / 1.0F, (float)l / 1.0F); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, (float)k / 1.0F, (float)l / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); this.drawSlots(mouseX, mouseY); @@ -487,7 +487,7 @@ public abstract class GuiContainer extends Gui private void drawItemStack(ItemStack stack, int x, int y, String altText) { - GL46.glTranslatef(0.0F, 0.0F, 32.0F); + GL46C.glTranslatef(0.0F, 0.0F, 32.0F); this.itemRender.zLevel = 200.0F; this.itemRender.renderItemAndEffectIntoGUI(stack, x, y); this.drawnOverlays.add(new Overlay(stack, x, y, altText)); @@ -526,12 +526,12 @@ public abstract class GuiContainer extends Gui } public void drawPost() { - GL46.glPushMatrix(); - GL46.glTranslatef((float)((this.gm.fbX - this.xSize * this.container_scale) / 2), (float)((this.gm.fbY - this.ySize * this.container_scale) / 2), 0.0f); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)((this.gm.fbX - this.xSize * this.container_scale) / 2), (float)((this.gm.fbY - this.ySize * this.container_scale) / 2), 0.0f); if(this.container_scale != 1) - GL46.glScalef((float)this.container_scale, (float)this.container_scale, (float)this.container_scale); + GL46C.glScalef((float)this.container_scale, (float)this.container_scale, (float)this.container_scale); this.drawScreen((this.gm.mouseX - this.container_x) / this.container_scale, (this.gm.mouseY - this.container_y) / this.container_scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); ItemRenderer.disableStandardItemLighting(); } diff --git a/client/src/main/java/client/gui/container/GuiMerchant.java b/client/src/main/java/client/gui/container/GuiMerchant.java index 333df8da..60822884 100755 --- a/client/src/main/java/client/gui/container/GuiMerchant.java +++ b/client/src/main/java/client/gui/container/GuiMerchant.java @@ -1,6 +1,6 @@ package client.gui.container; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.gui.element.ActButton; import client.gui.element.ButtonCallback; @@ -96,7 +96,7 @@ public class GuiMerchant extends GuiContainer implements ButtonCallback { ItemStack itemstack = merchantrecipe.first(); ItemStack itemstack1 = merchantrecipe.second(); ItemStack itemstack2 = merchantrecipe.result(); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); ItemRenderer.enableGUIStandardItemLighting(); GlState.disableLighting(); GlState.enableRescaleNormal(); @@ -123,7 +123,7 @@ public class GuiMerchant extends GuiContainer implements ButtonCallback { this.renderToolTip(itemstack2, mouseX, mouseY); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.enableLighting(); GlState.enableDepth(); ItemRenderer.enableStandardItemLighting(); diff --git a/client/src/main/java/client/gui/element/Element.java b/client/src/main/java/client/gui/element/Element.java index e4b437df..4eaf0732 100644 --- a/client/src/main/java/client/gui/element/Element.java +++ b/client/src/main/java/client/gui/element/Element.java @@ -1,6 +1,6 @@ package client.gui.element; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.gui.Formatter; @@ -222,7 +222,7 @@ public abstract class Element { int y2 = this.size_y - (this.margin_y1 + this.margin_y2); // if(elem.type == ElemType.FIELD) { this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fbY - (y1 + y2)) < 0 ? 0 : (this.gm.fbY - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); - GL46.glEnable(GL46.GL_SCISSOR_TEST); + GL46C.glEnable(GL46C.GL_SCISSOR_TEST); // } // if(this.type == ElemType.CUSTOM) // this.func(this, 1); @@ -230,7 +230,7 @@ public abstract class Element { this.drawForeground(x1, y1, x2, y2); // logd("DBG", "%d @ %d %d -> %d %d", elem.id, x1, y1, elem.pos_x + x2, elem.pos_y + y2); // if(elem.type == ElemType.FIELD) { - GL46.glDisable(GL46.GL_SCISSOR_TEST); + GL46C.glDisable(GL46C.GL_SCISSOR_TEST); // glScissor(0, 0, sys.fb_x, sys.fb_y); // } } diff --git a/client/src/main/java/client/gui/element/Textbox.java b/client/src/main/java/client/gui/element/Textbox.java index 3b78d555..fdef4d36 100644 --- a/client/src/main/java/client/gui/element/Textbox.java +++ b/client/src/main/java/client/gui/element/Textbox.java @@ -1,6 +1,6 @@ package client.gui.element; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.gui.Font; import client.renderer.Drawing; @@ -242,9 +242,9 @@ abstract class Textbox extends Element { int x2 = this.size_x - (this.margin_x1 + this.margin_x2); int y2 = this.size_y - (this.margin_y1 + this.margin_y2); this.gm.scissor(x1 < 0 ? 0 : x1, (this.gm.fbY - (y1 + y2)) < 0 ? 0 : (this.gm.fbY - (y1 + y2)), x2 < 0 ? 0 : x2, y2 < 0 ? 0 : y2); - GL46.glEnable(GL46.GL_SCISSOR_TEST); + GL46C.glEnable(GL46C.GL_SCISSOR_TEST); Drawing.drawRect(this.getCursorX(x1, x2), this.getCursorY(y1, y2), 1, Font.HEIGHT, 0xff000000 | (~Util.mixColor(this.gm.style.field_top, this.gm.style.field_btm))); - GL46.glDisable(GL46.GL_SCISSOR_TEST); + GL46C.glDisable(GL46C.GL_SCISSOR_TEST); } } diff --git a/client/src/main/java/client/init/RenderRegistry.java b/client/src/main/java/client/init/RenderRegistry.java index a3b14554..bea4c031 100644 --- a/client/src/main/java/client/init/RenderRegistry.java +++ b/client/src/main/java/client/init/RenderRegistry.java @@ -134,7 +134,6 @@ public abstract class RenderRegistry { map.put(EntityXp.class, new RenderXp(mgr)); map.put(EntityTnt.class, new RenderTntPrimed(mgr)); map.put(EntityFalling.class, new RenderFallingBlock(mgr)); - map.put(EntityTntCart.class, new RenderTntMinecart(mgr)); map.put(EntityCart.class, new RenderMinecart(mgr)); map.put(EntityBoat.class, new RenderBoat(mgr)); map.put(EntityHook.class, new RenderFish(mgr)); diff --git a/client/src/main/java/client/renderer/DefaultVertexFormats.java b/client/src/main/java/client/renderer/DefaultVertexFormats.java deleted file mode 100755 index 60ade6a6..00000000 --- a/client/src/main/java/client/renderer/DefaultVertexFormats.java +++ /dev/null @@ -1,63 +0,0 @@ -package client.renderer; - -public class DefaultVertexFormats -{ - public static final VertexFormat BLOCK = new VertexFormat(); - public static final VertexFormat ITEM = new VertexFormat(); - public static final VertexFormat OLDMODEL_POSITION_TEX_NORMAL = new VertexFormat(); - public static final VertexFormat PARTICLE_POSITION_TEX_COLOR_LMAP = new VertexFormat(); - public static final VertexFormat POSITION = new VertexFormat(); - public static final VertexFormat POSITION_COLOR = new VertexFormat(); - public static final VertexFormat POSITION_TEX = new VertexFormat(); - public static final VertexFormat POSITION_NORMAL = new VertexFormat(); - public static final VertexFormat POSITION_TEX_COLOR = new VertexFormat(); - public static final VertexFormat POSITION_TEX_NORMAL = new VertexFormat(); - public static final VertexFormat POSITION_TEX_COLOR_NORMAL = new VertexFormat(); - public static final VertexFormatElement POSITION_3F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3); - public static final VertexFormatElement COLOR_4UB = new VertexFormatElement(0, VertexFormatElement.EnumType.UBYTE, VertexFormatElement.EnumUsage.COLOR, 4); - public static final VertexFormatElement TEX_2F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.UV, 2); - public static final VertexFormatElement TEX_2S = new VertexFormatElement(1, VertexFormatElement.EnumType.SHORT, VertexFormatElement.EnumUsage.UV, 2); - public static final VertexFormatElement NORMAL_3B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.NORMAL, 3); - public static final VertexFormatElement PADDING_1B = new VertexFormatElement(0, VertexFormatElement.EnumType.BYTE, VertexFormatElement.EnumUsage.PADDING, 1); - - static - { - BLOCK.addElement(POSITION_3F); - BLOCK.addElement(COLOR_4UB); - BLOCK.addElement(TEX_2F); - BLOCK.addElement(TEX_2S); - ITEM.addElement(POSITION_3F); - ITEM.addElement(COLOR_4UB); - ITEM.addElement(TEX_2F); - ITEM.addElement(NORMAL_3B); - ITEM.addElement(PADDING_1B); - OLDMODEL_POSITION_TEX_NORMAL.addElement(POSITION_3F); - OLDMODEL_POSITION_TEX_NORMAL.addElement(TEX_2F); - OLDMODEL_POSITION_TEX_NORMAL.addElement(NORMAL_3B); - OLDMODEL_POSITION_TEX_NORMAL.addElement(PADDING_1B); - PARTICLE_POSITION_TEX_COLOR_LMAP.addElement(POSITION_3F); - PARTICLE_POSITION_TEX_COLOR_LMAP.addElement(TEX_2F); - PARTICLE_POSITION_TEX_COLOR_LMAP.addElement(COLOR_4UB); - PARTICLE_POSITION_TEX_COLOR_LMAP.addElement(TEX_2S); - POSITION.addElement(POSITION_3F); - POSITION_COLOR.addElement(POSITION_3F); - POSITION_COLOR.addElement(COLOR_4UB); - POSITION_TEX.addElement(POSITION_3F); - POSITION_TEX.addElement(TEX_2F); - POSITION_NORMAL.addElement(POSITION_3F); - POSITION_NORMAL.addElement(NORMAL_3B); - POSITION_NORMAL.addElement(PADDING_1B); - POSITION_TEX_COLOR.addElement(POSITION_3F); - POSITION_TEX_COLOR.addElement(TEX_2F); - POSITION_TEX_COLOR.addElement(COLOR_4UB); - POSITION_TEX_NORMAL.addElement(POSITION_3F); - POSITION_TEX_NORMAL.addElement(TEX_2F); - POSITION_TEX_NORMAL.addElement(NORMAL_3B); - POSITION_TEX_NORMAL.addElement(PADDING_1B); - POSITION_TEX_COLOR_NORMAL.addElement(POSITION_3F); - POSITION_TEX_COLOR_NORMAL.addElement(TEX_2F); - POSITION_TEX_COLOR_NORMAL.addElement(COLOR_4UB); - POSITION_TEX_COLOR_NORMAL.addElement(NORMAL_3B); - POSITION_TEX_COLOR_NORMAL.addElement(PADDING_1B); - } -} diff --git a/client/src/main/java/client/renderer/Drawing.java b/client/src/main/java/client/renderer/Drawing.java index 1442bb41..d45f7e9e 100644 --- a/client/src/main/java/client/renderer/Drawing.java +++ b/client/src/main/java/client/renderer/Drawing.java @@ -1,10 +1,9 @@ package client.renderer; -import org.lwjgl.opengl.GL46; - import client.Client; import client.gui.Font; import client.gui.FontChar; +import client.renderer.Shader.ShaderContext; import common.log.Log; import common.util.Color; import common.util.Util; @@ -30,15 +29,10 @@ public abstract class Drawing { } public static void txt_draw(int x, int y, int x1, int y1, int x2, int y2, int color, String str) { - GlState.enableTexture2D(); - GlState.enableBlend(); - GlState.disableAlpha(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.shadeModel(GL46.GL_SMOOTH); - GlState.color(1.0f, 1.0f, 1.0f, 1.0f); + ShaderContext context = Shader.UI_TEXTURE.use(); Font.bindTexture(); - RenderBuffer rb = Tessellator.getBuffer(); - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); int h = Font.HEIGHT; int tx, ty, u, v; FontChar glyph; @@ -75,14 +69,11 @@ public abstract class Drawing { if(x < x1 || y < y1 || x > x2 || y > y2) { break; } - putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x, y, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, h, ncolor, 0.0); + putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x, y, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, h, ncolor); x += u; } - Tessellator.draw(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.disableBlend(); - GlState.enableAlpha(); - GlState.enableTexture2D(); + rb.draw(); + context.finish(); } public static void txt_overlay(int start, int end, int x, int y, int x1, int y1, int x2, int y2, int back, String str) { @@ -92,13 +83,6 @@ public abstract class Drawing { char ch; int pos = 0; int lpos = 0; -// ShaderContext shd = Shader.TEXT.use(); -// shd.setVec2("font_size", (float)font.xglyph, (float)font.yglyph); -// shd.setInt("flags", 0); -// shd.setColor("color", 0x00000000); -// shd.setColor("back", back); -// shd.setInt("ch_index", Log.CHR_SPC & 0xff); -// GlState.bindTexture(font.textures[Log.CHR_SPC >> 8]); while(true) { pos = lpos; if(lpos >= str.length()) @@ -129,15 +113,10 @@ public abstract class Drawing { break; } if(pos >= start && pos < end) { -// shd.setVec2("offset", (float)x, (float)y); -// shd.setVec2("size", (float)u, (float)v); -// shd.setVec4("glyph", (float)glyph.s, 0.0f, (float)glyph.u, (float)h); -// shd.draw(); drawRect(x, y, u, v, back); } x += u; } -// shd.discard(); } public static Vec2i txt_size(int x, int y, int x1, int y1, int x2, int y2, String str) { @@ -278,26 +257,23 @@ public abstract class Drawing { } - private static void putGlyph(RenderBuffer rb, int tw, int th, int x, int y, int textureX, int textureY, int width, int height, int color, double depth) + private static void putGlyph(RenderBuffer rb, int tw, int th, int x, int y, int textureX, int textureY, int width, int height, int color) { float xs = 1.0f / (float)tw; float ys = 1.0f / (float)th; - rb.pos((double)(x + 0), (double)(y + height), depth).tex((double)((float)(textureX + 0) * xs), (double)((float)(textureY + height) * ys)).color(color).endVertex(); - rb.pos((double)(x + width), (double)(y + height), depth).tex((double)((float)(textureX + width) * xs), (double)((float)(textureY + height) * ys)).color(color).endVertex(); - rb.pos((double)(x + width), (double)(y + 0), depth).tex((double)((float)(textureX + width) * xs), (double)((float)(textureY + 0) * ys)).color(color).endVertex(); - rb.pos((double)(x + 0), (double)(y + 0), depth).tex((double)((float)(textureX + 0) * xs), (double)((float)(textureY + 0) * ys)).color(color).endVertex(); + rb.put2d(x + 0, y + height, (float)(textureX + 0) * xs, (float)(textureY + height) * ys, color); + rb.put2d(x + width, y + height, (float)(textureX + width) * xs, (float)(textureY + height) * ys, color); + rb.put2d(x + width, y + height, (float)(textureX + width) * xs, (float)(textureY + height) * ys, color); + rb.put2d(x + width, y + 0, (float)(textureX + width) * xs, (float)(textureY + 0) * ys, color); + rb.put2d(x + width, y + 0, (float)(textureX + width) * xs, (float)(textureY + 0) * ys, color); + rb.put2d(x + 0, y + 0, (float)(textureX + 0) * xs, (float)(textureY + 0) * ys, color); } - public static void drawText(String str, int x, int y, int color, boolean shadow) { - GlState.enableTexture2D(); - GlState.enableBlend(); - GlState.disableAlpha(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.shadeModel(GL46.GL_SMOOTH); - GlState.color(1.0f, 1.0f, 1.0f, 1.0f); + private static void drawText(String str, int x, int y, int color, boolean shadow) { + ShaderContext context = Shader.UI_TEXTURE.use(); Font.bindTexture(); - RenderBuffer rb = Tessellator.getBuffer(); - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); int ox = x; int ncolor = color; FontChar glyph; @@ -329,7 +305,7 @@ public abstract class Drawing { continue; else if(glyph.u == 0) glyph = Font.SIZES[Log.CHR_UNK]; - putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x + 1, y + 1, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, bcolor, -0.01); + putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x + 1, y + 1, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, bcolor); x += glyph.u + 3 - glyph.s; } x = ox; @@ -357,14 +333,11 @@ public abstract class Drawing { continue; else if(glyph.u == 0) glyph = Font.SIZES[Log.CHR_UNK]; - putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x, y, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, ncolor, -0.02); + putGlyph(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x, y, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, ncolor); x += glyph.u + 3 - glyph.s; } - Tessellator.draw(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.disableBlend(); - GlState.enableAlpha(); - GlState.enableTexture2D(); + rb.draw(); + context.finish(); } public static Vec2i getSize(String str) { @@ -400,22 +373,17 @@ public abstract class Drawing { public static void drawGradient(int x, int y, int w, int h, int top, int bottom) { - GlState.disableTexture2D(); - GlState.enableBlend(); - GlState.disableAlpha(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.shadeModel(GL46.GL_SMOOTH); - RenderBuffer buf = Tessellator.getBuffer(); - buf.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); - buf.pos((double)(x + w), (double)y, 0.0).color(top).endVertex(); - buf.pos((double)x, (double)y, 0.0).color(top).endVertex(); - buf.pos((double)x, (double)(y + h), 0.0).color(bottom).endVertex(); - buf.pos((double)(x + w), (double)(y + h), 0.0).color(bottom).endVertex(); - Tessellator.draw(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.disableBlend(); - GlState.enableAlpha(); - GlState.enableTexture2D(); + ShaderContext context = Shader.UI_COLOR.use(); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + rb.put2d(x + w, y, top); + rb.put2d(x, y, top); + rb.put2d(x, y, top); + rb.put2d(x, y + h, bottom); + rb.put2d(x, y + h, bottom); + rb.put2d(x + w, y + h, bottom); + rb.draw(); + context.finish(); } // public static void draw4Gradient(int x, int y, int w, int h, int topleft, int topright, int btmleft, int btmright) @@ -423,16 +391,16 @@ public abstract class Drawing { // GlState.disableTexture2D(); // GlState.enableBlend(); // GlState.disableAlpha(); -// GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); -// GlState.shadeModel(GL46.GL_SMOOTH); +// GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); +// GlState.shadeModel(GL46C.GL_SMOOTH); // RenderBuffer buf = Tessellator.getBuffer(); -// buf.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); +// buf.begin(GL46C.GL_QUADS, POSITION_COLOR); // buf.pos((double)(x + w), (double)y, 0.0).color(topright).endVertex(); // buf.pos((double)x, (double)y, 0.0).color(topleft).endVertex(); // buf.pos((double)x, (double)(y + h), 0.0).color(btmleft).endVertex(); // buf.pos((double)(x + w), (double)(y + h), 0.0).color(btmright).endVertex(); // Tessellator.draw(); -// GlState.shadeModel(GL46.GL_FLAT); +// GlState.shadeModel(GL46C.GL_FLAT); // GlState.disableBlend(); // GlState.enableAlpha(); // GlState.enableTexture2D(); @@ -440,24 +408,18 @@ public abstract class Drawing { public static void drawRect(int x, int y, int w, int h, int color) { - RenderBuffer rb = Tessellator.getBuffer(); - GlState.enableBlend(); - GlState.disableAlpha(); - GlState.disableTexture2D(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.shadeModel(GL46.GL_SMOOTH); - GlState.color(color); - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION); - rb.pos((double)x, (double)(y + h), 0.0D).endVertex(); - rb.pos((double)(x + w), (double)(y + h), 0.0D).endVertex(); - rb.pos((double)(x + w), (double)y, 0.0D).endVertex(); - rb.pos((double)x, (double)y, 0.0D).endVertex(); - Tessellator.draw(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.enableTexture2D(); - GlState.disableBlend(); - GlState.enableAlpha(); - GlState.color(1.0f, 1.0f, 1.0f, 1.0f); + ShaderContext context = Shader.UI_COLOR.use(); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + rb.setColor(color); + rb.put2d(x, y + h); + rb.put2d(x + w, y + h); + rb.put2d(x + w, y + h); + rb.put2d(x + w, y); + rb.put2d(x + w, y); + rb.put2d(x, y); + rb.draw(); + context.finish(); } public static void drawRectBorder(int x, int y, int w, int h, int color, int border, int topleft, int btmright) { @@ -543,11 +505,6 @@ public abstract class Drawing { drawText(str, x, y, color, true); } - public static void drawTextCenteredN(String str, int x, int y, int color) { - Vec2i size = getSize(str); - drawText(str, x - size.xpos / 2, y, color, false); - } - public static void drawTextCentered(String str, int x, int y, int color) { Vec2i size = getSize(str); drawText(str, x - size.xpos / 2, y, color); @@ -568,45 +525,146 @@ public abstract class Drawing { } public static void drawScaled(Client gm, String texture, int x, int y, int width, int height, int color) { - GlState.enableTexture2D(); - GlState.disableLighting(); - GlState.disableFog(); - RenderBuffer buf = Tessellator.getBuffer(); + ShaderContext context = Shader.UI_TEXTURE.use(); gm.getTextureManager().bindTexture(texture); - GlState.color(color); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + rb.setColor(color); double scale = 32.0; - buf.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - buf.pos((double)x, (double)y + (double)height, 0.0D).tex(0.0D, (double)height / scale).endVertex(); - buf.pos((double)x + (double)width, (double)y + (double)height, 0.0D).tex((double)width / scale, (double)height / scale).endVertex(); - buf.pos((double)x + (double)width, (double)y, 0.0D).tex((double)width / scale, 0.0).endVertex(); - buf.pos((double)x, (double)y, 0.0D).tex(0.0D, 0.0).endVertex(); - Tessellator.draw(); - GlState.disableTexture2D(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); + rb.put2d(x, y + height, 0.0, (double)height / scale); + rb.put2d(x + width, y + height, (double)width / scale, (double)height / scale); + rb.put2d(x + width, y + height, (double)width / scale, (double)height / scale); + rb.put2d(x + width, y, (double)width / scale, 0.0); + rb.put2d(x + width, y, (double)width / scale, 0.0); + rb.put2d(x, y, 0.0, 0.0); + rb.draw(); + context.finish(); } - - public static void drawTexturedRect(Client gm, String texture, int texWidth, int texHeight, int x, int y, int u, int v, int width, int height) - { - GlState.enableTexture2D(); -// GlState.disableFog(); - RenderBuffer buf = Tessellator.getBuffer(); + + public static void drawTexturedRect(Client gm, String texture, int texWidth, int texHeight, int x, int y, int u, int v, int width, int height) { + ShaderContext context = Shader.UI_TEXTURE.use(); gm.getTextureManager().bindTexture(texture); -// GlState.color(color); - float xs = 1.0f / (float)texWidth; // 0.00390625F; - float ys = 1.0f / (float)texHeight; // 0.00390625F; - buf.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - buf.pos((double)(x + 0), (double)(y + height), 0.0).tex((double)((float)(u + 0) * xs), (double)((float)(v + height) * ys)).endVertex(); - buf.pos((double)(x + width), (double)(y + height), 0.0).tex((double)((float)(u + width) * xs), (double)((float)(v + height) * ys)).endVertex(); - buf.pos((double)(x + width), (double)(y + 0), 0.0).tex((double)((float)(u + width) * xs), (double)((float)(v + 0) * ys)).endVertex(); - buf.pos((double)(x + 0), (double)(y + 0), 0.0).tex((double)((float)(u + 0) * xs), (double)((float)(v + 0) * ys)).endVertex(); -// double scale = 32.0; -// buf.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); -// buf.pos((double)x, (double)y + (double)height, 0.0D).tex(0.0D, (double)height / scale).endVertex(); -// buf.pos((double)x + (double)width, (double)y + (double)height, 0.0D).tex((double)width / scale, (double)height / scale).endVertex(); -// buf.pos((double)x + (double)width, (double)y, 0.0D).tex((double)width / scale, 0.0).endVertex(); -// buf.pos((double)x, (double)y, 0.0D).tex(0.0D, 0.0).endVertex(); - Tessellator.draw(); -// GlState.disableTexture2D(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - } + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + float xs = 1.0f / (float)texWidth; // 0.00390625F; + float ys = 1.0f / (float)texHeight; // 0.00390625F; + rb.put2d(x + 0, y + height, (float)(u + 0) * xs, (float)(v + height) * ys); + rb.put2d(x + width, y + height, (float)(u + width) * xs, (float)(v + height) * ys); + rb.put2d(x + width, y + height, (float)(u + width) * xs, (float)(v + height) * ys); + rb.put2d(x + width, y + 0, (float)(u + width) * xs, (float)(v + 0) * ys); + rb.put2d(x + width, y + 0, (float)(u + width) * xs, (float)(v + 0) * ys); + rb.put2d(x + 0, y + 0, (float)(u + 0) * xs, (float)(v + 0) * ys); + rb.draw(); + context.finish(); + } + + + private static void putGlyph3d(RenderBuffer rb, int tw, int th, int x, int y, int textureX, int textureY, int width, int height, int color, double depth) { + float xs = 1.0f / (float)tw; + float ys = 1.0f / (float)th; + rb.put(x + 0, y + height, depth, (float)(textureX + 0) * xs, (float)(textureY + height) * ys, color); + rb.put(x + width, y + height, depth, (float)(textureX + width) * xs, (float)(textureY + height) * ys, color); + rb.put(x + width, y + height, depth, (float)(textureX + width) * xs, (float)(textureY + height) * ys, color); + rb.put(x + width, y + 0, depth, (float)(textureX + width) * xs, (float)(textureY + 0) * ys, color); + rb.put(x + width, y + 0, depth, (float)(textureX + width) * xs, (float)(textureY + 0) * ys, color); + rb.put(x + 0, y + 0, depth, (float)(textureX + 0) * xs, (float)(textureY + 0) * ys, color); + } + + private static void drawText3d(String str, int x, int y, int color, boolean shadow) { + ShaderContext context = Shader.UI_TEXTURE.use(); + Font.bindTexture(); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + int ox = x; + int ncolor = color; + FontChar glyph; + char ch; + if(shadow) { + int oy = y; + int scolor = Util.mixColor(color, color & 0xff000000); + scolor = Util.mixColor(scolor, scolor & 0xff000000); + int bcolor = scolor; + for(int z = 0; z < str.length(); z++) { + ch = str.charAt(z); + if(ch == Log.CHR_NLN) { + x = ox; + y += Font.HEIGHT; + continue; + } + else if((ch >= Log.CHR_COLORS1 && ch <= Log.CHR_COLORE1) || (ch >= Log.CHR_COLORS2 && ch <= Log.CHR_COLORE2)) { + bcolor = Color.getShadow(ch) | (scolor & 0xff000000); + continue; + } + else if(ch == Log.CHR_CRESET) { + bcolor = scolor; + continue; + } + if(ch >= 256) + ch = Log.CHR_UNK; + glyph = Font.SIZES[ch]; + if(glyph.u == 0 && glyph.v != 0) + continue; + else if(glyph.u == 0) + glyph = Font.SIZES[Log.CHR_UNK]; + putGlyph3d(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x + 1, y + 1, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, bcolor, -0.01); + x += glyph.u + 3 - glyph.s; + } + x = ox; + y = oy; + } + for(int z = 0; z < str.length(); z++) { + ch = str.charAt(z); + if(ch == Log.CHR_NLN) { + x = ox; + y += Font.HEIGHT; + continue; + } + else if((ch >= Log.CHR_COLORS1 && ch <= Log.CHR_COLORE1) || (ch >= Log.CHR_COLORS2 && ch <= Log.CHR_COLORE2)) { + ncolor = Color.getColor(ch) | (color & 0xff000000); + continue; + } + else if(ch == Log.CHR_CRESET) { + ncolor = color; + continue; + } + if(ch >= 256) + ch = Log.CHR_UNK; + glyph = Font.SIZES[ch]; + if(glyph.u == 0 && glyph.v != 0) + continue; + else if(glyph.u == 0) + glyph = Font.SIZES[Log.CHR_UNK]; + putGlyph3d(rb, Font.WIDTH * 16, Font.HEIGHT * 16, x, y, (ch & 0x0f) * Font.WIDTH + glyph.s, ((ch & 0xf0) >> 4) * Font.HEIGHT, glyph.u, Font.HEIGHT, ncolor, -0.02); + x += glyph.u + 3 - glyph.s; + } + rb.draw(); + context.finish(); + } + + private static void drawRect3d(int x, int y, int w, int h, int color) { + ShaderContext context = Shader.UI_COLOR.use(); + RenderBuffer rb = RenderBuffer.getBuffer(); + rb.begin(); + rb.setColor(color); + rb.put2d(x, y + h); + rb.put2d(x + w, y + h); + rb.put2d(x + w, y + h); + rb.put2d(x + w, y); + rb.put2d(x + w, y); + rb.put2d(x, y); + rb.draw(); + context.finish(); + } + + public static void drawTextCentered3d(String str, int x, int y, int color) { + Vec2i size = getSize(str); + drawText3d(str, x - size.xpos / 2, y, color, false); + } + + public static void drawTextboxCentered3d(String str, int x, int y, int back) { + x -= getBoxWidth(str) / 2; + Vec2i size = getSize(str); + drawRect3d(x, y, size.xpos + 4, size.ypos + 2, back); + drawText3d(str, x + 2, y + 1, 0xffffffff, true); + } } diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index e8872002..43f99e2c 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -3,7 +3,7 @@ package client.renderer; import java.util.List; import java.util.Map; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.texture.Sprite; @@ -770,10 +770,6 @@ public class EffectRenderer { } private class Textured implements Effect { - private static final VertexFormat VERTEX_FORMAT = (new VertexFormat()).addElement(DefaultVertexFormats.POSITION_3F) - .addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.TEX_2S) - .addElement(DefaultVertexFormats.NORMAL_3B).addElement(DefaultVertexFormats.PADDING_1B); - private final String texture; private final int texWidth; private final int texHeight; @@ -815,7 +811,7 @@ public class EffectRenderer { GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.disableLighting(); ItemRenderer.disableStandardItemLighting(); - rb.begin(GL46.GL_QUADS, VERTEX_FORMAT); + rb.begin(GL46C.GL_QUADS, VERTEX_FORMAT); rb.pos((double)(x - rotX * scale - rotXY * scale), (double)(y - rotZ * scale), (double)(z - rotYZ * scale - rotXZ * scale)) .tex((double)u2, (double)v2).color(this.brightness, this.brightness, this.brightness, 1.0F).lightmap(0, 240) .normal(0.0F, 1.0F, 0.0F).endVertex(); @@ -1002,8 +998,8 @@ public class EffectRenderer { this.interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial; this.interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partial; GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); - GlState.alphaFunc(GL46.GL_GREATER, 0.003921569F); + GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA); + GlState.alphaFunc(GL46C.GL_GREATER, 0.003921569F); for(int i = 0; i < 2; ++i) { if(!this.layers[i].isEmpty()) { @@ -1021,7 +1017,7 @@ public class EffectRenderer { GlState.color(1.0F, 1.0F, 1.0F, 1.0F); RenderBuffer worldrenderer = Tessellator.getBuffer(); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); for(int k = 0; k < this.layers[i].size(); ++k) { this.layers[i].get(k).render(worldrenderer, partial, f, f4, f1, f2, f3); @@ -1033,7 +1029,7 @@ public class EffectRenderer { GlState.depthMask(true); GlState.disableBlend(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); } public void renderTextured(Entity entity, float partial) { diff --git a/client/src/main/java/client/renderer/Frustum.java b/client/src/main/java/client/renderer/Frustum.java index aca41c5e..60bb91af 100755 --- a/client/src/main/java/client/renderer/Frustum.java +++ b/client/src/main/java/client/renderer/Frustum.java @@ -4,7 +4,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.util.BoundingBox; import common.util.ExtMath; @@ -44,8 +44,8 @@ public class Frustum { public void init() { this.projection.clear(); this.modelview.clear(); - GL46.glGetFloatv(2983, this.projection); - GL46.glGetFloatv(2982, this.modelview); + GL46C.glGetFloatv(2983, this.projection); + GL46C.glGetFloatv(2982, this.modelview); float[] proj = this.projectionMat; float[] view = this.modelviewMat; this.projection.flip().limit(16); diff --git a/client/src/main/java/client/renderer/GlState.java b/client/src/main/java/client/renderer/GlState.java index 85742ff3..5c9175b2 100755 --- a/client/src/main/java/client/renderer/GlState.java +++ b/client/src/main/java/client/renderer/GlState.java @@ -1,84 +1,21 @@ package client.renderer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; public class GlState { - private static GlState.AlphaState alphaState = new GlState.AlphaState(); - private static GlState.BooleanState lightingState = new GlState.BooleanState(GL46.GL_LIGHTING); - private static GlState.BooleanState[] lightState = new GlState.BooleanState[2]; - private static GlState.ColorMaterialState colorMaterialState = new GlState.ColorMaterialState(); private static GlState.BlendState blendState = new GlState.BlendState(); private static GlState.DepthState depthState = new GlState.DepthState(); - private static GlState.FogState fogState = new GlState.FogState(); private static GlState.CullState cullState = new GlState.CullState(); - private static GlState.PolygonOffsetState polygonOffsetState = new GlState.PolygonOffsetState(); - private static GlState.Color clearState = new GlState.Color(); - private static GlState.BooleanState normalizeState = new GlState.BooleanState(GL46.GL_NORMALIZE); - private static int activeTextureUnit = 0; - private static GlState.TextureState[] textureState = new GlState.TextureState[2]; - private static int activeShadeModel = GL46.GL_SMOOTH; - private static GlState.BooleanState rescaleNormalState = new GlState.BooleanState(GL46.GL_RESCALE_NORMAL); - private static GlState.ColorMask colorMaskState = new GlState.ColorMask(); - private static GlState.Color colorState = new GlState.Color(); + private static GlState.ClearState clearState = new GlState.ClearState(); + private static GlState.TextureState textureState = new GlState.TextureState(); - public static void disableAlpha() + public static void bindTexture(int texture) { - alphaState.alphaTest.setDisabled(); - } - - public static void enableAlpha() - { - alphaState.alphaTest.setEnabled(); - } - - public static void alphaFunc(int func, float ref) - { - if (func != alphaState.func || ref != alphaState.ref) + if (texture != textureState.textureName) { - alphaState.func = func; - alphaState.ref = ref; - GL46.glAlphaFunc(func, ref); - } - } - - public static void enableLighting() - { - lightingState.setEnabled(); - } - - public static void disableLighting() - { - lightingState.setDisabled(); - } - - public static void enableLight(int light) - { - lightState[light].setEnabled(); - } - - public static void disableLight(int light) - { - lightState[light].setDisabled(); - } - - public static void enableColorMaterial() - { - colorMaterialState.colorMaterial.setEnabled(); - } - - public static void disableColorMaterial() - { - colorMaterialState.colorMaterial.setDisabled(); - } - - public static void colorMaterial(int face, int mode) - { - if (face != colorMaterialState.face || mode != colorMaterialState.mode) - { - colorMaterialState.face = face; - colorMaterialState.mode = mode; - GL46.glColorMaterial(face, mode); + textureState.textureName = texture; + GL46C.glBindTexture(GL46C.GL_TEXTURE_2D, texture); } } @@ -92,24 +29,6 @@ public class GlState depthState.depthTest.setEnabled(); } - public static void depthFunc(int depthFunc) - { - if (depthFunc != depthState.depthFunc) - { - depthState.depthFunc = depthFunc; - GL46.glDepthFunc(depthFunc); - } - } - - public static void depthMask(boolean flagIn) - { - if (flagIn != depthState.maskEnabled) - { - depthState.maskEnabled = flagIn; - GL46.glDepthMask(flagIn); - } - } - public static void disableBlend() { blendState.blend.setDisabled(); @@ -120,88 +39,6 @@ public class GlState blendState.blend.setEnabled(); } - public static void blendFunc(int srcFactor, int dstFactor) - { - if (srcFactor != blendState.srcFactor || dstFactor != blendState.dstFactor) - { - blendState.srcFactor = srcFactor; - blendState.dstFactor = dstFactor; - GL46.glBlendFunc(srcFactor, dstFactor); - } - } - - public static void tryBlendFuncSeparate(int srcFactor, int dstFactor, int srcFactorAlpha, int dstFactorAlpha) - { - if (srcFactor != blendState.srcFactor || dstFactor != blendState.dstFactor || srcFactorAlpha != blendState.srcFactorAlpha || dstFactorAlpha != blendState.dstFactorAlpha) - { - blendState.srcFactor = srcFactor; - blendState.dstFactor = dstFactor; - blendState.srcFactorAlpha = srcFactorAlpha; - blendState.dstFactorAlpha = dstFactorAlpha; - GL46.glBlendFuncSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha); - } - } - - public static void enableFog() - { - if(fogState.enabled) - fogState.fog.setEnabled(); - } - - public static void disableFog() - { -// if(fogState.enabled) - fogState.fog.setDisabled(); - } - - public static void setFogEnabled(boolean param) - { - if (param != fogState.enabled) - { - fogState.enabled = param; - } - if(param) - enableFog(); - else - disableFog(); - } - - public static void setFog(int param) - { - if (param != fogState.mode) - { - fogState.mode = param; - GL46.glFogi(GL46.GL_FOG_MODE, param); - } - } - - public static void setFogDensity(float param) - { - if (param != fogState.density) - { - fogState.density = param; - GL46.glFogf(GL46.GL_FOG_DENSITY, param); - } - } - - public static void setFogStart(float param) - { - if (param != fogState.start) - { - fogState.start = param; - GL46.glFogf(GL46.GL_FOG_START, param); - } - } - - public static void setFogEnd(float param) - { - if (param != fogState.end) - { - fogState.end = param; - GL46.glFogf(GL46.GL_FOG_END, param); - } - } - public static void enableCull() { cullState.cullFace.setEnabled(); @@ -212,6 +49,18 @@ public class GlState cullState.cullFace.setDisabled(); } + public static void tryBlendFuncSeparate(int srcFactor, int dstFactor, int srcFactorAlpha, int dstFactorAlpha) + { + if (srcFactor != blendState.srcFactor || dstFactor != blendState.dstFactor || srcFactorAlpha != blendState.srcFactorAlpha || dstFactorAlpha != blendState.dstFactorAlpha) + { + blendState.srcFactor = srcFactor; + blendState.dstFactor = dstFactor; + blendState.srcFactorAlpha = srcFactorAlpha; + blendState.dstFactorAlpha = dstFactorAlpha; + GL46C.glBlendFuncSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha); + } + } + public static boolean isCullEnabled() { return cullState.cullFace.currentState; @@ -222,109 +71,35 @@ public class GlState if (mode != cullState.mode) { cullState.mode = mode; - GL46.glCullFace(mode); + GL46C.glCullFace(mode); } } - public static void enablePolygonOffset() + public static void depthFunc(int depthFunc) { - polygonOffsetState.polygonOffsetFill.setEnabled(); - } - - public static void disablePolygonOffset() - { - polygonOffsetState.polygonOffsetFill.setDisabled(); - } - - public static void doPolygonOffset(float factor, float units) - { - if (factor != polygonOffsetState.factor || units != polygonOffsetState.units) + if (depthFunc != depthState.depthFunc) { - polygonOffsetState.factor = factor; - polygonOffsetState.units = units; - GL46.glPolygonOffset(factor, units); + depthState.depthFunc = depthFunc; + GL46C.glDepthFunc(depthFunc); } } - - public static void setActiveTexture(int texture) + + public static void depthMask(boolean flagIn) { - if (activeTextureUnit != texture - GL46.GL_TEXTURE0) + if (flagIn != depthState.maskEnabled) { - activeTextureUnit = texture - GL46.GL_TEXTURE0; - GL46.glActiveTexture(texture); + depthState.maskEnabled = flagIn; + GL46C.glDepthMask(flagIn); } } - public static void enableTexture2D() - { - textureState[activeTextureUnit].texture2DState.setEnabled(); - } - - public static void disableTexture2D() - { - textureState[activeTextureUnit].texture2DState.setDisabled(); - } - public static void deleteTexture(int texture) { - GL46.glDeleteTextures(texture); + GL46C.glDeleteTextures(texture); - for (GlState.TextureState glstatemanager$texturestate : textureState) + if (textureState.textureName == texture) { - if (glstatemanager$texturestate.textureName == texture) - { - glstatemanager$texturestate.textureName = -1; - } - } - } - - public static void bindTexture(int texture) - { - if (texture != textureState[activeTextureUnit].textureName) - { - textureState[activeTextureUnit].textureName = texture; - GL46.glBindTexture(GL46.GL_TEXTURE_2D, texture); - } - } - - public static void enableNormalize() - { - normalizeState.setEnabled(); - } - - public static void disableNormalize() - { - normalizeState.setDisabled(); - } - - public static void shadeModel(int mode) - { - if (mode != activeShadeModel) - { - activeShadeModel = mode; - GL46.glShadeModel(mode); - } - } - - public static void enableRescaleNormal() - { - rescaleNormalState.setEnabled(); - } - - public static void disableRescaleNormal() - { - rescaleNormalState.setDisabled(); - } - - public static void colorMask(boolean red, boolean green, boolean blue, boolean alpha) - { - if (red != colorMaskState.red || green != colorMaskState.green || blue != colorMaskState.blue || alpha != colorMaskState.alpha) - { - colorMaskState.red = red; - colorMaskState.green = green; - colorMaskState.blue = blue; - colorMaskState.alpha = alpha; - GL46.glColorMask(red, green, blue, alpha); + textureState.textureName = -1; } } @@ -336,59 +111,7 @@ public class GlState clearState.green = green; clearState.blue = blue; clearState.alpha = alpha; - GL46.glClearColor(red, green, blue, alpha); - } - } - - public static void color(float colorRed, float colorGreen, float colorBlue, float colorAlpha) - { - if (colorRed != colorState.red || colorGreen != colorState.green || colorBlue != colorState.blue || colorAlpha != colorState.alpha) - { - colorState.red = colorRed; - colorState.green = colorGreen; - colorState.blue = colorBlue; - colorState.alpha = colorAlpha; - GL46.glColor4f(colorRed, colorGreen, colorBlue, colorAlpha); - } - } - - public static void color(int c) { - float a = (float)(c >> 24 & 255) / 255.0F; - float r = (float)(c >> 16 & 255) / 255.0F; - float g = (float)(c >> 8 & 255) / 255.0F; - float b = (float)(c & 255) / 255.0F; - color(r, g, b, a); - } - - public static void resetColor() - { - colorState.red = colorState.green = colorState.blue = colorState.alpha = -1.0F; - } - - static - { - for (int i = 0; i < lightState.length; ++i) - { - lightState[i] = new GlState.BooleanState(GL46.GL_LIGHT0 + i); - } - - for (int j = 0; j < textureState.length; ++j) - { - textureState[j] = new GlState.TextureState(); - } - } - - static class AlphaState - { - public GlState.BooleanState alphaTest; - public int func; - public float ref; - - private AlphaState() - { - this.alphaTest = new GlState.BooleanState(GL46.GL_ALPHA_TEST); - this.func = GL46.GL_ALWAYS; - this.ref = -1.0F; + GL46C.glClearColor(red, green, blue, alpha); } } @@ -402,11 +125,11 @@ public class GlState private BlendState() { - this.blend = new GlState.BooleanState(GL46.GL_BLEND); - this.srcFactor = GL46.GL_ONE; - this.dstFactor = GL46.GL_ZERO; - this.srcFactorAlpha = GL46.GL_ONE; - this.dstFactorAlpha = GL46.GL_ZERO; + this.blend = new GlState.BooleanState(GL46C.GL_BLEND); + this.srcFactor = GL46C.GL_ONE; + this.dstFactor = GL46C.GL_ZERO; + this.srcFactorAlpha = GL46C.GL_ONE; + this.dstFactorAlpha = GL46C.GL_ZERO; } } @@ -438,57 +161,27 @@ public class GlState if (state) { - GL46.glEnable(this.capability); + GL46C.glEnable(this.capability); } else { - GL46.glDisable(this.capability); + GL46C.glDisable(this.capability); } } } } - static class Color + static class ClearState { public float red = 1.0F; public float green = 1.0F; public float blue = 1.0F; public float alpha = 1.0F; - public Color() + public ClearState() { } } - - static class ColorMask - { - public boolean red; - public boolean green; - public boolean blue; - public boolean alpha; - - private ColorMask() - { - this.red = true; - this.green = true; - this.blue = true; - this.alpha = true; - } - } - - static class ColorMaterialState - { - public GlState.BooleanState colorMaterial; - public int face; - public int mode; - - private ColorMaterialState() - { - this.colorMaterial = new GlState.BooleanState(GL46.GL_COLOR_MATERIAL); - this.face = GL46.GL_FRONT_AND_BACK; - this.mode = GL46.GL_AMBIENT_AND_DIFFUSE; - } - } static class CullState { @@ -497,8 +190,8 @@ public class GlState private CullState() { - this.cullFace = new GlState.BooleanState(GL46.GL_CULL_FACE); - this.mode = GL46.GL_BACK; + this.cullFace = new GlState.BooleanState(GL46C.GL_CULL_FACE); + this.mode = GL46C.GL_BACK; } } @@ -510,56 +203,18 @@ public class GlState private DepthState() { - this.depthTest = new GlState.BooleanState(GL46.GL_DEPTH_TEST); + this.depthTest = new GlState.BooleanState(GL46C.GL_DEPTH_TEST); this.maskEnabled = true; - this.depthFunc = GL46.GL_LESS; - } - } - - static class FogState - { - public GlState.BooleanState fog; - public boolean enabled; - public int mode; - public float density; - public float start; - public float end; - - private FogState() - { - this.fog = new GlState.BooleanState(GL46.GL_FOG); - this.enabled = true; - this.mode = GL46.GL_EXP; - this.density = 1.0F; - this.start = 0.0F; - this.end = 1.0F; - } - } - - static class PolygonOffsetState - { - public GlState.BooleanState polygonOffsetFill; - public GlState.BooleanState polygonOffsetLine; - public float factor; - public float units; - - private PolygonOffsetState() - { - this.polygonOffsetFill = new GlState.BooleanState(GL46.GL_POLYGON_OFFSET_FILL); - this.polygonOffsetLine = new GlState.BooleanState(GL46.GL_POLYGON_OFFSET_LINE); - this.factor = 0.0F; - this.units = 0.0F; + this.depthFunc = GL46C.GL_LESS; } } static class TextureState { - public GlState.BooleanState texture2DState; public int textureName; private TextureState() { - this.texture2DState = new GlState.BooleanState(GL46.GL_TEXTURE_2D); this.textureName = 0; } } diff --git a/client/src/main/java/client/renderer/ItemRenderer.java b/client/src/main/java/client/renderer/ItemRenderer.java index 09bcee3f..3858a263 100755 --- a/client/src/main/java/client/renderer/ItemRenderer.java +++ b/client/src/main/java/client/renderer/ItemRenderer.java @@ -4,7 +4,7 @@ import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.FloatBuffer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.entity.RenderItem; @@ -28,10 +28,6 @@ import common.world.State; public class ItemRenderer { - private static final FloatBuffer BUFFER = ByteBuffer.allocateDirect(16 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer(); - private static final Vec3 LIGHT0_POS = (new Vec3(0.20000000298023224D, 1.0D, -0.699999988079071D)).normalize(); - private static final Vec3 LIGHT1_POS = (new Vec3(-0.20000000298023224D, 1.0D, 0.699999988079071D)).normalize(); - private final Client gm; private final RenderManager renderManager; private final RenderItem itemRenderer; @@ -40,54 +36,14 @@ public class ItemRenderer private float equippedProgress; private float prevEquippedProgress; - private static FloatBuffer setColorBuffer(float r, float g, float b, float a) - { - BUFFER.clear(); - BUFFER.put(r).put(g).put(b).put(a); - BUFFER.flip(); - return BUFFER; - } - - public static void enableGUIStandardItemLighting() - { - GL46.glPushMatrix(); - GL46.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(165.0F, 1.0F, 0.0F, 0.0F); - enableStandardItemLighting(); - GL46.glPopMatrix(); - } - - public static void enableStandardItemLighting() - { - GlState.enableLighting(); - GlState.enableLight(0); - GlState.enableLight(1); - GlState.enableColorMaterial(); - GlState.colorMaterial(GL46.GL_FRONT_AND_BACK, GL46.GL_AMBIENT_AND_DIFFUSE); - float f = 0.4F; - float f1 = 0.6F; - float f2 = 0.0F; - GL46.glLightfv(GL46.GL_LIGHT0, GL46.GL_POSITION, setColorBuffer( - (float)LIGHT0_POS.xCoord, (float)LIGHT0_POS.yCoord, (float)LIGHT0_POS.zCoord, 0.0f)); - GL46.glLightfv(GL46.GL_LIGHT0, GL46.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F)); - GL46.glLightfv(GL46.GL_LIGHT0, GL46.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL46.glLightfv(GL46.GL_LIGHT0, GL46.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F)); - GL46.glLightfv(GL46.GL_LIGHT1, GL46.GL_POSITION, setColorBuffer( - (float)LIGHT1_POS.xCoord, (float)LIGHT1_POS.yCoord, (float)LIGHT1_POS.zCoord, 0.0f)); - GL46.glLightfv(GL46.GL_LIGHT1, GL46.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F)); - GL46.glLightfv(GL46.GL_LIGHT1, GL46.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GL46.glLightfv(GL46.GL_LIGHT1, GL46.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F)); - GlState.shadeModel(GL46.GL_FLAT); - GL46.glLightModelfv(GL46.GL_LIGHT_MODEL_AMBIENT, setColorBuffer(f, f, f, 1.0F)); - } - - public static void disableStandardItemLighting() - { - GlState.disableLighting(); - GlState.disableLight(0); - GlState.disableLight(1); - GlState.disableColorMaterial(); - } +// public static void enableGUIStandardItemLighting() +// { +// GL46C.glPushMatrix(); +// GL46C.glRotatef(-30.0F, 0.0F, 1.0F, 0.0F); +// GL46C.glRotatef(165.0F, 1.0F, 0.0F, 0.0F); +// enableStandardItemLighting(); +// GL46C.glPopMatrix(); +// } public ItemRenderer(Client gmIn) { @@ -102,26 +58,26 @@ public class ItemRenderer { Item item = heldStack.getItem(); Block block = item.getBlock(); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); if (this.itemRenderer.shouldRenderItemIn3D(heldStack)) { - GL46.glScalef(2.0F, 2.0F, 2.0F); + GL46C.glScalef(2.0F, 2.0F, 2.0F); } this.itemRenderer.renderItemForEntity(heldStack, entityIn, third); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } private void rotateArroundXAndY(float angle, float angleY) { - GL46.glPushMatrix(); - GL46.glRotatef(angle, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(angleY, 0.0F, 1.0F, 0.0F); + GL46C.glPushMatrix(); + GL46C.glRotatef(angle, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(angleY, 0.0F, 1.0F, 0.0F); ItemRenderer.enableStandardItemLighting(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } private void setLightMapFromPlayer(EntityNPC clientPlayer) @@ -129,15 +85,15 @@ public class ItemRenderer int i = this.gm.world.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ)); float f = (float)(i & 65535); float f1 = (float)(i >> 16); - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, f, f1); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, f, f1); } private void rotateWithPlayerRotations(EntityNPC entityplayerspIn, float partialTicks) { float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks; float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks; - GL46.glRotatef((entityplayerspIn.rotPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef((entityplayerspIn.rotYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef((entityplayerspIn.rotPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef((entityplayerspIn.rotYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F); } private float getMapAngleFromPitch(float pitch) @@ -214,7 +170,7 @@ public class ItemRenderer //// Tessellator tessellator = Tessellator.getInstance(); // RenderBuffer worldrenderer = Tessellator.getBuffer(); // SKC.glNormal3f(0.0F, 0.0F, -1.0F); -// worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); +// worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); // worldrenderer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex(); // worldrenderer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex(); // worldrenderer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex(); @@ -233,21 +189,21 @@ public class ItemRenderer float f = -0.3F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI); float f1 = 0.4F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI * 2.0F); float f2 = -0.4F * ExtMath.sin(swingProgress * (float)Math.PI); - GL46.glTranslatef(f, f1, f2); - GL46.glTranslatef(0.64000005F, -0.6F, -0.71999997F); - GL46.glTranslatef(0.0F, equipProgress * -0.6F, 0.0F); - GL46.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(f, f1, f2); + GL46C.glTranslatef(0.64000005F, -0.6F, -0.71999997F); + GL46C.glTranslatef(0.0F, equipProgress * -0.6F, 0.0F); + GL46C.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); float f3 = ExtMath.sin(swingProgress * swingProgress * (float)Math.PI); float f4 = ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI); - GL46.glRotatef(f4 * 70.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(f3 * -20.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(f4 * 70.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(f3 * -20.0F, 0.0F, 0.0F, 1.0F); this.gm.getTextureManager().bindTexture(EntityTexManager.getSkin(clientPlayer)); - GL46.glTranslatef(-1.0F, 3.6F, 3.5F); - GL46.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); - GL46.glScalef(1.0F, 1.0F, 1.0F); - GL46.glTranslatef(5.6F, 0.0F, 0.0F); + GL46C.glTranslatef(-1.0F, 3.6F, 3.5F); + GL46C.glRotatef(120.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(200.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL46C.glScalef(1.0F, 1.0F, 1.0F); + GL46C.glTranslatef(5.6F, 0.0F, 0.0F); RenderNpc render = this.renderManager.getRenderObject(this.gm.player.getModel()); GlState.disableCull(); render.renderPlayerArm(this.gm.player); @@ -259,7 +215,7 @@ public class ItemRenderer float f = -0.4F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI); float f1 = 0.2F * ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI * 2.0F); float f2 = -0.2F * ExtMath.sin(swingProgress * (float)Math.PI); - GL46.glTranslatef(f, f1, f2); + GL46C.glTranslatef(f, f1, f2); } private void performDrinking(EntityNPC clientPlayer, float partialTicks) @@ -273,33 +229,33 @@ public class ItemRenderer f2 = 0.0F; } - GL46.glTranslatef(0.0F, f2, 0.0F); + GL46C.glTranslatef(0.0F, f2, 0.0F); float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D); - GL46.glTranslatef(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); - GL46.glRotatef(f3 * 90.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(f3 * 10.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(f3 * 30.0F, 0.0F, 0.0F, 1.0F); + GL46C.glTranslatef(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F); + GL46C.glRotatef(f3 * 90.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(f3 * 10.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(f3 * 30.0F, 0.0F, 0.0F, 1.0F); } private void transformFirstPersonItem(float equipProgress, float swingProgress) { - GL46.glTranslatef(0.56F, -0.52F, -0.71999997F); - GL46.glTranslatef(0.0F, equipProgress * -0.6F, 0.0F); - GL46.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.56F, -0.52F, -0.71999997F); + GL46C.glTranslatef(0.0F, equipProgress * -0.6F, 0.0F); + GL46C.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); float f = ExtMath.sin(swingProgress * swingProgress * (float)Math.PI); float f1 = ExtMath.sin(ExtMath.sqrtf(swingProgress) * (float)Math.PI); - GL46.glRotatef(f * -20.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(f1 * -20.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(f1 * -80.0F, 1.0F, 0.0F, 0.0F); - GL46.glScalef(0.4F, 0.4F, 0.4F); + GL46C.glRotatef(f * -20.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(f1 * -20.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(f1 * -80.0F, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(0.4F, 0.4F, 0.4F); } private void doBowTransformations(float partialTicks, EntityNPC clientPlayer) { - GL46.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); - GL46.glTranslatef(-0.9F, 0.2F, 0.0F); + GL46C.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F); + GL46C.glTranslatef(-0.9F, 0.2F, 0.0F); float f = (float)this.itemToRender.getMaxItemUseDuration() - ((float)clientPlayer.getItemInUseCount() - partialTicks + 1.0F); float f1 = f / 20.0F; f1 = (f1 * f1 + f1 * 2.0F) / 3.0F; @@ -314,19 +270,19 @@ public class ItemRenderer float f2 = ExtMath.sin((f - 0.1F) * 1.3F); float f3 = f1 - 0.1F; float f4 = f2 * f3; - GL46.glTranslatef(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F); + GL46C.glTranslatef(f4 * 0.0F, f4 * 0.01F, f4 * 0.0F); } - GL46.glTranslatef(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F); - GL46.glScalef(1.0F, 1.0F, 1.0F + f1 * 0.2F); + GL46C.glTranslatef(f1 * 0.0F, f1 * 0.0F, f1 * 0.1F); + GL46C.glScalef(1.0F, 1.0F, 1.0F + f1 * 0.2F); } private void doBlockTransformations() { - GL46.glTranslatef(-0.5F, 0.2F, 0.0F); - GL46.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(-0.5F, 0.2F, 0.0F); + GL46C.glRotatef(30.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); } public void renderItemInFirstPerson(float partialTicks) @@ -340,7 +296,7 @@ public class ItemRenderer this.setLightMapFromPlayer(clientplayer); this.rotateWithPlayerRotations(clientplayer, partialTicks); GlState.enableRescaleNormal(); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); if (this.itemToRender != null && (this.itemToRender.getItem().getWieldType() != null || (clientplayer.getItemInUseCount() > 0 && this.itemToRender.getItemUseAction() != ItemAction.NONE))) { @@ -383,114 +339,11 @@ public class ItemRenderer this.renderPlayerArm(clientplayer, f, f1); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.disableRescaleNormal(); ItemRenderer.disableStandardItemLighting(); } - public void renderOverlays(float partialTicks) - { - GlState.disableAlpha(); - - if (this.gm.player.isEntityInsideOpaqueBlock()) - { - State iblockstate = this.gm.world.getState(new BlockPos(this.gm.player)); - EntityNPC entityplayer = this.gm.player; - - for (int i = 0; i < 8; ++i) - { - double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F); - double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F); - double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F); - BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2); - State iblockstate1 = this.gm.world.getState(blockpos); - - if (iblockstate1.getBlock().isVisuallyOpaque()) - { - iblockstate = iblockstate1; - } - } - - if (iblockstate.getBlock() != Blocks.air) - { - this.renderBlockInside(partialTicks, this.gm.renderer.getModelManager().getTexture(iblockstate)); - } - } - - if(this.gm.player.isBurning()) { - this.renderFireOverlay(partialTicks); - } - - GlState.enableAlpha(); - } - - private void renderBlockInside(float partialTicks, Sprite atlas) - { - this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS); - RenderBuffer worldrenderer = Tessellator.getBuffer(); - float f = 0.1F; - GlState.color(0.1F, 0.1F, 0.1F, 0.5F); - GL46.glPushMatrix(); - float f1 = -1.0F; - float f2 = 1.0F; - float f3 = -1.0F; - float f4 = 1.0F; - float f5 = -0.5F; - float f6 = atlas.getMinU(); - float f7 = atlas.getMaxU(); - float f8 = atlas.getMinV(); - float f9 = atlas.getMaxV(); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(-1.0D, -1.0D, -0.5D).tex((double)f7, (double)f9).endVertex(); - worldrenderer.pos(1.0D, -1.0D, -0.5D).tex((double)f6, (double)f9).endVertex(); - worldrenderer.pos(1.0D, 1.0D, -0.5D).tex((double)f6, (double)f8).endVertex(); - worldrenderer.pos(-1.0D, 1.0D, -0.5D).tex((double)f7, (double)f8).endVertex(); - Tessellator.draw(); - GL46.glPopMatrix(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - } - - private void renderFireOverlay(float partialTicks) - { - RenderBuffer worldrenderer = Tessellator.getBuffer(); - GlState.color(1.0F, 1.0F, 1.0F, 0.9F); - GlState.depthFunc(GL46.GL_ALWAYS); - GlState.depthMask(false); - GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - float f = 1.0F; - - for (int i = 0; i < 2; ++i) - { - GL46.glPushMatrix(); - Sprite textureatlassprite = this.gm.getTextureMapBlocks().getAtlasSprite("blocks/fire_layer_1"); - this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS); - float f1 = textureatlassprite.getMinU(); - float f2 = textureatlassprite.getMaxU(); - float f3 = textureatlassprite.getMinV(); - float f4 = textureatlassprite.getMaxV(); - float f5 = (0.0F - f) / 2.0F; - float f6 = f5 + f; - float f7 = 0.0F - f / 2.0F; - float f8 = f7 + f; - float f9 = -0.5F; - GL46.glTranslatef((float)(-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F); - GL46.glRotatef((float)(i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos((double)f5, (double)f7, (double)f9).tex((double)f2, (double)f4).endVertex(); - worldrenderer.pos((double)f6, (double)f7, (double)f9).tex((double)f1, (double)f4).endVertex(); - worldrenderer.pos((double)f6, (double)f8, (double)f9).tex((double)f1, (double)f3).endVertex(); - worldrenderer.pos((double)f5, (double)f8, (double)f9).tex((double)f2, (double)f3).endVertex(); - Tessellator.draw(); - GL46.glPopMatrix(); - } - - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.disableBlend(); - GlState.depthMask(true); - GlState.depthFunc(GL46.GL_LEQUAL); - } - public void update() { this.prevEquippedProgress = this.equippedProgress; diff --git a/client/src/main/java/client/renderer/MatrixState.java b/client/src/main/java/client/renderer/MatrixState.java index 42878823..4e126a6a 100755 --- a/client/src/main/java/client/renderer/MatrixState.java +++ b/client/src/main/java/client/renderer/MatrixState.java @@ -5,7 +5,7 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.block.Block; import common.block.liquid.BlockLiquid; @@ -32,9 +32,9 @@ public class MatrixState { private static float rotationXY; public static void update(EntityNPC player, boolean flip) { - GL46.glGetFloatv(GL46.GL_MODELVIEW_MATRIX, MODELVIEW); - GL46.glGetFloatv(GL46.GL_PROJECTION_MATRIX, PROJECTION); - GL46.glGetIntegerv(GL46.GL_VIEWPORT, VIEWPORT); + GL46C.glGetFloatv(GL46C.GL_MODELVIEW_MATRIX, MODELVIEW); + GL46C.glGetFloatv(GL46C.GL_PROJECTION_MATRIX, PROJECTION); + GL46C.glGetIntegerv(GL46C.GL_VIEWPORT, VIEWPORT); float x = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2); float y = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2); Project.gluUnProject(x, y, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS); diff --git a/client/src/main/java/client/renderer/Project.java b/client/src/main/java/client/renderer/Project.java index d2aa0751..9b828f7e 100644 --- a/client/src/main/java/client/renderer/Project.java +++ b/client/src/main/java/client/renderer/Project.java @@ -36,7 +36,7 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.nio.IntBuffer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; // 11-jan-2004 Erik Duijs public class Project { @@ -201,7 +201,7 @@ public class Project { matrix.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ); matrix.put(3 * 4 + 3, 0); - GL46.glMultMatrixf(matrix); + GL46C.glMultMatrixf(matrix); } public static void gluLookAt( @@ -248,8 +248,8 @@ public class Project { matrix.put(1 * 4 + 2, -forward[1]); matrix.put(2 * 4 + 2, -forward[2]); - GL46.glMultMatrixf(matrix); - GL46.glTranslatef(-eyex, -eyey, -eyez); + GL46C.glMultMatrixf(matrix); + GL46C.glTranslatef(-eyex, -eyey, -eyez); } public static boolean gluProject( diff --git a/client/src/main/java/client/renderer/RegionRenderCache.java b/client/src/main/java/client/renderer/RegionRenderCache.java index f4651eda..95441d5a 100755 --- a/client/src/main/java/client/renderer/RegionRenderCache.java +++ b/client/src/main/java/client/renderer/RegionRenderCache.java @@ -69,7 +69,7 @@ public class RegionRenderCache implements IWorldAccess return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED); } - public int getCombinedLight(BlockPos pos) + public int getWorldLight(BlockPos pos) { int i = this.getPositionIndex(pos); int j = this.combinedLights[i]; diff --git a/client/src/main/java/client/renderer/RegionRenderCacheBuilder.java b/client/src/main/java/client/renderer/RegionRenderCacheBuilder.java deleted file mode 100755 index 9bf2138d..00000000 --- a/client/src/main/java/client/renderer/RegionRenderCacheBuilder.java +++ /dev/null @@ -1,11 +0,0 @@ -package client.renderer; - -public class RegionRenderCacheBuilder -{ - private final RenderBuffer buffer = new RenderBuffer(4194304); - - public RenderBuffer getWorldRenderer() - { - return this.buffer; - } -} diff --git a/client/src/main/java/client/renderer/RenderBuffer.java b/client/src/main/java/client/renderer/RenderBuffer.java index 8def53f3..e1b00da5 100755 --- a/client/src/main/java/client/renderer/RenderBuffer.java +++ b/client/src/main/java/client/renderer/RenderBuffer.java @@ -2,456 +2,222 @@ package client.renderer; import java.nio.ByteBuffer; import java.nio.ByteOrder; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.ShortBuffer; import common.log.Log; -import common.util.ExtMath; -public class RenderBuffer -{ - private ByteBuffer byteBuffer; - private IntBuffer rawIntBuffer; - private ShortBuffer rawShortBuffer; - private FloatBuffer rawFloatBuffer; - private int vertexCount; - private VertexFormatElement vertexFormatElement; - private int vertexFormatIndex; - private int drawMode; - private double xOffset; - private double yOffset; - private double zOffset; - private VertexFormat vertexFormat; - private boolean isDrawing; +public class RenderBuffer { + private static final int[] QUAD_TO_TRI = {0, 1, 1, 2, 2, 3}; + private static final RenderBuffer BUFFER = new RenderBuffer(2097152); + + private static VertexBuffer vbo; - public RenderBuffer(int bufferSizeIn) - { - this.byteBuffer = ByteBuffer.allocateDirect(bufferSizeIn * 4).order(ByteOrder.nativeOrder()); - this.rawIntBuffer = this.byteBuffer.asIntBuffer(); - this.rawShortBuffer = this.byteBuffer.asShortBuffer(); - this.rawFloatBuffer = this.byteBuffer.asFloatBuffer(); - } + private ByteBuffer buffer; + private boolean drawing; + private int count; + + private double xOffset; + private double yOffset; + private double zOffset; - private void growBuffer(int p_181670_1_) - { - if (p_181670_1_ > this.rawIntBuffer.remaining()) - { - int i = this.byteBuffer.capacity(); - int j = i % 2097152; - int k = j + (((this.rawIntBuffer.position() + p_181670_1_) * 4 - j) / 2097152 + 1) * 2097152; - Log.RENDER.warn("Musste Puffer vergrößern: Alte Größe " + i + " Bytes, neue Größe " + k + " Bytes."); - int l = this.rawIntBuffer.position(); - ByteBuffer bytebuffer = ByteBuffer.allocateDirect(k).order(ByteOrder.nativeOrder()); - this.byteBuffer.position(0); - bytebuffer.put(this.byteBuffer); - bytebuffer.rewind(); - this.byteBuffer = bytebuffer; - this.rawFloatBuffer = this.byteBuffer.asFloatBuffer().asReadOnlyBuffer(); - this.rawIntBuffer = this.byteBuffer.asIntBuffer(); - this.rawIntBuffer.position(l); - this.rawShortBuffer = this.byteBuffer.asShortBuffer(); - this.rawShortBuffer.position(l << 1); - } - } + private float normalX = 0.0f; + private float normalY = 0.0f; + private float normalZ = 0.0f; + private float shine = 1.0f; + private int red = 255; + private int green = 255; + private int blue = 255; + private int alpha = 255; - private int getBufferSize() - { - return this.vertexCount * this.vertexFormat.getIntegerSize(); - } + public static RenderBuffer getBuffer() { + return BUFFER; + } - private static float getDistanceSq(FloatBuffer p_181665_0_, float p_181665_1_, float p_181665_2_, float p_181665_3_, int p_181665_4_, int p_181665_5_) - { - float f = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 0); - float f1 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 1); - float f2 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 0 + 2); - float f3 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 0); - float f4 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 1); - float f5 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 1 + 2); - float f6 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 0); - float f7 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 1); - float f8 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 2 + 2); - float f9 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 0); - float f10 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 1); - float f11 = p_181665_0_.get(p_181665_5_ + p_181665_4_ * 3 + 2); - float f12 = (f + f3 + f6 + f9) * 0.25F - p_181665_1_; - float f13 = (f1 + f4 + f7 + f10) * 0.25F - p_181665_2_; - float f14 = (f2 + f5 + f8 + f11) * 0.25F - p_181665_3_; - return f12 * f12 + f13 * f13 + f14 * f14; - } + public RenderBuffer(int size) { + this.buffer = ByteBuffer.allocateDirect(size * 4).order(ByteOrder.nativeOrder()); + } - public void reset() - { - this.vertexCount = 0; - this.vertexFormatElement = null; - this.vertexFormatIndex = 0; - } + public void begin() { + if(this.drawing) + throw new IllegalStateException("Puffer bereits in Verwendung"); + this.drawing = true; + this.count = 0; + this.buffer.limit(this.buffer.capacity()); + } - public void begin(int glMode, VertexFormat format) - { - if (this.isDrawing) - { - throw new IllegalStateException("Already building!"); - } - else - { - this.isDrawing = true; - this.reset(); - this.drawMode = glMode; - this.vertexFormat = format; - this.vertexFormatElement = format.getElement(this.vertexFormatIndex); - this.byteBuffer.limit(this.byteBuffer.capacity()); - } - } + public void begin(double x, double y, double z) { + this.begin(); + this.xOffset = x; + this.yOffset = y; + this.zOffset = z; + } - public RenderBuffer tex(double u, double v) - { - int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex); + public RenderBuffer put(double x, double y, double z, float nx, float ny, float nz, float shine, double u, double v, int red, int green, int blue, int alpha) { + this.buffer.putFloat((float)(x + this.xOffset)); + this.buffer.putFloat((float)(y + this.yOffset)); + this.buffer.putFloat((float)(z + this.zOffset)); + this.buffer.put((byte)((int)(nx * 127.0f) & 255)); + this.buffer.put((byte)((int)(ny * 127.0f) & 255)); + this.buffer.put((byte)((int)(nz * 127.0f) & 255)); + this.buffer.put((byte)((int)((shine / 32.0f) * 127.0f) & 255)); + this.buffer.putFloat((float)u); + this.buffer.putFloat((float)v); + this.buffer.put((byte)red); + this.buffer.put((byte)green); + this.buffer.put((byte)blue); + this.buffer.put((byte)alpha); + ++this.count; + if(this.buffer.remaining() < 28) { + int cap = this.buffer.capacity(); + int rest = cap % 2097152; + int extend = rest + (((this.buffer.position() + 28) - rest) / 2097152 + 1) * 2097152; + Log.RENDER.warn("Musste Puffer vergrößern: Alte Größe " + cap + " Bytes, neue Größe " + extend + " Bytes."); + ByteBuffer buffer = ByteBuffer.allocateDirect(extend).order(ByteOrder.nativeOrder()); + this.buffer.position(0); + buffer.put(this.buffer); + this.buffer = buffer; + } + return this; + } - switch (this.vertexFormatElement.type()) - { - case FLOAT: - this.byteBuffer.putFloat(i, (float)u); - this.byteBuffer.putFloat(i + 4, (float)v); - break; + public RenderBuffer put(double x, double y, double z, float nx, float ny, float nz, float shine, double u, double v, float red, float green, float blue, float alpha) { + return this.put(x, y, z, nx, ny, nz, shine, u, v, (int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } - case UINT: - case INT: - this.byteBuffer.putInt(i, (int)u); - this.byteBuffer.putInt(i + 4, (int)v); - break; + public RenderBuffer put(double x, double y, double z, float nx, float ny, float nz, float shine, double u, double v, int color) { + return this.put(x, y, z, nx, ny, nz, shine, u, v, color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } + + + public RenderBuffer setColor(int red, int green, int blue, int alpha) { + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = alpha; + return this; + } + + public RenderBuffer setColor(float red, float green, float blue, float alpha) { + return this.setColor((int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } + + public RenderBuffer setColor(int color) { + return this.setColor(color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } + + public RenderBuffer setNormal(float x, float y, float z, float shine) { + this.normalX = x; + this.normalY = y; + this.normalZ = z; + this.shine = shine; + return this; + } + - case USHORT: - case SHORT: - this.byteBuffer.putShort(i, (short)((int)v)); - this.byteBuffer.putShort(i + 2, (short)((int)u)); - break; + public RenderBuffer put(double x, double y, double z, double u, double v, int red, int green, int blue, int alpha) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, u, v, red, green, blue, alpha); + } - case UBYTE: - case BYTE: - this.byteBuffer.put(i, (byte)((int)v)); - this.byteBuffer.put(i + 1, (byte)((int)u)); - } + public RenderBuffer put(double x, double y, double z, double u, double v, float red, float green, float blue, float alpha) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, u, v, (int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } - this.nextVertexFormatIndex(); - return this; - } + public RenderBuffer put(double x, double y, double z, double u, double v, int color) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, u, v, color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } + - public RenderBuffer lightmap(int p_181671_1_, int p_181671_2_) - { - int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex); + public RenderBuffer put(double x, double y, double z, int red, int green, int blue, int alpha) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, 0.0, 0.0, red, green, blue, alpha); + } - switch (this.vertexFormatElement.type()) - { - case FLOAT: - this.byteBuffer.putFloat(i, (float)p_181671_1_); - this.byteBuffer.putFloat(i + 4, (float)p_181671_2_); - break; + public RenderBuffer put(double x, double y, double z, float red, float green, float blue, float alpha) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, 0.0, 0.0, (int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } - case UINT: - case INT: - this.byteBuffer.putInt(i, p_181671_1_); - this.byteBuffer.putInt(i + 4, p_181671_2_); - break; + public RenderBuffer put(double x, double y, double z, int color) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, 0.0, 0.0, color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } - case USHORT: - case SHORT: - this.byteBuffer.putShort(i, (short)p_181671_2_); - this.byteBuffer.putShort(i + 2, (short)p_181671_1_); - break; + public RenderBuffer put(double x, double y, double z, double u, double v) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, u, v, this.red, this.green, this.blue, this.alpha); + } - case UBYTE: - case BYTE: - this.byteBuffer.put(i, (byte)p_181671_2_); - this.byteBuffer.put(i + 1, (byte)p_181671_1_); - } + public RenderBuffer put(double x, double y, double z) { + return this.put(x, y, z, this.normalX, this.normalY, this.normalZ, this.shine, 0.0, 0.0, this.red, this.green, this.blue, this.alpha); + } + - this.nextVertexFormatIndex(); - return this; - } + public RenderBuffer put2d(double x, double y, double u, double v, int red, int green, int blue, int alpha) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, u, v, red, green, blue, alpha); + } - public void putBrightness4(int p_178962_1_, int p_178962_2_, int p_178962_3_, int p_178962_4_) - { - int i = (this.vertexCount - 4) * this.vertexFormat.getIntegerSize() + this.vertexFormat.getUvOffsetById(1) / 4; - int j = this.vertexFormat.getNextOffset() >> 2; - this.rawIntBuffer.put(i, p_178962_1_); - this.rawIntBuffer.put(i + j, p_178962_2_); - this.rawIntBuffer.put(i + j * 2, p_178962_3_); - this.rawIntBuffer.put(i + j * 3, p_178962_4_); - } + public RenderBuffer put2d(double x, double y, double u, double v, float red, float green, float blue, float alpha) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, u, v, (int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } - public void putPosition(double x, double y, double z) - { - int i = this.vertexFormat.getIntegerSize(); - int j = (this.vertexCount - 4) * i; + public RenderBuffer put2d(double x, double y, double u, double v, int color) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, u, v, color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } + - for (int k = 0; k < 4; ++k) - { - int l = j + k * i; - int i1 = l + 1; - int j1 = i1 + 1; - this.rawIntBuffer.put(l, Float.floatToRawIntBits((float)(x + this.xOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(l)))); - this.rawIntBuffer.put(i1, Float.floatToRawIntBits((float)(y + this.yOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(i1)))); - this.rawIntBuffer.put(j1, Float.floatToRawIntBits((float)(z + this.zOffset) + Float.intBitsToFloat(this.rawIntBuffer.get(j1)))); - } - } + public RenderBuffer put2d(double x, double y, int red, int green, int blue, int alpha) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, red, green, blue, alpha); + } - private int getColorIndex(int p_78909_1_) - { - return ((this.vertexCount - p_78909_1_) * this.vertexFormat.getNextOffset() + this.vertexFormat.getColorOffset()) / 4; - } + public RenderBuffer put2d(double x, double y, float red, float green, float blue, float alpha) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, (int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); + } - private void putColor(int argb, int p_178988_2_) - { - int i = this.getColorIndex(p_178988_2_); - int j = argb >> 16 & 255; - int k = argb >> 8 & 255; - int l = argb & 255; - int i1 = argb >> 24 & 255; - this.putColorRGBA(i, j, k, l, i1); - } + public RenderBuffer put2d(double x, double y, int color) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } - public void putColorRGB_F(float red, float green, float blue, int p_178994_4_) - { - int i = this.getColorIndex(p_178994_4_); - int j = ExtMath.clampi((int)(red * 255.0F), 0, 255); - int k = ExtMath.clampi((int)(green * 255.0F), 0, 255); - int l = ExtMath.clampi((int)(blue * 255.0F), 0, 255); - this.putColorRGBA(i, j, k, l, 255); - } + public RenderBuffer put2d(double x, double y, double u, double v) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, u, v, this.red, this.green, this.blue, this.alpha); + } - private void putColorRGBA(int index, int red, int p_178972_3_, int p_178972_4_, int p_178972_5_) - { - if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) - { - this.rawIntBuffer.put(index, p_178972_5_ << 24 | p_178972_4_ << 16 | p_178972_3_ << 8 | red); - } - else - { - this.rawIntBuffer.put(index, red << 24 | p_178972_3_ << 16 | p_178972_4_ << 8 | p_178972_5_); - } - } + public RenderBuffer put2d(double x, double y) { + return this.put(x, y, 0.0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0, 0.0, this.red, this.green, this.blue, this.alpha); + } + + + public RenderBuffer put(double x, double y, double z, int[] data, int color) { + for(int n = 0; n < 6; n++) { + int idx = QUAD_TO_TRI[n] * 7; + this.put(x + (double)Float.intBitsToFloat(data[idx + 0]), y + (double)Float.intBitsToFloat(data[idx + 1]), z + (double)Float.intBitsToFloat(data[idx + 2]), + (float)((byte)(data[idx + 3] & 0xff)) / 127.0f, (float)((byte)(data[idx + 3] & 0xff)) / 127.0f, (float)((byte)(data[idx + 3] & 0xff)) / 127.0f, + ((float)((byte)(data[idx + 3] & 0xff)) / 127.0f) * 32.0f, + (double)Float.intBitsToFloat(data[idx + 4]), (double)Float.intBitsToFloat(data[idx + 5]), + color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); + } + return this; + } + - public RenderBuffer color(float red, float green, float blue, float alpha) - { - return this.color((int)(red * 255.0F), (int)(green * 255.0F), (int)(blue * 255.0F), (int)(alpha * 255.0F)); - } + public ByteBuffer getByteBuffer() { + if(!this.drawing) + throw new IllegalStateException("Puffer nicht in Verwendung"); + this.buffer.position(0); + this.buffer.limit(this.count * 28); + this.drawing = false; + this.count = 0; + this.xOffset = 0.0; + this.yOffset = 0.0; + this.zOffset = 0.0; + this.normalX = 0.0f; + this.normalY = 0.0f; + this.normalZ = 0.0f; + this.shine = 1.0f; + this.red = 255; + this.green = 255; + this.blue = 255; + this.alpha = 255; + return this.buffer; + } - public RenderBuffer color(int color) - { - return this.color(color >> 16 & 255, color >> 8 & 255, color & 255, color >> 24 & 255); - } - - public RenderBuffer color(int red, int green, int blue, int alpha) - { - int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex); - - switch (this.vertexFormatElement.type()) - { - case FLOAT: - this.byteBuffer.putFloat(i, (float)red / 255.0F); - this.byteBuffer.putFloat(i + 4, (float)green / 255.0F); - this.byteBuffer.putFloat(i + 8, (float)blue / 255.0F); - this.byteBuffer.putFloat(i + 12, (float)alpha / 255.0F); - break; - - case UINT: - case INT: - this.byteBuffer.putFloat(i, (float)red); - this.byteBuffer.putFloat(i + 4, (float)green); - this.byteBuffer.putFloat(i + 8, (float)blue); - this.byteBuffer.putFloat(i + 12, (float)alpha); - break; - - case USHORT: - case SHORT: - this.byteBuffer.putShort(i, (short)red); - this.byteBuffer.putShort(i + 2, (short)green); - this.byteBuffer.putShort(i + 4, (short)blue); - this.byteBuffer.putShort(i + 6, (short)alpha); - break; - - case UBYTE: - case BYTE: - if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) - { - this.byteBuffer.put(i, (byte)red); - this.byteBuffer.put(i + 1, (byte)green); - this.byteBuffer.put(i + 2, (byte)blue); - this.byteBuffer.put(i + 3, (byte)alpha); - } - else - { - this.byteBuffer.put(i, (byte)alpha); - this.byteBuffer.put(i + 1, (byte)blue); - this.byteBuffer.put(i + 2, (byte)green); - this.byteBuffer.put(i + 3, (byte)red); - } - } - - this.nextVertexFormatIndex(); - return this; - } - - public void addVertexData(int[] vertexData) - { - this.growBuffer(vertexData.length); - this.rawIntBuffer.position(this.getBufferSize()); - this.rawIntBuffer.put(vertexData); - this.vertexCount += vertexData.length / this.vertexFormat.getIntegerSize(); - } - - public void endVertex() - { - ++this.vertexCount; - this.growBuffer(this.vertexFormat.getIntegerSize()); - } - - public RenderBuffer pos(double x, double y, double z) - { - int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex); - - switch (this.vertexFormatElement.type()) - { - case FLOAT: - this.byteBuffer.putFloat(i, (float)(x + this.xOffset)); - this.byteBuffer.putFloat(i + 4, (float)(y + this.yOffset)); - this.byteBuffer.putFloat(i + 8, (float)(z + this.zOffset)); - break; - - case UINT: - case INT: - this.byteBuffer.putInt(i, Float.floatToRawIntBits((float)(x + this.xOffset))); - this.byteBuffer.putInt(i + 4, Float.floatToRawIntBits((float)(y + this.yOffset))); - this.byteBuffer.putInt(i + 8, Float.floatToRawIntBits((float)(z + this.zOffset))); - break; - - case USHORT: - case SHORT: - this.byteBuffer.putShort(i, (short)((int)(x + this.xOffset))); - this.byteBuffer.putShort(i + 2, (short)((int)(y + this.yOffset))); - this.byteBuffer.putShort(i + 4, (short)((int)(z + this.zOffset))); - break; - - case UBYTE: - case BYTE: - this.byteBuffer.put(i, (byte)((int)(x + this.xOffset))); - this.byteBuffer.put(i + 1, (byte)((int)(y + this.yOffset))); - this.byteBuffer.put(i + 2, (byte)((int)(z + this.zOffset))); - } - - this.nextVertexFormatIndex(); - return this; - } - - public void putNormal(float x, float y, float z) - { - int i = (byte)((int)(x * 127.0F)) & 255; - int j = (byte)((int)(y * 127.0F)) & 255; - int k = (byte)((int)(z * 127.0F)) & 255; - int l = i | j << 8 | k << 16; - int i1 = this.vertexFormat.getNextOffset() >> 2; - int j1 = (this.vertexCount - 4) * i1 + this.vertexFormat.getNormalOffset() / 4; - this.rawIntBuffer.put(j1, l); - this.rawIntBuffer.put(j1 + i1, l); - this.rawIntBuffer.put(j1 + i1 * 2, l); - this.rawIntBuffer.put(j1 + i1 * 3, l); - } - - private void nextVertexFormatIndex() - { - ++this.vertexFormatIndex; - this.vertexFormatIndex %= this.vertexFormat.getElementCount(); - this.vertexFormatElement = this.vertexFormat.getElement(this.vertexFormatIndex); - - if (this.vertexFormatElement.usage() == VertexFormatElement.EnumUsage.PADDING) - { - this.nextVertexFormatIndex(); - } - } - - public RenderBuffer normal(float p_181663_1_, float p_181663_2_, float p_181663_3_) - { - int i = this.vertexCount * this.vertexFormat.getNextOffset() + this.vertexFormat.getOffset(this.vertexFormatIndex); - - switch (this.vertexFormatElement.type()) - { - case FLOAT: - this.byteBuffer.putFloat(i, p_181663_1_); - this.byteBuffer.putFloat(i + 4, p_181663_2_); - this.byteBuffer.putFloat(i + 8, p_181663_3_); - break; - - case UINT: - case INT: - this.byteBuffer.putInt(i, (int)p_181663_1_); - this.byteBuffer.putInt(i + 4, (int)p_181663_2_); - this.byteBuffer.putInt(i + 8, (int)p_181663_3_); - break; - - case USHORT: - case SHORT: - this.byteBuffer.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535)); - this.byteBuffer.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535)); - this.byteBuffer.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535)); - break; - - case UBYTE: - case BYTE: - this.byteBuffer.put(i, (byte)((int)p_181663_1_ * 127 & 255)); - this.byteBuffer.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255)); - this.byteBuffer.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255)); - } - - this.nextVertexFormatIndex(); - return this; - } - - public void setTranslation(double x, double y, double z) - { - this.xOffset = x; - this.yOffset = y; - this.zOffset = z; - } - - public void finishDrawing() - { - if (!this.isDrawing) - { - throw new IllegalStateException("Not building!"); - } - else - { - this.isDrawing = false; - this.byteBuffer.position(0); - this.byteBuffer.limit(this.getBufferSize() * 4); - } - } - - public ByteBuffer getByteBuffer() - { - return this.byteBuffer; - } - - public VertexFormat getVertexFormat() - { - return this.vertexFormat; - } - - public int getVertexCount() - { - return this.vertexCount; - } - - public int getDrawMode() - { - return this.drawMode; - } - - public void putColor4(int argb) - { - for (int i = 0; i < 4; ++i) - { - this.putColor(argb, i + 1); - } - } + public void draw() { + if(vbo == null) + vbo = new VertexBuffer(); + vbo.bufferData(this, true); + vbo.draw(); + } } diff --git a/client/src/main/java/client/renderer/Renderer.java b/client/src/main/java/client/renderer/Renderer.java index 4387878d..ebb366b2 100755 --- a/client/src/main/java/client/renderer/Renderer.java +++ b/client/src/main/java/client/renderer/Renderer.java @@ -16,7 +16,7 @@ import java.util.Queue; import java.util.Set; import java.util.function.Predicate; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.Shader.ShaderContext; @@ -102,7 +102,6 @@ public class Renderer { private static final String PLANET_TEX = "textures/world/planet_phases.png"; private static final String SUN_TEX = "textures/world/sun.png"; private static final String EXTERMINATED_TEX = "textures/world/destroyed.png"; - private static final String TEX_LIGHTMAP = "dynamic/lightmap"; private static final float FOG_DENSITY = 0.05f; private static final float FOG_DISTANCE = 0.4f; private static final float SQRT_2 = ExtMath.sqrtf(2.0F); @@ -113,8 +112,6 @@ public class Renderer { private final Random rng = new Random(); private final Random seededRng = new Random(); private final ItemRenderer itemRenderer; - private final DynamicTexture lightmapTexture; - private final int[] lightmapColors; private final TextureManager renderEngine; private final RenderManager renderManager; private final ModelManager manager; @@ -149,7 +146,6 @@ public class Renderer { private Set chunksToUpdate = new LinkedHashSet(); private List renderInfos = new ArrayList(69696); private ViewFrustum viewFrustum; - private VertexFormat vertexBufferFormat = new VertexFormat().addElement(new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.POSITION, 3)); private VertexBuffer starVBO; private VertexBuffer dstarVBO; private VertexBuffer skyVBO; @@ -196,9 +192,6 @@ public class Renderer { this.itemRenderer = gm.getItemRenderer(); this.renderManager = gm.getRenderManager(); this.renderEngine = gm.getTextureManager(); - this.lightmapTexture = new DynamicTexture(16, 16); - gm.getTextureManager().loadTexture(TEX_LIGHTMAP, this.lightmapTexture); - this.lightmapColors = this.lightmapTexture.getData(); for (int x = 0; x < 32; ++x) { @@ -212,11 +205,11 @@ public class Renderer { } } - GlState.bindTexture(0); - this.generateStars(); - this.generateDeepStars(); - this.generateSky(); - this.generateSky2(); +// GlState.bindTexture(0); +// this.generateStars(); +// this.generateDeepStars(); +// this.generateSky(); +// this.generateSky2(); } public float getNearPlane() { @@ -543,7 +536,7 @@ public class Renderer { if (entitylivingbase.getHealth() <= 0) { float f1 = (float)entitylivingbase.deathTime + partialTicks; - GL46.glRotatef(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(40.0F - 8000.0F / (f1 + 200.0F), 0.0F, 0.0F, 1.0F); } if (f < 0.0F || entitylivingbase.hasEffect(Effect.STABILITY)) @@ -554,9 +547,9 @@ public class Renderer { f = f / (float)entitylivingbase.maxHurtTime; f = ExtMath.sin(f * f * f * f * (float)Math.PI); float f2 = entitylivingbase.attackedYaw; - GL46.glRotatef(-f2, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-f * 14.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(f2, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-f2, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-f * 14.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(f2, 0.0F, 1.0F, 0.0F); } } @@ -569,10 +562,10 @@ public class Renderer { float f1 = -(entityplayer.walkDistMod + f * partialTicks); float f2 = entityplayer.prevCameraYaw + (entityplayer.cameraYaw - entityplayer.prevCameraYaw) * partialTicks; float f3 = entityplayer.prevCamPitch + (entityplayer.camPitch - entityplayer.prevCamPitch) * partialTicks; - GL46.glTranslatef(ExtMath.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(ExtMath.cos(f1 * (float)Math.PI) * f2), 0.0F); - GL46.glRotatef(ExtMath.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(Math.abs(ExtMath.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(f3, 1.0F, 0.0F, 0.0F); + GL46C.glTranslatef(ExtMath.sin(f1 * (float)Math.PI) * f2 * 0.5F, -Math.abs(ExtMath.cos(f1 * (float)Math.PI) * f2), 0.0F); + GL46C.glRotatef(ExtMath.sin(f1 * (float)Math.PI) * f2 * 3.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(Math.abs(ExtMath.cos(f1 * (float)Math.PI - 0.2F) * f2) * 5.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(f3, 1.0F, 0.0F, 0.0F); } } @@ -612,7 +605,7 @@ public class Renderer { if (this.gm.debugCamEnable) { - GL46.glTranslatef(0.0F, 0.0F, (float)(-d3)); + GL46C.glTranslatef(0.0F, 0.0F, (float)(-d3)); } else { @@ -651,19 +644,19 @@ public class Renderer { if (this.gm.thirdPersonView == 2) { - GL46.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } - GL46.glRotatef(entity.rotPitch - f2, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(entity.rotYaw - f1, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, 0.0F, (float)(-d3)); - GL46.glRotatef(f1 - entity.rotYaw, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(f2 - entity.rotPitch, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(entity.rotPitch - f2, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(entity.rotYaw - f1, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, 0.0F, (float)(-d3)); + GL46C.glRotatef(f1 - entity.rotYaw, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(f2 - entity.rotPitch, 1.0F, 0.0F, 0.0F); } } else { - GL46.glTranslatef(0.0F, 0.0F, -0.1F); + GL46C.glTranslatef(0.0F, 0.0F, -0.1F); } if (!this.gm.debugCamEnable || this.gm.thirdPersonView == 0) @@ -671,29 +664,29 @@ public class Renderer { this.rotateCamera(entity, partialTicks, false); } - GL46.glTranslatef(0.0F, -f, 0.0F); + GL46C.glTranslatef(0.0F, -f, 0.0F); } public void rotateCamera(Entity entity, float partialTicks, boolean invert) { if(invert) - GL46.glRotatef(360.0f - (entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(360.0f - (entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks), 1.0F, 0.0F, 0.0F); else - GL46.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 1.0F, 0.0F, 0.0F); if(entity instanceof EntityAnimal) { EntityAnimal entityanimal = (EntityAnimal)entity; - GL46.glRotatef(entityanimal.prevHeadYaw + (entityanimal.headYaw - entityanimal.prevHeadYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(entityanimal.prevHeadYaw + (entityanimal.headYaw - entityanimal.prevHeadYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); } else { - GL46.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks + 180.0F, 0.0F, 1.0F, 0.0F); } } private void setupCameraTransform(float partialTicks) { this.farPlaneDistance = (float)(this.gm.renderDistance * 16); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); float f = 0.07F; // if (this.cameraZoom != 1.0D) @@ -703,8 +696,8 @@ public class Renderer { // } Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glLoadIdentity(); this.hurtCameraEffect(partialTicks); @@ -763,15 +756,15 @@ public class Renderer { { // if (!this.debugView) // { - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); float f = 0.07F; Project.gluPerspective(this.getFOVModifier(partialTicks, false), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 2.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glLoadIdentity(); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.hurtCameraEffect(partialTicks); // if (this.gm.viewBobbing) @@ -788,11 +781,10 @@ public class Renderer { this.disableLightmap(); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); if (this.gm.thirdPersonView == 0) // && !flag) { - this.itemRenderer.renderOverlays(partialTicks); this.hurtCameraEffect(partialTicks); } @@ -803,32 +795,6 @@ public class Renderer { // } } - private void disableLightmap() - { - GlState.setActiveTexture(GL46.GL_TEXTURE1); - GlState.disableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); - } - - private void enableLightmap() - { - GlState.setActiveTexture(GL46.GL_TEXTURE1); - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); - float f = 0.00390625F; - GL46.glScalef(f, f, f); - GL46.glTranslatef(8.0F, 8.0F, 8.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.enableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); - } - private void updateTorchFlicker() { this.torchFlickerDX = (float)((double)this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random()); @@ -1142,7 +1108,6 @@ public class Renderer { this.lightmapColors[n] = a << 24 | r << 16 | g << 8 | b; } - this.lightmapTexture.updateTexture(); this.lightmapUpdateNeeded = false; } } @@ -1167,11 +1132,11 @@ public class Renderer { this.getMouseOver(partialTicks); GlState.enableDepth(); GlState.enableAlpha(); - GlState.alphaFunc(GL46.GL_GREATER, 0.5F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.5F); GlState.enableCull(); this.updateFogColor(partialTicks); - GL46.glClear(16640); + GL46C.glClear(GL46C.GL_COLOR_BUFFER_BIT | GL46C.GL_DEPTH_BUFFER_BIT); this.setupCameraTransform(partialTicks); MatrixState.update(this.gm.player, this.gm.thirdPersonView == 2); Entity entity = this.gm.getRenderViewEntity(); @@ -1182,19 +1147,19 @@ public class Renderer { if (this.gm.renderDistance >= 4) { this.setupFog(-1, partialTicks); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 2.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); this.renderSky(partialTicks); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); } this.setupFog(0, partialTicks); - GlState.shadeModel(GL46.GL_SMOOTH); + GlState.shadeModel(GL46C.GL_SMOOTH); if (entity.posY + (double)entity.getEyeHeight() < (double)this.gm.world.dimension.getCloudHeight()) { @@ -1205,29 +1170,29 @@ public class Renderer { ItemRenderer.disableStandardItemLighting(); this.setupTerrain(entity, (double)partialTicks, this.frameCount++, entity != this.gm.player || this.gm.player.noclip); this.updateChunks(finishTimeNano); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glPushMatrix(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glPushMatrix(); this.renderChunks(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.shadeModel(GL46C.GL_FLAT); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); // if (!this.debugView) // { - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); ItemRenderer.enableStandardItemLighting(); this.renderEntities(entity, partialTicks); ItemRenderer.disableStandardItemLighting(); this.disableLightmap(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glPopMatrix(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glPopMatrix(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE, GL46C.GL_ZERO); GlState.disableBlend(); // if (!this.debugView) @@ -1247,15 +1212,15 @@ public class Renderer { // renderglobal.renderWorldBorder(entity, partialTicks); GlState.disableBlend(); GlState.enableCull(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); // this.setupFog(0, partialTicks); // GlState.enableBlend(); // GlState.depthMask(false); // this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS); -// GlState.shadeModel(GL46.GL_SMOOTH); +// GlState.shadeModel(GL46C.GL_SMOOTH); // this.renderBlockLayer(BlockLayer.TRANSLUCENT, (double)partialTicks, entity); -// GlState.shadeModel(GL46.GL_FLAT); +// GlState.shadeModel(GL46C.GL_FLAT); // GlState.depthMask(true); // GlState.enableCull(); // GlState.disableBlend(); @@ -1268,7 +1233,7 @@ public class Renderer { if (entity == this.gm.player && !(this.gm.player instanceof EntityCameraHolder)) { - GL46.glClear(256); + GL46C.glClear(GL46C.GL_DEPTH_BUFFER_BIT); this.renderHand(partialTicks); } } @@ -1277,21 +1242,21 @@ public class Renderer { { if (this.gm.renderDistance >= 4) { - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * 4.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glPushMatrix(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glPushMatrix(); this.setupFog(0, partialTicks); float alpha = 0.8F * (1.0f - this.getSpaceFactor()); if(this.gm.world.dimension.hasWeather() && alpha > 0.5f) this.renderClouds(alpha, partialTicks); GlState.disableFog(); - GL46.glPopMatrix(); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glPopMatrix(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float)this.gm.fbRawX / (float)this.gm.fbRawY, 0.05F, this.farPlaneDistance * SQRT_2); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); } } @@ -1406,10 +1371,10 @@ public class Renderer { int ez = ExtMath.floord(entity.posZ); RenderBuffer buf = Tessellator.getBuffer(); GlState.disableCull(); - GL46.glNormal3f(0.0F, 1.0F, 0.0F); + GL46C.glNormal3f(0.0F, 1.0F, 0.0F); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); double ax = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partial; double ay = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial; double az = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partial; @@ -1459,7 +1424,7 @@ public class Renderer { mode = temp >= 194.0f ? 2 : (temp <= 5.0f ? 3 : 0); this.gm.getTextureManager() .bindTexture(temp >= 194.0f ? TEX_MOLTEN : (temp <= 5.0f ? TEX_HAIL : TEX_RAIN)); - buf.begin(GL46.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + buf.begin(GL46C.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); } double offset = ((double)(this.rendererUpdateCount + x * x * 3121 + x * 45238971 + z * z * 418711 + z * 13761 & 31) @@ -1469,17 +1434,15 @@ public class Renderer { float dist = ExtMath.sqrtd(dx * dx + dz * dz) / (float)range; float alpha = ((1.0F - dist * dist) * 0.5F + 0.5F) * rain; pos.set(x, lpos, z); - int light = world.getCombinedLight(pos); - int sky = light >> 16 & 65535; - int blk = light & 65535; + int light = getLightmapValueRaw(world, pos); buf.pos((double)x - rx + 0.5D, (double)miny, (double)z - rz + 0.5D).tex(0.0D, (double)miny * 0.25D + offset) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x + rx + 0.5D, (double)miny, (double)z + rz + 0.5D).tex(1.0D, (double)miny * 0.25D + offset) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x + rx + 0.5D, (double)maxy, (double)z + rz + 0.5D).tex(1.0D, (double)maxy * 0.25D + offset) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x - rx + 0.5D, (double)maxy, (double)z - rz + 0.5D).tex(0.0D, (double)maxy * 0.25D + offset) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); } else { if(mode != 1) { @@ -1487,7 +1450,7 @@ public class Renderer { Tessellator.draw(); mode = 1; this.gm.getTextureManager().bindTexture(TEX_SNOW); - buf.begin(GL46.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + buf.begin(GL46C.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); } double offset = (double)(((float)(this.rendererUpdateCount & 511) + partial) / 512.0F); @@ -1498,17 +1461,15 @@ public class Renderer { float dist = ExtMath.sqrtd(dx * dx + dz * dz) / (float)range; float alpha = ((1.0F - dist * dist) * 0.3F + 0.5F) * rain; pos.set(x, lpos, z); - int light = (world.getCombinedLight(pos) * 3 + 15728880) / 4; - int sky = light >> 16 & 65535; - int blk = light & 65535; + int light = getLightmapValueRaw(world, pos); buf.pos((double)x - rx + 0.5D, (double)miny, (double)z - rz + 0.5D).tex(0.0D + tx, (double)miny * 0.25D + offset + ty) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x + rx + 0.5D, (double)miny, (double)z + rz + 0.5D).tex(1.0D + tx, (double)miny * 0.25D + offset + ty) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x + rx + 0.5D, (double)maxy, (double)z + rz + 0.5D).tex(1.0D + tx, (double)maxy * 0.25D + offset + ty) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); buf.pos((double)x - rx + 0.5D, (double)maxy, (double)z - rz + 0.5D).tex(0.0D + tx, (double)maxy * 0.25D + offset + ty) - .color(1.0F, 1.0F, 1.0F, alpha).lightmap(sky, blk).endVertex(); + .color(1.0F, 1.0F, 1.0F, alpha).lightmap(light).endVertex(); } } } @@ -1519,7 +1480,7 @@ public class Renderer { buf.setTranslation(0.0D, 0.0D, 0.0D); GlState.enableCull(); GlState.disableBlend(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); this.disableLightmap(); } @@ -1669,8 +1630,8 @@ public class Renderer { float distance = Math.min(0.995f, Math.max(0.005f, FOG_DISTANCE - (0.3f * fog))); float density = 1.0f - Math.min(1.0f, FOG_DENSITY * (1.0f - fog * 0.1f)); - GL46.glFogfv(GL46.GL_FOG_COLOR, (FloatBuffer)this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); - GL46.glNormal3f(0.0F, -1.0F, 0.0F); + GL46C.glFogfv(GL46C.GL_FOG_COLOR, (FloatBuffer)this.setFogColorBuffer(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 1.0F)); + GL46C.glNormal3f(0.0F, -1.0F, 0.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); Block block = MatrixState.getLookedBlock(this.gm.world, entity, partial); @@ -1687,7 +1648,7 @@ public class Renderer { far = 5.0F + (this.farPlaneDistance - 5.0F) * (1.0F - (float)effect / 20.0F); } - GlState.setFog(GL46.GL_LINEAR); + GlState.setFog(GL46C.GL_LINEAR); if (start == -1) { @@ -1712,7 +1673,7 @@ public class Renderer { // } else if (block.getMaterial().isColdLiquid()) { - GlState.setFog(GL46.GL_EXP); + GlState.setFog(GL46C.GL_EXP); // if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).hasEffect(Potion.waterBreathing)) // { @@ -1725,13 +1686,13 @@ public class Renderer { } else if (block.getMaterial().isHotLiquid()) { - GlState.setFog(GL46.GL_EXP); + GlState.setFog(GL46C.GL_EXP); GlState.setFogDensity(2.0F); } else { float far = this.farPlaneDistance; - GlState.setFog(GL46.GL_LINEAR); + GlState.setFog(GL46C.GL_LINEAR); if (start == -1) { @@ -1758,7 +1719,7 @@ public class Renderer { GlState.enableColorMaterial(); GlState.setFogEnabled(distance < 1.0f); - GlState.colorMaterial(GL46.GL_FRONT, GL46.GL_AMBIENT); + GlState.colorMaterial(GL46C.GL_FRONT, GL46C.GL_AMBIENT); } private FloatBuffer setFogColorBuffer(float red, float green, float blue, float alpha) @@ -1792,7 +1753,7 @@ public class Renderer { if (this.sky2VBO != null) { - this.sky2VBO.deleteGlBuffers(); + this.sky2VBO.delete(); } // if (this.glSkyList2 >= 0) @@ -1803,11 +1764,9 @@ public class Renderer { // if (this.vboEnabled) // { - this.sky2VBO = new VertexBuffer(this.vertexBufferFormat); + this.sky2VBO = new VertexBuffer(DefaultVertexFormats.POSITION); this.renderSky(worldrenderer, -16.0F, true); - worldrenderer.finishDrawing(); - worldrenderer.reset(); - this.sky2VBO.bufferData(worldrenderer.getByteBuffer()); + this.sky2VBO.bufferData(worldrenderer, false); // } // else // { @@ -1826,7 +1785,7 @@ public class Renderer { if (this.skyVBO != null) { - this.skyVBO.deleteGlBuffers(); + this.skyVBO.delete(); } // if (this.glSkyList >= 0) @@ -1837,11 +1796,9 @@ public class Renderer { // if (this.vboEnabled) // { - this.skyVBO = new VertexBuffer(this.vertexBufferFormat); + this.skyVBO = new VertexBuffer(DefaultVertexFormats.POSITION); this.renderSky(worldrenderer, 16.0F, false); - worldrenderer.finishDrawing(); - worldrenderer.reset(); - this.skyVBO.bufferData(worldrenderer.getByteBuffer()); + this.skyVBO.bufferData(worldrenderer, false); // } // else // { @@ -1857,7 +1814,7 @@ public class Renderer { { int i = 64; int j = 6; - worldRendererIn.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION); + worldRendererIn.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION); for (int k = -384; k <= 384; k += 64) { @@ -1887,7 +1844,7 @@ public class Renderer { if (this.starVBO != null) { - this.starVBO.deleteGlBuffers(); + this.starVBO.delete(); } // if (this.starGLCallList >= 0) @@ -1898,11 +1855,9 @@ public class Renderer { // if (this.vboEnabled) // { - this.starVBO = new VertexBuffer(this.vertexBufferFormat); + this.starVBO = new VertexBuffer(DefaultVertexFormats.POSITION); this.renderStars(worldrenderer, 10842L, 1500, 0.15f, 0.25f); - worldrenderer.finishDrawing(); - worldrenderer.reset(); - this.starVBO.bufferData(worldrenderer.getByteBuffer()); + this.starVBO.bufferData(worldrenderer, false); // } // else // { @@ -1923,7 +1878,7 @@ public class Renderer { if (this.dstarVBO != null) { - this.dstarVBO.deleteGlBuffers(); + this.dstarVBO.delete(); } // if (this.dstarGLCallList >= 0) @@ -1934,11 +1889,9 @@ public class Renderer { // if (this.vboEnabled) // { - this.dstarVBO = new VertexBuffer(this.vertexBufferFormat); + this.dstarVBO = new VertexBuffer(DefaultVertexFormats.POSITION); this.renderStars(worldrenderer, 0x59616f69L, 5000, 0.025f, 0.15f); - worldrenderer.finishDrawing(); - worldrenderer.reset(); - this.dstarVBO.bufferData(worldrenderer.getByteBuffer()); + this.dstarVBO.bufferData(worldrenderer, false); // } // else // { @@ -1956,7 +1909,7 @@ public class Renderer { { max -= min; Random rand = new Random(seed); - rend.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION); + rend.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION); for (int n = 0; n < nstars; ++n) { @@ -2119,12 +2072,12 @@ public class Renderer { if (this.gm.tileOverlay) { - GlState.depthFunc(GL46.GL_ALWAYS); + GlState.depthFunc(GL46C.GL_ALWAYS); GlState.disableFog(); ItemRenderer.disableStandardItemLighting(); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glLineWidth(2.0F); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GL46C.glLineWidth(2.0F); GlState.disableTexture2D(); GlState.depthMask(false); @@ -2152,19 +2105,19 @@ public class Renderer { GlState.depthMask(true); GlState.enableFog(); GlState.enableColorMaterial(); - GlState.depthFunc(GL46.GL_LEQUAL); + GlState.depthFunc(GL46C.GL_LEQUAL); GlState.enableDepth(); GlState.enableAlpha(); } if (this.gm.renderOutlines && this.gm.player != null) { - GlState.depthFunc(GL46.GL_ALWAYS); + GlState.depthFunc(GL46C.GL_ALWAYS); GlState.disableFog(); ItemRenderer.disableStandardItemLighting(); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glLineWidth(2.0F); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GL46C.glLineWidth(2.0F); GlState.disableTexture2D(); GlState.depthMask(false); @@ -2191,7 +2144,7 @@ public class Renderer { GlState.depthMask(true); GlState.enableFog(); GlState.enableColorMaterial(); - GlState.depthFunc(GL46.GL_LEQUAL); + GlState.depthFunc(GL46C.GL_LEQUAL); GlState.enableDepth(); GlState.enableAlpha(); } @@ -2535,7 +2488,6 @@ public class Renderer { private int renderChunks() { - ItemRenderer.disableStandardItemLighting(); int l = 0; int i = this.renderInfos.size(); for (int j = 0; j < i; j++) @@ -2547,31 +2499,10 @@ public class Renderer { this.renderChunks.add(renderchunk); } } - GlState.setActiveTexture(GL46.GL_TEXTURE1); - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - this.gm.getTextureManager().bindTexture(TEX_LIGHTMAP); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, GL46.GL_LINEAR); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, GL46.GL_LINEAR); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_CLAMP); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_CLAMP); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.enableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); if (this.initialized) { ShaderContext context = Shader.WORLD.use(); - boolean moon = false; - for(int color : this.theWorld.dimension.getMoonColors()) { - if((color & 0xff000000) == 0) { - moon = true; - break; - } - } - context.bool("sky_light", this.theWorld.dimension.hasSkyLight() && !this.gm.setGamma && !this.gm.xrayActive); - context.bool("moon_light", moon); for (RenderChunk renderchunk : this.renderChunks) { VertexBuffer vertexbuffer = renderchunk.getVertexBuffer(); @@ -2585,32 +2516,13 @@ public class Renderer { context.integer("chunk_y", blockpos.getY()); context.integer("chunk_z", blockpos.getZ()); - vertexbuffer.bindBuffer(); - - GL46.glVertexAttribPointer(0, 3, GL46.GL_FLOAT, false, 28, 0L); - GL46.glEnableVertexAttribArray(0); - GL46.glVertexAttribPointer(1, 4, GL46.GL_BYTE, true, 28, 12L); - GL46.glEnableVertexAttribArray(1); - GL46.glVertexAttribPointer(2, 2, GL46.GL_FLOAT, false, 28, 16L); - GL46.glEnableVertexAttribArray(2); - GL46.glVertexAttribPointer(3, 4, GL46.GL_UNSIGNED_BYTE, true, 28, 24L); - GL46.glEnableVertexAttribArray(3); - - vertexbuffer.drawArrays(GL46.GL_QUADS); - - GL46.glDisableVertexAttribArray(0); - GL46.glDisableVertexAttribArray(1); - GL46.glDisableVertexAttribArray(2); - GL46.glDisableVertexAttribArray(3); + vertexbuffer.draw(); } context.finish(); - GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0); - GlState.resetColor(); this.renderChunks.clear(); } - this.gm.renderer.disableLightmap(); return l; } @@ -2619,7 +2531,7 @@ public class Renderer { GlState.disableFog(); GlState.disableAlpha(); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); ItemRenderer.disableStandardItemLighting(); GlState.depthMask(false); this.renderEngine.bindTexture(texture); @@ -2628,40 +2540,40 @@ public class Renderer { for (int i = 0; i < 6; ++i) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); if (i == 1) { - GL46.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); } if (i == 2) { - GL46.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); } if (i == 3) { - GL46.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); } if (i == 4) { - GL46.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); } if (i == 5) { - GL46.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F); } - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR); worldrenderer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).color(40, 40, 40, 255).endVertex(); worldrenderer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 16.0D).color(40, 40, 40, 255).endVertex(); worldrenderer.pos(100.0D, -100.0D, 100.0D).tex(16.0D, 16.0D).color(40, 40, 40, 255).endVertex(); worldrenderer.pos(100.0D, -100.0D, -100.0D).tex(16.0D, 0.0D).color(40, 40, 40, 255).endVertex(); Tessellator.draw(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } GlState.depthMask(true); @@ -2703,12 +2615,10 @@ public class Renderer { // if (this.vboEnabled) // { - this.skyVBO.bindBuffer(); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - GL46.nglVertexPointer(3, GL46.GL_FLOAT, 12, 0L); - this.skyVBO.drawArrays(GL46.GL_QUADS); - this.skyVBO.unbindBuffer(); - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); + GL46C.glEnableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.nglVertexPointer(3, GL46C.GL_FLOAT, 12, 0L); + this.skyVBO.drawArrays(GL46C.GL_QUADS); + GL46C.glDisableClientState(GL46C.GL_VERTEX_ARRAY); // } // else // { @@ -2718,7 +2628,7 @@ public class Renderer { GlState.disableFog(); GlState.disableAlpha(); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); ItemRenderer.disableStandardItemLighting(); float[] afloat = this.theWorld.dimension.hasDaylight() && !this.theWorld.dimension.isBaseDestroyed() ? @@ -2726,11 +2636,11 @@ public class Renderer { if (afloat != null) { GlState.disableTexture2D(); - GlState.shadeModel(GL46.GL_SMOOTH); - GL46.glPushMatrix(); - GL46.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(ExtMath.sin(this.getDayPhase(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); + GlState.shadeModel(GL46C.GL_SMOOTH); + GL46C.glPushMatrix(); + GL46C.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(ExtMath.sin(this.getDayPhase(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); float f6 = afloat[0]; float f7 = afloat[1]; float f8 = afloat[2]; @@ -2745,7 +2655,7 @@ public class Renderer { // f8 = f11; // } - worldrenderer.begin(GL46.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(0.0D, 100.0D, 0.0D).color(f6, f7, f8, afloat[3]).endVertex(); int j = 16; @@ -2758,16 +2668,16 @@ public class Renderer { } Tessellator.draw(); - GL46.glPopMatrix(); - GlState.shadeModel(GL46.GL_FLAT); + GL46C.glPopMatrix(); + GlState.shadeModel(GL46C.GL_FLAT); } GlState.enableTexture2D(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glPushMatrix(); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE, GL46C.GL_ZERO); + GL46C.glPushMatrix(); float f16 = 1.0F - Math.max(this.theWorld.getRainStrength(), this.theWorld.getFogStrength()); - GL46.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(this.getCelestialAngle(partialTicks), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.getCelestialAngle(partialTicks), 1.0F, 0.0F, 0.0F); if(this.gm.world.dimension.getType() == DimType.PLANET || this.gm.world.dimension.getType() == DimType.MOON) { float size = 30.0F; int color = this.gm.world.dimension.getSunColor(); @@ -2776,7 +2686,7 @@ public class Renderer { Vec3 ncolor = new Vec3(color); float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord)); GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0D, 0.0D).endVertex(); worldrenderer.pos((double)size, 100.0D, (double)(-size)).tex(1.0D, 0.0D).endVertex(); worldrenderer.pos((double)size, 100.0D, (double)size).tex(1.0D, 1.0D).endVertex(); @@ -2801,7 +2711,7 @@ public class Renderer { float v1 = destroyed ? 0.0f : (float)(ty + 0) / 2.0F; float u2 = destroyed ? 1.0f : (float)(tx + 1) / 4.0F; float v2 = destroyed ? 1.0f : (float)(ty + 1) / 2.0F; - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)(-size + mx), -100.0D, (double)(size + mz)).tex((double)u2, (double)v2).endVertex(); worldrenderer.pos((double)(size + mx), -100.0D, (double)(size + mz)).tex((double)u1, (double)v2).endVertex(); worldrenderer.pos((double)(size + mx), -100.0D, (double)(-size + mz)).tex((double)u1, (double)v1).endVertex(); @@ -2827,12 +2737,10 @@ public class Renderer { // if (this.vboEnabled) // { - this.starVBO.bindBuffer(); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - GL46.nglVertexPointer(3, GL46.GL_FLOAT, 12, 0L); - this.starVBO.drawArrays(GL46.GL_QUADS); - this.starVBO.unbindBuffer(); - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); + GL46C.glEnableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.nglVertexPointer(3, GL46C.GL_FLOAT, 12, 0L); + this.starVBO.drawArrays(GL46C.GL_QUADS); + GL46C.glDisableClientState(GL46C.GL_VERTEX_ARRAY); // } // else // { @@ -2854,12 +2762,10 @@ public class Renderer { // if (this.vboEnabled) // { - this.dstarVBO.bindBuffer(); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - GL46.nglVertexPointer(3, GL46.GL_FLOAT, 12, 0L); - this.dstarVBO.drawArrays(GL46.GL_QUADS); - this.dstarVBO.unbindBuffer(); - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); + GL46C.glEnableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.nglVertexPointer(3, GL46C.GL_FLOAT, 12, 0L); + this.dstarVBO.drawArrays(GL46C.GL_QUADS); + GL46C.glDisableClientState(GL46C.GL_VERTEX_ARRAY); // } // else // { @@ -2871,7 +2777,7 @@ public class Renderer { GlState.disableBlend(); GlState.enableAlpha(); GlState.enableFog(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.enableTexture2D(); GlState.depthMask(true); } @@ -2895,7 +2801,7 @@ public class Renderer { d2 = d2 - (double)(j * 2048); this.renderEngine.bindTexture(this.gm.world.dimension.getCloudTexture()); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); Vec3 vec3 = this.gm.renderer.getCloudColor(this.gm.getRenderViewEntity(), partialTicks); float f4 = (float)vec3.xCoord; float f5 = (float)vec3.yCoord; @@ -2928,7 +2834,7 @@ public class Renderer { int k = 8; int l = 4; float f21 = 9.765625E-4F; - GL46.glScalef(12.0F, 1.0F, 12.0F); + GL46C.glScalef(12.0F, 1.0F, 12.0F); for (int i1 = 0; i1 < 2; ++i1) { @@ -2957,7 +2863,7 @@ public class Renderer { { for (int k1 = -3; k1 <= 4; ++k1) { - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); float f22 = (float)(j1 * 8); float f23 = (float)(k1 * 8); float f24 = f22 - f19; @@ -3066,21 +2972,21 @@ public class Renderer { { // Tessellator tessellator = Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); Tessellator.draw(); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); Tessellator.draw(); - worldrenderer.begin(GL46.GL_LINES, DefaultVertexFormats.POSITION); + worldrenderer.begin(GL46C.GL_LINES, DefaultVertexFormats.POSITION); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); @@ -3096,21 +3002,21 @@ public class Renderer { { // Tessellator tessellator = Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); Tessellator.draw(); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); Tessellator.draw(); - worldrenderer.begin(GL46.GL_LINES, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_LINES, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).color(red, green, blue, alpha).endVertex(); @@ -3160,18 +3066,18 @@ public class Renderer { Drawing.drawRect(0, 0, w, h, bg | 0xff000000); // Gui.drawRect(0, 0, w, h, bg | 0xff000000); for(int z = 0; z < 6; z++) { - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glLoadIdentity(); float shift = ticks % 30.0f - (float)z * 30.0f; int n = z + (int)(ticks / 30.0f); // WCF.glTranslatef(0.0f, 0.0f, (float)n * -30.0f); rand.setSeed((long)n * 8436723957L); - GL46.glRotatef(rand.floatv() * 360.0f, 0.0f, 0.0f, 1.0f); + GL46C.glRotatef(rand.floatv() * 360.0f, 0.0f, 0.0f, 1.0f); float timer = (float)((double)(System.nanoTime() / 1000L) / 1000000.0) * 0.12f; // Project.gluLookAt(0.0f, 0.0f, shift, ExtMath.sin(timer), ExtMath.cos(timer * 2.0f), shift + ExtMath.cos(timer * 0.33f), 0.0f, ExtMath.sin(timer), ExtMath.cos(timer)); Project.gluLookAt(0.0f, 0.0f, shift, 0.0f, 0.0f, shift + 1.0f, 0.0f, 1.0f, 0.0f); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); Project.gluPerspective(90.0f, (float)w / (float)h, 0.05f, 1024.0f); // WCF.glTranslatef(w / 2.0f, h / 2.0f, 0.0f); // GlState.disableDepth(); @@ -3180,31 +3086,27 @@ public class Renderer { // this.skyVBO.bindBuffer(); // WCF.glEnableClientState(WCF.GL_VERTEX_ARRAY); // WCF.glVertexPointer(3, WCF.GL_FLOAT, 12, 0L); - // this.skyVBO.drawArrays(GL46.GL_QUADS); + // this.skyVBO.drawArrays(GL46C.GL_QUADS); // this.skyVBO.unbindBuffer(); // WCF.glDisableClientState(WCF.GL_VERTEX_ARRAY); GlState.disableAlpha(); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE, GL46C.GL_ZERO); ItemRenderer.disableStandardItemLighting(); GlState.color((float)stars.xCoord, (float)stars.yCoord, (float)stars.zCoord, 1.0f); - this.starVBO.bindBuffer(); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - GL46.nglVertexPointer(3, GL46.GL_FLOAT, 12, 0L); - this.starVBO.drawArrays(GL46.GL_QUADS); - this.starVBO.unbindBuffer(); - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); - this.dstarVBO.bindBuffer(); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - GL46.nglVertexPointer(3, GL46.GL_FLOAT, 12, 0L); - this.dstarVBO.drawArrays(GL46.GL_QUADS); - this.dstarVBO.unbindBuffer(); - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); + GL46C.glEnableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.nglVertexPointer(3, GL46C.GL_FLOAT, 12, 0L); + this.starVBO.drawArrays(GL46C.GL_QUADS); + GL46C.glDisableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.glEnableClientState(GL46C.GL_VERTEX_ARRAY); + GL46C.nglVertexPointer(3, GL46C.GL_FLOAT, 12, 0L); + this.dstarVBO.drawArrays(GL46C.GL_QUADS); + GL46C.glDisableClientState(GL46C.GL_VERTEX_ARRAY); GlState.enableTexture2D(); - GL46.glMatrixMode(GL46.GL_PROJECTION); - GL46.glLoadIdentity(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_PROJECTION); + GL46C.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); + GL46C.glLoadIdentity(); } GlState.enableCull(); this.gm.setupOverlay(); @@ -3238,7 +3140,7 @@ public class Renderer { int light = brightPos == null ? 0xffffffff : getLightmapValue(this.gm.world, brightPos); IBakedModel model = this.manager.getModelForState(state); Block block = state.getBlock(); - GL46.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); for (Facing enumfacing : Facing.values()) { @@ -3251,17 +3153,14 @@ public class Renderer { private void renderSimple(int light, List listQuads) { - RenderBuffer worldrenderer = Tessellator.getBuffer(); + RenderBuffer worldrenderer = RenderBuffer.getBuffer(); + worldrenderer.begin(); for (BakedQuad bakedquad : listQuads) { - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.ITEM); - worldrenderer.addVertexData(bakedquad.getVertexData()); - worldrenderer.putBrightness4(light, light, light, light); - Vec3i vec3i = bakedquad.getFace().getDirectionVec(); - worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ()); - Tessellator.draw(); + worldrenderer.put(0.0, 0.0, 0.0, bakedquad.getVertexData(), light); } + worldrenderer.draw(); } public boolean renderBlock(State state, BlockPos pos, IWorldAccess world, RenderBuffer rb) { @@ -3316,20 +3215,24 @@ public class Renderer { private int getLightmapValue(IWorldAccess world, BlockPos pos) { Block block = world.getState(pos).getBlock(); - int light = componentMax(world.getCombinedLight(pos), block.getLight()); + int light = componentMax(world.getWorldLight(pos), block.getLight()); if(light == 0 && block instanceof BlockSlab) { pos = pos.down(); block = world.getState(pos).getBlock(); - light = componentMax(world.getCombinedLight(pos), block.getLight()); + light = componentMax(world.getWorldLight(pos), block.getLight()); } return getLightColor(light); } private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos) { - int light = world.getCombinedLight(pos); - int up = world.getCombinedLight(pos.up()); + int light = world.getWorldLight(pos); + int up = world.getWorldLight(pos.up()); return getLightColor(componentMax(light, up)); } + + private int getLightmapValueRaw(IWorldAccess world, BlockPos pos) { + return getLightColor(world.getWorldLight(pos)); + } private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, boolean ownLight, RenderBuffer worldRendererIn, List listQuadsIn, BitSet boundsFlags) { @@ -3345,9 +3248,7 @@ public class Renderer { light = boundsFlags.get(0) ? getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : getLightmapValue(blockAccessIn, blockPosIn); } - worldRendererIn.addVertexData(bakedquad.getVertexData()); - worldRendererIn.putBrightness4(light, light, light, light); - worldRendererIn.putPosition(d0, d1, d2); + worldRendererIn.put(d0, d1, d2, bakedquad.getVertexData(), light); } } @@ -3502,19 +3403,17 @@ public class Renderer { } int k2 = getLightmapValueLiquid(blockAccess, blockPosIn); - int l2 = k2 >> 16 & 65535; - int i3 = k2 & 65535; - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(k2).endVertex(); if (blockliquid.shouldRenderSides(blockAccess, blockPosIn.up())) { - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(k2).endVertex(); } } @@ -3525,12 +3424,10 @@ public class Renderer { float f37 = atextureatlassprite[0].getMinV(); float f38 = atextureatlassprite[0].getMaxV(); int l1 = getLightmapValueLiquid(blockAccess, blockPosIn.down()); - int i2 = l1 >> 16 & 65535; - int j2 = l1 & 65535; - worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(i2, j2).endVertex(); + worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(l1).endVertex(); + worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(l1).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(l1).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(l1).endVertex(); rendered = true; } @@ -3615,18 +3512,16 @@ public class Renderer { float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F)); float f30 = textureatlassprite1.getInterpolatedV(8.0D); int j = getLightmapValueLiquid(blockAccess, blockpos); - int k = j >> 16 & 65535; - int l = j & 65535; float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f); float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f); - worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(j).endVertex(); } } @@ -3730,19 +3625,17 @@ public class Renderer { f20 = f17; int k2 = getLightmapValueLiquid(blockAccess, blockPosIn); - int l2 = k2 >> 16 & 65535; - int i3 = k2 & 65535; - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(k2).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(k2).endVertex(); // // if (block.shouldRenderSides(blockAccess, blockPosIn.up())) // { -// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex(); -// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex(); -// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex(); -// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex(); +// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f13, (double)f17).lightmap(k2).endVertex(); +// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f16, (double)f20).lightmap(k2).endVertex(); +// worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f15, (double)f19).lightmap(k2).endVertex(); +// worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(0.0f, 1.0f, 0.0f, shine).tex((double)f14, (double)f18).lightmap(k2).endVertex(); // } } @@ -3753,12 +3646,10 @@ public class Renderer { float f37 = textureatlassprite.getMinV(); float f38 = textureatlassprite.getMaxV(); int l1 = getLightmapValueLiquid(blockAccess, blockPosIn.down()); - int i2 = l1 >> 16 & 65535; - int j2 = l1 & 65535; - worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(i2, j2).endVertex(); - worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(i2, j2).endVertex(); + worldRendererIn.pos(d0, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f38).lightmap(l1).endVertex(); + worldRendererIn.pos(d0, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f35, (double)f37).lightmap(l1).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f37).lightmap(l1).endVertex(); + worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(0.0f, -1.0f, 0.0f, shine).tex((double)f36, (double)f38).lightmap(l1).endVertex(); rendered = true; } @@ -3843,18 +3734,16 @@ public class Renderer { float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F)); float f30 = textureatlassprite1.getInterpolatedV(16.0D); int j = getLightmapValueLiquid(blockAccess, blockpos); - int k = j >> 16 & 65535; - int l = j & 65535; float xn = np == 2 ? -1.0f : (np == 3 ? 1.0f : 0.0f); float zn = np == 0 ? -1.0f : (np == 1 ? 1.0f : 0.0f); - worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(k, l).endVertex(); - worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(k, l).endVertex(); - worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(k, l).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + 0.0D, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + 0.0D, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f30).lightmap(j).endVertex(); + worldRendererIn.pos(d5, d1 + (double)f40, d6).color(xn, 0.0f, zn, shine).tex((double)f27, (double)f29).lightmap(j).endVertex(); + worldRendererIn.pos(d3, d1 + (double)f39, d4).color(xn, 0.0f, zn, shine).tex((double)f41, (double)f28).lightmap(j).endVertex(); } } @@ -3923,7 +3812,7 @@ public class Renderer { } } - public int getCombinedLight(BlockPos pos) { + public int getWorldLight(BlockPos pos) { if(pos.getY() < -World.MAX_SIZE_Y) { pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ()); } @@ -4040,14 +3929,14 @@ public class Renderer { public boolean checkBlockLight(BlockPos pos) { if(!this.gm.world.isAreaLoaded(pos, 17, false)) return false; + int bx = pos.getX(); + int by = pos.getY(); + int bz = pos.getZ(); for(int component = 0; component < 3; component++) { int done = 0; int cnt = 0; int light = this.getLightFor(pos, component); int raw = this.getRawBlockLight(pos, component); - int bx = pos.getX(); - int by = pos.getY(); - int bz = pos.getZ(); if(raw > light) { this.lightUpdate[cnt++] = 133152; diff --git a/client/src/main/java/client/renderer/Shader.java b/client/src/main/java/client/renderer/Shader.java index cc33eaca..1892aca9 100644 --- a/client/src/main/java/client/renderer/Shader.java +++ b/client/src/main/java/client/renderer/Shader.java @@ -9,7 +9,7 @@ import java.util.Map.Entry; import java.util.function.Consumer; import java.util.function.Supplier; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.util.FileUtils; @@ -23,43 +23,74 @@ import common.util.Vector3f; import common.util.Vector4f; public enum Shader { - WORLD("world", "world", context -> {context.integer("tex", 0); /* GL46.glUniformBlockBinding(context.getProgram(), GL46.glGetUniformBlockIndex(context.getProgram(), "light_block"), 0); */}, context -> { - context.vec("clip_near", Client.CLIENT.renderer.getNearPlane()); - context.vec("clip_far", Client.CLIENT.renderer.getFarPlane()); - context.vec("screen", (float)Client.CLIENT.fbRawX, (float)Client.CLIENT.fbRawY); + UI_COLOR("ui_color", "ui_color", null, context -> { + GlState.disableCull(); + GlState.disableDepth(); + GlState.enableBlend(); +// GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE_MINUS_SRC_ALPHA); + + context.vec("screen_size", Client.CLIENT.fbX, Client.CLIENT.fbY); + }), + + UI_TEXTURE("ui_texture", "ui_texture", context -> context.integer("tex", 0), context -> { + GlState.disableCull(); + GlState.disableDepth(); + GlState.enableBlend(); +// GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ONE_MINUS_SRC_ALPHA); + + context.vec("screen_size", Client.CLIENT.fbX, Client.CLIENT.fbY); + }), + + WORLD("world", "world", context -> {context.integer("tex", 0); /* GL46C.glUniformBlockBinding(context.getProgram(), GL46C.glGetUniformBlockIndex(context.getProgram(), "light_block"), 0); */}, context -> { + Client gm = Client.CLIENT; + + context.vec("clip_near", gm.renderer.getNearPlane()); + context.vec("clip_far", gm.renderer.getFarPlane()); + context.vec("screen", (float)gm.fbRawX, (float)gm.fbRawY); context.matrix("view", MatrixState.getModelView()); context.matrix("projection", MatrixState.getProjection()); context.vec("time", (float)Util.ftime()); - float angle = -90.0f + Client.CLIENT.renderer.getCelestialAngle(Client.CLIENT.getTickFraction()); + float angle = -90.0f + gm.renderer.getCelestialAngle(gm.getTickFraction()); - float sunX = !Client.CLIENT.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos(angle / 180.0f * (float)Math.PI); - float sunY = !Client.CLIENT.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin(angle / 180.0f * (float)Math.PI); + float sunX = !gm.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos(angle / 180.0f * (float)Math.PI); + float sunY = !gm.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin(angle / 180.0f * (float)Math.PI); context.vec("sun_direction", sunX, sunY, 0.0f); - float moonX = !Client.CLIENT.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos((180.0f + angle) / 180.0f * (float)Math.PI); - float moonY = !Client.CLIENT.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin((180.0f + angle) / 180.0f * (float)Math.PI); + float moonX = !gm.world.dimension.hasDaylight() ? 0.0f : ExtMath.cos((180.0f + angle) / 180.0f * (float)Math.PI); + float moonY = !gm.world.dimension.hasDaylight() ? -1.0f : ExtMath.sin((180.0f + angle) / 180.0f * (float)Math.PI); context.vec("moon_direction", moonX, moonY, 0.0f); - float sunRed = Client.CLIENT.renderer.getSunColorRed(); - float sunGreen = Client.CLIENT.renderer.getSunColorGreen(); - float sunBlue = Client.CLIENT.renderer.getSunColorBlue(); + float sunRed = gm.renderer.getSunColorRed(); + float sunGreen = gm.renderer.getSunColorGreen(); + float sunBlue = gm.renderer.getSunColorBlue(); context.vec("sun_ambient", sunRed, sunGreen, sunBlue); - float moonRed = Client.CLIENT.renderer.getMoonColorRed(); - float moonGreen = Client.CLIENT.renderer.getMoonColorGreen(); - float moonBlue = Client.CLIENT.renderer.getMoonColorBlue(); + float moonRed = gm.renderer.getMoonColorRed(); + float moonGreen = gm.renderer.getMoonColorGreen(); + float moonBlue = gm.renderer.getMoonColorBlue(); context.vec("moon_ambient", moonRed, moonGreen, moonBlue); - context.vec("light_factor", Client.CLIENT.lightBlend); - context.vec("max_vert_dist", Client.CLIENT.lightDistVert); - context.vec("max_cam_dist", Client.CLIENT.lightDistCam); + context.vec("light_factor", gm.lightBlend); + context.vec("max_vert_dist", gm.lightDistVert); + context.vec("max_cam_dist", gm.lightDistCam); context.integer("n_lights", 0); - context.color3("specular", Client.CLIENT.specularColors && !Client.CLIENT.setGamma && !Client.CLIENT.xrayActive ? 0xffffff : 0x000000); - context.bool("shade", Client.CLIENT.flatShading || Client.CLIENT.setGamma || Client.CLIENT.xrayActive); + context.color3("specular", gm.specularColors && !gm.setGamma && !gm.xrayActive ? 0xffffff : 0x000000); + context.bool("shade", gm.flatShading || gm.setGamma || gm.xrayActive); + + boolean moon = false; + for(int color : gm.world.dimension.getMoonColors()) { + if((color & 0xff000000) == 0) { + moon = true; + break; + } + } + context.bool("sky_light", gm.world.dimension.hasSkyLight() && !gm.setGamma && !gm.xrayActive); + context.bool("moon_light", moon); - GlState.setActiveTexture(GL46.GL_TEXTURE0); // glBindBufferBase(GL_UNIFORM_BUFFER, 0, world->light_buf); }, "MAX_LIGHTS", (Supplier)() -> Client.CLIENT.lightMaximum), @@ -69,8 +100,8 @@ public enum Shader { }); // BLIT("blit", "blit", context -> context.integer("tex", 0), context -> { -// GL46.glBindVertexArray(QUAD); -// GlState.setActiveTexture(GL46.GL_TEXTURE0); +// GL46C.glBindVertexArray(QUAD); +// GlState.setActiveTexture(GL46C.GL_TEXTURE0); // }); public class ShaderContext { @@ -85,63 +116,63 @@ public enum Shader { } public ShaderContext bool(String name, boolean x) { - GL46.glUniform1i(GL46.glGetUniformLocation(this.program, name), x ? 1 : 0); + GL46C.glUniform1i(GL46C.glGetUniformLocation(this.program, name), x ? 1 : 0); return this; } public ShaderContext integer(String name, int x) { - GL46.glUniform1i(GL46.glGetUniformLocation(this.program, name), x); + GL46C.glUniform1i(GL46C.glGetUniformLocation(this.program, name), x); return this; } public ShaderContext vec(String name, float x) { - GL46.glUniform1f(GL46.glGetUniformLocation(this.program, name), x); + GL46C.glUniform1f(GL46C.glGetUniformLocation(this.program, name), x); return this; } public ShaderContext vec(String name, float x, float y) { - GL46.glUniform2f(GL46.glGetUniformLocation(this.program, name), x, y); + GL46C.glUniform2f(GL46C.glGetUniformLocation(this.program, name), x, y); return this; } public ShaderContext vec(String name, float x, float y, float z) { - GL46.glUniform3f(GL46.glGetUniformLocation(this.program, name), x, y, z); + GL46C.glUniform3f(GL46C.glGetUniformLocation(this.program, name), x, y, z); return this; } public ShaderContext vec(String name, float x, float y, float z, float w) { - GL46.glUniform4f(GL46.glGetUniformLocation(this.program, name), x, y, z, w); + GL46C.glUniform4f(GL46C.glGetUniformLocation(this.program, name), x, y, z, w); return this; } public ShaderContext vec(String name, Vec3 vec) { - GL46.glUniform3f(GL46.glGetUniformLocation(this.program, name), (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord); + GL46C.glUniform3f(GL46C.glGetUniformLocation(this.program, name), (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord); return this; } public ShaderContext vec(String name, Vector3f vec) { - GL46.glUniform3f(GL46.glGetUniformLocation(this.program, name), vec.x, vec.y, vec.z); + GL46C.glUniform3f(GL46C.glGetUniformLocation(this.program, name), vec.x, vec.y, vec.z); return this; } public ShaderContext vec(String name, Vector4f vec) { - GL46.glUniform4f(GL46.glGetUniformLocation(this.program, name), vec.x, vec.y, vec.z, vec.w); + GL46C.glUniform4f(GL46C.glGetUniformLocation(this.program, name), vec.x, vec.y, vec.z, vec.w); return this; } public ShaderContext matrix(String name, FloatBuffer mat) { - GL46.glUniformMatrix4fv(GL46.glGetUniformLocation(this.program, name), false, mat); + GL46C.glUniformMatrix4fv(GL46C.glGetUniformLocation(this.program, name), false, mat); return this; } public ShaderContext matrix(String name, Matrix4f mat) { mat.store(BUFFER); - GL46.glUniformMatrix4fv(GL46.glGetUniformLocation(this.program, name), false, BUFFER); + GL46C.glUniformMatrix4fv(GL46C.glGetUniformLocation(this.program, name), false, BUFFER); return this; } public ShaderContext color(String name, int color) { - GL46.glUniform4f(GL46.glGetUniformLocation(this.program, name), + GL46C.glUniform4f(GL46C.glGetUniformLocation(this.program, name), (float)((int)((color >> 16) & 0xff)) / 255.0f, (float)((int)((color >> 8) & 0xff)) / 255.0f, (float)((int)(color & 0xff)) / 255.0f, (float)((int)((color >> 24) & 0xff)) / 255.0f ); @@ -149,7 +180,7 @@ public enum Shader { } public ShaderContext color3(String name, int color) { - GL46.glUniform3f(GL46.glGetUniformLocation(this.program, name), + GL46C.glUniform3f(GL46C.glGetUniformLocation(this.program, name), (float)((int)((color >> 16) & 0xff)) / 255.0f, (float)((int)((color >> 8) & 0xff)) / 255.0f, (float)((int)(color & 0xff)) / 255.0f ); @@ -159,7 +190,7 @@ public enum Shader { public void finish() { if(context != this) throw new IllegalStateException("Der Shader-Kontext wird nicht mehr verwendet"); - GL46.glUseProgram(0); + GL46C.glUseProgram(0); context = null; } } @@ -218,44 +249,44 @@ public enum Shader { private boolean compile(String vcode, String fcode) { String include = this.buildInclude(); - int vs = GL46.glCreateShader(GL46.GL_VERTEX_SHADER); - GL46.glShaderSource(vs, "#version 460 compatibility\n" + include + vcode); - GL46.glCompileShader(vs); - int ok = GL46.glGetShaderi(vs, GL46.GL_COMPILE_STATUS); + int vs = GL46C.glCreateShader(GL46C.GL_VERTEX_SHADER); + GL46C.glShaderSource(vs, "#version 460 core\n" + include + vcode); + GL46C.glCompileShader(vs); + int ok = GL46C.glGetShaderi(vs, GL46C.GL_COMPILE_STATUS); if(ok == 0) { - Log.RENDER.error(GL46.glGetShaderInfoLog(vs)); + Log.RENDER.error(GL46C.glGetShaderInfoLog(vs)); Log.RENDER.error("Fehler beim Kompilieren des Vertex-Shaders '%s'", this.vertex); - GL46.glDeleteShader(vs); + GL46C.glDeleteShader(vs); return false; } - int fs = GL46.glCreateShader(GL46.GL_FRAGMENT_SHADER); - GL46.glShaderSource(fs, "#version 460 compatibility\n" + include + fcode); - GL46.glCompileShader(fs); - ok = GL46.glGetShaderi(fs, GL46.GL_COMPILE_STATUS); + int fs = GL46C.glCreateShader(GL46C.GL_FRAGMENT_SHADER); + GL46C.glShaderSource(fs, "#version 460 core\n" + include + fcode); + GL46C.glCompileShader(fs); + ok = GL46C.glGetShaderi(fs, GL46C.GL_COMPILE_STATUS); if(ok == 0) { - Log.RENDER.error(GL46.glGetShaderInfoLog(fs)); + Log.RENDER.error(GL46C.glGetShaderInfoLog(fs)); Log.RENDER.error("Fehler beim Kompilieren des Fragment-Shaders '%s'", this.fragment); - GL46.glDeleteShader(vs); - GL46.glDeleteShader(fs); + GL46C.glDeleteShader(vs); + GL46C.glDeleteShader(fs); return false; } - int pr = GL46.glCreateProgram(); - GL46.glAttachShader(pr, vs); - GL46.glAttachShader(pr, fs); - GL46.glLinkProgram(pr); - ok = GL46.glGetProgrami(pr, GL46.GL_LINK_STATUS); + int pr = GL46C.glCreateProgram(); + GL46C.glAttachShader(pr, vs); + GL46C.glAttachShader(pr, fs); + GL46C.glLinkProgram(pr); + ok = GL46C.glGetProgrami(pr, GL46C.GL_LINK_STATUS); if(ok == 0) { - Log.RENDER.error(GL46.glGetProgramInfoLog(pr)); + Log.RENDER.error(GL46C.glGetProgramInfoLog(pr)); Log.RENDER.error("Fehler beim Verbinden des Shader-Programms '%s' / '%s'", this.vertex, this.fragment); - GL46.glDeleteShader(vs); - GL46.glDeleteShader(fs); - GL46.glDeleteProgram(pr); + GL46C.glDeleteShader(vs); + GL46C.glDeleteShader(fs); + GL46C.glDeleteProgram(pr); return false; } - GL46.glDeleteShader(vs); - GL46.glDeleteShader(fs); + GL46C.glDeleteShader(vs); + GL46C.glDeleteShader(fs); if(this.program != 0) { - GL46.glDeleteProgram(this.program); + GL46C.glDeleteProgram(this.program); Log.RENDER.debug("Shader '%s' / '%s' / ID #%d wurde mit ID #%d neu geladen", this.vertex, this.fragment, this.program, pr); } else { @@ -263,7 +294,7 @@ public enum Shader { } this.program = pr; if(this.init != null) { - GL46.glUseProgram(this.program); + GL46C.glUseProgram(this.program); context = new ShaderContext(this.program); this.init.accept(context); context.finish(); @@ -294,7 +325,7 @@ public enum Shader { private boolean unload() { if(this.program == 0) return false; - GL46.glDeleteProgram(this.program); + GL46C.glDeleteProgram(this.program); Log.RENDER.debug("Shader '%s' / '%s' / ID #%d wurde gelöscht", this.vertex, this.fragment, this.program); this.program = 0; return true; @@ -303,7 +334,7 @@ public enum Shader { public ShaderContext use() { if(context != null) throw new IllegalStateException("Ein Shader wird bereits verwendet"); - GL46.glUseProgram(this.program); + GL46C.glUseProgram(this.program); context = new ShaderContext(this.program); if(this.draw != null) this.draw.accept(context); diff --git a/client/src/main/java/client/renderer/Tessellator.java b/client/src/main/java/client/renderer/Tessellator.java deleted file mode 100755 index 4183e5d2..00000000 --- a/client/src/main/java/client/renderer/Tessellator.java +++ /dev/null @@ -1,93 +0,0 @@ -package client.renderer; - -import java.nio.ByteBuffer; -import java.util.List; - -import org.lwjgl.opengl.GL46; - -public abstract class Tessellator -{ - private static final RenderBuffer BUFFER = new RenderBuffer(2097152); - - public static RenderBuffer getBuffer() - { - return BUFFER; - } - - public static void draw() - { - BUFFER.finishDrawing(); - if (BUFFER.getVertexCount() > 0) - { - VertexFormat vertexformat = BUFFER.getVertexFormat(); - int i = vertexformat.getNextOffset(); - ByteBuffer bytebuffer = BUFFER.getByteBuffer(); - List list = vertexformat.getElements(); - - for (int j = 0; j < list.size(); ++j) - { - VertexFormatElement vertexformatelement = (VertexFormatElement)list.get(j); - VertexFormatElement.EnumUsage vertexformatelement$enumusage = vertexformatelement.usage(); - int k = vertexformatelement.type().getGlConstant(); - int l = vertexformatelement.index(); - bytebuffer.position(vertexformat.getOffset(j)); - - switch (vertexformatelement$enumusage) - { - case POSITION: - GL46.glVertexPointer(vertexformatelement.count(), k, i, bytebuffer); - GL46.glEnableClientState(GL46.GL_VERTEX_ARRAY); - break; - - case UV: - GL46.glClientActiveTexture(GL46.GL_TEXTURE0 + l); - GL46.glTexCoordPointer(vertexformatelement.count(), k, i, bytebuffer); - GL46.glEnableClientState(GL46.GL_TEXTURE_COORD_ARRAY); - GL46.glClientActiveTexture(GL46.GL_TEXTURE0); - break; - - case COLOR: - GL46.glColorPointer(vertexformatelement.count(), k, i, bytebuffer); - GL46.glEnableClientState(GL46.GL_COLOR_ARRAY); - break; - - case NORMAL: - GL46.glNormalPointer(k, i, bytebuffer); - GL46.glEnableClientState(GL46.GL_NORMAL_ARRAY); - } - } - - GL46.glDrawArrays(BUFFER.getDrawMode(), 0, BUFFER.getVertexCount()); - int i1 = 0; - - for (int j1 = list.size(); i1 < j1; ++i1) - { - VertexFormatElement vertexformatelement1 = (VertexFormatElement)list.get(i1); - VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.usage(); - int k1 = vertexformatelement1.index(); - - switch (vertexformatelement$enumusage1) - { - case POSITION: - GL46.glDisableClientState(GL46.GL_VERTEX_ARRAY); - break; - - case UV: - GL46.glClientActiveTexture(GL46.GL_TEXTURE0 + k1); - GL46.glDisableClientState(GL46.GL_TEXTURE_COORD_ARRAY); - GL46.glClientActiveTexture(GL46.GL_TEXTURE0); - break; - - case COLOR: - GL46.glDisableClientState(GL46.GL_COLOR_ARRAY); - GlState.resetColor(); - break; - - case NORMAL: - GL46.glDisableClientState(GL46.GL_NORMAL_ARRAY); - } - } - } - BUFFER.reset(); - } -} diff --git a/client/src/main/java/client/renderer/VertexBuffer.java b/client/src/main/java/client/renderer/VertexBuffer.java index 4765bd91..f25676bb 100755 --- a/client/src/main/java/client/renderer/VertexBuffer.java +++ b/client/src/main/java/client/renderer/VertexBuffer.java @@ -2,40 +2,52 @@ package client.renderer; import java.nio.ByteBuffer; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; public class VertexBuffer { private int id; - private final VertexFormat format; private int count; - public VertexBuffer(VertexFormat format) { - this.format = format; - this.id = GL46.glGenBuffers(); + public VertexBuffer() { + this.id = GL46C.glGenBuffers(); } - public void bindBuffer() { - GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, this.id); + public void bufferData(RenderBuffer buffer, boolean dynamic) { + ByteBuffer buf = buffer.getByteBuffer(); + GL46C.glBindBuffer(GL46C.GL_ARRAY_BUFFER, this.id); + GL46C.glBufferData(GL46C.GL_ARRAY_BUFFER, buf, dynamic ? GL46C.GL_DYNAMIC_DRAW : GL46C.GL_STATIC_DRAW); + GL46C.glBindBuffer(GL46C.GL_ARRAY_BUFFER, 0); + this.count = buf.limit() / 28; } - public void bufferData(ByteBuffer buffer) { - this.bindBuffer(); - GL46.glBufferData(GL46.GL_ARRAY_BUFFER, buffer, GL46.GL_STATIC_DRAW); - this.unbindBuffer(); - this.count = buffer.limit() / this.format.getNextOffset(); + public void draw() { + if(this.count == 0) + return; + + GL46C.glBindBuffer(GL46C.GL_ARRAY_BUFFER, this.id); + + GL46C.glVertexAttribPointer(0, 3, GL46C.GL_FLOAT, false, 28, 0L); + GL46C.glEnableVertexAttribArray(0); + GL46C.glVertexAttribPointer(1, 4, GL46C.GL_BYTE, true, 28, 12L); + GL46C.glEnableVertexAttribArray(1); + GL46C.glVertexAttribPointer(2, 2, GL46C.GL_FLOAT, false, 28, 16L); + GL46C.glEnableVertexAttribArray(2); + GL46C.glVertexAttribPointer(3, 4, GL46C.GL_UNSIGNED_BYTE, true, 28, 24L); + GL46C.glEnableVertexAttribArray(3); + + GL46C.glDrawArrays(GL46C.GL_TRIANGLES, 0, this.count); + + GL46C.glDisableVertexAttribArray(0); + GL46C.glDisableVertexAttribArray(1); + GL46C.glDisableVertexAttribArray(2); + GL46C.glDisableVertexAttribArray(3); + + GL46C.glBindBuffer(GL46C.GL_ARRAY_BUFFER, 0); } - public void drawArrays(int mode) { - GL46.glDrawArrays(mode, 0, this.count); - } - - public void unbindBuffer() { - GL46.glBindBuffer(GL46.GL_ARRAY_BUFFER, 0); - } - - public void deleteGlBuffers() { + public void delete() { if(this.id >= 0) { - GL46.glDeleteBuffers(this.id); + GL46C.glDeleteBuffers(this.id); this.id = -1; } } diff --git a/client/src/main/java/client/renderer/VertexFormat.java b/client/src/main/java/client/renderer/VertexFormat.java deleted file mode 100755 index 35717324..00000000 --- a/client/src/main/java/client/renderer/VertexFormat.java +++ /dev/null @@ -1,200 +0,0 @@ -package client.renderer; - -import java.util.List; - -import common.collect.Lists; -import common.log.Log; - -public class VertexFormat -{ - private final List elements; - private final List offsets; - - private int nextOffset; - private int colorElementOffset; - private List uvOffsetsById; - private int normalElementOffset; - - public VertexFormat(VertexFormat vertexFormatIn) - { - this(); - - for (int i = 0; i < vertexFormatIn.getElementCount(); ++i) - { - this.addElement(vertexFormatIn.getElement(i)); - } - - this.nextOffset = vertexFormatIn.getNextOffset(); - } - - public VertexFormat() - { - this.elements = Lists.newArrayList(); - this.offsets = Lists.newArrayList(); - this.nextOffset = 0; - this.colorElementOffset = -1; - this.uvOffsetsById = Lists.newArrayList(); - this.normalElementOffset = -1; - } - - public void clear() - { - this.elements.clear(); - this.offsets.clear(); - this.colorElementOffset = -1; - this.uvOffsetsById.clear(); - this.normalElementOffset = -1; - this.nextOffset = 0; - } - - - public VertexFormat addElement(VertexFormatElement element) - { - if (element.isPosition() && this.hasPosition()) - { - Log.RENDER.warn("VertexFormat-Fehler: Versuche eine Position vom Typ VertexFormatElement hinzuzufügen, während eine bereits existiert, ignoriere."); - return this; - } - else - { - this.elements.add(element); - this.offsets.add(Integer.valueOf(this.nextOffset)); - - switch (element.usage()) - { - case NORMAL: - this.normalElementOffset = this.nextOffset; - break; - - case COLOR: - this.colorElementOffset = this.nextOffset; - break; - - case UV: - this.uvOffsetsById.add(element.index(), Integer.valueOf(this.nextOffset)); - } - - this.nextOffset += element.size(); - return this; - } - } - - public boolean hasNormal() - { - return this.normalElementOffset >= 0; - } - - public int getNormalOffset() - { - return this.normalElementOffset; - } - - public boolean hasColor() - { - return this.colorElementOffset >= 0; - } - - public int getColorOffset() - { - return this.colorElementOffset; - } - - public boolean hasUvOffset(int id) - { - return this.uvOffsetsById.size() - 1 >= id; - } - - public int getUvOffsetById(int id) - { - return ((Integer)this.uvOffsetsById.get(id)).intValue(); - } - - public String toString() - { - String s = "format: " + this.elements.size() + " elements: "; - - for (int i = 0; i < this.elements.size(); ++i) - { - s = s + ((VertexFormatElement)this.elements.get(i)).toString(); - - if (i != this.elements.size() - 1) - { - s = s + " "; - } - } - - return s; - } - - private boolean hasPosition() - { - int i = 0; - - for (int j = this.elements.size(); i < j; ++i) - { - VertexFormatElement vertexformatelement = (VertexFormatElement)this.elements.get(i); - - if (vertexformatelement.isPosition()) - { - return true; - } - } - - return false; - } - - public int getIntegerSize() - { - return this.getNextOffset() / 4; - } - - public int getNextOffset() - { - return this.nextOffset; - } - - public List getElements() - { - return this.elements; - } - - public int getElementCount() - { - return this.elements.size(); - } - - public VertexFormatElement getElement(int index) - { - return (VertexFormatElement)this.elements.get(index); - } - - public int getOffset(int p_181720_1_) - { - return ((Integer)this.offsets.get(p_181720_1_)).intValue(); - } - - public boolean equals(Object p_equals_1_) - { - if (this == p_equals_1_) - { - return true; - } - else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass()) - { - VertexFormat vertexformat = (VertexFormat)p_equals_1_; - return this.nextOffset != vertexformat.nextOffset ? false : (!this.elements.equals(vertexformat.elements) ? false : this.offsets.equals(vertexformat.offsets)); - } - else - { - return false; - } - } - - public int hashCode() - { - int i = this.elements.hashCode(); - i = 31 * i + this.offsets.hashCode(); - i = 31 * i + this.nextOffset; - return i; - } -} diff --git a/client/src/main/java/client/renderer/VertexFormatElement.java b/client/src/main/java/client/renderer/VertexFormatElement.java deleted file mode 100755 index fd0534ed..00000000 --- a/client/src/main/java/client/renderer/VertexFormatElement.java +++ /dev/null @@ -1,84 +0,0 @@ -package client.renderer; - -import org.lwjgl.opengl.GL46; - -public record VertexFormatElement(int index, VertexFormatElement.EnumType type, VertexFormatElement.EnumUsage usage, int count) { - public String toString() { - return this.count + "," + this.usage.getName() + "," + this.type.getName(); - } - - public int size() { - return this.type.getSize() * this.count; - } - - public boolean isPosition() { - return this.usage == VertexFormatElement.EnumUsage.POSITION; - } - - public boolean equals(Object other) { - if(this == other) - return true; - if(!(other instanceof VertexFormatElement)) - return false; - VertexFormatElement elem = (VertexFormatElement)other; - return this.count == elem.count && this.index == elem.index && this.type == elem.type && this.usage == elem.usage; - } - - public int hashCode() { - int i = this.type.hashCode(); - i = 31 * i + this.usage.hashCode(); - i = 31 * i + this.index; - i = 31 * i + this.count; - return i; - } - - public static enum EnumType { - FLOAT(4, "Float", GL46.GL_FLOAT), - UBYTE(1, "Unsigned Byte", GL46.GL_UNSIGNED_BYTE), - BYTE(1, "Byte", GL46.GL_BYTE), - USHORT(2, "Unsigned Short", GL46.GL_UNSIGNED_SHORT), - SHORT(2, "Short", GL46.GL_SHORT), - UINT(4, "Unsigned Int", GL46.GL_UNSIGNED_INT), - INT(4, "Int", GL46.GL_INT); - - private final int size; - private final String name; - private final int glConstant; - - private EnumType(int size, String name, int glConstant) { - this.size = size; - this.name = name; - this.glConstant = glConstant; - } - - public int getSize() { - return this.size; - } - - public String getName() { - return this.name; - } - - public int getGlConstant() { - return this.glConstant; - } - } - - public static enum EnumUsage { - POSITION("Position"), - NORMAL("Normal"), - COLOR("Vertex Color"), - UV("UV"), - PADDING("Padding"); - - private final String name; - - private EnumUsage(String name) { - this.name = name; - } - - public String getName() { - return this.name; - } - } -} diff --git a/client/src/main/java/client/renderer/blockmodel/FaceBakery.java b/client/src/main/java/client/renderer/blockmodel/FaceBakery.java index 1d72ca77..e9bc9d16 100755 --- a/client/src/main/java/client/renderer/blockmodel/FaceBakery.java +++ b/client/src/main/java/client/renderer/blockmodel/FaceBakery.java @@ -102,11 +102,6 @@ public class FaceBakery return aint; } - - private int getFaceShadeColor(Facing facing) - { - return this.getFaceNormal(facing); - } private int getFaceNormal(Facing facing) { @@ -143,7 +138,7 @@ public class FaceBakery private void fillVertexData(int[] faceData, int vertexIndex, Facing facing, BlockPartFace partFace, float[] p_178402_5_, Sprite sprite, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade, float shine) { Facing enumfacing = modelRotationIn.rotateFace(facing); - int i = (int)((shine / 32.0f) * 127.0f) << 24 | (shade ? this.getFaceShadeColor(enumfacing) : 0x000000); + int i = (int)((shine / 32.0f) * 127.0f) << 24 | (shade ? this.getFaceNormal(enumfacing) : 0x000000); VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing).getVertexInformation(vertexIndex); Vector3f vector3f = new Vector3f(p_178402_5_[enumfacedirection$vertexinformation.xIndex], p_178402_5_[enumfacedirection$vertexinformation.yIndex], p_178402_5_[enumfacedirection$vertexinformation.zIndex]); this.rotatePart(vector3f, partRotation); @@ -151,15 +146,15 @@ public class FaceBakery this.storeVertexData(faceData, j, vertexIndex, vector3f, i, sprite, partFace.uv); } - private void storeVertexData(int[] faceData, int storeIndex, int vertexIndex, Vector3f position, int shadeColor, Sprite sprite, BlockFaceUV faceUV) + private void storeVertexData(int[] faceData, int storeIndex, int vertexIndex, Vector3f position, int normalPacked, Sprite sprite, BlockFaceUV faceUV) { int i = storeIndex * 7; - faceData[i] = Float.floatToRawIntBits(position.x); + faceData[i + 0] = Float.floatToRawIntBits(position.x); faceData[i + 1] = Float.floatToRawIntBits(position.y); faceData[i + 2] = Float.floatToRawIntBits(position.z); - faceData[i + 3] = shadeColor; + faceData[i + 3] = normalPacked; faceData[i + 4] = Float.floatToRawIntBits(sprite.getInterpolatedU((double)faceUV.getU(vertexIndex))); - faceData[i + 4 + 1] = Float.floatToRawIntBits(sprite.getInterpolatedV((double)faceUV.getV(vertexIndex))); + faceData[i + 5] = Float.floatToRawIntBits(sprite.getInterpolatedV((double)faceUV.getV(vertexIndex))); } private void rotatePart(Vector3f p_178407_1_, BlockPartRotation partRotation) diff --git a/client/src/main/java/client/renderer/chunk/ChunkRenderDispatcher.java b/client/src/main/java/client/renderer/chunk/ChunkRenderDispatcher.java index 62e3272b..8d625657 100755 --- a/client/src/main/java/client/renderer/chunk/ChunkRenderDispatcher.java +++ b/client/src/main/java/client/renderer/chunk/ChunkRenderDispatcher.java @@ -192,10 +192,7 @@ public class ChunkRenderDispatcher { if (Client.CLIENT.isMainThread()) { - buf.reset(); - renderer.getVertexBuffer().bufferData(buf.getByteBuffer()); - - buf.setTranslation(0.0D, 0.0D, 0.0D); + renderer.getVertexBuffer().bufferData(buf, true); return new ImmediateFuture(); } else diff --git a/client/src/main/java/client/renderer/chunk/RenderChunk.java b/client/src/main/java/client/renderer/chunk/RenderChunk.java index f9a3c798..0ce60229 100755 --- a/client/src/main/java/client/renderer/chunk/RenderChunk.java +++ b/client/src/main/java/client/renderer/chunk/RenderChunk.java @@ -8,7 +8,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.locks.ReentrantLock; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.DefaultVertexFormats; @@ -59,7 +59,7 @@ public class RenderChunk this.setPosition(blockPosIn); } - this.vertexBuffer = new VertexBuffer(DefaultVertexFormats.BLOCK); + this.vertexBuffer = new VertexBuffer(Renderer.WORLD_FORMAT); } public boolean setFrameIndex(int frameIndexIn) @@ -172,10 +172,10 @@ public class RenderChunk compiledchunk.setLayerUsed(); } - if (compiledchunk.isLayerStarted()) - { - generator.getRegionRenderCacheBuilder().finishDrawing(); - } +// if (compiledchunk.isLayerStarted()) +// { +// generator.getRegionRenderCacheBuilder().finishDrawing(); +// } } compiledchunk.setVisibility(lvt_10_1_.computeVisibility()); @@ -241,20 +241,19 @@ public class RenderChunk private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos) { - worldRendererIn.begin(GL46.GL_QUADS, DefaultVertexFormats.BLOCK); - worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); + worldRendererIn.begin((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); } private void initModelviewMatrix() { - GL46.glPushMatrix(); - GL46.glLoadIdentity(); + GL46C.glPushMatrix(); + GL46C.glLoadIdentity(); float f = 1.000001F; - GL46.glTranslatef(-8.0F, -8.0F, -8.0F); - GL46.glScalef(f, f, f); - GL46.glTranslatef(8.0F, 8.0F, 8.0F); - GL46.glGetFloatv(2982, this.modelviewMatrix); - GL46.glPopMatrix(); + GL46C.glTranslatef(-8.0F, -8.0F, -8.0F); + GL46C.glScalef(f, f, f); + GL46C.glTranslatef(8.0F, 8.0F, 8.0F); + GL46C.glGetFloatv(2982, this.modelviewMatrix); + GL46C.glPopMatrix(); } public FloatBuffer getModelviewMatrix() @@ -292,7 +291,7 @@ public class RenderChunk this.stopCompileTask(); this.gm = null; if(this.vertexBuffer != null) - this.vertexBuffer.deleteGlBuffers(); + this.vertexBuffer.delete(); } public BlockPos getPosition() diff --git a/client/src/main/java/client/renderer/entity/RenderArachnoid.java b/client/src/main/java/client/renderer/entity/RenderArachnoid.java index 976941ed..c220101d 100755 --- a/client/src/main/java/client/renderer/entity/RenderArachnoid.java +++ b/client/src/main/java/client/renderer/entity/RenderArachnoid.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.layers.LayerArachnoidArmor; import client.renderer.model.ModelArachnoid; @@ -22,10 +22,10 @@ public class RenderArachnoid extends RenderHumanoid // } protected void renderLayers(EntityNPC entity, float swing, float amount, float partial, float time, float dYaw, float dPitch, float scale) { - GL46.glPushMatrix(); - GL46.glTranslatef(0.0f, 3.0f / 16.0f, 0.0f); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0f, 3.0f / 16.0f, 0.0f); super.renderLayers(entity, swing, amount, partial, time, dYaw, dPitch, scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } public ModelArachnoid getMainModel() diff --git a/client/src/main/java/client/renderer/entity/RenderArrow.java b/client/src/main/java/client/renderer/entity/RenderArrow.java index 6f3a40b6..02e49e65 100755 --- a/client/src/main/java/client/renderer/entity/RenderArrow.java +++ b/client/src/main/java/client/renderer/entity/RenderArrow.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -26,10 +26,10 @@ public class RenderArrow extends Render { this.bindEntityTexture(entity); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); - GL46.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 0.0F, 0.0F, 1.0F); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); + GL46C.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 0.0F, 0.0F, 1.0F); // Tessellator tessellator = Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); int i = 0; @@ -48,21 +48,21 @@ public class RenderArrow extends Render if (f9 > 0.0F) { float f10 = -ExtMath.sin(f9 * 3.0F) * f9; - GL46.glRotatef(f10, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(f10, 0.0F, 0.0F, 1.0F); } - GL46.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); - GL46.glScalef(f8, f8, f8); - GL46.glTranslatef(-4.0F, 0.0F, 0.0F); - GL46.glNormal3f(f8, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(f8, f8, f8); + GL46C.glTranslatef(-4.0F, 0.0F, 0.0F); + GL46C.glNormal3f(f8, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); Tessellator.draw(); - GL46.glNormal3f(-f8, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glNormal3f(-f8, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); @@ -71,9 +71,9 @@ public class RenderArrow extends Render for (int j = 0; j < 4; ++j) { - GL46.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL46.glNormal3f(0.0F, 0.0F, f8); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL46C.glNormal3f(0.0F, 0.0F, f8); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex(); worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex(); worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex(); @@ -82,7 +82,7 @@ public class RenderArrow extends Render } GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderBat.java b/client/src/main/java/client/renderer/entity/RenderBat.java index 9ef40442..0efaed20 100755 --- a/client/src/main/java/client/renderer/entity/RenderBat.java +++ b/client/src/main/java/client/renderer/entity/RenderBat.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.model.ModelBat; import common.entity.animal.EntityBat; @@ -30,18 +30,18 @@ public class RenderBat extends RenderLiving */ protected void preRenderCallback(EntityBat entitylivingbaseIn, float partialTickTime) { - GL46.glScalef(0.35F, 0.35F, 0.35F); + GL46C.glScalef(0.35F, 0.35F, 0.35F); } protected void rotateCorpse(EntityBat bat, float p_77043_2_, float p_77043_3_, float partialTicks) { if (!bat.getIsBatHanging()) { - GL46.glTranslatef(0.0F, ExtMath.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); + GL46C.glTranslatef(0.0F, ExtMath.cos(p_77043_2_ * 0.3F) * 0.1F, 0.0F); } else { - GL46.glTranslatef(0.0F, -0.1F, 0.0F); + GL46C.glTranslatef(0.0F, -0.1F, 0.0F); } super.rotateCorpse(bat, p_77043_2_, p_77043_3_, partialTicks); diff --git a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java index 926935c5..6e757a51 100755 --- a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.texture.TextureMap; @@ -21,13 +21,13 @@ public class RenderBlockEntity extends Render public void doRender(Entity entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y + 0.5F, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y + 0.5F, (float)z); this.bindEntityTexture(entity); - GL46.glTranslatef(-0.5F, -0.5F, 0.5F); + GL46C.glTranslatef(-0.5F, -0.5F, 0.5F); Client.CLIENT.renderer.renderBlockEntity(this.state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); - GL46.glTranslatef(0.0F, 0.0F, 1.0F); - GL46.glPopMatrix(); + GL46C.glTranslatef(0.0F, 0.0F, 1.0F); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderBoat.java b/client/src/main/java/client/renderer/entity/RenderBoat.java index 9237f080..7ec5070f 100755 --- a/client/src/main/java/client/renderer/entity/RenderBoat.java +++ b/client/src/main/java/client/renderer/entity/RenderBoat.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.model.ModelBase; import client.renderer.model.ModelBoat; @@ -26,9 +26,9 @@ public class RenderBoat extends Render */ public void doRender(EntityBoat entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y + 0.25F, (float)z); - GL46.glRotatef(180.0F - (entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks), 0.0F, 1.0F, 0.0F); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y + 0.25F, (float)z); + GL46C.glRotatef(180.0F - (entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks), 0.0F, 1.0F, 0.0F); float f = (float)entity.getTimeSinceHit() - partialTicks; float f1 = (float)entity.getDamageTaken() - partialTicks; @@ -39,16 +39,16 @@ public class RenderBoat extends Render if (f > 0.0F) { - GL46.glRotatef(ExtMath.sin(f) * f * f1 / 10.0F * (float)entity.getForwardDirection(), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(ExtMath.sin(f) * f * f1 / 10.0F * (float)entity.getForwardDirection(), 1.0F, 0.0F, 0.0F); } float f2 = 0.75F; - GL46.glScalef(f2, f2, f2); - GL46.glScalef(1.0F / f2, 1.0F / f2, 1.0F / f2); + GL46C.glScalef(f2, f2, f2); + GL46C.glScalef(1.0F / f2, 1.0F / f2, 1.0F / f2); this.bindEntityTexture(entity); - GL46.glScalef(-1.0F, -1.0F, 1.0F); + GL46C.glScalef(-1.0F, -1.0F, 1.0F); this.modelBoat.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderBullet.java b/client/src/main/java/client/renderer/entity/RenderBullet.java index 86f7b45f..229b5dc8 100755 --- a/client/src/main/java/client/renderer/entity/RenderBullet.java +++ b/client/src/main/java/client/renderer/entity/RenderBullet.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -22,10 +22,10 @@ public class RenderBullet extends Render { this.bindEntityTexture(entity); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); - GL46.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 0.0F, 0.0F, 1.0F); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); + GL46C.glRotatef(entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks, 0.0F, 0.0F, 1.0F); RenderBuffer worldrenderer = Tessellator.getBuffer(); float f = 0.0F; float f1 = 0.5F; @@ -38,18 +38,18 @@ public class RenderBullet extends Render float f8 = 0.05625F; GlState.enableRescaleNormal(); - GL46.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); - GL46.glScalef(f8, f8, f8); - GL46.glTranslatef(-4.0F, 0.0F, 0.0F); - GL46.glNormal3f(f8, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(f8, f8, f8); + GL46C.glTranslatef(-4.0F, 0.0F, 0.0F); + GL46C.glNormal3f(f8, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, -2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f7).endVertex(); Tessellator.draw(); - GL46.glNormal3f(-f8, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glNormal3f(-f8, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-7.0D, 2.0D, -2.0D).tex((double)f4, (double)f6).endVertex(); worldrenderer.pos(-7.0D, 2.0D, 2.0D).tex((double)f5, (double)f6).endVertex(); worldrenderer.pos(-7.0D, -2.0D, 2.0D).tex((double)f5, (double)f7).endVertex(); @@ -58,9 +58,9 @@ public class RenderBullet extends Render for (int j = 0; j < 4; ++j) { - GL46.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL46.glNormal3f(0.0F, 0.0F, f8); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + GL46C.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); + GL46C.glNormal3f(0.0F, 0.0F, f8); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(-8.0D, -2.0D, 0.0D).tex((double)f, (double)f2).endVertex(); worldrenderer.pos(8.0D, -2.0D, 0.0D).tex((double)f1, (double)f2).endVertex(); worldrenderer.pos(8.0D, 2.0D, 0.0D).tex((double)f1, (double)f3).endVertex(); @@ -69,7 +69,7 @@ public class RenderBullet extends Render } GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderCat.java b/client/src/main/java/client/renderer/entity/RenderCat.java index 33d2cce0..b965bf4c 100755 --- a/client/src/main/java/client/renderer/entity/RenderCat.java +++ b/client/src/main/java/client/renderer/entity/RenderCat.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.model.ModelBase; import common.entity.animal.EntityCat; @@ -50,7 +50,7 @@ public class RenderCat extends RenderLiving if (entitylivingbaseIn.isTamed()) { - GL46.glScalef(0.8F, 0.8F, 0.8F); + GL46C.glScalef(0.8F, 0.8F, 0.8F); } } } diff --git a/client/src/main/java/client/renderer/entity/RenderCrystal.java b/client/src/main/java/client/renderer/entity/RenderCrystal.java index b06a4c49..384228b4 100755 --- a/client/src/main/java/client/renderer/entity/RenderCrystal.java +++ b/client/src/main/java/client/renderer/entity/RenderCrystal.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.model.ModelBase; import client.renderer.model.ModelCrystal; @@ -26,13 +26,13 @@ public class RenderCrystal extends Render public void doRender(EntityCrystal entity, double x, double y, double z, float partialTicks) { float f = (float)entity.innerRotation + partialTicks; - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); this.bindTexture(crystalTextures); float f1 = ExtMath.sin(f * 0.2F) / 2.0F + 0.5F; f1 = f1 * f1 + f1; this.modelCrystal.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderDie.java b/client/src/main/java/client/renderer/entity/RenderDie.java index 4bf6340e..18a50cde 100755 --- a/client/src/main/java/client/renderer/entity/RenderDie.java +++ b/client/src/main/java/client/renderer/entity/RenderDie.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.model.ModelDie; @@ -19,16 +19,16 @@ public class RenderDie extends Render { } public void doRender(EntityDie entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y + 0.05F, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y + 0.05F, (float)z); this.bindEntityTexture(entity); if(entity.getValue() == 0) - GL46.glRotatef((float)((entity.ticksExisted % 10) * (360 / 10)), 0.3f, 0.4f, 0.1f); - GL46.glScalef(-0.1f, -0.1f, 0.1f); + GL46C.glRotatef((float)((entity.ticksExisted % 10) * (360 / 10)), 0.3f, 0.4f, 0.1f); + GL46C.glScalef(-0.1f, -0.1f, 0.1f); GlState.disableCull(); this.model.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GlState.enableCull(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } } diff --git a/client/src/main/java/client/renderer/entity/RenderEntity.java b/client/src/main/java/client/renderer/entity/RenderEntity.java index 2ce1d5ab..60f6e92b 100755 --- a/client/src/main/java/client/renderer/entity/RenderEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderEntity.java @@ -1,68 +1,13 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; - -import client.renderer.DefaultVertexFormats; -import client.renderer.GlState; -import client.renderer.RenderBuffer; -import client.renderer.Tessellator; import common.entity.Entity; -import common.util.BoundingBox; +public class RenderEntity extends Render { + public RenderEntity(RenderManager renderManagerIn) { + super(renderManagerIn); + } -public class RenderEntity extends Render -{ - public static void renderOffsetAABB(BoundingBox bb, double x, double y, double z) - { - GlState.disableTexture2D(); - RenderBuffer rb = Tessellator.getBuffer(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - rb.setTranslation(x, y, z); - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); - rb.pos(bb.minX, bb.maxY, bb.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.minZ).normal(0.0F, 0.0F, -1.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); - rb.pos(bb.minX, bb.maxY, bb.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.minZ).normal(0.0F, -1.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.maxY, bb.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.maxY, bb.minZ).normal(0.0F, 1.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.maxY, bb.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.maxY, bb.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.minX, bb.minY, bb.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.minZ).normal(1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.maxY, bb.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); - rb.pos(bb.maxX, bb.minY, bb.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex(); - Tessellator.draw(); - rb.setTranslation(0.0D, 0.0D, 0.0D); - GlState.enableTexture2D(); - } - - public RenderEntity(RenderManager renderManagerIn) - { - super(renderManagerIn); - } - - public void doRender(Entity entity, double x, double y, double z, float partialTicks) - { - GL46.glPushMatrix(); - renderOffsetAABB(entity.getEntityBoundingBox(), x - entity.lastTickPosX, y - entity.lastTickPosY, z - entity.lastTickPosZ); - GL46.glPopMatrix(); - super.doRender(entity, x, y, z, partialTicks); - } - - protected String getEntityTexture(Entity entity) - { - return null; - } + protected String getEntityTexture(Entity entity) { + return null; + } } diff --git a/client/src/main/java/client/renderer/entity/RenderEntityItem.java b/client/src/main/java/client/renderer/entity/RenderEntityItem.java index 98c40ae1..5f757dc5 100755 --- a/client/src/main/java/client/renderer/entity/RenderEntityItem.java +++ b/client/src/main/java/client/renderer/entity/RenderEntityItem.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.blockmodel.IBakedModel; @@ -39,12 +39,12 @@ public class RenderEntityItem extends Render int i = this.getMultiplier(itemstack); float f = 0.25F; float f1 = ExtMath.sin(((float)itemIn.getAge() + p_177077_8_) / 10.0F + itemIn.hoverStart) * 0.1F + 0.1F; - GL46.glTranslatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F, (float)p_177077_6_); + GL46C.glTranslatef((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F, (float)p_177077_6_); if (flag || this.manager.gm != null) { float f3 = (((float)itemIn.getAge() + p_177077_8_) / 20.0F + itemIn.hoverStart) * (180F / (float)Math.PI); - GL46.glRotatef(f3, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(f3, 0.0F, 1.0F, 0.0F); } if (!flag) @@ -52,7 +52,7 @@ public class RenderEntityItem extends Render float f6 = -0.0F * (float)(i - 1) * 0.5F; float f4 = -0.0F * (float)(i - 1) * 0.5F; float f5 = -0.046875F * (float)(i - 1) * 0.5F; - GL46.glTranslatef(f6, f4, f5); + GL46C.glTranslatef(f6, f4, f5); } GlState.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -102,10 +102,10 @@ public class RenderEntityItem extends Render // } GlState.enableRescaleNormal(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glPushMatrix(); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GL46C.glPushMatrix(); IBakedModel ibakedmodel = this.itemRenderer.getItemModelMesher().getItemModel(itemstack); int i = this.func_177077_a(entity, x, y, z, partialTicks, ibakedmodel); @@ -113,30 +113,30 @@ public class RenderEntityItem extends Render { if (ibakedmodel.isGui3d()) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); if (j > 0) { float f = (this.field_177079_e.floatv() * 2.0F - 1.0F) * 0.15F; float f1 = (this.field_177079_e.floatv() * 2.0F - 1.0F) * 0.15F; float f2 = (this.field_177079_e.floatv() * 2.0F - 1.0F) * 0.15F; - GL46.glTranslatef(f, f1, f2); + GL46C.glTranslatef(f, f1, f2); } - GL46.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glScalef(0.5F, 0.5F, 0.5F); this.itemRenderer.renderItem(itemstack, ibakedmodel); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.itemRenderer.renderItem(itemstack, ibakedmodel); - GL46.glPopMatrix(); - GL46.glTranslatef(0.0F, 0.0F, 0.046875F); + GL46C.glPopMatrix(); + GL46C.glTranslatef(0.0F, 0.0F, 0.046875F); } } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.disableRescaleNormal(); GlState.disableBlend(); this.bindEntityTexture(entity); diff --git a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java index c5d44d7a..1d018b99 100755 --- a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java +++ b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.texture.TextureMap; @@ -25,13 +25,13 @@ public class RenderFallingBlock extends Render { if(state != world.getState(pos) && block != Blocks.air && !block.getMaterial().isLiquid()) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y + 0.5F, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y + 0.5F, (float)z); this.bindEntityTexture(entity); - GL46.glTranslatef(-0.5F, -0.5F, 0.5F); + GL46C.glTranslatef(-0.5F, -0.5F, 0.5F); Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); - GL46.glTranslatef(0.0F, 0.0F, 1.0F); - GL46.glPopMatrix(); + GL46C.glTranslatef(0.0F, 0.0F, 1.0F); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } } diff --git a/client/src/main/java/client/renderer/entity/RenderFireball.java b/client/src/main/java/client/renderer/entity/RenderFireball.java index bb8608d9..47df3a5d 100755 --- a/client/src/main/java/client/renderer/entity/RenderFireball.java +++ b/client/src/main/java/client/renderer/entity/RenderFireball.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.DefaultVertexFormats; @@ -28,11 +28,11 @@ public class RenderFireball extends Render */ public void doRender(EntityProjectile entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.bindEntityTexture(entity); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glTranslatef((float)x, (float)y, (float)z); GlState.enableRescaleNormal(); - GL46.glScalef(this.scale, this.scale, this.scale); + GL46C.glScalef(this.scale, this.scale, this.scale); Sprite textureatlassprite = Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(Items.fireball); // Tessellator tessellator = Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); @@ -43,16 +43,16 @@ public class RenderFireball extends Render float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.25F; - GL46.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + GL46C.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); worldrenderer.pos(-0.5D, -0.25D, 0.0D).tex((double)f, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(0.5D, -0.25D, 0.0D).tex((double)f1, (double)f3).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(0.5D, 0.75D, 0.0D).tex((double)f1, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(-0.5D, 0.75D, 0.0D).tex((double)f, (double)f2).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.draw(); GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderFish.java b/client/src/main/java/client/renderer/entity/RenderFish.java index d81f39ec..9be26620 100755 --- a/client/src/main/java/client/renderer/entity/RenderFish.java +++ b/client/src/main/java/client/renderer/entity/RenderFish.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.DefaultVertexFormats; @@ -25,10 +25,10 @@ public class RenderFish extends Render */ public void doRender(EntityHook entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); GlState.enableRescaleNormal(); - GL46.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glScalef(0.5F, 0.5F, 0.5F); this.bindEntityTexture(entity); // Tessellator tessellator = Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); @@ -41,16 +41,16 @@ public class RenderFish extends Render float f4 = 1.0F; float f5 = 0.5F; float f6 = 0.5F; - GL46.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); + GL46C.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); worldrenderer.pos(-0.5D, -0.5D, 0.0D).tex(0.0D, 0.25D).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(0.5D, -0.5D, 0.0D).tex(0.25D, 0.25D).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(0.5D, 0.5D, 0.0D).tex(0.25D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex(); worldrenderer.pos(-0.5D, 0.5D, 0.0D).tex(0.0D, 0.0D).normal(0.0F, 1.0F, 0.0F).endVertex(); Tessellator.draw(); GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); if (entity.angler != null) { @@ -87,7 +87,7 @@ public class RenderFish extends Render double d12 = (double)((float)(d2 - d7)); GlState.disableTexture2D(); GlState.disableLighting(); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); int k = 16; for (int l = 0; l <= 16; ++l) diff --git a/client/src/main/java/client/renderer/entity/RenderFlyingBox.java b/client/src/main/java/client/renderer/entity/RenderFlyingBox.java index d367686c..093e57c9 100755 --- a/client/src/main/java/client/renderer/entity/RenderFlyingBox.java +++ b/client/src/main/java/client/renderer/entity/RenderFlyingBox.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.model.ModelHead; @@ -40,19 +40,19 @@ public class RenderFlyingBox extends Render */ public void doRender(EntityBox entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); GlState.disableCull(); float f = this.func_82400_a(entity.prevYaw, entity.rotYaw, partialTicks); float f1 = entity.prevPitch + (entity.rotPitch - entity.prevPitch) * partialTicks; - GL46.glTranslatef((float)x, (float)y, (float)z); - GL46.glRotatef((float)(entity.ticksExisted % 100) * 360.0f / 100.0f, 0.3f, 0.4f, 0.1f); + GL46C.glTranslatef((float)x, (float)y, (float)z); + GL46C.glRotatef((float)(entity.ticksExisted % 100) * 360.0f / 100.0f, 0.3f, 0.4f, 0.1f); float f2 = 0.0625F; GlState.enableRescaleNormal(); - GL46.glScalef(-1.0F, -1.0F, 1.0F); + GL46C.glScalef(-1.0F, -1.0F, 1.0F); GlState.enableAlpha(); this.bindEntityTexture(entity); this.boxModel.render(entity, 0.0F, 0.0F, 0.0F, f, f1, f2); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderHorse.java b/client/src/main/java/client/renderer/entity/RenderHorse.java index 54437d81..7208cce6 100755 --- a/client/src/main/java/client/renderer/entity/RenderHorse.java +++ b/client/src/main/java/client/renderer/entity/RenderHorse.java @@ -2,7 +2,7 @@ package client.renderer.entity; import java.util.Set; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.model.ModelHorse; @@ -40,7 +40,7 @@ public class RenderHorse extends RenderLiving f *= 0.92F; } - GL46.glScalef(f, f, f); + GL46C.glScalef(f, f, f); super.preRenderCallback(entitylivingbaseIn, partialTickTime); } diff --git a/client/src/main/java/client/renderer/entity/RenderHumanoid.java b/client/src/main/java/client/renderer/entity/RenderHumanoid.java index 13a8d30b..59e0f244 100755 --- a/client/src/main/java/client/renderer/entity/RenderHumanoid.java +++ b/client/src/main/java/client/renderer/entity/RenderHumanoid.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.layers.LayerArmor; @@ -178,7 +178,7 @@ public class RenderHumanoid extends RenderNpc // SKC.glScalef(f2, f3, f2); // } float f = entitylivingbaseIn.getRenderScale(); // 0.9375F; - GL46.glScalef(f, f, f); + GL46C.glScalef(f, f, f); } // protected int getColorMultiplier(EntityNPC entitylivingbaseIn, float lightBrightness, float partialTickTime) diff --git a/client/src/main/java/client/renderer/entity/RenderItem.java b/client/src/main/java/client/renderer/entity/RenderItem.java index 6e95dd0f..845329c2 100755 --- a/client/src/main/java/client/renderer/entity/RenderItem.java +++ b/client/src/main/java/client/renderer/entity/RenderItem.java @@ -2,7 +2,7 @@ package client.renderer.entity; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -67,7 +67,7 @@ public class RenderItem private void renderModel(IBakedModel model, int color, ItemStack stack) { RenderBuffer worldrenderer = Tessellator.getBuffer(); - worldrenderer.begin(GL46.GL_QUADS, DefaultVertexFormats.ITEM); + worldrenderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.ITEM); for (Facing enumfacing : Facing.values()) { @@ -82,31 +82,31 @@ public class RenderItem { if (stack != null) { - GL46.glPushMatrix(); - GL46.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glPushMatrix(); + GL46C.glScalef(0.5F, 0.5F, 0.5F); if (model.isBuiltin()) { - GL46.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(-0.5F, -0.5F, -0.5F); + GL46C.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(-0.5F, -0.5F, -0.5F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.enableRescaleNormal(); this.renderBuiltin(stack); } else { - GL46.glTranslatef(-0.5F, -0.5F, -0.5F); + GL46C.glTranslatef(-0.5F, -0.5F, -0.5F); this.renderModel(model, stack); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } private void renderBuiltin(ItemStack stack) { if(stack.getItem() instanceof ItemArmor armor) { this.stack = stack; - GL46.glPushMatrix(); + GL46C.glPushMatrix(); float offset = 0.0f; switch(armor.getArmorType()) { case HELMET: @@ -128,9 +128,9 @@ public class RenderItem offset = 0.0f; break; } - GL46.glTranslatef(1.0f, offset, 0.0f); - GL46.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); - GL46.glScalef(1.4f, -1.4f, 1.4f); + GL46C.glTranslatef(1.0f, offset, 0.0f); + GL46C.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL46C.glScalef(1.4f, -1.4f, 1.4f); boolean cull = GlState.isCullEnabled(); if(cull) GlState.disableCull(); @@ -142,14 +142,14 @@ public class RenderItem // if(cull) GlState.enableCull(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); this.stack = null; } else if(stack.getItem() instanceof ItemAnimalArmor horseArmor) { - GL46.glPushMatrix(); - GL46.glTranslatef(0.9f, 0.5f, 0.0f); - GL46.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); - GL46.glScalef(0.85f, -0.85f, 0.85f); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.9f, 0.5f, 0.0f); + GL46C.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL46C.glScalef(0.85f, -0.85f, 0.85f); Class clazz = horseArmor.getArmorType().getAnimalType(); boolean cull = GlState.isCullEnabled(); if(cull) @@ -160,7 +160,7 @@ public class RenderItem } if(cull) GlState.enableCull(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } @@ -214,7 +214,7 @@ public class RenderItem if (!flag) { - GL46.glScalef(2.0F, 2.0F, 2.0F); + GL46C.glScalef(2.0F, 2.0F, 2.0F); } GlState.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -254,45 +254,45 @@ public class RenderItem this.manager.bindTexture(TextureMap.BLOCKS); this.preTransform(stack); GlState.enableRescaleNormal(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); - GL46.glPushMatrix(); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); + GL46C.glPushMatrix(); if(transform) { WieldType type = stack.getItem().getWieldType(); if(third && type != null) { switch(type) { case TOOL_FLIP: - GL46.glTranslatef(0.0f, 0.0f, -3.5f * 0.0625f); - GL46.glRotatef(90.0f, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(180.0f, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F); - GL46.glScalef(0.85f, 0.85f, 0.85f); + GL46C.glTranslatef(0.0f, 0.0f, -3.5f * 0.0625f); + GL46C.glRotatef(90.0f, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(180.0f, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F); + GL46C.glScalef(0.85f, 0.85f, 0.85f); break; case TOOL: - GL46.glTranslatef(0.0f, 1.25f * 0.0625f, -3.5f * 0.0625f); - GL46.glRotatef(90.0f, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F); - GL46.glScalef(0.85f, 0.85f, 0.85f); + GL46C.glTranslatef(0.0f, 1.25f * 0.0625f, -3.5f * 0.0625f); + GL46C.glRotatef(90.0f, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-35.0f, 0.0F, 0.0F, 1.0F); + GL46C.glScalef(0.85f, 0.85f, 0.85f); break; case RANGED: - GL46.glTranslatef(0.75f * 0.0625f, 0.0f, 0.25f * 0.0625f); - GL46.glRotatef(80.0f, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(5.0f, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(-45.0f, 0.0F, 0.0F, 1.0F); + GL46C.glTranslatef(0.75f * 0.0625f, 0.0f, 0.25f * 0.0625f); + GL46C.glRotatef(80.0f, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(5.0f, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-45.0f, 0.0F, 0.0F, 1.0F); break; } } else if(!third) { - GL46.glTranslatef(0.0f, 4.0f * 0.0625f, 2.0f * 0.0625f); - GL46.glRotatef(type == WieldType.TOOL_FLIP ? 45.0f : -135.0f, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(25.0f, 0.0F, 0.0F, 1.0F); - GL46.glScalef(1.7f, 1.7f, 1.7f); + GL46C.glTranslatef(0.0f, 4.0f * 0.0625f, 2.0f * 0.0625f); + GL46C.glRotatef(type == WieldType.TOOL_FLIP ? 45.0f : -135.0f, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(25.0f, 0.0F, 0.0F, 1.0F); + GL46C.glScalef(1.7f, 1.7f, 1.7f); } } this.renderItem(stack, model); - GlState.cullFace(GL46.GL_BACK); - GL46.glPopMatrix(); + GlState.cullFace(GL46C.GL_BACK); + GL46C.glPopMatrix(); GlState.disableRescaleNormal(); GlState.disableBlend(); this.manager.bindTexture(TextureMap.BLOCKS); @@ -301,22 +301,22 @@ public class RenderItem private void renderItemIntoGUI(ItemStack stack, int x, int y) { IBakedModel ibakedmodel = this.mesher.getItemModel(stack); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.manager.bindTexture(TextureMap.BLOCKS); GlState.enableRescaleNormal(); GlState.enableAlpha(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); + GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); this.setupGuiTransform(x, y, ibakedmodel.isGui3d()); GuiPosition vec = ibakedmodel.getTransforms(); if(vec != GuiPosition.NORMAL) { - GL46.glTranslatef(vec.translationX(), vec.translationY(), vec.translationZ()); - GL46.glRotatef(vec.rotationY(), 0.0F, 1.0F, 0.0F); - GL46.glRotatef(vec.rotationX(), 1.0F, 0.0F, 0.0F); - GL46.glRotatef(vec.rotationZ(), 0.0F, 0.0F, 1.0F); - GL46.glScalef(vec.scale(), vec.scale(), vec.scale()); + GL46C.glTranslatef(vec.translationX(), vec.translationY(), vec.translationZ()); + GL46C.glRotatef(vec.rotationY(), 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(vec.rotationX(), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(vec.rotationZ(), 0.0F, 0.0F, 1.0F); + GL46C.glScalef(vec.scale(), vec.scale(), vec.scale()); } boolean cull = GlState.isCullEnabled(); if(!cull) @@ -327,28 +327,28 @@ public class RenderItem GlState.disableAlpha(); GlState.disableRescaleNormal(); GlState.disableLighting(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); this.manager.bindTexture(TextureMap.BLOCKS); } private void setupGuiTransform(int xPosition, int yPosition, boolean isGui3d) { - GL46.glTranslatef((float)xPosition, (float)yPosition, 100.0F + this.zLevel); - GL46.glTranslatef(8.0F, 8.0F, 0.0F); - GL46.glScalef(1.0F, 1.0F, -1.0F); - GL46.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glTranslatef((float)xPosition, (float)yPosition, 100.0F + this.zLevel); + GL46C.glTranslatef(8.0F, 8.0F, 0.0F); + GL46C.glScalef(1.0F, 1.0F, -1.0F); + GL46C.glScalef(0.5F, 0.5F, 0.5F); if (isGui3d) { - GL46.glScalef(40.0F, 40.0F, 40.0F); - GL46.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); + GL46C.glScalef(40.0F, 40.0F, 40.0F); + GL46C.glRotatef(210.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GlState.enableLighting(); } else { - GL46.glScalef(64.0F, 64.0F, 64.0F); - GL46.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(64.0F, 64.0F, 64.0F); + GL46C.glRotatef(180.0F, 1.0F, 0.0F, 0.0F); GlState.disableLighting(); } } diff --git a/client/src/main/java/client/renderer/entity/RenderItemEntity.java b/client/src/main/java/client/renderer/entity/RenderItemEntity.java index 93e2699c..c6efea41 100755 --- a/client/src/main/java/client/renderer/entity/RenderItemEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderItemEntity.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.texture.TextureMap; @@ -23,16 +23,16 @@ public class RenderItemEntity extends Render public void doRender(T entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); GlState.enableRescaleNormal(); - GL46.glScalef(0.5F, 0.5F, 0.5F); - GL46.glRotatef(-this.manager.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(this.manager.playerViewX, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glRotatef(-this.manager.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.manager.playerViewX, 1.0F, 0.0F, 0.0F); this.bindTexture(TextureMap.BLOCKS); this.itemRenderer.renderItemAsGround(this.getStack(entity)); GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderLeashKnot.java b/client/src/main/java/client/renderer/entity/RenderLeashKnot.java index 62ccd59c..393b8215 100755 --- a/client/src/main/java/client/renderer/entity/RenderLeashKnot.java +++ b/client/src/main/java/client/renderer/entity/RenderLeashKnot.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.model.ModelLeashKnot; @@ -22,16 +22,16 @@ public class RenderLeashKnot extends Render */ public void doRender(EntityLeashKnot entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); GlState.disableCull(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glTranslatef((float)x, (float)y, (float)z); float f = 0.0625F; GlState.enableRescaleNormal(); - GL46.glScalef(-1.0F, -1.0F, 1.0F); + GL46C.glScalef(-1.0F, -1.0F, 1.0F); GlState.enableAlpha(); this.bindEntityTexture(entity); this.leashKnotModel.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, f); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderLightning.java b/client/src/main/java/client/renderer/entity/RenderLightning.java index 1705ca64..10f479b3 100755 --- a/client/src/main/java/client/renderer/entity/RenderLightning.java +++ b/client/src/main/java/client/renderer/entity/RenderLightning.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -27,7 +27,7 @@ public class RenderLightning extends Render GlState.disableTexture2D(); GlState.disableLighting(); GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE); + GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE); double[] adouble = new double[8]; double[] adouble1 = new double[8]; double d0 = 0.0D; @@ -83,7 +83,7 @@ public class RenderLightning extends Render d3 += (double)(random1.zrange(31) - 15); } - worldrenderer.begin(GL46.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); float f = 0.5F; float f1 = 0.45F; float f2 = 0.45F; diff --git a/client/src/main/java/client/renderer/entity/RenderLiving.java b/client/src/main/java/client/renderer/entity/RenderLiving.java index 58233430..48d590d5 100755 --- a/client/src/main/java/client/renderer/entity/RenderLiving.java +++ b/client/src/main/java/client/renderer/entity/RenderLiving.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.Frustum; @@ -46,7 +46,7 @@ public abstract class RenderLiving extends RendererLivin int l = RenderManager.getBrightnessForRender(entity); int a = l % 65536; int b = l / 65536; - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)a / 1.0F, (float)b / 1.0F); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, (float)a / 1.0F, (float)b / 1.0F); } private static double interpolateValue(double start, double end, double pct) { @@ -95,7 +95,7 @@ public abstract class RenderLiving extends RendererLivin GlState.disableTexture2D(); GlState.disableLighting(); GlState.disableCull(); - renderer.begin(GL46.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); + renderer.begin(GL46C.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); for(int n = 0; n <= 24; ++n) { float cr = r; float cg = g; @@ -118,7 +118,7 @@ public abstract class RenderLiving extends RendererLivin ).color(cr, cg, cb, 1.0F).endVertex(); } Tessellator.draw(); - renderer.begin(GL46.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); + renderer.begin(GL46C.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); for(int n = 0; n <= 24; ++n) { float cr = r; float cg = g; diff --git a/client/src/main/java/client/renderer/entity/RenderManager.java b/client/src/main/java/client/renderer/entity/RenderManager.java index 9d322abb..e9ed34ec 100755 --- a/client/src/main/java/client/renderer/entity/RenderManager.java +++ b/client/src/main/java/client/renderer/entity/RenderManager.java @@ -2,7 +2,7 @@ package client.renderer.entity; import java.util.Map; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.init.RenderRegistry; @@ -142,7 +142,7 @@ public class RenderManager { int j = i % 65536; int k = i / 65536; - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); return this.renderEntity(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, partialTicks); } @@ -180,22 +180,22 @@ public class RenderManager { if(dist > (double)(maxDistance * maxDistance) || !this.gm.canRenderHud()) return; float scale = 0.016666668F; - GL46.glPushMatrix(); - GL46.glTranslatef((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z); - GL46.glNormal3f(0.0F, 1.0F, 0.0F); - GL46.glRotatef(-this.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(this.playerViewX, 1.0F, 0.0F, 0.0F); - GL46.glScalef(-scale, -scale, scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z); + GL46C.glNormal3f(0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-this.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.playerViewX, 1.0F, 0.0F, 0.0F); + GL46C.glScalef(-scale, -scale, scale); GlState.disableLighting(); GlState.depthMask(false); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); GlState.depthMask(true); - Drawing.drawTextboxCentered(str, 0, 0, 0x3f000000); + Drawing.drawTextboxCentered3d(str, 0, 0, 0x3f000000); GlState.enableLighting(); GlState.disableBlend(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } private void renderEntityFire(Entity entity, double x, double y, double z) { @@ -203,21 +203,21 @@ public class RenderManager { TextureMap map = this.gm.getTextureMapBlocks(); Sprite layer0 = map.getAtlasSprite("blocks/fire_layer_0"); Sprite layer1 = map.getAtlasSprite("blocks/fire_layer_1"); - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); float scale = entity.width * 1.4F; - GL46.glScalef(scale, scale, scale); + GL46C.glScalef(scale, scale, scale); RenderBuffer rb = Tessellator.getBuffer(); float f1 = 0.5F; float f2 = 0.0F; float f3 = entity.height / scale; float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY); - GL46.glRotatef(-this.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F); + GL46C.glRotatef(-this.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); float f5 = 0.0F; int i = 0; - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + rb.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX); while(f3 > 0.0F) { Sprite layer = i % 2 == 0 ? layer0 : layer1; @@ -245,7 +245,7 @@ public class RenderManager { } Tessellator.draw(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.enableLighting(); } @@ -269,7 +269,7 @@ public class RenderManager { RenderBuffer worldrenderer = Tessellator.getBuffer(); Vec3 vec3 = entityIn.getLook(partialTicks); - worldrenderer.begin(GL46.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.begin(GL46C.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR); worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex(); worldrenderer.pos(x + vec3.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, z + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex(); Tessellator.draw(); diff --git a/client/src/main/java/client/renderer/entity/RenderMinecart.java b/client/src/main/java/client/renderer/entity/RenderMinecart.java index 1625e348..5d2867c4 100755 --- a/client/src/main/java/client/renderer/entity/RenderMinecart.java +++ b/client/src/main/java/client/renderer/entity/RenderMinecart.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.GlState; @@ -33,14 +33,14 @@ public class RenderMinecart extends Render public void doRender(T entity, double x, double y, double z, float partialTicks) { float entityYaw = entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks; - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.bindEntityTexture(entity); long i = (long)entity.getId() * 493286711L; i = i * i * 4392167121L + i * 98761L; float f = (((float)(i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; float f1 = (((float)(i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; float f2 = (((float)(i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; - GL46.glTranslatef(f, f1, f2); + GL46C.glTranslatef(f, f1, f2); double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; @@ -76,9 +76,9 @@ public class RenderMinecart extends Render } } - GL46.glTranslatef((float)x, (float)y + 0.375F, (float)z); - GL46.glRotatef(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-f3, 0.0F, 0.0F, 1.0F); + GL46C.glTranslatef((float)x, (float)y + 0.375F, (float)z); + GL46C.glRotatef(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-f3, 0.0F, 0.0F, 1.0F); float f5 = (float)entity.getRollingAmplitude() - partialTicks; float f6 = (float)entity.getDamage() - partialTicks; @@ -89,7 +89,7 @@ public class RenderMinecart extends Render if (f5 > 0.0F) { - GL46.glRotatef(ExtMath.sin(f5) * f5 * f6 / 10.0F * (float)entity.getRollingDirection(), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(ExtMath.sin(f5) * f5 * f6 / 10.0F * (float)entity.getRollingDirection(), 1.0F, 0.0F, 0.0F); } int j = entity.getDisplayTileOffset(); @@ -97,20 +97,20 @@ public class RenderMinecart extends Render if (iblockstate.getBlock() != Blocks.air && !iblockstate.getBlock().getMaterial().isLiquid()) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.bindTexture(TextureMap.BLOCKS); float f4 = 0.75F; - GL46.glScalef(f4, f4, f4); - GL46.glTranslatef(-0.5F, (float)(j - 8) / 16.0F, 0.5F); + GL46C.glScalef(f4, f4, f4); + GL46C.glTranslatef(-0.5F, (float)(j - 8) / 16.0F, 0.5F); this.func_180560_a(entity, partialTicks, iblockstate); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); this.bindEntityTexture(entity); } - GL46.glScalef(-1.0F, -1.0F, 1.0F); + GL46C.glScalef(-1.0F, -1.0F, 1.0F); this.modelMinecart.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } @@ -124,8 +124,8 @@ public class RenderMinecart extends Render protected void func_180560_a(T minecart, float partialTicks, State state) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ)); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/entity/RenderSlime.java b/client/src/main/java/client/renderer/entity/RenderSlime.java index 233557c3..9c9baf72 100755 --- a/client/src/main/java/client/renderer/entity/RenderSlime.java +++ b/client/src/main/java/client/renderer/entity/RenderSlime.java @@ -1,8 +1,7 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; -import client.renderer.layers.LayerSlimeGel; import client.renderer.model.ModelSlime; import common.entity.npc.EntityNPC; import common.entity.npc.EntitySlime; @@ -13,7 +12,7 @@ public class RenderSlime extends RenderNpc public RenderSlime(RenderManager renderManagerIn) { super(renderManagerIn, new ModelSlime(16)); - this.addLayer(new LayerSlimeGel(this)); +// this.addLayer(new LayerSlimeGel(this)); } protected void preRenderCallback(EntityNPC entitylivingbaseIn, float partialTickTime) @@ -25,7 +24,7 @@ public class RenderSlime extends RenderNpc f1 = (slime.prevSquishFactor + (slime.squishFactor - slime.prevSquishFactor) * partialTickTime) / (f * 0.5F + 1.0F); } float f2 = 1.0F / (f1 + 1.0F); - GL46.glScalef(f2 * f, 1.0F / f2 * f, f2 * f); + GL46C.glScalef(f2 * f, 1.0F / f2 * f, f2 * f); } public void doRender(EntityNPC entity, double x, double y, double z, float partialTicks) diff --git a/client/src/main/java/client/renderer/entity/RenderSpaceMarine.java b/client/src/main/java/client/renderer/entity/RenderSpaceMarine.java index 7847e95b..cfab4d4a 100755 --- a/client/src/main/java/client/renderer/entity/RenderSpaceMarine.java +++ b/client/src/main/java/client/renderer/entity/RenderSpaceMarine.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.layers.LayerArrow; import client.renderer.layers.LayerHeldItem; @@ -83,7 +83,7 @@ public class RenderSpaceMarine extends RenderNpc protected void preRenderCallback(EntityNPC entitylivingbaseIn, float partialTickTime) { float f = entitylivingbaseIn.getRenderScale(); // 0.9375F; - GL46.glScalef(f, f, f); + GL46C.glScalef(f, f, f); } // public void renderPlayerArm(EntityNPC entity) diff --git a/client/src/main/java/client/renderer/entity/RenderTntMinecart.java b/client/src/main/java/client/renderer/entity/RenderTntMinecart.java deleted file mode 100755 index e7bdbe3d..00000000 --- a/client/src/main/java/client/renderer/entity/RenderTntMinecart.java +++ /dev/null @@ -1,51 +0,0 @@ -package client.renderer.entity; - -import org.lwjgl.opengl.GL46; - -import client.Client; -import client.renderer.GlState; -import common.entity.item.EntityTntCart; -import common.init.Blocks; -import common.util.ExtMath; -import common.world.State; - -public class RenderTntMinecart extends RenderMinecart -{ - public RenderTntMinecart(RenderManager renderManagerIn) - { - super(renderManagerIn); - } - - protected void func_180560_a(EntityTntCart minecart, float partialTicks, State state) - { - int i = minecart.getFuseTicks(); - - if (i > -1 && (float)i - partialTicks + 1.0F < 10.0F) - { - float f = 1.0F - ((float)i - partialTicks + 1.0F) / 10.0F; - f = ExtMath.clampf(f, 0.0F, 1.0F); - f = f * f; - f = f * f; - float f1 = 1.0F + f * 0.3F; - GL46.glScalef(f1, f1, f1); - } - - super.func_180560_a(minecart, partialTicks, state); - - if (i > -1 && i / 5 % 2 == 0) - { - GlState.disableTexture2D(); - GlState.disableLighting(); - GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_DST_ALPHA); - GlState.color(1.0F, 1.0F, 1.0F, (1.0F - ((float)i - partialTicks + 1.0F) / 100.0F) * 0.8F); - GL46.glPushMatrix(); - Client.CLIENT.renderer.renderBlockEntity(Blocks.tnt.getState(), null); - GL46.glPopMatrix(); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.disableBlend(); - GlState.enableLighting(); - GlState.enableTexture2D(); - } - } -} diff --git a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java index ab22173b..3dac91ba 100755 --- a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java +++ b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.GlState; @@ -23,8 +23,8 @@ public class RenderTntPrimed extends Render public void doRender(EntityTnt entity, double x, double y, double z, float partialTicks) { Renderer renderer = Client.CLIENT.renderer; - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y + 0.5F, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y + 0.5F, (float)z); if ((float)entity.fuse - partialTicks + 1.0F < 10.0F) { @@ -33,22 +33,22 @@ public class RenderTntPrimed extends Render f = f * f; f = f * f; float f1 = 1.0F + f * 0.3F; - GL46.glScalef(f1, f1, f1); + GL46C.glScalef(f1, f1, f1); } float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(entity); - GL46.glTranslatef(-0.5F, -0.5F, 0.5F); + GL46C.glTranslatef(-0.5F, -0.5F, 0.5F); Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); renderer.renderBlockEntity(tnt.getState(), new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ)); - GL46.glTranslatef(0.0F, 0.0F, 1.0F); + GL46C.glTranslatef(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) { GlState.disableTexture2D(); GlState.disableLighting(); GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_DST_ALPHA); + GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_DST_ALPHA); GlState.color(1.0F, 1.0F, 1.0F, f2); GlState.doPolygonOffset(-3.0F, -3.0F); GlState.enablePolygonOffset(); @@ -61,7 +61,7 @@ public class RenderTntPrimed extends Render GlState.enableTexture2D(); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partialTicks); } diff --git a/client/src/main/java/client/renderer/entity/RenderXp.java b/client/src/main/java/client/renderer/entity/RenderXp.java index 61921ede..8eaf47f7 100755 --- a/client/src/main/java/client/renderer/entity/RenderXp.java +++ b/client/src/main/java/client/renderer/entity/RenderXp.java @@ -1,6 +1,6 @@ package client.renderer.entity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -17,8 +17,8 @@ public class RenderXp extends Render { } public void doRender(EntityXp entity, double x, double y, double z, float partial) { - GL46.glPushMatrix(); - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x, (float)y, (float)z); this.bindEntityTexture(entity); int value = entity.getXpValue(); float u1 = (float)(value % 4 * 16 + 0) / 64.0F; @@ -31,19 +31,19 @@ public class RenderXp extends Render { int light = RenderManager.getBrightnessForRender(entity); int block = light % 65536; int sky = light / 65536; - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); float color = ((float)entity.xpColor + partial) / 16.0F; int g = (int)((ExtMath.sin(color + 0.0F) + 1.0F) * 0.5F * 255.0F); float n = (int)((ExtMath.sin(color + (float)Math.PI) + 1.0F) * 0.5F * 255.0F); int r = (int)(n * (value / 10.0f)); int b = (int)(n * ((10 - value) / 10.0f)); - GL46.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(180.0F - this.manager.playerViewY, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-this.manager.playerViewX, 1.0F, 0.0F, 0.0F); float size = 0.25F; - GL46.glScalef(size, size, size); + GL46C.glScalef(size, size, size); RenderBuffer rb = Tessellator.getBuffer(); - rb.begin(GL46.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); + rb.begin(GL46C.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); rb.pos((double)(0.0F - dx), (double)(0.0F - dy), 0.0D).tex((double)u1, (double)v2).color(r, g, b, 128).normal(0.0F, 1.0F, 0.0F) .endVertex(); rb.pos((double)(bx - dx), (double)(0.0F - dy), 0.0D).tex((double)u2, (double)v2).color(r, g, b, 128).normal(0.0F, 1.0F, 0.0F) @@ -55,7 +55,7 @@ public class RenderXp extends Render { Tessellator.draw(); GlState.disableBlend(); GlState.disableRescaleNormal(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); super.doRender(entity, x, y, z, partial); } diff --git a/client/src/main/java/client/renderer/entity/RendererLivingEntity.java b/client/src/main/java/client/renderer/entity/RendererLivingEntity.java index 60cbe529..6d671e83 100755 --- a/client/src/main/java/client/renderer/entity/RendererLivingEntity.java +++ b/client/src/main/java/client/renderer/entity/RendererLivingEntity.java @@ -5,7 +5,7 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; @@ -86,7 +86,7 @@ public abstract class RendererLivingEntity extends Rende */ public void doRender(T entity, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); GlState.disableCull(); this.mainModel.swingProgress = this.getSwingProgress(entity, partialTicks); this.mainModel.isRiding = entity.isRiding(); @@ -128,10 +128,10 @@ public abstract class RendererLivingEntity extends Rende float f8 = this.handleRotationFloat(entity, partialTicks); this.rotateCorpse(entity, f8, f, partialTicks); GlState.enableRescaleNormal(); - GL46.glScalef(-1.0F, -1.0F, 1.0F); + GL46C.glScalef(-1.0F, -1.0F, 1.0F); this.preRenderCallback(entity, partialTicks); float f4 = 0.0625F; - GL46.glTranslatef(0.0F, -1.5078125F, 0.0F); + GL46C.glTranslatef(0.0F, -1.5078125F, 0.0F); float f5 = entity.prevLswingAmount + (entity.lswingAmount - entity.prevLswingAmount) * partialTicks; float f6 = entity.limbSwing - entity.lswingAmount * (1.0F - partialTicks); @@ -184,11 +184,11 @@ public abstract class RendererLivingEntity extends Rende Log.RENDER.error((Throwable)exception, (String)"Konnte Objekt nicht rendern"); } - GlState.setActiveTexture(GL46.GL_TEXTURE1); + GlState.setActiveTexture(GL46C.GL_TEXTURE1); GlState.enableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); GlState.enableCull(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); if (!this.renderOutlines) { @@ -222,23 +222,23 @@ public abstract class RendererLivingEntity extends Rende float g = (float)(c >> 8 & 255) / 255.0F; float b = (float)(c & 255) / 255.0F; GlState.disableLighting(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); GlState.color(r, g, b, 1.0F); GlState.disableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE1); + GlState.setActiveTexture(GL46C.GL_TEXTURE1); GlState.disableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); return true; } protected void unsetOutlineColor() { GlState.enableLighting(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); GlState.enableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE1); + GlState.setActiveTexture(GL46C.GL_TEXTURE1); GlState.enableTexture2D(); - GlState.setActiveTexture(GL46.GL_TEXTURE0); + GlState.setActiveTexture(GL46C.GL_TEXTURE0); } protected void renderModel(T entity, float x, float y, float z, float yaw, float pitch, float scale) @@ -255,13 +255,13 @@ public abstract class RendererLivingEntity extends Rende if (ghost) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); GlState.color(1.0F, 1.0F, 1.0F, 0.3F); // GlState.color(entity.getRenderColor() | (vis ? 0x50000000 : 0x26000000)); GlState.depthMask(false); GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); - GlState.alphaFunc(GL46.GL_GREATER, 0.003921569F); + GlState.blendFunc(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA); + GlState.alphaFunc(GL46C.GL_GREATER, 0.003921569F); } if(entity.isGlowing()) @@ -274,8 +274,8 @@ public abstract class RendererLivingEntity extends Rende if (ghost) { GlState.disableBlend(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); - GL46.glPopMatrix(); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); + GL46C.glPopMatrix(); GlState.depthMask(true); } // } @@ -414,12 +414,12 @@ public abstract class RendererLivingEntity extends Rende */ protected void renderLivingAt(T entityLivingBaseIn, double x, double y, double z) { - GL46.glTranslatef((float)x, (float)y, (float)z); + GL46C.glTranslatef((float)x, (float)y, (float)z); } protected void rotateCorpse(T bat, float p_77043_2_, float p_77043_3_, float partialTicks) { - GL46.glRotatef(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F); if (bat.deathTime > 0) { @@ -431,7 +431,7 @@ public abstract class RendererLivingEntity extends Rende f = 1.0F; } - GL46.glRotatef(f * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(f * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F); } else { @@ -439,8 +439,8 @@ public abstract class RendererLivingEntity extends Rende if (s != null && (s.startsWith("Australia") || s.startsWith("Australien"))) // && (!(bat.isPlayer()) || ((EntityNPC)bat).isWearing(ModelPart.CAPE))) { - GL46.glTranslatef(0.0F, bat.height + 0.1F, 0.0F); - GL46.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); + GL46C.glTranslatef(0.0F, bat.height + 0.1F, 0.0F); + GL46C.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); } } } @@ -515,47 +515,6 @@ public abstract class RendererLivingEntity extends Rende { this.renderOutlines = renderOutlinesIn; } - - protected void drawRechargeRay(Entity entity, EntityCrystal crystal, double p_180574_2_, double p_180574_4_, double p_180574_6_, float p_180574_8_) - { - float f = (float)crystal.innerRotation + p_180574_8_; - float f1 = ExtMath.sin(f * 0.2F) / 2.0F + 0.5F; - f1 = (f1 * f1 + f1) * 0.2F; - float f2 = (float)(crystal.posX - entity.posX - (entity.prevX - entity.posX) * (double)(1.0F - p_180574_8_)); - float f3 = (float)((double)f1 + crystal.posY - 1.0D - entity.posY - (entity.prevY - entity.posY) * (double)(1.0F - p_180574_8_)); - float f4 = (float)(crystal.posZ - entity.posZ - (entity.prevZ - entity.posZ) * (double)(1.0F - p_180574_8_)); - float f5 = ExtMath.sqrtf(f2 * f2 + f4 * f4); - float f6 = ExtMath.sqrtf(f2 * f2 + f3 * f3 + f4 * f4); - GL46.glPushMatrix(); - GL46.glTranslatef((float)p_180574_2_, (float)p_180574_4_ + 2.0F, (float)p_180574_6_); - GL46.glRotatef((float)(-Math.atan2((double)f4, (double)f2)) * 180.0F / (float)Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef((float)(-Math.atan2((double)f5, (double)f3)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); -// Tessellator tessellator = Tessellator.getInstance(); - RenderBuffer worldrenderer = Tessellator.getBuffer(); - ItemRenderer.disableStandardItemLighting(); - GlState.disableCull(); - this.bindTexture(crystalBeamTextures); - GlState.shadeModel(GL46.GL_SMOOTH); - float f7 = 0.0F - ((float)entity.ticksExisted + p_180574_8_) * 0.01F; - float f8 = ExtMath.sqrtf(f2 * f2 + f3 * f3 + f4 * f4) / 32.0F - ((float)entity.ticksExisted + p_180574_8_) * 0.01F; - worldrenderer.begin(GL46.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_TEX_COLOR); - int i = 8; - - for (int j = 0; j <= 8; ++j) - { - float f9 = ExtMath.sin((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F; - float f10 = ExtMath.cos((float)(j % 8) * (float)Math.PI * 2.0F / 8.0F) * 0.75F; - float f11 = (float)(j % 8) * 1.0F / 8.0F; - worldrenderer.pos((double)(f9 * 0.2F), (double)(f10 * 0.2F), 0.0D).tex((double)f11, (double)f8).color(0, 0, 0, 255).endVertex(); - worldrenderer.pos((double)f9, (double)f10, (double)f6).tex((double)f11, (double)f7).color(255, 255, 255, 255).endVertex(); - } - - Tessellator.draw(); - GlState.enableCull(); - GlState.shadeModel(GL46.GL_FLAT); - ItemRenderer.enableStandardItemLighting(); - GL46.glPopMatrix(); - } static { diff --git a/client/src/main/java/client/renderer/layers/LayerArmor.java b/client/src/main/java/client/renderer/layers/LayerArmor.java index c4d77c99..603cc8e5 100755 --- a/client/src/main/java/client/renderer/layers/LayerArmor.java +++ b/client/src/main/java/client/renderer/layers/LayerArmor.java @@ -2,7 +2,7 @@ package client.renderer.layers; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.GlState; @@ -19,7 +19,6 @@ import common.util.Equipment; public class LayerArmor implements LayerRenderer { - protected static final String ENCHANTED_ITEM_GLINT_RES = "textures/glint.png"; private static final Equipment[] SLOTS; static { @@ -93,8 +92,6 @@ public class LayerArmor implements LayerRenderer } GlState.color(this.colorR, this.colorG, this.colorB, this.alpha); t.render(entitylivingbaseIn, limbSwing, limbSwingAmount, yaw, pitch, factor, scale); - if (itemstack.isItemEnchanted()) - this.renderGlint(entitylivingbaseIn, t, limbSwing, limbSwingAmount, partial, yaw, pitch, factor, scale); } } @@ -113,44 +110,6 @@ public class LayerArmor implements LayerRenderer return armorSlot == Equipment.LEGGINGS; } - private void renderGlint(EntityLiving entitylivingbaseIn, ModelArmor modelbaseIn, float p_177183_3_, float p_177183_4_, float partialTicks, float p_177183_6_, float p_177183_7_, float p_177183_8_, float scale) - { - float f = entitylivingbaseIn == null ? (float)(System.currentTimeMillis() % 1000000L) / 50.0f : (float)entitylivingbaseIn.ticksExisted + partialTicks; - if(this.renderer != null) - this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES); - else - Client.CLIENT.getTextureManager().bindTexture(ENCHANTED_ITEM_GLINT_RES); - GlState.enableBlend(); - GlState.depthFunc(GL46.GL_EQUAL); - GlState.depthMask(false); - float f1 = 0.5F; - GlState.color(f1, f1, f1, 1.0F); - - for (int i = 0; i < 2; ++i) - { - GlState.disableLighting(); - GlState.blendFunc(GL46.GL_SRC_COLOR, GL46.GL_ONE); - float f2 = 0.76F; - GlState.color(0.5F * f2, 0.25F * f2, 0.8F * f2, 1.0F); - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); - float f3 = 0.33333334F; - GL46.glScalef(f3, f3, f3); - GL46.glRotatef(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F); - GL46.glTranslatef(0.0F, f * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, scale); - } - - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); - GlState.enableLighting(); - GlState.depthMask(true); - GlState.depthFunc(GL46.GL_LEQUAL); - GlState.disableBlend(); - } - // private String getArmorResource(ItemArmor item, boolean legs) // { // return this.getArmorResource(item, legs, null); diff --git a/client/src/main/java/client/renderer/layers/LayerArrow.java b/client/src/main/java/client/renderer/layers/LayerArrow.java index 902303d3..dcf33d94 100755 --- a/client/src/main/java/client/renderer/layers/LayerArrow.java +++ b/client/src/main/java/client/renderer/layers/LayerArrow.java @@ -1,6 +1,6 @@ package client.renderer.layers; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.ItemRenderer; import client.renderer.entity.RendererLivingEntity; @@ -33,7 +33,7 @@ public class LayerArrow implements LayerRenderer for (int j = 0; j < i; ++j) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); ModelRenderer modelrenderer = this.field_177168_a.getMainModel().getRandomModelBox(random); ModelBox modelbox = (ModelBox)modelrenderer.cubeList.get(random.zrange(modelrenderer.cubeList.size())); modelrenderer.postRender(0.0625F); @@ -43,7 +43,7 @@ public class LayerArrow implements LayerRenderer float f3 = (modelbox.posX1 + (modelbox.posX2 - modelbox.posX1) * f) / 16.0F; float f4 = (modelbox.posY1 + (modelbox.posY2 - modelbox.posY1) * f1) / 16.0F; float f5 = (modelbox.posZ1 + (modelbox.posZ2 - modelbox.posZ1) * f2) / 16.0F; - GL46.glTranslatef(f3, f4, f5); + GL46C.glTranslatef(f3, f4, f5); f = f * 2.0F - 1.0F; f1 = f1 * 2.0F - 1.0F; f2 = f2 * 2.0F - 1.0F; @@ -57,7 +57,7 @@ public class LayerArrow implements LayerRenderer double d1 = 0.0D; double d2 = 0.0D; this.field_177168_a.getRenderManager().renderEntity(entity, d0, d1, d2, partialTicks); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } ItemRenderer.enableStandardItemLighting(); diff --git a/client/src/main/java/client/renderer/layers/LayerCape.java b/client/src/main/java/client/renderer/layers/LayerCape.java index 2c485e7a..003f11be 100755 --- a/client/src/main/java/client/renderer/layers/LayerCape.java +++ b/client/src/main/java/client/renderer/layers/LayerCape.java @@ -1,6 +1,6 @@ package client.renderer.layers; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.entity.RenderHumanoid; @@ -31,8 +31,8 @@ public class LayerCape implements LayerRenderer entitylivingbaseIn.getCape() != null) { GlState.color(1.0F, 1.0F, 1.0F, 1.0F); this.renderer.bindTexture("textures/npc/cape_" + entitylivingbaseIn.getCape() + ".png"); - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 0.0F, 0.125F); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 0.0F, 0.125F); if(entitylivingbaseIn.isPlayer()) { EntityNPC player = (EntityNPC)entitylivingbaseIn; double d0 = player.prevChasingPosX + (player.chasingPosX - player.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevX) * (double)partialTicks); @@ -59,17 +59,17 @@ public class LayerCape implements LayerRenderer f1 += 25.0F; } - GL46.glRotatef(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(f3 / 2.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(f3 / 2.0F, 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(-f3 / 2.0F, 0.0F, 1.0F, 0.0F); } else { - GL46.glRotatef(entitylivingbaseIn.isSneakingVisually() ? 25.0F : 5.0F, 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(entitylivingbaseIn.isSneakingVisually() ? 25.0F : 5.0F, 1.0F, 0.0F, 0.0F); } - GL46.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); this.bipedCape.rotationPointY = this.shift + (entitylivingbaseIn.isSneakingVisually() ? 2.0f : 0.0f); this.bipedCape.render(0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/layers/LayerCharge.java b/client/src/main/java/client/renderer/layers/LayerCharge.java index b1817682..c29c43ca 100755 --- a/client/src/main/java/client/renderer/layers/LayerCharge.java +++ b/client/src/main/java/client/renderer/layers/LayerCharge.java @@ -1,6 +1,6 @@ package client.renderer.layers; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.renderer.entity.RenderHumanoid; @@ -27,23 +27,23 @@ public class LayerCharge implements LayerRenderer // boolean flag = entitylivingbaseIn.isInvisible(); GlState.depthMask(true); this.main.bindTexture(LIGHTNING_TEXTURE); - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_TEXTURE); + GL46C.glLoadIdentity(); float f = (float)entitylivingbaseIn.ticksExisted + partialTicks; - GL46.glTranslatef(f * 0.01F, f * 0.01F, 0.0F); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + GL46C.glTranslatef(f * 0.01F, f * 0.01F, 0.0F); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); GlState.enableBlend(); float f1 = 0.5F; GlState.color(f1, f1, f1, 1.0F); GlState.disableLighting(); - GlState.blendFunc(GL46.GL_ONE, GL46.GL_ONE); + GlState.blendFunc(GL46C.GL_ONE, GL46C.GL_ONE); this.charge.setModelAttributes(this.main.getMainModel()); - GL46.glScalef(entitylivingbaseIn.height, entitylivingbaseIn.height, entitylivingbaseIn.height); - GL46.glTranslatef(0.0f, -0.25f, 0.0f); + GL46C.glScalef(entitylivingbaseIn.height, entitylivingbaseIn.height, entitylivingbaseIn.height); + GL46C.glTranslatef(0.0f, -0.25f, 0.0f); this.charge.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); - GL46.glMatrixMode(GL46.GL_TEXTURE); - GL46.glLoadIdentity(); - GL46.glMatrixMode(GL46.GL_MODELVIEW); + GL46C.glMatrixMode(GL46C.GL_TEXTURE); + GL46C.glLoadIdentity(); + GL46C.glMatrixMode(GL46C.GL_MODELVIEW); GlState.enableLighting(); GlState.disableBlend(); GlState.depthMask(false); diff --git a/client/src/main/java/client/renderer/layers/LayerEntityBreak.java b/client/src/main/java/client/renderer/layers/LayerEntityBreak.java deleted file mode 100755 index b215b571..00000000 --- a/client/src/main/java/client/renderer/layers/LayerEntityBreak.java +++ /dev/null @@ -1,76 +0,0 @@ -package client.renderer.layers; - -import org.lwjgl.opengl.GL46; - -import client.renderer.DefaultVertexFormats; -import client.renderer.GlState; -import client.renderer.ItemRenderer; -import client.renderer.RenderBuffer; -import client.renderer.Tessellator; -import common.entity.animal.EntityDragon; -import common.rng.Random; - -public class LayerEntityBreak implements LayerRenderer -{ - public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) - { - if (entitylivingbaseIn.deathTime > 0) - { -// Tessellator tessellator = Tessellator.getInstance(); - RenderBuffer worldrenderer = Tessellator.getBuffer(); - ItemRenderer.disableStandardItemLighting(); - float f = ((float)entitylivingbaseIn.deathTime + partialTicks) / 200.0F; - float f1 = 0.0F; - - if (f > 0.8F) - { - f1 = (f - 0.8F) / 0.2F; - } - - Random random = new Random(432L); - GlState.disableTexture2D(); - GlState.shadeModel(GL46.GL_SMOOTH); - GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE); - GlState.disableAlpha(); - GlState.enableCull(); - GlState.depthMask(false); - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, -1.0F, -2.0F); - - for (int i = 0; (float)i < (f + f * f) / 2.0F * 60.0F; ++i) - { - GL46.glRotatef(random.floatv() * 360.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(random.floatv() * 360.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(random.floatv() * 360.0F, 0.0F, 0.0F, 1.0F); - GL46.glRotatef(random.floatv() * 360.0F, 1.0F, 0.0F, 0.0F); - GL46.glRotatef(random.floatv() * 360.0F, 0.0F, 1.0F, 0.0F); - GL46.glRotatef(random.floatv() * 360.0F + f * 90.0F, 0.0F, 0.0F, 1.0F); - float f2 = random.floatv() * 20.0F + 5.0F + f1 * 10.0F; - float f3 = random.floatv() * 2.0F + 1.0F + f1 * 2.0F; - worldrenderer.begin(GL46.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos(0.0D, 0.0D, 0.0D).color(255, 255, 255, (int)(255.0F * (1.0F - f1))).endVertex(); - worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); - worldrenderer.pos(0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); - worldrenderer.pos(0.0D, (double)f2, (double)(1.0F * f3)).color(255, 0, 255, 0).endVertex(); - worldrenderer.pos(-0.866D * (double)f3, (double)f2, (double)(-0.5F * f3)).color(255, 0, 255, 0).endVertex(); - Tessellator.draw(); - } - - GL46.glPopMatrix(); - GlState.depthMask(true); - GlState.disableCull(); - GlState.disableBlend(); - GlState.shadeModel(GL46.GL_FLAT); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.enableTexture2D(); - GlState.enableAlpha(); - ItemRenderer.enableStandardItemLighting(); - } - } - - public boolean shouldCombineTextures() - { - return false; - } -} diff --git a/client/src/main/java/client/renderer/layers/LayerExtra.java b/client/src/main/java/client/renderer/layers/LayerExtra.java index bba0db0f..67b8bce0 100755 --- a/client/src/main/java/client/renderer/layers/LayerExtra.java +++ b/client/src/main/java/client/renderer/layers/LayerExtra.java @@ -2,7 +2,7 @@ package client.renderer.layers; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.GlState; @@ -62,11 +62,11 @@ public class LayerExtra implements LayerRenderer // { GlState.color(1.0F, 1.0F, 1.0F, 1.0F); Client.CLIENT.getTextureManager().bindTexture(EntityTexManager.getSkin(entity)); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); if (entity.isSneakingVisually()) { - GL46.glTranslatef(0.0F, 0.2F, 0.0F); + GL46C.glTranslatef(0.0F, 0.2F, 0.0F); } // if (entity.isChild()) @@ -77,20 +77,20 @@ public class LayerExtra implements LayerRenderer // SKC.glTranslatef(0.0F, 24.0F * scale, 0.0F); // } - GL46.glPushMatrix(); + GL46C.glPushMatrix(); this.model.bipedBody.postRender(0.0625F); for(ModelRenderer model : this.wing) { if(entity.hasDualWings()) { - GL46.glPushMatrix(); - GL46.glRotatef(model.rotateAngleY < 0.0f ? -10.0f : 10.0f, 0.0f, 1.0f, 0.0f); - GL46.glTranslatef(0.0f, 0.125f, -0.0625f); + GL46C.glPushMatrix(); + GL46C.glRotatef(model.rotateAngleY < 0.0f ? -10.0f : 10.0f, 0.0f, 1.0f, 0.0f); + GL46C.glTranslatef(0.0f, 0.125f, -0.0625f); model.render(0.0625F); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glRotatef(model.rotateAngleY < 0.0f ? 10.0f : -10.0f, 0.0f, 1.0f, 0.0f); - GL46.glTranslatef(model.rotateAngleY < 0.0f ? 0.0625f : -0.0625f, -0.125f, 0.0f); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glRotatef(model.rotateAngleY < 0.0f ? 10.0f : -10.0f, 0.0f, 1.0f, 0.0f); + GL46C.glTranslatef(model.rotateAngleY < 0.0f ? 0.0625f : -0.0625f, -0.125f, 0.0f); model.render(0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { model.render(0.0625F); @@ -99,35 +99,35 @@ public class LayerExtra implements LayerRenderer for(ModelRenderer model : this.body) { model.render(0.0625F); } - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); this.model.bipedLeftArm.postRender(0.0625F); this.model.slimLeftArm.postRender(0.0625F, -1.0f, 0.0f, 0.0f); for(ModelRenderer model : this.larm) { model.render(0.0625F); } - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); this.model.bipedRightArm.postRender(0.0625F); this.model.slimRightArm.postRender(0.0625F, 1.0f, 0.0f, 0.0f); for(ModelRenderer model : this.rarm) { model.render(0.0625F); } - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); this.model.bipedHead.postRender(0.0625F); for(ModelRenderer model : this.head) { model.render(0.0625F); } for(ModelRenderer model : this.halo) { - GL46.glPushMatrix(); - GL46.glRotatef((float)(entity.ticksExisted % (360 * 4)) * 0.25f, 0.0f, 1.0f, 0.0f); + GL46C.glPushMatrix(); + GL46C.glRotatef((float)(entity.ticksExisted % (360 * 4)) * 0.25f, 0.0f, 1.0f, 0.0f); model.render(0.0625F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); // } } diff --git a/client/src/main/java/client/renderer/layers/LayerHeldItem.java b/client/src/main/java/client/renderer/layers/LayerHeldItem.java index 8f74a2f2..fd2b11f0 100755 --- a/client/src/main/java/client/renderer/layers/LayerHeldItem.java +++ b/client/src/main/java/client/renderer/layers/LayerHeldItem.java @@ -1,6 +1,6 @@ package client.renderer.layers; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.entity.RendererLivingEntity; @@ -29,7 +29,7 @@ public class LayerHeldItem implements LayerRenderer if (itemstack != null && itemstack.getItem().getWieldType() != null) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); // if (this.livingEntityRenderer.getMainModel().isChild) // { @@ -42,7 +42,7 @@ public class LayerHeldItem implements LayerRenderer // } ((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F); - GL46.glTranslatef(this.xshift, this.yshift, 0.0625F); + GL46C.glTranslatef(this.xshift, this.yshift, 0.0625F); if (entitylivingbaseIn.isPlayer() && ((EntityNPC)entitylivingbaseIn).fishEntity != null) { @@ -54,11 +54,11 @@ public class LayerHeldItem implements LayerRenderer if (entitylivingbaseIn.isSneakingVisually()) { - GL46.glTranslatef(0.0F, 0.203125F, 0.0F); + GL46C.glTranslatef(0.0F, 0.203125F, 0.0F); } gm.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, true); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/layers/LayerSlimeGel.java b/client/src/main/java/client/renderer/layers/LayerSlimeGel.java deleted file mode 100755 index 9eabf740..00000000 --- a/client/src/main/java/client/renderer/layers/LayerSlimeGel.java +++ /dev/null @@ -1,40 +0,0 @@ -package client.renderer.layers; - -import org.lwjgl.opengl.GL46; - -import client.renderer.GlState; -import client.renderer.entity.RenderSlime; -import client.renderer.model.ModelBase; -import client.renderer.model.ModelSlime; -import common.entity.npc.EntityNPC; - -public class LayerSlimeGel implements LayerRenderer -{ - private final RenderSlime slimeRenderer; - private final ModelBase slimeModel = new ModelSlime(0); - - public LayerSlimeGel(RenderSlime slimeRendererIn) - { - this.slimeRenderer = slimeRendererIn; - } - - public void doRenderLayer(EntityNPC entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) - { -// if (!entitylivingbaseIn.isInvisible()) -// { - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GlState.enableNormalize(); - GlState.enableBlend(); - GlState.blendFunc(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA); - this.slimeModel.setModelAttributes(this.slimeRenderer.getMainModel()); - this.slimeModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale); - GlState.disableBlend(); - GlState.disableNormalize(); -// } - } - - public boolean shouldCombineTextures() - { - return true; - } -} diff --git a/client/src/main/java/client/renderer/model/ModelArachnoid.java b/client/src/main/java/client/renderer/model/ModelArachnoid.java index 3df1e63a..dcfdfb26 100755 --- a/client/src/main/java/client/renderer/model/ModelArachnoid.java +++ b/client/src/main/java/client/renderer/model/ModelArachnoid.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.util.ExtMath; @@ -96,14 +96,14 @@ public class ModelArachnoid extends ModelHumanoid { this.isSneak = false; // this.setVisible(true); - GL46.glPushMatrix(); - GL46.glTranslatef(0.0f, 3.0f / 16.0f, 0.0f); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0f, 3.0f / 16.0f, 0.0f); super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); // this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); // this.spiderHead.render(scale); // this.spiderNeck.render(scale); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); // if (this.isChild) // { // float f = 2.0F; @@ -123,7 +123,7 @@ public class ModelArachnoid extends ModelHumanoid this.spiderLeg6.render(scale); this.spiderLeg7.render(scale); this.spiderLeg8.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } /** diff --git a/client/src/main/java/client/renderer/model/ModelBiped.java b/client/src/main/java/client/renderer/model/ModelBiped.java index 3ec9e886..6279707f 100755 --- a/client/src/main/java/client/renderer/model/ModelBiped.java +++ b/client/src/main/java/client/renderer/model/ModelBiped.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.types.EntityLiving; @@ -61,7 +61,7 @@ public abstract class ModelBiped extends ModelBase public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); // if (this.isChild) // { @@ -89,7 +89,7 @@ public abstract class ModelBiped extends ModelBase // { if (this.isSneak) // entityIn.isSneaking()) { - GL46.glTranslatef(0.0F, 0.2F, 0.0F); + GL46C.glTranslatef(0.0F, 0.2F, 0.0F); } this.bipedHead.render(scale); @@ -102,7 +102,7 @@ public abstract class ModelBiped extends ModelBase this.bipedHeadwear.render(scale); // } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } /** diff --git a/client/src/main/java/client/renderer/model/ModelCat.java b/client/src/main/java/client/renderer/model/ModelCat.java index 68b558e1..b66ea6fb 100755 --- a/client/src/main/java/client/renderer/model/ModelCat.java +++ b/client/src/main/java/client/renderer/model/ModelCat.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.animal.EntityCat; @@ -65,14 +65,14 @@ public class ModelCat extends ModelBase if (this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glScalef(1.5F / f, 1.5F / f, 1.5F / f); - GL46.glTranslatef(0.0F, 10.0F * scale, 4.0F * scale); + GL46C.glPushMatrix(); + GL46C.glScalef(1.5F / f, 1.5F / f, 1.5F / f); + GL46C.glTranslatef(0.0F, 10.0F * scale, 4.0F * scale); this.head.render(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.body.render(scale); this.backLeftLeg.render(scale); this.backRightLeg.render(scale); @@ -80,7 +80,7 @@ public class ModelCat extends ModelBase this.frontRightLeg.render(scale); this.tail.render(scale); this.tail2.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { diff --git a/client/src/main/java/client/renderer/model/ModelChicken.java b/client/src/main/java/client/renderer/model/ModelChicken.java index 6e491ee6..11becfec 100755 --- a/client/src/main/java/client/renderer/model/ModelChicken.java +++ b/client/src/main/java/client/renderer/model/ModelChicken.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.util.ExtMath; @@ -55,21 +55,21 @@ public class ModelChicken extends ModelBase if (this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); this.head.render(scale); this.bill.render(scale); this.chin.render(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.body.render(scale); this.rightLeg.render(scale); this.leftLeg.render(scale); this.rightWing.render(scale); this.leftWing.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { diff --git a/client/src/main/java/client/renderer/model/ModelCrystal.java b/client/src/main/java/client/renderer/model/ModelCrystal.java index a91532e1..71738e9a 100755 --- a/client/src/main/java/client/renderer/model/ModelCrystal.java +++ b/client/src/main/java/client/renderer/model/ModelCrystal.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; @@ -33,28 +33,28 @@ public class ModelCrystal extends ModelBase */ public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { - GL46.glPushMatrix(); - GL46.glScalef(2.0F, 2.0F, 2.0F); - GL46.glTranslatef(0.0F, -0.5F, 0.0F); + GL46C.glPushMatrix(); + GL46C.glScalef(2.0F, 2.0F, 2.0F); + GL46C.glTranslatef(0.0F, -0.5F, 0.0F); if (this.base != null) { this.base.render(scale); } - GL46.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, 0.8F + p_78088_4_, 0.0F); - GL46.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + GL46C.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, 0.8F + p_78088_4_, 0.0F); + GL46C.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); this.glass.render(scale); float f = 0.875F; - GL46.glScalef(f, f, f); - GL46.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); - GL46.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); + GL46C.glScalef(f, f, f); + GL46C.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + GL46C.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); this.glass.render(scale); - GL46.glScalef(f, f, f); - GL46.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); - GL46.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); + GL46C.glScalef(f, f, f); + GL46C.glRotatef(60.0F, 0.7071F, 0.0F, 0.7071F); + GL46C.glRotatef(p_78088_3_, 0.0F, 1.0F, 0.0F); this.cube.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/model/ModelDragon.java b/client/src/main/java/client/renderer/model/ModelDragon.java index f8db379c..4e68d1c1 100755 --- a/client/src/main/java/client/renderer/model/ModelDragon.java +++ b/client/src/main/java/client/renderer/model/ModelDragon.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import common.entity.Entity; @@ -139,17 +139,17 @@ public class ModelDragon extends ModelBase */ public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 0.5F, 0.0F); - GL46.glScalef(0.35f, 0.35f, 0.35f); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 0.5F, 0.0F); + GL46C.glScalef(0.35f, 0.35f, 0.35f); + GL46C.glPushMatrix(); EntityDragon entitydragon = (EntityDragon)entityIn; float f = entitydragon.prevAnimTime + (entitydragon.animTime - entitydragon.prevAnimTime) * this.partialTicks; this.jaw.rotateAngleX = (float)(Math.sin((double)(f * (float)Math.PI * 2.0F)) + 1.0D) * 0.2F; float f1 = (float)(Math.sin((double)(f * (float)Math.PI * 2.0F - 1.0F)) + 1.0D); f1 = (f1 * f1 * 1.0F + f1 * 2.0F) * 0.05F; - GL46.glTranslatef(0.0F, f1 - 2.0F, -3.0F); - GL46.glRotatef(f1 * 2.0F, 1.0F, 0.0F, 0.0F); + GL46C.glTranslatef(0.0F, f1 - 2.0F, -3.0F); + GL46C.glRotatef(f1 * 2.0F, 1.0F, 0.0F, 0.0F); float f2 = -30.0F; float f4 = 0.0F; float f5 = 1.5F; @@ -181,10 +181,10 @@ public class ModelDragon extends ModelBase this.head.rotateAngleY = 0.0f * (float)Math.PI / 180.0F * 1.0F; this.head.rotateAngleZ = -this.updateRotations(p_78088_5_ - (double)f7) * (float)Math.PI / 180.0F * 1.0F; this.head.render(scale); - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 1.0F, 0.0F); - GL46.glRotatef(-f6 * f5 * 1.0F, 0.0F, 0.0F, 1.0F); - GL46.glTranslatef(0.0F, -1.0F, 0.0F); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 1.0F, 0.0F); + GL46C.glRotatef(-f6 * f5 * 1.0F, 0.0F, 0.0F, 1.0F); + GL46C.glTranslatef(0.0F, -1.0F, 0.0F); this.body.rotateAngleZ = 0.0F; this.body.render(scale); @@ -205,16 +205,16 @@ public class ModelDragon extends ModelBase this.wing.render(scale); this.frontLeg.render(scale); this.rearLeg.render(scale); - GL46.glScalef(-1.0F, 1.0F, 1.0F); + GL46C.glScalef(-1.0F, 1.0F, 1.0F); if (j == 0) { - GlState.cullFace(GL46.GL_FRONT); + GlState.cullFace(GL46C.GL_FRONT); } } - GL46.glPopMatrix(); - GlState.cullFace(GL46.GL_BACK); + GL46C.glPopMatrix(); + GlState.cullFace(GL46C.GL_BACK); GlState.disableCull(); float f10 = -((float)Math.sin((double)(f * (float)Math.PI * 2.0F))) * 0.0F; f8 = f * (float)Math.PI * 2.0F; @@ -237,8 +237,8 @@ public class ModelDragon extends ModelBase this.spine.render(scale); } - GL46.glPopMatrix(); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); + GL46C.glPopMatrix(); } /** diff --git a/client/src/main/java/client/renderer/model/ModelFox.java b/client/src/main/java/client/renderer/model/ModelFox.java index e404cbf8..6e4a9d3c 100644 --- a/client/src/main/java/client/renderer/model/ModelFox.java +++ b/client/src/main/java/client/renderer/model/ModelFox.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.util.ExtMath; @@ -54,20 +54,20 @@ public class ModelFox extends ModelBase if (this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 3.5F * scale, 2.0F * scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 3.5F * scale, 2.0F * scale); this.head.renderWithRotation(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.body.render(scale); this.wolfLeg1.render(scale); this.wolfLeg2.render(scale); this.wolfLeg3.render(scale); this.wolfLeg4.render(scale); this.tail.renderWithRotation(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { diff --git a/client/src/main/java/client/renderer/model/ModelHorse.java b/client/src/main/java/client/renderer/model/ModelHorse.java index 6c3679f6..fe4ee842 100755 --- a/client/src/main/java/client/renderer/model/ModelHorse.java +++ b/client/src/main/java/client/renderer/model/ModelHorse.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.animal.EntityHorse; @@ -242,9 +242,9 @@ public class ModelHorse extends ModelBase if (!flag) { - GL46.glPushMatrix(); - GL46.glScalef(f1, 0.5F + f1 * 0.5F, f1); - GL46.glTranslatef(0.0F, 0.95F * (1.0F - f1), 0.0F); + GL46C.glPushMatrix(); + GL46C.glScalef(f1, 0.5F + f1 * 0.5F, f1); + GL46C.glTranslatef(0.0F, 0.95F * (1.0F - f1), 0.0F); } this.backLeftLeg.render(scale); @@ -262,10 +262,10 @@ public class ModelHorse extends ModelBase if (!flag) { - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(f1, f1, f1); - GL46.glTranslatef(0.0F, 1.35F * (1.0F - f1), 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(f1, f1, f1); + GL46C.glTranslatef(0.0F, 1.35F * (1.0F - f1), 0.0F); } this.body.render(scale); @@ -277,18 +277,18 @@ public class ModelHorse extends ModelBase if (!flag) { - GL46.glPopMatrix(); - GL46.glPushMatrix(); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); float f2 = 0.5F + f1 * f1 * 0.5F; - GL46.glScalef(f2, f2, f2); + GL46C.glScalef(f2, f2, f2); if (f <= 0.0F) { - GL46.glTranslatef(0.0F, 1.35F * (1.0F - f1), 0.0F); + GL46C.glTranslatef(0.0F, 1.35F * (1.0F - f1), 0.0F); } else { - GL46.glTranslatef(0.0F, 0.9F * (1.0F - f1) * f + 1.35F * (1.0F - f1) * (1.0F - f), 0.15F * (1.0F - f1) * f); + GL46C.glTranslatef(0.0F, 0.9F * (1.0F - f1) * f + 1.35F * (1.0F - f1) * (1.0F - f), 0.15F * (1.0F - f1) * f); } } @@ -307,7 +307,7 @@ public class ModelHorse extends ModelBase if (!flag) { - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } if (flag2) diff --git a/client/src/main/java/client/renderer/model/ModelHumanoid.java b/client/src/main/java/client/renderer/model/ModelHumanoid.java index d77a54ce..b73371fe 100755 --- a/client/src/main/java/client/renderer/model/ModelHumanoid.java +++ b/client/src/main/java/client/renderer/model/ModelHumanoid.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.util.ExtMath; @@ -150,7 +150,7 @@ public class ModelHumanoid extends ModelBiped public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale); - GL46.glPushMatrix(); + GL46C.glPushMatrix(); // if (this.isChild) // { @@ -171,7 +171,7 @@ public class ModelHumanoid extends ModelBiped // { if (this.isSneak) // entityIn.isSneaking()) { - GL46.glTranslatef(0.0F, 0.2F, 0.0F); + GL46C.glTranslatef(0.0F, 0.2F, 0.0F); // } } @@ -188,7 +188,7 @@ public class ModelHumanoid extends ModelBiped // if(this.sticks) { // } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } // public void renderCape(float scale) diff --git a/client/src/main/java/client/renderer/model/ModelMouse.java b/client/src/main/java/client/renderer/model/ModelMouse.java index ec2d8637..4e898d89 100755 --- a/client/src/main/java/client/renderer/model/ModelMouse.java +++ b/client/src/main/java/client/renderer/model/ModelMouse.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.types.EntityLiving; @@ -63,9 +63,9 @@ public class ModelMouse extends ModelBase this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn); float s = this.isChild ? 0.125f : 0.25f; - GL46.glPushMatrix(); - GL46.glScalef(s, s, s); - GL46.glTranslatef(0.0f, (this.isChild ? 171.0f : 74.5f) * scale, 0.0f); + GL46C.glPushMatrix(); + GL46C.glScalef(s, s, s); + GL46C.glTranslatef(0.0f, (this.isChild ? 171.0f : 74.5f) * scale, 0.0f); // if (this.isChild) // { // float f = 2.0F; @@ -97,7 +97,7 @@ public class ModelMouse extends ModelBase this.frontLeftLeg.render(scale); this.frontRightLeg.render(scale); // } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) diff --git a/client/src/main/java/client/renderer/model/ModelQuadruped.java b/client/src/main/java/client/renderer/model/ModelQuadruped.java index b2c0a620..4c0c6885 100755 --- a/client/src/main/java/client/renderer/model/ModelQuadruped.java +++ b/client/src/main/java/client/renderer/model/ModelQuadruped.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.util.ExtMath; @@ -47,19 +47,19 @@ public class ModelQuadruped extends ModelBase if (this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, this.childYOffset * scale, this.childZOffset * scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, this.childYOffset * scale, this.childZOffset * scale); this.head.render(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.body.render(scale); this.leg1.render(scale); this.leg2.render(scale); this.leg3.render(scale); this.leg4.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { diff --git a/client/src/main/java/client/renderer/model/ModelRabbit.java b/client/src/main/java/client/renderer/model/ModelRabbit.java index 5417b550..53be9ba1 100755 --- a/client/src/main/java/client/renderer/model/ModelRabbit.java +++ b/client/src/main/java/client/renderer/model/ModelRabbit.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.animal.EntityRabbit; @@ -101,16 +101,16 @@ public class ModelRabbit extends ModelBase { if(this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); this.rabbitHead.render(scale); this.rabbitLeftEar.render(scale); this.rabbitRightEar.render(scale); this.rabbitNose.render(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.rabbitLeftFoot.render(scale); this.rabbitRightFoot.render(scale); this.rabbitLeftThigh.render(scale); @@ -119,7 +119,7 @@ public class ModelRabbit extends ModelBase { this.rabbitLeftArm.render(scale); this.rabbitRightArm.render(scale); this.rabbitTail.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { this.rabbitLeftFoot.render(scale); diff --git a/client/src/main/java/client/renderer/model/ModelRenderer.java b/client/src/main/java/client/renderer/model/ModelRenderer.java index 5b759f69..2c110981 100755 --- a/client/src/main/java/client/renderer/model/ModelRenderer.java +++ b/client/src/main/java/client/renderer/model/ModelRenderer.java @@ -2,7 +2,7 @@ package client.renderer.model; import java.util.List; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.RenderBuffer; import client.renderer.Tessellator; @@ -173,13 +173,13 @@ public class ModelRenderer this.compileDisplayList(p_78785_1_); } - GL46.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); + GL46C.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { - GL46.glCallList(this.displayList); + GL46C.glCallList(this.displayList); if (this.childModels != null) { @@ -191,8 +191,8 @@ public class ModelRenderer } else { - GL46.glTranslatef(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); - GL46.glCallList(this.displayList); + GL46C.glTranslatef(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); + GL46C.glCallList(this.displayList); if (this.childModels != null) { @@ -202,30 +202,30 @@ public class ModelRenderer } } - GL46.glTranslatef(-this.rotationPointX * p_78785_1_, -this.rotationPointY * p_78785_1_, -this.rotationPointZ * p_78785_1_); + GL46C.glTranslatef(-this.rotationPointX * p_78785_1_, -this.rotationPointY * p_78785_1_, -this.rotationPointZ * p_78785_1_); } } else { - GL46.glPushMatrix(); - GL46.glTranslatef(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); + GL46C.glPushMatrix(); + GL46C.glTranslatef(this.rotationPointX * p_78785_1_, this.rotationPointY * p_78785_1_, this.rotationPointZ * p_78785_1_); if (this.rotateAngleZ != 0.0F) { - GL46.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); } if (this.rotateAngleY != 0.0F) { - GL46.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); } if (this.rotateAngleX != 0.0F) { - GL46.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); } - GL46.glCallList(this.displayList); + GL46C.glCallList(this.displayList); if (this.childModels != null) { @@ -235,10 +235,10 @@ public class ModelRenderer } } - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } - GL46.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); + GL46C.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); } } } @@ -254,26 +254,26 @@ public class ModelRenderer this.compileDisplayList(p_78791_1_); } - GL46.glPushMatrix(); - GL46.glTranslatef(this.rotationPointX * p_78791_1_, this.rotationPointY * p_78791_1_, this.rotationPointZ * p_78791_1_); + GL46C.glPushMatrix(); + GL46C.glTranslatef(this.rotationPointX * p_78791_1_, this.rotationPointY * p_78791_1_, this.rotationPointZ * p_78791_1_); if (this.rotateAngleY != 0.0F) { - GL46.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); } if (this.rotateAngleX != 0.0F) { - GL46.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); } if (this.rotateAngleZ != 0.0F) { - GL46.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); } - GL46.glCallList(this.displayList); - GL46.glPopMatrix(); + GL46C.glCallList(this.displayList); + GL46C.glPopMatrix(); } } } @@ -296,26 +296,26 @@ public class ModelRenderer { if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { - GL46.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL46C.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); } } else { - GL46.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + GL46C.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); if (this.rotateAngleZ != 0.0F) { - GL46.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); } if (this.rotateAngleY != 0.0F) { - GL46.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); } if (this.rotateAngleX != 0.0F) { - GL46.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); } } } @@ -337,26 +337,26 @@ public class ModelRenderer { if (this.rotationPointX + x != 0.0F || this.rotationPointY + y != 0.0F || this.rotationPointZ + z != 0.0F) { - GL46.glTranslatef((this.rotationPointX + x) * scale, (this.rotationPointY + y) * scale, (this.rotationPointZ + z) * scale); + GL46C.glTranslatef((this.rotationPointX + x) * scale, (this.rotationPointY + y) * scale, (this.rotationPointZ + z) * scale); } } else { - GL46.glTranslatef((this.rotationPointX + x) * scale, (this.rotationPointY + y) * scale, (this.rotationPointZ + z) * scale); + GL46C.glTranslatef((this.rotationPointX + x) * scale, (this.rotationPointY + y) * scale, (this.rotationPointZ + z) * scale); if (this.rotateAngleZ != 0.0F) { - GL46.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); + GL46C.glRotatef(this.rotateAngleZ * (180F / (float)Math.PI), 0.0F, 0.0F, 1.0F); } if (this.rotateAngleY != 0.0F) { - GL46.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleY * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); } if (this.rotateAngleX != 0.0F) { - GL46.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); + GL46C.glRotatef(this.rotateAngleX * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); } } } @@ -365,8 +365,8 @@ public class ModelRenderer private void compileDisplayList(float scale) { - this.displayList = GL46.glGenLists(1); - GL46.glNewList(this.displayList, GL46.GL_COMPILE); + this.displayList = GL46C.glGenLists(1); + GL46C.glNewList(this.displayList, GL46C.GL_COMPILE); // Tessellator.getInstance(); RenderBuffer worldrenderer = Tessellator.getBuffer(); @@ -375,13 +375,13 @@ public class ModelRenderer ((ModelBox)this.cubeList.get(i)).makeList(worldrenderer, scale); } - GL46.glEndList(); + GL46C.glEndList(); this.compiled = true; } public void deleteDisplayList() { if(this.displayList != 0) - GL46.glDeleteLists(this.displayList, 1); + GL46C.glDeleteLists(this.displayList, 1); this.displayList = 0; } diff --git a/client/src/main/java/client/renderer/model/ModelWolf.java b/client/src/main/java/client/renderer/model/ModelWolf.java index 571f8c19..bce5259b 100755 --- a/client/src/main/java/client/renderer/model/ModelWolf.java +++ b/client/src/main/java/client/renderer/model/ModelWolf.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import common.entity.Entity; import common.entity.animal.EntityWolf; @@ -77,13 +77,13 @@ public class ModelWolf extends ModelBase if (this.isChild) { float f = 2.0F; - GL46.glPushMatrix(); - GL46.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); + GL46C.glPushMatrix(); + GL46C.glTranslatef(0.0F, 5.0F * scale, 2.0F * scale); this.wolfHeadMain.renderWithRotation(scale); - GL46.glPopMatrix(); - GL46.glPushMatrix(); - GL46.glScalef(1.0F / f, 1.0F / f, 1.0F / f); - GL46.glTranslatef(0.0F, 24.0F * scale, 0.0F); + GL46C.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(1.0F / f, 1.0F / f, 1.0F / f); + GL46C.glTranslatef(0.0F, 24.0F * scale, 0.0F); this.wolfBody.render(scale); this.wolfLeg1.render(scale); this.wolfLeg2.render(scale); @@ -91,7 +91,7 @@ public class ModelWolf extends ModelBase this.wolfLeg4.render(scale); this.wolfTail.renderWithRotation(scale); this.wolfMane.render(scale); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } else { diff --git a/client/src/main/java/client/renderer/model/TexturedQuad.java b/client/src/main/java/client/renderer/model/TexturedQuad.java index 1585e840..4362d835 100755 --- a/client/src/main/java/client/renderer/model/TexturedQuad.java +++ b/client/src/main/java/client/renderer/model/TexturedQuad.java @@ -1,6 +1,6 @@ package client.renderer.model; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.DefaultVertexFormats; import client.renderer.RenderBuffer; @@ -59,7 +59,7 @@ public class TexturedQuad // ny = -ny; // nz = -nz; // } - renderer.begin(GL46.GL_QUADS, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); + renderer.begin(GL46C.GL_QUADS, DefaultVertexFormats.OLDMODEL_POSITION_TEX_NORMAL); for (int i = 0; i < 4; ++i) { PositionTextureVertex vertex = this.vertices[i]; diff --git a/client/src/main/java/client/renderer/texture/Texture.java b/client/src/main/java/client/renderer/texture/Texture.java index 9496f77a..38a9b18d 100755 --- a/client/src/main/java/client/renderer/texture/Texture.java +++ b/client/src/main/java/client/renderer/texture/Texture.java @@ -2,7 +2,7 @@ package client.renderer.texture; import java.io.IOException; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; @@ -11,7 +11,7 @@ public abstract class Texture { public final int getGlTextureId() { if(this.id == -1) - this.id = GL46.glGenTextures(); + this.id = GL46C.glGenTextures(); return this.id; } diff --git a/client/src/main/java/client/renderer/texture/TextureMap.java b/client/src/main/java/client/renderer/texture/TextureMap.java index 18c9c9d6..1e0e987b 100755 --- a/client/src/main/java/client/renderer/texture/TextureMap.java +++ b/client/src/main/java/client/renderer/texture/TextureMap.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import java.util.Map.Entry; @@ -190,7 +190,7 @@ public class TextureMap extends Texture textureatlassprite.updateAnimation(); } - GL46.glGenerateMipmap(GL46.GL_TEXTURE_2D); + GL46C.glGenerateMipmap(GL46C.GL_TEXTURE_2D); } private Sprite registerSprite(String location) diff --git a/client/src/main/java/client/renderer/texture/TextureUtil.java b/client/src/main/java/client/renderer/texture/TextureUtil.java index dd6070e9..a3a9056f 100755 --- a/client/src/main/java/client/renderer/texture/TextureUtil.java +++ b/client/src/main/java/client/renderer/texture/TextureUtil.java @@ -11,7 +11,7 @@ import java.nio.IntBuffer; import javax.imageio.ImageIO; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import client.util.FileUtils; @@ -23,11 +23,11 @@ public class TextureUtil public static final int[] MISSING_DATA = MISSING.getData(); public static void setParams(boolean filter, boolean mips, boolean linear, float aniso) { - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MIN_FILTER, filter ? (mips ? (linear ? GL46.GL_LINEAR_MIPMAP_LINEAR : GL46.GL_LINEAR_MIPMAP_NEAREST) : GL46.GL_LINEAR) : (mips ? (linear ? GL46.GL_NEAREST_MIPMAP_LINEAR : GL46.GL_NEAREST_MIPMAP_NEAREST) : GL46.GL_NEAREST)); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAG_FILTER, filter ? GL46.GL_LINEAR : GL46.GL_NEAREST); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_S, GL46.GL_REPEAT); - GL46.glTexParameteri(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_WRAP_T, GL46.GL_REPEAT); - GL46.glTexParameterf(GL46.GL_TEXTURE_2D, GL46.GL_TEXTURE_MAX_ANISOTROPY, aniso); + GL46C.glTexParameteri(GL46C.GL_TEXTURE_2D, GL46C.GL_TEXTURE_MIN_FILTER, filter ? (mips ? (linear ? GL46C.GL_LINEAR_MIPMAP_LINEAR : GL46C.GL_LINEAR_MIPMAP_NEAREST) : GL46C.GL_LINEAR) : (mips ? (linear ? GL46C.GL_NEAREST_MIPMAP_LINEAR : GL46C.GL_NEAREST_MIPMAP_NEAREST) : GL46C.GL_NEAREST)); + GL46C.glTexParameteri(GL46C.GL_TEXTURE_2D, GL46C.GL_TEXTURE_MAG_FILTER, filter ? GL46C.GL_LINEAR : GL46C.GL_NEAREST); + GL46C.glTexParameteri(GL46C.GL_TEXTURE_2D, GL46C.GL_TEXTURE_WRAP_S, GL46C.GL_REPEAT); + GL46C.glTexParameteri(GL46C.GL_TEXTURE_2D, GL46C.GL_TEXTURE_WRAP_T, GL46C.GL_REPEAT); + GL46C.glTexParameterf(GL46C.GL_TEXTURE_2D, GL46C.GL_TEXTURE_MAX_ANISOTROPY, aniso); } public static void uploadTexture(int[] data, int w, int h, int x, int y, boolean params) @@ -45,7 +45,7 @@ public class TextureUtil BUFFER.clear(); BUFFER.put(data, j, i1); BUFFER.position(0).limit(i1); - GL46.glTexSubImage2D(GL46.GL_TEXTURE_2D, 0, x, y + k, w, l, GL46.GL_BGRA, GL46.GL_UNSIGNED_INT_8_8_8_8_REV, BUFFER); + GL46C.glTexSubImage2D(GL46C.GL_TEXTURE_2D, 0, x, y + k, w, l, GL46C.GL_BGRA, GL46C.GL_UNSIGNED_INT_8_8_8_8_REV, BUFFER); } } @@ -68,7 +68,7 @@ public class TextureUtil BUFFER.clear(); BUFFER.put(data, 0, k1); BUFFER.position(0).limit(k1); - GL46.glTexSubImage2D(GL46.GL_TEXTURE_2D, 0, 0, i1, w, j1, GL46.GL_BGRA, GL46.GL_UNSIGNED_INT_8_8_8_8_REV, BUFFER); + GL46C.glTexSubImage2D(GL46C.GL_TEXTURE_2D, 0, 0, i1, w, j1, GL46C.GL_BGRA, GL46C.GL_UNSIGNED_INT_8_8_8_8_REV, BUFFER); } return id; } @@ -77,7 +77,7 @@ public class TextureUtil { // GlState.deleteTexture(id); //TODO: check needed GlState.bindTexture(id); - GL46.nglTexImage2D(GL46.GL_TEXTURE_2D, 0, GL46.GL_RGBA, width, height, 0, GL46.GL_BGRA, GL46.GL_UNSIGNED_INT_8_8_8_8_REV, NULL); + GL46C.nglTexImage2D(GL46C.GL_TEXTURE_2D, 0, GL46C.GL_RGBA, width, height, 0, GL46C.GL_BGRA, GL46C.GL_UNSIGNED_INT_8_8_8_8_REV, NULL); } public static int[] readImageData(String loc) throws IOException diff --git a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java index 3e8a46ff..2b4be233 100644 --- a/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java @@ -3,7 +3,7 @@ package client.renderer.tileentity; import java.util.Iterator; import java.util.Map; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.Drawing; @@ -92,18 +92,18 @@ public class DisplayRenderer extends ElementRenderer { else if(dir == Facing.EAST) rot = -90.0F; - GL46.glPushMatrix(); - GL46.glTranslatef((float)x + 0.5F, (float)y + 1.0f, (float)z + 0.5F); - GL46.glRotatef(-rot, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(-0.5F, 0.0f, -0.5f + 0.0625f + 0.005f); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x + 0.5F, (float)y + 1.0f, (float)z + 0.5F); + GL46C.glRotatef(-rot, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(-0.5F, 0.0f, -0.5f + 0.0625f + 0.005f); float density = 1.0f / (float)(te.density / 16); - GL46.glScalef(0.0625f * density, -0.0625f * density, 0.0625f * density); + GL46C.glScalef(0.0625f * density, -0.0625f * density, 0.0625f * density); GlState.disableLighting(); Drawing.drawTexturedRect(Client.CLIENT, getTexture(te), te.density, te.density, 0, 0, 0, 0, te.density, te.density); GlState.enableLighting(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/tileentity/ItemPipeRenderer.java b/client/src/main/java/client/renderer/tileentity/ItemPipeRenderer.java index 38b9e993..bbc7ed08 100644 --- a/client/src/main/java/client/renderer/tileentity/ItemPipeRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/ItemPipeRenderer.java @@ -1,6 +1,6 @@ package client.renderer.tileentity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.Client; import client.renderer.GlState; @@ -17,17 +17,17 @@ public class ItemPipeRenderer extends ElementRenderer { return; Client.CLIENT.getTextureManager().bindTexture(TextureMap.BLOCKS); GlState.enableRescaleNormal(); - GlState.alphaFunc(GL46.GL_GREATER, 0.1F); + GlState.alphaFunc(GL46C.GL_GREATER, 0.1F); GlState.enableBlend(); - GlState.tryBlendFuncSeparate(GL46.GL_SRC_ALPHA, GL46.GL_ONE_MINUS_SRC_ALPHA, GL46.GL_ONE, GL46.GL_ZERO); + GlState.tryBlendFuncSeparate(GL46C.GL_SRC_ALPHA, GL46C.GL_ONE_MINUS_SRC_ALPHA, GL46C.GL_ONE, GL46C.GL_ZERO); RenderItem itemRenderer = Client.CLIENT.getRenderItem(); IBakedModel ibakedmodel = itemRenderer.getItemModelMesher().getItemModel(itemstack); - GL46.glPushMatrix(); - GL46.glTranslatef((float)x + 0.5F, (float)y + 0.5f, (float)z + 0.5F); + GL46C.glPushMatrix(); + GL46C.glTranslatef((float)x + 0.5F, (float)y + 0.5f, (float)z + 0.5F); if(ibakedmodel.isGui3d()) - GL46.glScalef(0.5F, 0.5F, 0.5F); + GL46C.glScalef(0.5F, 0.5F, 0.5F); itemRenderer.renderItem(itemstack, ibakedmodel); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); GlState.disableRescaleNormal(); GlState.disableBlend(); } diff --git a/client/src/main/java/client/renderer/tileentity/SignRenderer.java b/client/src/main/java/client/renderer/tileentity/SignRenderer.java index 969183be..c8964baf 100755 --- a/client/src/main/java/client/renderer/tileentity/SignRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SignRenderer.java @@ -1,6 +1,6 @@ package client.renderer.tileentity; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.Drawing; import client.renderer.GlState; @@ -14,13 +14,13 @@ public class SignRenderer extends ElementRenderer { public void renderElements(TileEntitySign te, double x, double y, double z, float partialTicks) { - GL46.glPushMatrix(); + GL46C.glPushMatrix(); float f = 0.6666667F; State state = te.getState(); if (state.getBlock() instanceof BlockStandingSign) { - GL46.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); + GL46C.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); int r = state.getValue(BlockStandingSign.FACING).getIndex(); float f1 = 0.0F; @@ -38,8 +38,8 @@ public class SignRenderer extends ElementRenderer { f1 = -90.0F; } - GL46.glRotatef(-f1, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, f * -0.0625f * 2.0f, 0.0F); + GL46C.glRotatef(-f1, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, f * -0.0625f * 2.0f, 0.0F); } else { @@ -61,16 +61,16 @@ public class SignRenderer extends ElementRenderer f2 = -90.0F; } - GL46.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); - GL46.glRotatef(-f2, 0.0F, 1.0F, 0.0F); - GL46.glTranslatef(0.0F, -0.3125F - f * 0.0625f * 0.5f, -0.4375F); + GL46C.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F); + GL46C.glRotatef(-f2, 0.0F, 1.0F, 0.0F); + GL46C.glTranslatef(0.0F, -0.3125F - f * 0.0625f * 0.5f, -0.4375F); } GlState.enableRescaleNormal(); float f3 = 0.015625F * f; - GL46.glTranslatef(0.0F, 0.5F * f, 0.1F * f); - GL46.glScalef(f3, -f3, f3); - GL46.glNormal3f(0.0F, 0.0F, -1.0F * f3); + GL46C.glTranslatef(0.0F, 0.5F * f, 0.1F * f); + GL46C.glScalef(f3, -f3, f3); + GL46C.glNormal3f(0.0F, 0.0F, -1.0F * f3); GlState.depthMask(false); for (int j = 0; j < te.text.length; ++j) @@ -78,15 +78,15 @@ public class SignRenderer extends ElementRenderer if (te.text[j] != null && !te.text[j].isEmpty()) { String s = te.text[j].length() > 50 ? te.text[j].substring(0, 50) : te.text[j]; - GL46.glPushMatrix(); - GL46.glScalef(0.75f, 0.75f, 0.75f); - Drawing.drawTextCenteredN(s, 0, j * (18 - 3) - 30, 0xff000000); - GL46.glPopMatrix(); + GL46C.glPushMatrix(); + GL46C.glScalef(0.75f, 0.75f, 0.75f); + Drawing.drawTextCentered3d(s, 0, j * (18 - 3) - 30, 0xff000000); + GL46C.glPopMatrix(); } } GlState.depthMask(true); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - GL46.glPopMatrix(); + GL46C.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java index d698047e..720386f7 100755 --- a/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/SpecialRenderer.java @@ -2,7 +2,7 @@ package client.renderer.tileentity; import java.util.Map; -import org.lwjgl.opengl.GL46; +import org.lwjgl.opengl.GL46C; import client.renderer.GlState; import common.collect.Maps; @@ -58,7 +58,7 @@ public class SpecialRenderer { int light = this.world.getCombinedLight(tile.getPos()); int block = light % 65536; int sky = light / 65536; - GL46.glMultiTexCoord2f(GL46.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); + GL46C.glMultiTexCoord2f(GL46C.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); BlockPos pos = tile.getPos(); this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial); diff --git a/client/src/main/resources/shaders/ui_color.fsh b/client/src/main/resources/shaders/ui_color.fsh new file mode 100644 index 00000000..81dda8ee --- /dev/null +++ b/client/src/main/resources/shaders/ui_color.fsh @@ -0,0 +1,7 @@ +out vec4 FragColor; + +in vec4 tex_color; + +void main() { + FragColor = tex_color; +} diff --git a/client/src/main/resources/shaders/ui_color.vsh b/client/src/main/resources/shaders/ui_color.vsh new file mode 100644 index 00000000..561b5617 --- /dev/null +++ b/client/src/main/resources/shaders/ui_color.vsh @@ -0,0 +1,13 @@ +layout (location = 0) in vec3 pos; +layout (location = 1) in vec4 norm; +layout (location = 2) in vec2 coord; +layout (location = 3) in vec4 color; + +out vec4 tex_color; + +uniform vec2 screen_size; + +void main() { + tex_color = color; + gl_Position = vec4(-1.0 + pos.x / screen_size.x * 2.0, -1.0 + pos.y / screen_size.y * 2.0, 0.0, 1.0); +} diff --git a/client/src/main/resources/shaders/ui_texture.fsh b/client/src/main/resources/shaders/ui_texture.fsh new file mode 100644 index 00000000..4648b41d --- /dev/null +++ b/client/src/main/resources/shaders/ui_texture.fsh @@ -0,0 +1,10 @@ +out vec4 FragColor; + +in vec2 tex_coord; +in vec4 tex_color; + +uniform sampler2D tex; + +void main() { + FragColor = texture(tex, tex_coord) * tex_color; +} diff --git a/client/src/main/resources/shaders/ui_texture.vsh b/client/src/main/resources/shaders/ui_texture.vsh new file mode 100644 index 00000000..2672befe --- /dev/null +++ b/client/src/main/resources/shaders/ui_texture.vsh @@ -0,0 +1,15 @@ +layout (location = 0) in vec3 pos; +layout (location = 1) in vec4 norm; +layout (location = 2) in vec2 coord; +layout (location = 3) in vec4 color; + +out vec2 tex_coord; +out vec4 tex_color; + +uniform vec2 screen_size; + +void main() { + tex_coord = coord; + tex_color = color; + gl_Position = vec4(pos.x, pos.y, 0.0, 1.0); +} diff --git a/common/src/main/java/common/world/IWorldAccess.java b/common/src/main/java/common/world/IWorldAccess.java index d2d9e945..5794e722 100755 --- a/common/src/main/java/common/world/IWorldAccess.java +++ b/common/src/main/java/common/world/IWorldAccess.java @@ -8,5 +8,5 @@ public interface IWorldAccess extends IBlockAccess { TileEntity getTileEntity(BlockPos pos); @Clientside - int getCombinedLight(BlockPos pos); + int getWorldLight(BlockPos pos); } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index de62709e..bba00304 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -187,7 +187,7 @@ public abstract class World implements IWorldAccess { public void checkBlockLight(BlockPos pos) { } - public int getCombinedLight(BlockPos pos) { + public int getWorldLight(BlockPos pos) { return 0; }