add support for Iris BLOCK_EMISSION_ATTRIBUTE to auto add lights to the floodfill

This commit is contained in:
fayer3
2024-06-12 16:58:20 +02:00
parent 9bc16c418d
commit b001751de4
4 changed files with 28 additions and 7 deletions

View File

@ -54,7 +54,11 @@ uniform int entityId;
#include "/lib/entities.glsl"
#ifdef IS_LPV_ENABLED
attribute vec3 at_midBlock;
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
attribute vec4 at_midBlock;
#else
attribute vec3 at_midBlock;
#endif
uniform int currentRenderedItemId;
uniform int renderStage;
@ -204,9 +208,12 @@ void main() {
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED
) {
uint voxelId = uint(blockId);
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
if (voxelId == 0u && at_midBlock.w > 0) voxelId = BLOCK_LIGHT_1 + uint(at_midBlock.w - 1);
#endif
if (voxelId == 0u) voxelId = 1u;
vec3 originPos = playerpos + at_midBlock/64.0;
vec3 originPos = playerpos + at_midBlock.xyz/64.0;
SetVoxelBlock(originPos, voxelId);
}