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); } } }
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 RenderChunk(World p_i47120_1_, RenderGlobal p_i47120_2_, int p_i47120_3_) { for (int i = 0; i < this.mapEnumFacing.length; ++i) { this.mapEnumFacing[i] = new BlockPos.MutableBlockPos(); } this.world = p_i47120_1_; this.renderGlobal = p_i47120_2_; this.index = p_i47120_3_; if (OpenGlHelper.useVbo()) { for (int j = 0; j < BlockRenderLayer.values().length; ++j) { this.vertexBuffers[j] = new VertexBuffer(DefaultVertexFormats.BLOCK); } } }
@Override public void renderLayer(BlockRenderLayer layer) { if (this.initialized) { for (RenderChunk chunk : this.renderChunks) { VertexBuffer builder = chunk.getVertexBufferByLayer(layer.ordinal()); GlStateManager.pushMatrix(); this.preRender(chunk); chunk.multModelviewMatrix(); builder.bindBuffer(); this.setupArrayPointers(); builder.drawArrays(GL11.GL_QUADS); GlStateManager.popMatrix(); } OpenGlHelper.glBindBuffer(OpenGlHelper.GL_ARRAY_BUFFER, 0); GlStateManager.resetColor(); this.renderChunks.clear(); } }
@Override public void generateSky2() { if (this.sky2VBO != null) { this.sky2VBO.deleteGlBuffers(); } if (this.glSkyList2 >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList2); this.glSkyList2 = -1; } if (this.vboEnabled) { this.sky2VBO = new VertexBuffer(this.vertexBufferFormat); } else { this.glSkyList2 = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); GL11.glEndList(); } }
@Override public void generateSky() { if (this.skyVBO != null) { this.skyVBO.deleteGlBuffers(); } if (this.glSkyList >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList); this.glSkyList = -1; } if (this.vboEnabled) { this.skyVBO = new VertexBuffer(this.vertexBufferFormat); } else { this.glSkyList = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); GL11.glEndList(); } }
private void generateSky2() { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); if (this.sky2VBO != null) { this.sky2VBO.deleteGlBuffers(); } if (this.glSkyList2 >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList2); this.glSkyList2 = -1; } if (this.vboEnabled) { this.sky2VBO = new VertexBuffer(this.vertexBufferFormat); this.renderSky(worldrenderer, -16.0F, true); worldrenderer.finishDrawing(); worldrenderer.reset(); this.sky2VBO.func_181722_a(worldrenderer.getByteBuffer()); } else { this.glSkyList2 = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); this.renderSky(worldrenderer, -16.0F, true); tessellator.draw(); GL11.glEndList(); } }
private void generateSky() { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); if (this.skyVBO != null) { this.skyVBO.deleteGlBuffers(); } if (this.glSkyList >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList); this.glSkyList = -1; } if (this.vboEnabled) { this.skyVBO = new VertexBuffer(this.vertexBufferFormat); this.renderSky(worldrenderer, 16.0F, false); worldrenderer.finishDrawing(); worldrenderer.reset(); this.skyVBO.func_181722_a(worldrenderer.getByteBuffer()); } else { this.glSkyList = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); this.renderSky(worldrenderer, 16.0F, false); tessellator.draw(); GL11.glEndList(); } }
private void generateStars() { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); if (this.starVBO != null) { this.starVBO.deleteGlBuffers(); } if (this.starGLCallList >= 0) { GLAllocation.deleteDisplayLists(this.starGLCallList); this.starGLCallList = -1; } if (this.vboEnabled) { this.starVBO = new VertexBuffer(this.vertexBufferFormat); this.renderStars(worldrenderer); worldrenderer.finishDrawing(); worldrenderer.reset(); this.starVBO.func_181722_a(worldrenderer.getByteBuffer()); } else { this.starGLCallList = GLAllocation.generateDisplayLists(1); GlStateManager.pushMatrix(); GL11.glNewList(this.starGLCallList, GL11.GL_COMPILE); this.renderStars(worldrenderer); tessellator.draw(); GL11.glEndList(); GlStateManager.popMatrix(); } }
public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator) { CompiledChunk compiledchunk = generator.getCompiledChunk(); if (compiledchunk.getState() != null && !compiledchunk.isLayerEmpty(BlockRenderLayer.TRANSLUCENT)) { net.minecraft.client.renderer.VertexBuffer vertexbuffer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockRenderLayer.TRANSLUCENT); this.preRenderBlocks(vertexbuffer, this.position); vertexbuffer.setVertexState(compiledchunk.getState()); this.postRenderBlocks(BlockRenderLayer.TRANSLUCENT, x, y, z, vertexbuffer, compiledchunk); } }
private void postRenderBlocks(BlockRenderLayer layer, float x, float y, float z, net.minecraft.client.renderer.VertexBuffer worldRendererIn, CompiledChunk compiledChunkIn) { if (layer == BlockRenderLayer.TRANSLUCENT && !compiledChunkIn.isLayerEmpty(layer)) { worldRendererIn.sortVertexData(x, y, z); compiledChunkIn.setState(worldRendererIn.getVertexState()); } worldRendererIn.finishDrawing(); }
private void postRenderOverlay(BlockRenderLayer p_postRenderOverlay_1_, RegionRenderCacheBuilder p_postRenderOverlay_2_, CompiledChunk p_postRenderOverlay_3_, boolean[] p_postRenderOverlay_4_) { net.minecraft.client.renderer.VertexBuffer vertexbuffer = p_postRenderOverlay_2_.getWorldRendererByLayer(p_postRenderOverlay_1_); if (vertexbuffer.isDrawing()) { p_postRenderOverlay_3_.setLayerStarted(p_postRenderOverlay_1_); p_postRenderOverlay_4_[p_postRenderOverlay_1_.ordinal()] = true; } }
private void generateSky() { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); if (this.skyVBO != null) { this.skyVBO.deleteGlBuffers(); } if (this.glSkyList >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList); this.glSkyList = -1; } if (this.vboEnabled) { this.skyVBO = new VertexBuffer(this.vertexBufferFormat); this.renderSky(worldrenderer, 16.0F, false); worldrenderer.finishDrawing(); worldrenderer.reset(); this.skyVBO.bufferData(worldrenderer.getByteBuffer(), worldrenderer.getByteIndex()); } else { this.glSkyList = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList, GL11.GL_COMPILE); this.renderSky(worldrenderer, 16.0F, false); tessellator.draw(); GL11.glEndList(); } }
private void generateSky2() { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); if (this.sky2VBO != null) { this.sky2VBO.deleteGlBuffers(); } if (this.glSkyList2 >= 0) { GLAllocation.deleteDisplayLists(this.glSkyList2); this.glSkyList2 = -1; } if (this.vboEnabled) { this.sky2VBO = new VertexBuffer(this.vertexBufferFormat); this.renderSky(worldrenderer, -16.0F, true); worldrenderer.finishDrawing(); worldrenderer.reset(); this.sky2VBO.bufferData(worldrenderer.getByteBuffer(), worldrenderer.getByteIndex()); } else { this.glSkyList2 = GLAllocation.generateDisplayLists(1); GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE); this.renderSky(worldrenderer, -16.0F, true); tessellator.draw(); GL11.glEndList(); } }
public void setVertexBuffer(VertexBuffer vertexBufferIn) { this.vertexBuffer = vertexBufferIn; }
private void uploadVertexBuffer(WorldRenderer p_178506_1_, VertexBuffer vertexBufferIn) { this.vertexUploader.setVertexBuffer(vertexBufferIn); this.vertexUploader.func_181679_a(p_178506_1_); }
public VertexBuffer getVertexBufferByLayer(int layer) { return this.vertexBuffers[layer]; }
private void preRenderBlocks(net.minecraft.client.renderer.VertexBuffer worldRendererIn, BlockPos pos) { worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); }