public RenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos blockPosIn, int indexIn) { this.world = worldIn; this.renderGlobal = renderGlobalIn; this.index = indexIn; if (!blockPosIn.equals(this.getPosition())) { this.setPosition(blockPosIn); } if (OpenGlHelper.useVbo()) { for (int i = 0; i < EnumWorldBlockLayer.values().length; ++i) { this.vertexBuffers[i] = new VertexBuffer(DefaultVertexFormats.BLOCK); } } }
private EnumWorldBlockLayer fixBlockLayer(Block p_fixBlockLayer_1_, EnumWorldBlockLayer p_fixBlockLayer_2_) { if (this.isMipmaps) { if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT) { if (p_fixBlockLayer_1_ instanceof BlockRedstoneWire) { return p_fixBlockLayer_2_; } if (p_fixBlockLayer_1_ instanceof BlockCactus) { return p_fixBlockLayer_2_; } return EnumWorldBlockLayer.CUTOUT_MIPPED; } } else if (p_fixBlockLayer_2_ == EnumWorldBlockLayer.CUTOUT_MIPPED) { return EnumWorldBlockLayer.CUTOUT; } return p_fixBlockLayer_2_; }
public void renderChunkLayer(EnumWorldBlockLayer layer) { if (this.initialized) { for (RenderChunk renderchunk : this.renderChunks) { VertexBuffer vertexbuffer = renderchunk.getVertexBufferByLayer(layer.ordinal()); GlStateManager.pushMatrix(); this.preRenderChunk(renderchunk); renderchunk.multModelviewMatrix(); vertexbuffer.bindBuffer(); this.setupArrayPointers(); vertexbuffer.drawArrays(7); GlStateManager.popMatrix(); } OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); GlStateManager.resetColor(); this.renderChunks.clear(); } }
public ListenableFuture<Object> uploadChunk(final EnumWorldBlockLayer player, final WorldRenderer p_178503_2_, final RenderChunk chunkRenderer, final CompiledChunk compiledChunkIn) { if (Minecraft.getMinecraft().isCallingFromMinecraftThread()) { if (OpenGlHelper.useVbo()) { this.uploadVertexBuffer(p_178503_2_, chunkRenderer.getVertexBufferByLayer(player.ordinal())); } else { this.uploadDisplayList(p_178503_2_, ((ListedRenderChunk)chunkRenderer).getDisplayList(player, compiledChunkIn), chunkRenderer); } p_178503_2_.setTranslation(0.0D, 0.0D, 0.0D); return Futures.<Object>immediateFuture((Object)null); } else { ListenableFutureTask<Object> listenablefuturetask = ListenableFutureTask.<Object>create(new Runnable() { public void run() { ChunkRenderDispatcher.this.uploadChunk(player, p_178503_2_, chunkRenderer, compiledChunkIn); } }, (Object)null); synchronized (this.queueChunkUploads) { this.queueChunkUploads.add(listenablefuturetask); return listenablefuturetask; } } }
public void deleteGlResources() { this.stopCompileTask(); this.world = null; for (int i = 0; i < EnumWorldBlockLayer.values().length; ++i) { if (this.vertexBuffers[i] != null) { this.vertexBuffers[i].deleteGlBuffers(); } } }
public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator) { CompiledChunk compiledchunk = generator.getCompiledChunk(); if (compiledchunk.getState() != null && !compiledchunk.isLayerEmpty(EnumWorldBlockLayer.TRANSLUCENT)) { WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT); this.preRenderBlocks(worldrenderer, this.position); worldrenderer.setVertexState(compiledchunk.getState()); this.postRenderBlocks(EnumWorldBlockLayer.TRANSLUCENT, x, y, z, worldrenderer, compiledchunk); } }
public RegionRenderCacheBuilder() { this.worldRenderers[EnumWorldBlockLayer.SOLID.ordinal()] = new WorldRenderer(2097152); this.worldRenderers[EnumWorldBlockLayer.CUTOUT.ordinal()] = new WorldRenderer(131072); this.worldRenderers[EnumWorldBlockLayer.CUTOUT_MIPPED.ordinal()] = new WorldRenderer(131072); this.worldRenderers[EnumWorldBlockLayer.TRANSLUCENT.ordinal()] = new WorldRenderer(262144); }
public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator) { CompiledChunk compiledchunk = generator.getCompiledChunk(); if (compiledchunk.getState() != null && !compiledchunk.isLayerEmpty(EnumWorldBlockLayer.TRANSLUCENT)) { this.preRenderBlocks(generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT), this.position); generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT).setVertexState(compiledchunk.getState()); this.postRenderBlocks(EnumWorldBlockLayer.TRANSLUCENT, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(EnumWorldBlockLayer.TRANSLUCENT), compiledchunk); } }
public void renderChunkLayer(EnumWorldBlockLayer layer) { if (this.initialized) { if (this.renderChunks.size() == 0) { return; } for (RenderChunk renderchunk : this.renderChunks) { ListedRenderChunk listedrenderchunk = (ListedRenderChunk)renderchunk; GlStateManager.pushMatrix(); this.preRenderChunk(renderchunk); GL11.glCallList(listedrenderchunk.getDisplayList(layer, listedrenderchunk.getCompiledChunk())); GlStateManager.popMatrix(); } if (Config.isMultiTexture()) { GlStateManager.bindCurrentTexture(); } GlStateManager.resetColor(); this.renderChunks.clear(); } }
public void setBlockLayer(EnumWorldBlockLayer p_setBlockLayer_1_) { this.blockLayer = p_setBlockLayer_1_; if (p_setBlockLayer_1_ == null) { if (this.quadSprites != null) { this.quadSpritesPrev = this.quadSprites; } this.quadSprites = null; this.quadSprite = null; } }
protected void setLayerUsed(EnumWorldBlockLayer layer) { this.empty = false; this.layersUsed[layer.ordinal()] = true; }
public WorldRenderer getWorldRendererByLayer(EnumWorldBlockLayer layer) { return this.worldRenderers[layer.ordinal()]; }
public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT; }
public EnumWorldBlockLayer getBlockLayer() { return this.modelBlock.getBlockLayer(); }
public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; }
public boolean isLayerStarted(EnumWorldBlockLayer layer) { return this.layersStarted[layer.ordinal()]; }
public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.SOLID; }
public void addRenderChunk(RenderChunk renderChunkIn, EnumWorldBlockLayer layer) { this.renderChunks.add(renderChunkIn); }
public void drawMultiTexture() { if (this.quadSprites != null) { int i = Config.getMinecraft().getTextureMapBlocks().getCountRegisteredSprites(); if (this.drawnIcons.length <= i) { this.drawnIcons = new boolean[i + 1]; } Arrays.fill(this.drawnIcons, false); int j = 0; int k = -1; int l = this.vertexCount / 4; for (int i1 = 0; i1 < l; ++i1) { TextureAtlasSprite textureatlassprite = this.quadSprites[i1]; if (textureatlassprite != null) { int j1 = textureatlassprite.getIndexInMap(); if (!this.drawnIcons[j1]) { if (textureatlassprite == TextureUtils.iconGrassSideOverlay) { if (k < 0) { k = i1; } } else { i1 = this.drawForIcon(textureatlassprite, i1) - 1; ++j; if (this.blockLayer != EnumWorldBlockLayer.TRANSLUCENT) { this.drawnIcons[j1] = true; } } } } } if (k >= 0) { this.drawForIcon(TextureUtils.iconGrassSideOverlay, k); ++j; } if (j > 0) { ; } } }
public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.CUTOUT_MIPPED; }