remove translucency code
This commit is contained in:
parent
8678351810
commit
20b9cb4c7c
9 changed files with 22 additions and 283 deletions
|
@ -9,8 +9,7 @@ public class RegionRenderCacheBuilder
|
||||||
public RegionRenderCacheBuilder()
|
public RegionRenderCacheBuilder()
|
||||||
{
|
{
|
||||||
this.buffers[BlockLayer.SOLID.ordinal()] = new RenderBuffer(2097152);
|
this.buffers[BlockLayer.SOLID.ordinal()] = new RenderBuffer(2097152);
|
||||||
this.buffers[BlockLayer.CUTOUT.ordinal()] = new RenderBuffer(262144);
|
this.buffers[BlockLayer.CUTOUT.ordinal()] = new RenderBuffer(524288);
|
||||||
this.buffers[BlockLayer.TRANSLUCENT.ordinal()] = new RenderBuffer(262144);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderBuffer getWorldRendererByLayer(BlockLayer layer)
|
public RenderBuffer getWorldRendererByLayer(BlockLayer layer)
|
||||||
|
|
|
@ -59,78 +59,6 @@ public class RenderBuffer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortVertexData(float p_181674_1_, float p_181674_2_, float p_181674_3_)
|
|
||||||
{
|
|
||||||
int i = this.vertexCount / 4;
|
|
||||||
final float[] afloat = new float[i];
|
|
||||||
|
|
||||||
for (int j = 0; j < i; ++j)
|
|
||||||
{
|
|
||||||
afloat[j] = getDistanceSq(this.rawFloatBuffer, (float)((double)p_181674_1_ + this.xOffset), (float)((double)p_181674_2_ + this.yOffset), (float)((double)p_181674_3_ + this.zOffset), this.vertexFormat.getIntegerSize(), j * this.vertexFormat.getNextOffset());
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer[] ainteger = new Integer[i];
|
|
||||||
|
|
||||||
for (int k = 0; k < ainteger.length; ++k)
|
|
||||||
{
|
|
||||||
ainteger[k] = Integer.valueOf(k);
|
|
||||||
}
|
|
||||||
|
|
||||||
Arrays.sort(ainteger, new Comparator<Integer>()
|
|
||||||
{
|
|
||||||
public int compare(Integer p_compare_1_, Integer p_compare_2_)
|
|
||||||
{
|
|
||||||
return Float.compare(afloat[p_compare_2_.intValue()], afloat[p_compare_1_.intValue()]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
BitSet bitset = new BitSet();
|
|
||||||
int l = this.vertexFormat.getNextOffset();
|
|
||||||
int[] aint = new int[l];
|
|
||||||
|
|
||||||
for (int l1 = 0; (l1 = bitset.nextClearBit(l1)) < ainteger.length; ++l1)
|
|
||||||
{
|
|
||||||
int i1 = ainteger[l1].intValue();
|
|
||||||
|
|
||||||
if (i1 != l1)
|
|
||||||
{
|
|
||||||
this.rawIntBuffer.limit(i1 * l + l);
|
|
||||||
this.rawIntBuffer.position(i1 * l);
|
|
||||||
this.rawIntBuffer.get(aint);
|
|
||||||
int j1 = i1;
|
|
||||||
|
|
||||||
for (int k1 = ainteger[i1].intValue(); j1 != l1; k1 = ainteger[k1].intValue())
|
|
||||||
{
|
|
||||||
this.rawIntBuffer.limit(k1 * l + l);
|
|
||||||
this.rawIntBuffer.position(k1 * l);
|
|
||||||
IntBuffer intbuffer = this.rawIntBuffer.slice();
|
|
||||||
this.rawIntBuffer.limit(j1 * l + l);
|
|
||||||
this.rawIntBuffer.position(j1 * l);
|
|
||||||
this.rawIntBuffer.put(intbuffer);
|
|
||||||
bitset.set(j1);
|
|
||||||
j1 = k1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.rawIntBuffer.limit(l1 * l + l);
|
|
||||||
this.rawIntBuffer.position(l1 * l);
|
|
||||||
this.rawIntBuffer.put(aint);
|
|
||||||
}
|
|
||||||
|
|
||||||
bitset.set(l1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RenderBuffer.State getVertexState()
|
|
||||||
{
|
|
||||||
this.rawIntBuffer.rewind();
|
|
||||||
int i = this.getBufferSize();
|
|
||||||
this.rawIntBuffer.limit(i);
|
|
||||||
int[] aint = new int[i];
|
|
||||||
this.rawIntBuffer.get(aint);
|
|
||||||
this.rawIntBuffer.limit(this.rawIntBuffer.capacity());
|
|
||||||
this.rawIntBuffer.position(i);
|
|
||||||
return new RenderBuffer.State(aint, new VertexFormat(this.vertexFormat));
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getBufferSize()
|
private int getBufferSize()
|
||||||
{
|
{
|
||||||
return this.vertexCount * this.vertexFormat.getIntegerSize();
|
return this.vertexCount * this.vertexFormat.getIntegerSize();
|
||||||
|
@ -156,15 +84,6 @@ public class RenderBuffer
|
||||||
return f12 * f12 + f13 * f13 + f14 * f14;
|
return f12 * f12 + f13 * f13 + f14 * f14;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVertexState(RenderBuffer.State state)
|
|
||||||
{
|
|
||||||
this.rawIntBuffer.clear();
|
|
||||||
this.growBuffer(state.getRawBuffer().length);
|
|
||||||
this.rawIntBuffer.put(state.getRawBuffer());
|
|
||||||
this.vertexCount = state.getVertexCount();
|
|
||||||
this.vertexFormat = new VertexFormat(state.getVertexFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
this.vertexCount = 0;
|
this.vertexCount = 0;
|
||||||
|
@ -561,31 +480,4 @@ public class RenderBuffer
|
||||||
this.putColorRGB_F(red, green, blue, i + 1);
|
this.putColorRGB_F(red, green, blue, i + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class State
|
|
||||||
{
|
|
||||||
private final int[] stateRawBuffer;
|
|
||||||
private final VertexFormat stateVertexFormat;
|
|
||||||
|
|
||||||
public State(int[] buffer, VertexFormat format)
|
|
||||||
{
|
|
||||||
this.stateRawBuffer = buffer;
|
|
||||||
this.stateVertexFormat = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getRawBuffer()
|
|
||||||
{
|
|
||||||
return this.stateRawBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVertexCount()
|
|
||||||
{
|
|
||||||
return this.stateRawBuffer.length / this.stateVertexFormat.getIntegerSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
public VertexFormat getVertexFormat()
|
|
||||||
{
|
|
||||||
return this.stateVertexFormat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1265,16 +1265,16 @@ public class Renderer {
|
||||||
GlState.enableCull();
|
GlState.enableCull();
|
||||||
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||||
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
|
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
this.setupFog(0, partialTicks);
|
// this.setupFog(0, partialTicks);
|
||||||
GlState.enableBlend();
|
// GlState.enableBlend();
|
||||||
GlState.depthMask(false);
|
// GlState.depthMask(false);
|
||||||
this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS);
|
// this.gm.getTextureManager().bindTexture(TextureMap.BLOCKS);
|
||||||
GlState.shadeModel(GL11.GL_SMOOTH);
|
// GlState.shadeModel(GL11.GL_SMOOTH);
|
||||||
this.renderBlockLayer(BlockLayer.TRANSLUCENT, (double)partialTicks, entity);
|
// this.renderBlockLayer(BlockLayer.TRANSLUCENT, (double)partialTicks, entity);
|
||||||
GlState.shadeModel(GL11.GL_FLAT);
|
// GlState.shadeModel(GL11.GL_FLAT);
|
||||||
GlState.depthMask(true);
|
// GlState.depthMask(true);
|
||||||
GlState.enableCull();
|
// GlState.enableCull();
|
||||||
GlState.disableBlend();
|
// GlState.disableBlend();
|
||||||
GlState.disableFog();
|
GlState.disableFog();
|
||||||
|
|
||||||
if (entity.posY + (double)entity.getEyeHeight() >= (double)this.gm.world.dimension.getCloudHeight())
|
if (entity.posY + (double)entity.getEyeHeight() >= (double)this.gm.world.dimension.getCloudHeight())
|
||||||
|
@ -2551,35 +2551,10 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
ItemRenderer.disableStandardItemLighting();
|
ItemRenderer.disableStandardItemLighting();
|
||||||
|
|
||||||
if (blockLayerIn == BlockLayer.TRANSLUCENT)
|
|
||||||
{
|
|
||||||
double d0 = entityIn.posX - this.prevRenderSortX;
|
|
||||||
double d1 = entityIn.posY - this.prevRenderSortY;
|
|
||||||
double d2 = entityIn.posZ - this.prevRenderSortZ;
|
|
||||||
|
|
||||||
if (d0 * d0 + d1 * d1 + d2 * d2 > 1.0D)
|
|
||||||
{
|
|
||||||
this.prevRenderSortX = entityIn.posX;
|
|
||||||
this.prevRenderSortY = entityIn.posY;
|
|
||||||
this.prevRenderSortZ = entityIn.posZ;
|
|
||||||
int k = 0;
|
|
||||||
|
|
||||||
for (RenderInfo renderglobal$containerlocalrenderinformation : this.renderInfos)
|
|
||||||
{
|
|
||||||
if (renderglobal$containerlocalrenderinformation.chunk.compiledChunk.isLayerStarted(blockLayerIn) && k++ < 15)
|
|
||||||
{
|
|
||||||
this.renderDispatcher.updateTransparencyLater(renderglobal$containerlocalrenderinformation.chunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int l = 0;
|
int l = 0;
|
||||||
boolean flag = blockLayerIn == BlockLayer.TRANSLUCENT;
|
int i = this.renderInfos.size();
|
||||||
int i1 = flag ? this.renderInfos.size() - 1 : 0;
|
|
||||||
int i = flag ? -1 : this.renderInfos.size();
|
|
||||||
int j1 = flag ? -1 : 1;
|
|
||||||
|
|
||||||
for (int j = i1; j != i; j += j1)
|
for (int j = 0; j < i; j++)
|
||||||
{
|
{
|
||||||
RenderChunk renderchunk = ((RenderInfo)this.renderInfos.get(j)).chunk;
|
RenderChunk renderchunk = ((RenderInfo)this.renderInfos.get(j)).chunk;
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@ package client.renderer.chunk;
|
||||||
|
|
||||||
public enum BlockLayer {
|
public enum BlockLayer {
|
||||||
SOLID("Solid"),
|
SOLID("Solid"),
|
||||||
CUTOUT("Cutout"),
|
CUTOUT("Cutout");
|
||||||
TRANSLUCENT("Translucent");
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,14 @@ public class ChunkCompileTaskGenerator
|
||||||
private final RenderChunk renderChunk;
|
private final RenderChunk renderChunk;
|
||||||
private final ReentrantLock lock = new ReentrantLock();
|
private final ReentrantLock lock = new ReentrantLock();
|
||||||
private final List<Runnable> listFinishRunnables = Lists.<Runnable>newArrayList();
|
private final List<Runnable> listFinishRunnables = Lists.<Runnable>newArrayList();
|
||||||
private final ChunkCompileTaskGenerator.Type type;
|
|
||||||
private RegionRenderCacheBuilder regionRenderCacheBuilder;
|
private RegionRenderCacheBuilder regionRenderCacheBuilder;
|
||||||
private CompiledChunk compiledChunk;
|
private CompiledChunk compiledChunk;
|
||||||
private ChunkCompileTaskGenerator.Status status = ChunkCompileTaskGenerator.Status.PENDING;
|
private ChunkCompileTaskGenerator.Status status = ChunkCompileTaskGenerator.Status.PENDING;
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
public ChunkCompileTaskGenerator(RenderChunk renderChunkIn, ChunkCompileTaskGenerator.Type typeIn)
|
public ChunkCompileTaskGenerator(RenderChunk renderChunkIn)
|
||||||
{
|
{
|
||||||
this.renderChunk = renderChunkIn;
|
this.renderChunk = renderChunkIn;
|
||||||
this.type = typeIn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkCompileTaskGenerator.Status getStatus()
|
public ChunkCompileTaskGenerator.Status getStatus()
|
||||||
|
@ -73,7 +71,7 @@ public class ChunkCompileTaskGenerator
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (this.type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK && this.status != ChunkCompileTaskGenerator.Status.DONE)
|
if (this.status != ChunkCompileTaskGenerator.Status.DONE)
|
||||||
{
|
{
|
||||||
this.renderChunk.setNeedsUpdate(true);
|
this.renderChunk.setNeedsUpdate(true);
|
||||||
}
|
}
|
||||||
|
@ -116,11 +114,6 @@ public class ChunkCompileTaskGenerator
|
||||||
return this.lock;
|
return this.lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkCompileTaskGenerator.Type getType()
|
|
||||||
{
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFinished()
|
public boolean isFinished()
|
||||||
{
|
{
|
||||||
return this.finished;
|
return this.finished;
|
||||||
|
@ -133,10 +126,4 @@ public class ChunkCompileTaskGenerator
|
||||||
UPLOADING,
|
UPLOADING,
|
||||||
DONE;
|
DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum Type
|
|
||||||
{
|
|
||||||
REBUILD_CHUNK,
|
|
||||||
RESORT_TRANSPARENCY;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,38 +189,6 @@ public class ChunkRenderDispatcher
|
||||||
return (ChunkCompileTaskGenerator)this.queueChunkUpdates.take();
|
return (ChunkCompileTaskGenerator)this.queueChunkUpdates.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateTransparencyLater(RenderChunk chunkRenderer)
|
|
||||||
{
|
|
||||||
chunkRenderer.getLockCompileTask().lock();
|
|
||||||
boolean flag;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskTransparency();
|
|
||||||
|
|
||||||
if (chunkcompiletaskgenerator == null)
|
|
||||||
{
|
|
||||||
flag = true;
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
chunkcompiletaskgenerator.addFinishRunnable(new Runnable()
|
|
||||||
{
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
ChunkRenderDispatcher.this.queueChunkUpdates.remove(chunkcompiletaskgenerator);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
flag = this.queueChunkUpdates.offer(chunkcompiletaskgenerator);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
chunkRenderer.getLockCompileTask().unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ListenableFuture<Object> uploadChunk(final BlockLayer layer, final RenderBuffer buf, final RenderChunk renderer, final CompiledChunk compiled)
|
public ListenableFuture<Object> uploadChunk(final BlockLayer layer, final RenderBuffer buf, final RenderChunk renderer, final CompiledChunk compiled)
|
||||||
{
|
{
|
||||||
if (Client.CLIENT.isMainThread())
|
if (Client.CLIENT.isMainThread())
|
||||||
|
|
|
@ -81,16 +81,8 @@ public class ChunkRenderWorker implements Runnable
|
||||||
float f = (float)lvt_2_1_.posX;
|
float f = (float)lvt_2_1_.posX;
|
||||||
float f1 = (float)lvt_2_1_.posY + lvt_2_1_.getEyeHeight();
|
float f1 = (float)lvt_2_1_.posY + lvt_2_1_.getEyeHeight();
|
||||||
float f2 = (float)lvt_2_1_.posZ;
|
float f2 = (float)lvt_2_1_.posZ;
|
||||||
ChunkCompileTaskGenerator.Type chunkcompiletaskgenerator$type = generator.getType();
|
|
||||||
|
|
||||||
if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK)
|
|
||||||
{
|
|
||||||
generator.getRenderChunk().rebuildChunk(f, f1, f2, generator);
|
generator.getRenderChunk().rebuildChunk(f, f1, f2, generator);
|
||||||
}
|
|
||||||
else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY)
|
|
||||||
{
|
|
||||||
generator.getRenderChunk().resortTransparency(f, f1, f2, generator);
|
|
||||||
}
|
|
||||||
|
|
||||||
generator.getLock().lock();
|
generator.getLock().lock();
|
||||||
|
|
||||||
|
@ -117,8 +109,6 @@ public class ChunkRenderWorker implements Runnable
|
||||||
final CompiledChunk compiled = generator.getCompiledChunk();
|
final CompiledChunk compiled = generator.getCompiledChunk();
|
||||||
List<ListenableFuture<Object>> list = Lists.newArrayList();
|
List<ListenableFuture<Object>> list = Lists.newArrayList();
|
||||||
|
|
||||||
if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK)
|
|
||||||
{
|
|
||||||
for (BlockLayer enumworldblocklayer : BlockLayer.values())
|
for (BlockLayer enumworldblocklayer : BlockLayer.values())
|
||||||
{
|
{
|
||||||
if (compiled.isLayerStarted(enumworldblocklayer))
|
if (compiled.isLayerStarted(enumworldblocklayer))
|
||||||
|
@ -126,11 +116,6 @@ public class ChunkRenderWorker implements Runnable
|
||||||
list.add(this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), generator.getRenderChunk(), compiled));
|
list.add(this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), generator.getRenderChunk(), compiled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY)
|
|
||||||
{
|
|
||||||
list.add(this.chunkRenderDispatcher.uploadChunk(BlockLayer.TRANSLUCENT, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockLayer.TRANSLUCENT), generator.getRenderChunk(), compiled));
|
|
||||||
}
|
|
||||||
|
|
||||||
ChunkBuilder.addCallback(list, generator, compiled, this);
|
ChunkBuilder.addCallback(list, generator, compiled, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package client.renderer.chunk;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import client.renderer.RenderBuffer;
|
|
||||||
import common.collect.Lists;
|
import common.collect.Lists;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -29,7 +28,6 @@ public class CompiledChunk
|
||||||
private boolean empty = true;
|
private boolean empty = true;
|
||||||
private final List<TileEntity> tileEntities = Lists.<TileEntity>newArrayList();
|
private final List<TileEntity> tileEntities = Lists.<TileEntity>newArrayList();
|
||||||
private SetVisibility setVisibility = new SetVisibility();
|
private SetVisibility setVisibility = new SetVisibility();
|
||||||
private RenderBuffer.State state;
|
|
||||||
|
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
|
@ -76,14 +74,4 @@ public class CompiledChunk
|
||||||
{
|
{
|
||||||
this.setVisibility = visibility;
|
this.setVisibility = visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderBuffer.State getState()
|
|
||||||
{
|
|
||||||
return this.state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setState(RenderBuffer.State stateIn)
|
|
||||||
{
|
|
||||||
this.state = stateIn;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,18 +97,6 @@ public class RenderChunk
|
||||||
this.initModelviewMatrix();
|
this.initModelviewMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resortTransparency(float x, float y, float z, ChunkCompileTaskGenerator generator)
|
|
||||||
{
|
|
||||||
CompiledChunk compiledchunk = generator.getCompiledChunk();
|
|
||||||
|
|
||||||
if (compiledchunk.getState() != null && !compiledchunk.isLayerEmpty(BlockLayer.TRANSLUCENT))
|
|
||||||
{
|
|
||||||
this.preRenderBlocks(generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockLayer.TRANSLUCENT), this.position);
|
|
||||||
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockLayer.TRANSLUCENT).setVertexState(compiledchunk.getState());
|
|
||||||
this.postRenderBlocks(BlockLayer.TRANSLUCENT, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockLayer.TRANSLUCENT), compiledchunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator)
|
public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator)
|
||||||
{
|
{
|
||||||
CompiledChunk compiledchunk = new CompiledChunk();
|
CompiledChunk compiledchunk = new CompiledChunk();
|
||||||
|
@ -193,7 +181,7 @@ public class RenderChunk
|
||||||
|
|
||||||
if (compiledchunk.isLayerStarted(enumworldblocklayer))
|
if (compiledchunk.isLayerStarted(enumworldblocklayer))
|
||||||
{
|
{
|
||||||
this.postRenderBlocks(enumworldblocklayer, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), compiledchunk);
|
generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer).finishDrawing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +236,7 @@ public class RenderChunk
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.finishCompileTask();
|
this.finishCompileTask();
|
||||||
this.compileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.REBUILD_CHUNK);
|
this.compileTask = new ChunkCompileTaskGenerator(this);
|
||||||
chunkcompiletaskgenerator = this.compileTask;
|
chunkcompiletaskgenerator = this.compileTask;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -259,54 +247,12 @@ public class RenderChunk
|
||||||
return chunkcompiletaskgenerator;
|
return chunkcompiletaskgenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkCompileTaskGenerator makeCompileTaskTransparency()
|
|
||||||
{
|
|
||||||
this.lockCompileTask.lock();
|
|
||||||
ChunkCompileTaskGenerator chunkcompiletaskgenerator;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (this.compileTask == null || this.compileTask.getStatus() != ChunkCompileTaskGenerator.Status.PENDING)
|
|
||||||
{
|
|
||||||
if (this.compileTask != null && this.compileTask.getStatus() != ChunkCompileTaskGenerator.Status.DONE)
|
|
||||||
{
|
|
||||||
this.compileTask.finish();
|
|
||||||
this.compileTask = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.compileTask = new ChunkCompileTaskGenerator(this, ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY);
|
|
||||||
this.compileTask.setCompiledChunk(this.compiledChunk);
|
|
||||||
chunkcompiletaskgenerator = this.compileTask;
|
|
||||||
return chunkcompiletaskgenerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
chunkcompiletaskgenerator = null;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
this.lockCompileTask.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return chunkcompiletaskgenerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos)
|
private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos)
|
||||||
{
|
{
|
||||||
worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
worldRendererIn.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||||
worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postRenderBlocks(BlockLayer layer, float x, float y, float z, RenderBuffer worldRendererIn, CompiledChunk compiledChunkIn)
|
|
||||||
{
|
|
||||||
if (layer == BlockLayer.TRANSLUCENT && !compiledChunkIn.isLayerEmpty(layer))
|
|
||||||
{
|
|
||||||
worldRendererIn.sortVertexData(x, y, z);
|
|
||||||
compiledChunkIn.setState(worldRendererIn.getVertexState());
|
|
||||||
}
|
|
||||||
|
|
||||||
worldRendererIn.finishDrawing();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initModelviewMatrix()
|
private void initModelviewMatrix()
|
||||||
{
|
{
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue