private void prepareTexturedModel(TexturedModel model) { RawModel rawModel = model.getModel(); GL30.glBindVertexArray(rawModel.getVaoID()); GL20.glEnableVertexAttribArray(0); // vertices array GL20.glEnableVertexAttribArray(1); // textures array GL20.glEnableVertexAttribArray(2); // normals array { // Load Texture and shine ModelTexture texture = model.getTexture(); shader.loadShineVariables(texture.getShineDamper(), texture.getReflectivity()); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getTextureID()); } }
private void loadScreen() throws LWJGLException { ScaledResolution scaledresolution = new ScaledResolution(gameSettings, displayWidth, displayHeight); GL11.glClear(16640); GL11.glMatrixMode(5889 /*GL_PROJECTION*/); GL11.glLoadIdentity(); GL11.glOrtho( 0.0D, scaledresolution.field_25121_a, scaledresolution.field_25120_b, 0.0D, 1000D, 3000D); GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000F); GL11.glViewport(0, 0, displayWidth, displayHeight); GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); Tessellator tessellator = Tessellator.instance; GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glEnable(3553 /*GL_TEXTURE_2D*/); GL11.glDisable(2912 /*GL_FOG*/); GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/title/mojang.png")); tessellator.startDrawingQuads(); tessellator.setColorOpaque_I(0xffffff); tessellator.addVertexWithUV(0.0D, displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(displayWidth, displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.draw(); char c = '\u0100'; char c1 = '\u0100'; GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); tessellator.setColorOpaque_I(0xffffff); func_6274_a( (scaledresolution.getScaledWidth() - c) / 2, (scaledresolution.getScaledHeight() - c1) / 2, 0, 0, c, c1); GL11.glDisable(2896 /*GL_LIGHTING*/); GL11.glDisable(2912 /*GL_FOG*/); GL11.glEnable(3008 /*GL_ALPHA_TEST*/); GL11.glAlphaFunc(516, 0.1F); Display.swapBuffers(); }
public int func_982_a() { if (!field_1488_w) { throw new IllegalStateException("Not tesselating!"); } if (renderingChunk && subTessellators.length > 0) { boolean flag = false; for (int j = 0; j < subTessellators.length; j++) { int k = subTextures[j]; if (k <= 0) { break; } Tessellator tessellator = subTessellators[j]; if (tessellator.field_1488_w) { GL11.glBindTexture(3553, k); tessellator.func_982_a(); flag = true; } } if (flag) { GL11.glBindTexture(3553, getTerrainTexture()); } } field_1488_w = false; if (field_1505_h > 0) { field_1508_e.clear(); field_1508_e.put(field_1506_g, 0, field_1498_o); field_1509_d.position(0); field_1509_d.limit(field_1498_o * 4); if (field_1487_x) { field_1485_z = (field_1485_z + 1) % field_1496_A; ARBVertexBufferObject.glBindBufferARB(34962, field_1486_y.get(field_1485_z)); ARBVertexBufferObject.glBufferDataARB(34962, field_1509_d, 35040); } if (field_1500_m) { if (field_1487_x) { GL11.glTexCoordPointer(2, 5126, 32, 12L); } else { field_1507_f.position(3); GL11.glTexCoordPointer(2, 32, field_1507_f); } GL11.glEnableClientState(32888); } if (field_35838_p) { OpenGlHelper.func_40451_b(OpenGlHelper.field_40455_b); if (field_1487_x) { GL11.glTexCoordPointer(2, 5122, 32, 28L); } else { field_35836_g.position(14); GL11.glTexCoordPointer(2, 32, field_35836_g); } GL11.glEnableClientState(32888); OpenGlHelper.func_40451_b(OpenGlHelper.field_40457_a); } if (field_1501_l) { if (field_1487_x) { GL11.glColorPointer(4, 5121, 32, 20L); } else { field_1509_d.position(20); GL11.glColorPointer(4, true, 32, field_1509_d); } GL11.glEnableClientState(32886); } if (field_1499_n) { if (field_1487_x) { GL11.glNormalPointer(5121, 32, 24L); } else { field_1509_d.position(24); GL11.glNormalPointer(32, field_1509_d); } GL11.glEnableClientState(32885); } if (field_1487_x) { GL11.glVertexPointer(3, 5126, 32, 0L); } else { field_1507_f.position(0); GL11.glVertexPointer(3, 32, field_1507_f); } GL11.glEnableClientState(32884); if (field_1493_r == 7 && field_1511_b) { GL11.glDrawArrays(4, 0, field_1505_h); } else { GL11.glDrawArrays(field_1493_r, 0, field_1505_h); } GL11.glDisableClientState(32884); if (field_1500_m) { GL11.glDisableClientState(32888); } if (field_35838_p) { OpenGlHelper.func_40451_b(OpenGlHelper.field_40455_b); GL11.glDisableClientState(32888); OpenGlHelper.func_40451_b(OpenGlHelper.field_40457_a); } if (field_1501_l) { GL11.glDisableClientState(32886); } if (field_1499_n) { GL11.glDisableClientState(32885); } } int i = field_1498_o * 4; func_985_d(); return i; }
public void runTick() { if (ticksRan == 6000) { func_28001_B(); } statFileWriter.func_27178_d(); ingameGUI.updateTick(); entityRenderer.getMouseOver(1.0F); if (thePlayer != null) { net.minecraft.src.IChunkProvider ichunkprovider = theWorld.getIChunkProvider(); if (ichunkprovider instanceof ChunkProviderLoadOrGenerate) { ChunkProviderLoadOrGenerate chunkproviderloadorgenerate = (ChunkProviderLoadOrGenerate) ichunkprovider; int j = MathHelper.floor_float((int) thePlayer.posX) >> 4; int i1 = MathHelper.floor_float((int) thePlayer.posZ) >> 4; chunkproviderloadorgenerate.setCurrentChunkOver(j, i1); } } if (!isGamePaused && theWorld != null) { playerController.updateController(); } GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, renderEngine.getTexture("/terrain.png")); if (!isGamePaused) { renderEngine.updateDynamicTextures(); } if (currentScreen == null && thePlayer != null) { if (thePlayer.health <= 0) { displayGuiScreen(null); } else if (thePlayer.isPlayerSleeping() && theWorld != null && theWorld.multiplayerWorld) { displayGuiScreen(new GuiSleepMP()); } } else if (currentScreen != null && (currentScreen instanceof GuiSleepMP) && !thePlayer.isPlayerSleeping()) { displayGuiScreen(null); } if (currentScreen != null) { leftClickCounter = 10000; mouseTicksRan = ticksRan + 10000; } if (currentScreen != null) { currentScreen.handleInput(); if (currentScreen != null) { currentScreen.field_25091_h.func_25088_a(); currentScreen.updateScreen(); } } if (currentScreen == null || currentScreen.field_948_f) { do { if (!Mouse.next()) { break; } long l = System.currentTimeMillis() - systemTime; if (l <= 200L) { int k = Mouse.getEventDWheel(); if (k != 0) { thePlayer.inventory.changeCurrentItem(k); if (gameSettings.field_22275_C) { if (k > 0) { k = 1; } if (k < 0) { k = -1; } gameSettings.field_22272_F += (float) k * 0.25F; } } if (currentScreen == null) { if (!inGameHasFocus && Mouse.getEventButtonState()) { setIngameFocus(); } else { if (Mouse.getEventButton() == 0 && Mouse.getEventButtonState()) { clickMouse(0); mouseTicksRan = ticksRan; } if (Mouse.getEventButton() == 1 && Mouse.getEventButtonState()) { clickMouse(1); mouseTicksRan = ticksRan; } if (Mouse.getEventButton() == 2 && Mouse.getEventButtonState()) { clickMiddleMouseButton(); } } } else if (currentScreen != null) { currentScreen.handleMouseInput(); } } } while (true); if (leftClickCounter > 0) { leftClickCounter--; } do { if (!Keyboard.next()) { break; } thePlayer.handleKeyPress(Keyboard.getEventKey(), Keyboard.getEventKeyState()); if (Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == 87) { toggleFullscreen(); } else { if (currentScreen != null) { currentScreen.handleKeyboardInput(); } else { if (Keyboard.getEventKey() == 1) { displayInGameMenu(); } if (Keyboard.getEventKey() == 31 && Keyboard.isKeyDown(61)) { forceReload(); } if (Keyboard.getEventKey() == 59) { gameSettings.hideGUI = !gameSettings.hideGUI; } if (Keyboard.getEventKey() == 61) { gameSettings.showDebugInfo = !gameSettings.showDebugInfo; } if (Keyboard.getEventKey() == 63) { gameSettings.thirdPersonView = !gameSettings.thirdPersonView; } if (Keyboard.getEventKey() == 66) { gameSettings.smoothCamera = !gameSettings.smoothCamera; } if (Keyboard.getEventKey() == gameSettings.keyBindInventory.keyCode) { displayGuiScreen(new GuiInventory(thePlayer)); } if (Keyboard.getEventKey() == gameSettings.keyBindDrop.keyCode) { thePlayer.dropCurrentItem(); } if (isMultiplayerWorld() && Keyboard.getEventKey() == gameSettings.keyBindChat.keyCode) { displayGuiScreen(new GuiChat()); } } for (int i = 0; i < 9; i++) { if (Keyboard.getEventKey() == 2 + i) { thePlayer.inventory.currentItem = i; } } if (Keyboard.getEventKey() == gameSettings.keyBindToggleFog.keyCode) { gameSettings.setOptionValue( EnumOptions.RENDER_DISTANCE, !Keyboard.isKeyDown(42) && !Keyboard.isKeyDown(54) ? 1 : -1); } } } } while (true); if (currentScreen == null) { if (Mouse.isButtonDown(0) && (float) (ticksRan - mouseTicksRan) >= timer.ticksPerSecond / 4F && inGameHasFocus) { clickMouse(0); mouseTicksRan = ticksRan; } if (Mouse.isButtonDown(1) && (float) (ticksRan - mouseTicksRan) >= timer.ticksPerSecond / 4F && inGameHasFocus) { clickMouse(1); mouseTicksRan = ticksRan; } } func_6254_a(0, currentScreen == null && Mouse.isButtonDown(0) && inGameHasFocus); } if (theWorld != null) { if (thePlayer != null) { joinPlayerCounter++; if (joinPlayerCounter == 30) { joinPlayerCounter = 0; theWorld.joinEntityInSurroundings(thePlayer); } } theWorld.difficultySetting = gameSettings.difficulty; if (theWorld.multiplayerWorld) { theWorld.difficultySetting = 3; } if (!isGamePaused) { entityRenderer.updateRenderer(); } if (!isGamePaused) { renderGlobal.updateClouds(); } if (!isGamePaused) { if (theWorld.field_27172_i > 0) { theWorld.field_27172_i--; } theWorld.updateEntities(); } if (!isGamePaused || isMultiplayerWorld()) { theWorld.setAllowedMobSpawns(gameSettings.difficulty > 0, true); theWorld.tick(); } if (!isGamePaused && theWorld != null) { theWorld.randomDisplayUpdates( MathHelper.floor_double(thePlayer.posX), MathHelper.floor_double(thePlayer.posY), MathHelper.floor_double(thePlayer.posZ)); } if (!isGamePaused) { effectRenderer.updateEffects(); } } systemTime = System.currentTimeMillis(); }