Skip to content

Commit b3c0c25

Browse files
authored
Fixes everything being cutout (#3571)
* fix some of the frapi stuff * enhanced
1 parent ca366ac commit b3c0c25

3 files changed

Lines changed: 10 additions & 12 deletions

File tree

common/src/main/java/net/caffeinemc/mods/sodium/client/render/model/AbstractBlockRenderContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ public void bufferDefaultModel(BlockStateModelPart part, Predicate<Direction> cu
238238
final BakedQuad q = quads.get(j);
239239
editorQuad.fromBakedQuad(q);
240240
editorQuad.setCullFace(cullFace);
241-
editorQuad.setRenderType(q.materialInfo().layer());
242241
editorQuad.setAmbientOcclusion(ao.toTriState());
242+
editorQuad.setShadeMode(SodiumShadeMode.ENHANCED);
243243
// Call processQuad instead of emit for efficiency
244244
// (avoid unnecessarily clearing data, trying to apply transforms, and performing cull check again)
245245

common/src/main/java/net/caffeinemc/mods/sodium/client/render/model/EncodingFormat.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@ private EncodingFormat() { }
101101
private static final int DIRECTION_COUNT = Direction.values().length;
102102
private static final int NULLABLE_DIRECTION_COUNT = DIRECTION_COUNT + 1;
103103

104-
private static final ChunkSectionLayer[] CHUNK_SECTION_LAYERS = ChunkSectionLayer.values();
105-
private static final int CHUNK_SECTION_LAYER_COUNT = CHUNK_SECTION_LAYERS.length;
106104
private static final RenderType[] ITEM_RENDER_TYPES = ItemRenderType.RENDER_TYPES;
107105
private static final int ITEM_RENDER_TYPE_COUNT = ITEM_RENDER_TYPES.length;
108-
private static final @Nullable ChunkSectionLayer[] NULLABLE_BLOCK_RENDER_LAYERS = ArrayUtils.add(ChunkSectionLayer.values(), null);
109-
private static final int NULLABLE_BLOCK_RENDER_LAYER_COUNT = NULLABLE_BLOCK_RENDER_LAYERS.length;
106+
private static final @Nullable ChunkSectionLayer[] NULLABLE_CHUNK_SECTION_LAYERS = ArrayUtils.add(ChunkSectionLayer.values(), null);
107+
private static final int NULLABLE_CHUNK_SECTION_LAYER_COUNT = NULLABLE_CHUNK_SECTION_LAYERS.length;
110108
private static final TriState[] TRI_STATES = TriState.values();
111109
private static final int TRI_STATE_COUNT = TRI_STATES.length;
112110
private static final @Nullable ItemStackRenderState.FoilType[] NULLABLE_GLINTS = ArrayUtils.add(ItemStackRenderState.FoilType.values(), null);
@@ -116,16 +114,15 @@ private EncodingFormat() { }
116114
private static final SodiumQuadAtlas[] QUAD_ATLASES = SodiumQuadAtlas.values();
117115
private static final int QUAD_ATLAS_COUNT = QUAD_ATLASES.length;
118116

119-
private static final int NULL_RENDER_LAYER_INDEX = NULLABLE_BLOCK_RENDER_LAYER_COUNT - 1;
117+
private static final int NULL_CHUNK_SECTION_LAYER_INDEX = NULLABLE_CHUNK_SECTION_LAYER_COUNT - 1;
120118
private static final int NULL_GLINT_INDEX = NULLABLE_GLINT_COUNT - 1;
121119

122120
private static final int CULL_BIT_LENGTH = Mth.ceillog2(NULLABLE_DIRECTION_COUNT);
123121
private static final int LIGHT_BIT_LENGTH = Mth.ceillog2(DIRECTION_COUNT);
124122
private static final int NORMALS_BIT_LENGTH = 4;
125123
private static final int NORMAL_FACE_BIT_LENGTH = 3;
126-
private static final int CHUNK_LAYER_BIT_LENGTH = Mth.ceillog2(CHUNK_SECTION_LAYER_COUNT);
124+
private static final int CHUNK_LAYER_BIT_LENGTH = Mth.ceillog2(NULLABLE_CHUNK_SECTION_LAYER_COUNT);
127125
private static final int ITEM_RENDER_TYPE_BIT_LENGTH = Mth.ceillog2(ITEM_RENDER_TYPE_COUNT);
128-
private static final int RENDER_LAYER_BIT_LENGTH = Mth.ceillog2(NULLABLE_BLOCK_RENDER_LAYER_COUNT);
129126
private static final int EMISSIVE_BIT_LENGTH = 1;
130127
private static final int DIFFUSE_BIT_LENGTH = 1;
131128
private static final int AO_BIT_LENGTH = Mth.ceillog2(TRI_STATE_COUNT);
@@ -156,7 +153,7 @@ private EncodingFormat() { }
156153
private static final int NORMAL_FACE_MASK = bitMask(NORMAL_FACE_BIT_LENGTH, NORMAL_FACE_BIT_OFFSET);
157154
private static final int NORMALS_MASK = bitMask(NORMALS_BIT_LENGTH, NORMALS_BIT_OFFSET);
158155
private static final int GEOMETRY_MASK = bitMask(GEOMETRY_BIT_LENGTH, GEOMETRY_BIT_OFFSET);
159-
private static final int RENDER_LAYER_MASK = bitMask(RENDER_LAYER_BIT_LENGTH, CHUNK_LAYER_BIT_OFFSET);
156+
private static final int CHUNK_LAYER_MASK = bitMask(CHUNK_LAYER_BIT_LENGTH, CHUNK_LAYER_BIT_OFFSET);
160157
private static final int QUAD_ATLAS_MASK = bitMask(QUAD_ATLAS_BIT_LENGTH, QUAD_ATLAS_BIT_OFFSET);
161158
private static final int EMISSIVE_MASK = bitMask(EMISSIVE_BIT_LENGTH, EMISSIVE_BIT_OFFSET);
162159
private static final int DIFFUSE_MASK = bitMask(DIFFUSE_BIT_LENGTH, DIFFUSE_BIT_OFFSET);
@@ -219,12 +216,12 @@ static int normalFace(int bits, ModelQuadFacing face) {
219216

220217
@Nullable
221218
static ChunkSectionLayer renderLayer(int bits) {
222-
return NULLABLE_BLOCK_RENDER_LAYERS[(bits & RENDER_LAYER_MASK) >>> CHUNK_LAYER_BIT_OFFSET];
219+
return NULLABLE_CHUNK_SECTION_LAYERS[(bits & CHUNK_LAYER_MASK) >>> CHUNK_LAYER_BIT_OFFSET];
223220
}
224221

225222
static int renderLayer(int bits, @Nullable ChunkSectionLayer renderLayer) {
226-
int index = renderLayer == null ? NULL_RENDER_LAYER_INDEX : renderLayer.ordinal();
227-
return (bits & ~RENDER_LAYER_MASK) | (index << CHUNK_LAYER_BIT_OFFSET);
223+
int index = renderLayer == null ? NULL_CHUNK_SECTION_LAYER_INDEX : renderLayer.ordinal();
224+
return (bits & ~CHUNK_LAYER_MASK) | (index << CHUNK_LAYER_BIT_OFFSET);
228225
}
229226

230227
static boolean emissive(int bits) {

common/src/main/java/net/caffeinemc/mods/sodium/client/render/model/MutableQuadViewImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ public final MutableQuadViewImpl fromBakedQuad(BakedQuad quad) {
289289
setTintIndex(quad.materialInfo().tintIndex());
290290
setAmbientOcclusion(((BakedQuadView) (Object) quad).hasAO() ? TriState.DEFAULT : TriState.FALSE); // TODO: TRUE, or DEFAULT?
291291
setItemRenderType(quad.materialInfo().itemRenderType());
292+
setRenderType(quad.materialInfo().layer());
292293
setAnimated(quad.materialInfo().sprite().contents().isAnimated());
293294
setEmissive(quad.materialInfo().lightEmission() == 15);
294295

0 commit comments

Comments
 (0)