Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PepperCode1 committed Feb 12, 2024
1 parent 96cef68 commit 3160481
Show file tree
Hide file tree
Showing 6 changed files with 530 additions and 486 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package me.jellysquid.mods.sodium.client.render.chunk.compile.buffers;

import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
import me.jellysquid.mods.sodium.client.render.chunk.data.BuiltSectionInfo;
import me.jellysquid.mods.sodium.client.render.chunk.terrain.material.Material;
import me.jellysquid.mods.sodium.client.render.chunk.vertex.builder.ChunkMeshBufferBuilder;
import me.jellysquid.mods.sodium.client.render.chunk.data.BuiltSectionInfo;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.texture.Sprite;

public class BakedChunkModelBuilder implements ChunkModelBuilder {
private final ChunkMeshBufferBuilder[] vertexBuffers;
private final ChunkVertexConsumer vertexConsumerAdapter = new ChunkVertexConsumer(this);
private final ChunkVertexConsumer fallbackVertexConsumer = new ChunkVertexConsumer(this);

private BuiltSectionInfo.Builder renderData;

Expand All @@ -28,9 +28,9 @@ public void addSprite(Sprite sprite) {
}

@Override
public VertexConsumer asVertexConsumer(Material material) {
vertexConsumerAdapter.setMaterial(material);
return vertexConsumerAdapter;
public VertexConsumer asFallbackVertexConsumer(Material material) {
fallbackVertexConsumer.setMaterial(material);
return fallbackVertexConsumer;
}

public void destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@ public interface ChunkModelBuilder {

void addSprite(Sprite sprite);

VertexConsumer asVertexConsumer(Material material);
/**
* <b>This method should not be used unless absolutely necessary!</b> It exists only for compatibility purposes.
* Prefer using the other methods in this class instead as they are more efficient.
*
* <p>Returns a {@link VertexConsumer} which adds geometry to this model builder using the given {@link Material}.
* The returned vertex consumer expects quads and requires the position, color, texture, light, and normal
* attributes to be provided for each vertex. The returned vertex consumer may be a reused object, so it must not be
* stored or cached in any way by the caller.
*
* @param material the material that should be used for geometry pushed to the vertex consumer
* @return the fallback vertex consumer which adds geometry to this model builder
*/
VertexConsumer asFallbackVertexConsumer(Material material);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.block.BlockModels;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.world.World;

public class BlockRenderCache {
private final ArrayLightDataCache lightDataCache;
Expand Down
Loading

0 comments on commit 3160481

Please sign in to comment.