use of me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData in project sodium-fabric by CaffeineMC.
the class ChunkRenderDataVBO method uploadMeshes.
@Override
public void uploadMeshes(Object2ObjectMap<RenderLayer, BufferUploadData> layers) {
for (Map.Entry<RenderLayer, BufferUploadData> entry : layers.entrySet()) {
GlVertexBuffer array = this.vbos.get(entry.getKey());
if (array == null) {
throw new NullPointerException("No graphics state container for layer " + entry.getKey());
}
array.upload(entry.getValue());
}
}
use of me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData in project sodium-fabric by CaffeineMC.
the class MixinBufferBuilder method copyData.
@Override
public BufferUploadData copyData() {
BufferBuilder.DrawArrayParameters params = this.parameters.get(this.lastParameterIndex++);
this.buffer.position(this.nextDrawStart);
this.nextDrawStart += params.getCount() * params.getVertexFormat().getVertexSize();
this.buffer.limit(this.nextDrawStart);
if (this.lastParameterIndex == this.parameters.size() && this.vertexCount == 0) {
this.clear();
}
ByteBuffer copy = ByteBuffer.allocateDirect(this.buffer.limit());
copy.put(this.buffer);
copy.flip();
this.buffer.clear();
return new BufferUploadData(copy, this.format);
}
use of me.jellysquid.mods.sodium.client.render.vertex.BufferUploadData 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);
}
Aggregations