Search in sources :

Example 1 with SuperByteBufferCache

use of com.simibubi.create.foundation.render.SuperByteBufferCache in project Create by Creators-of-Create.

the class WorldSectionElement method renderLayer.

@Override
protected void renderLayer(PonderWorld world, MultiBufferSource buffer, RenderType type, PoseStack ms, float fade, float pt) {
    SuperByteBufferCache bufferCache = CreateClient.BUFFER_CACHE;
    int code = hashCode() ^ world.hashCode();
    Pair<Integer, Integer> key = Pair.of(code, RenderType.chunkBufferLayers().indexOf(type));
    if (redraw)
        bufferCache.invalidate(DOC_WORLD_SECTION, key);
    SuperByteBuffer contraptionBuffer = bufferCache.get(DOC_WORLD_SECTION, key, () -> buildStructureBuffer(world, type));
    if (contraptionBuffer.isEmpty())
        return;
    transformMS(contraptionBuffer.getTransforms(), pt);
    int light = lightCoordsFromFade(fade);
    contraptionBuffer.light(light).renderInto(ms, buffer.getBuffer(type));
}
Also used : SuperByteBufferCache(com.simibubi.create.foundation.render.SuperByteBufferCache) SuperByteBuffer(com.simibubi.create.foundation.render.SuperByteBuffer)

Aggregations

SuperByteBuffer (com.simibubi.create.foundation.render.SuperByteBuffer)1 SuperByteBufferCache (com.simibubi.create.foundation.render.SuperByteBufferCache)1