Search in sources :

Example 1 with AccessBufferBuilder

use of net.fabricmc.indigo.renderer.accessor.AccessBufferBuilder in project fabric by FabricMC.

the class ChunkRenderInfo method getInitializedBuffer.

/**
 * Lazily retrieves output buffer for given layer, initializing as needed.
 */
public AccessBufferBuilder getInitializedBuffer(int layerIndex) {
    // redundant for first layer, but probably not faster to check
    resultFlags[layerIndex] = true;
    AccessBufferBuilder result = buffers[layerIndex];
    if (result == null) {
        BufferBuilder builder = chunkTask.getBufferBuilders().get(layerIndex);
        buffers[layerIndex] = (AccessBufferBuilder) builder;
        BlockRenderLayer layer = LAYERS[layerIndex];
        if (!chunkData.isBufferInitialized(layer)) {
            // start buffer
            chunkData.markBufferInitialized(layer);
            ((AccessChunkRenderer) chunkRenderer).fabric_beginBufferBuilding(builder, chunkOrigin);
        }
        result = (AccessBufferBuilder) builder;
    }
    return result;
}
Also used : AccessChunkRenderer(net.fabricmc.indigo.renderer.accessor.AccessChunkRenderer) AccessBufferBuilder(net.fabricmc.indigo.renderer.accessor.AccessBufferBuilder) BufferBuilder(net.minecraft.client.render.BufferBuilder) BlockRenderLayer(net.minecraft.block.BlockRenderLayer) AccessBufferBuilder(net.fabricmc.indigo.renderer.accessor.AccessBufferBuilder)

Aggregations

AccessBufferBuilder (net.fabricmc.indigo.renderer.accessor.AccessBufferBuilder)1 AccessChunkRenderer (net.fabricmc.indigo.renderer.accessor.AccessChunkRenderer)1 BlockRenderLayer (net.minecraft.block.BlockRenderLayer)1 BufferBuilder (net.minecraft.client.render.BufferBuilder)1