Add functionality to fake blockId for shaders

This commit is contained in:
Fabian Maurer authored and Jason Mitchell committed 2025-04-24 14:11:24 -07:00
1 parent 1e71b1c4d8
commit 720aaca1b7
13 files changed
+56 -15

No files matched your search

@@ -17,7 +17,7 @@ public class ChunkModelVertexTransformer extends AbstractVertexTransformer<Model
}
@Override
public void writeQuad(float x, float y, float z, int color, float u, float v, int light) {
this.delegate.writeQuad(x + this.offset.x, y + this.offset.y, z + this.offset.z, color, u, v, light);
public void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId) {
this.delegate.writeQuad(x + this.offset.x, y + this.offset.y, z + this.offset.z, color, u, v, light, shaderBlockId);
}
}
@@ -12,6 +12,7 @@ public interface ModelVertexSink extends VertexSink {
* @param u The u-texture of the vertex
* @param v The y-texture of the vertex
* @param light The packed light-map coordinates of the vertex
* @param shaderBlockId The blockId to be passed to the shader
*/
void writeQuad(float x, float y, float z, int color, float u, float v, int light);
void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId);
}
@@ -14,7 +14,7 @@ public class HFPModelVertexBufferWriterNio extends VertexBufferWriterNio impleme
}
@Override
public void writeQuad(float x, float y, float z, int color, float u, float v, int light) {
public void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId) {
this.writeQuadInternal(
ModelVertexUtil.denormalizeVertexPositionFloatAsShort(x),
ModelVertexUtil.denormalizeVertexPositionFloatAsShort(y),
@@ -14,7 +14,7 @@ public class HFPModelVertexBufferWriterUnsafe extends VertexBufferWriterUnsafe i
}
@Override
public void writeQuad(float x, float y, float z, int color, float u, float v, int light) {
public void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId) {
this.writeQuadInternal(
ModelVertexUtil.denormalizeVertexPositionFloatAsShort(x),
ModelVertexUtil.denormalizeVertexPositionFloatAsShort(y),
@@ -13,7 +13,7 @@ public class SFPModelVertexBufferWriterNio extends VertexBufferWriterNio impleme
}
@Override
public void writeQuad(float x, float y, float z, int color, float u, float v, int light) {
public void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId) {
int i = this.writeOffset;
ByteBuffer buffer = this.byteBuffer;
@@ -13,7 +13,7 @@ public class SFPModelVertexBufferWriterUnsafe extends VertexBufferWriterUnsafe i
}
@Override
public void writeQuad(float x, float y, float z, int color, float u, float v, int light) {
public void writeQuad(float x, float y, float z, int color, float u, float v, int light, int shaderBlockId) {
long i = this.writePointer;
memPutFloat(i, x);
@@ -150,6 +150,7 @@ public class BlockRenderer {
final ModelQuadOrientation order = (useSodiumLight || this.useSeparateAo) ? ModelQuadOrientation.orient(light.br) : ModelQuadOrientation.NORMAL;
int shaderBlockId = quad.getShaderBlockId();
for (int dstIndex = 0; dstIndex < 4; dstIndex++) {
final int srcIndex = order.getVertexIndex(dstIndex);
@@ -173,7 +174,7 @@ public class BlockRenderer {
final int lm = (useSeparateAo) ? ModelQuadUtil.mergeBakedLight(quad.getLight(srcIndex), light.lm[srcIndex]) :
(useSodiumLight) ? light.lm[srcIndex] : quad.getLight(srcIndex);
sink.writeQuad(x, y, z, color, u, v, lm);
sink.writeQuad(x, y, z, color, u, v, lm, shaderBlockId);
}
final TextureAtlasSprite sprite = quad.rubidium$getSprite();
@@ -405,7 +405,7 @@ public class FluidRenderer {
int light = this.quadLightData.lm[vertexIdx];
sink.writeQuad(x, y, z, color, u, v, light);
sink.writeQuad(x, y, z, color, u, v, light, -1);
vertexIdx += lightOrder;
}