Search in sources :

Example 1 with CloneableBufferBuilder

use of me.jellysquid.mods.sodium.client.render.chunk.CloneableBufferBuilder in project sodium-fabric by CaffeineMC.

the class ChunkRenderRebuildTask method performBuild.

@Override
public ChunkRenderUploadTask performBuild(VertexBufferCache buffers) {
    ChunkMeshInfo meshInfo;
    Object2ObjectMap<RenderLayer, BufferUploadData> uploads;
    if (this.region == null) {
        meshInfo = new ChunkMeshInfo();
        meshInfo.occlusionGraph = new ChunkOcclusionData();
        meshInfo.occlusionGraph.addOpenEdgeFaces(EnumSet.allOf(Direction.class));
        uploads = Object2ObjectMaps.emptyMap();
    } else {
        meshInfo = this.generateMesh(buffers);
        uploads = new Object2ObjectArrayMap<>();
        for (RenderLayer layer : meshInfo.presentLayers) {
            BufferBuilder builder = buffers.get(layer);
            builder.end();
            uploads.put(layer, ((CloneableBufferBuilder) builder).copyData());
        }
    }
    return new Result(this.render, meshInfo, uploads);
}
Also used : ChunkOcclusionData(net.minecraft.client.render.chunk.ChunkOcclusionData) BufferBuilder(net.minecraft.client.render.BufferBuilder) CloneableBufferBuilder(me.jellysquid.mods.sodium.client.render.chunk.CloneableBufferBuilder) RenderLayer(net.minecraft.client.render.RenderLayer) BufferUploadData(me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData) Direction(net.minecraft.util.math.Direction)

Aggregations

CloneableBufferBuilder (me.jellysquid.mods.sodium.client.render.chunk.CloneableBufferBuilder)1 BufferUploadData (me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData)1 BufferBuilder (net.minecraft.client.render.BufferBuilder)1 RenderLayer (net.minecraft.client.render.RenderLayer)1 ChunkOcclusionData (net.minecraft.client.render.chunk.ChunkOcclusionData)1 Direction (net.minecraft.util.math.Direction)1