fix snow layers mapping; fix block entity mappings; reduce shadow lpv code

This commit is contained in:
NULL511
2024-06-16 16:22:34 -04:00
parent 7443074a9d
commit bf20af2d12
11 changed files with 503 additions and 417 deletions

View File

@ -212,70 +212,71 @@
#define BLOCK_PRESSURE_PLATE 411
#define BLOCK_SLAB_TOP 412
#define BLOCK_SLAB_BOTTOM 413
#define BLOCK_TRAPDOOR_BOTTOM 414
#define BLOCK_TRAPDOOR_TOP 415
#define BLOCK_TRAPDOOR_N 416
#define BLOCK_TRAPDOOR_E 417
#define BLOCK_TRAPDOOR_S 418
#define BLOCK_TRAPDOOR_W 419
#define BLOCK_WALL_POST 420
#define BLOCK_WALL_MIN 420
#define BLOCK_WALL_POST_LOW_N 421
#define BLOCK_WALL_POST_LOW_E 422
#define BLOCK_WALL_POST_LOW_S 423
#define BLOCK_WALL_POST_LOW_W 424
#define BLOCK_WALL_POST_LOW_N_S 425
#define BLOCK_WALL_POST_LOW_W_E 426
#define BLOCK_WALL_POST_LOW_N_W 427
#define BLOCK_WALL_POST_LOW_N_E 428
#define BLOCK_WALL_POST_LOW_S_W 429
#define BLOCK_WALL_POST_LOW_S_E 430
#define BLOCK_WALL_POST_LOW_N_W_S 431
#define BLOCK_WALL_POST_LOW_N_E_S 432
#define BLOCK_WALL_POST_LOW_W_N_E 433
#define BLOCK_WALL_POST_LOW_W_S_E 434
#define BLOCK_WALL_POST_LOW_ALL 435
#define BLOCK_WALL_POST_TALL_N 436
#define BLOCK_WALL_POST_TALL_E 437
#define BLOCK_WALL_POST_TALL_S 438
#define BLOCK_WALL_POST_TALL_W 439
#define BLOCK_WALL_POST_TALL_N_S 440
#define BLOCK_WALL_POST_TALL_W_E 441
#define BLOCK_WALL_POST_TALL_N_W 442
#define BLOCK_WALL_POST_TALL_N_E 443
#define BLOCK_WALL_POST_TALL_S_W 444
#define BLOCK_WALL_POST_TALL_S_E 445
#define BLOCK_WALL_POST_TALL_N_W_S 446
#define BLOCK_WALL_POST_TALL_N_E_S 447
#define BLOCK_WALL_POST_TALL_W_N_E 448
#define BLOCK_WALL_POST_TALL_W_S_E 449
#define BLOCK_WALL_POST_TALL_ALL 450
#define BLOCK_WALL_POST_TALL_N_LOW_S 451
#define BLOCK_WALL_POST_TALL_E_LOW_W 452
#define BLOCK_WALL_POST_TALL_S_LOW_N 453
#define BLOCK_WALL_POST_TALL_W_LOW_E 454
#define BLOCK_WALL_POST_TALL_N_S_LOW_W_E 455
#define BLOCK_WALL_POST_TALL_W_E_LOW_N_S 456
#define BLOCK_WALL_POST_TALL_N_W_LOW_S_E 457
#define BLOCK_WALL_POST_TALL_N_E_LOW_S_W 458
#define BLOCK_WALL_POST_TALL_S_W_LOW_N_E 459
#define BLOCK_WALL_POST_TALL_S_E_LOW_N_W 460
#define BLOCK_WALL_LOW_N_S 461
#define BLOCK_WALL_LOW_W_E 462
#define BLOCK_WALL_LOW_N_W 463
#define BLOCK_WALL_LOW_N_E 464
#define BLOCK_WALL_LOW_S_W 465
#define BLOCK_WALL_LOW_S_E 466
#define BLOCK_WALL_LOW_ALL 467
#define BLOCK_WALL_TALL_N_S 468
#define BLOCK_WALL_TALL_W_E 469
#define BLOCK_WALL_TALL_N_W 470
#define BLOCK_WALL_TALL_N_E 471
#define BLOCK_WALL_TALL_S_W 472
#define BLOCK_WALL_TALL_S_E 473
#define BLOCK_WALL_TALL_ALL 474
#define BLOCK_WALL_TALL_N_S_LOW_W_E 475
#define BLOCK_WALL_TALL_W_E_LOW_N_S 476
#define BLOCK_WALL_MAX 476
#define BLOCK_SNOW_LAYERS 414
#define BLOCK_TRAPDOOR_BOTTOM 415
#define BLOCK_TRAPDOOR_TOP 416
#define BLOCK_TRAPDOOR_N 417
#define BLOCK_TRAPDOOR_E 418
#define BLOCK_TRAPDOOR_S 419
#define BLOCK_TRAPDOOR_W 420
#define BLOCK_WALL_POST 421
#define BLOCK_WALL_MIN 421
#define BLOCK_WALL_POST_LOW_N 422
#define BLOCK_WALL_POST_LOW_E 423
#define BLOCK_WALL_POST_LOW_S 424
#define BLOCK_WALL_POST_LOW_W 425
#define BLOCK_WALL_POST_LOW_N_S 426
#define BLOCK_WALL_POST_LOW_W_E 427
#define BLOCK_WALL_POST_LOW_N_W 428
#define BLOCK_WALL_POST_LOW_N_E 429
#define BLOCK_WALL_POST_LOW_S_W 430
#define BLOCK_WALL_POST_LOW_S_E 431
#define BLOCK_WALL_POST_LOW_N_W_S 432
#define BLOCK_WALL_POST_LOW_N_E_S 433
#define BLOCK_WALL_POST_LOW_W_N_E 434
#define BLOCK_WALL_POST_LOW_W_S_E 435
#define BLOCK_WALL_POST_LOW_ALL 436
#define BLOCK_WALL_POST_TALL_N 437
#define BLOCK_WALL_POST_TALL_E 438
#define BLOCK_WALL_POST_TALL_S 439
#define BLOCK_WALL_POST_TALL_W 440
#define BLOCK_WALL_POST_TALL_N_S 441
#define BLOCK_WALL_POST_TALL_W_E 442
#define BLOCK_WALL_POST_TALL_N_W 443
#define BLOCK_WALL_POST_TALL_N_E 444
#define BLOCK_WALL_POST_TALL_S_W 445
#define BLOCK_WALL_POST_TALL_S_E 446
#define BLOCK_WALL_POST_TALL_N_W_S 447
#define BLOCK_WALL_POST_TALL_N_E_S 448
#define BLOCK_WALL_POST_TALL_W_N_E 449
#define BLOCK_WALL_POST_TALL_W_S_E 450
#define BLOCK_WALL_POST_TALL_ALL 451
#define BLOCK_WALL_POST_TALL_N_LOW_S 452
#define BLOCK_WALL_POST_TALL_E_LOW_W 453
#define BLOCK_WALL_POST_TALL_S_LOW_N 454
#define BLOCK_WALL_POST_TALL_W_LOW_E 455
#define BLOCK_WALL_POST_TALL_N_S_LOW_W_E 456
#define BLOCK_WALL_POST_TALL_W_E_LOW_N_S 457
#define BLOCK_WALL_POST_TALL_N_W_LOW_S_E 458
#define BLOCK_WALL_POST_TALL_N_E_LOW_S_W 459
#define BLOCK_WALL_POST_TALL_S_W_LOW_N_E 460
#define BLOCK_WALL_POST_TALL_S_E_LOW_N_W 461
#define BLOCK_WALL_LOW_N_S 462
#define BLOCK_WALL_LOW_W_E 463
#define BLOCK_WALL_LOW_N_W 464
#define BLOCK_WALL_LOW_N_E 465
#define BLOCK_WALL_LOW_S_W 466
#define BLOCK_WALL_LOW_S_E 467
#define BLOCK_WALL_LOW_ALL 468
#define BLOCK_WALL_TALL_N_S 469
#define BLOCK_WALL_TALL_W_E 470
#define BLOCK_WALL_TALL_N_W 471
#define BLOCK_WALL_TALL_N_E 472
#define BLOCK_WALL_TALL_S_W 473
#define BLOCK_WALL_TALL_S_E 474
#define BLOCK_WALL_TALL_ALL 475
#define BLOCK_WALL_TALL_N_S_LOW_W_E 476
#define BLOCK_WALL_TALL_W_E_LOW_N_S 477
#define BLOCK_WALL_MAX 477
#define BLOCK_END_PORTAL 500
#define BLOCK_SIGN 501

View File

@ -9,3 +9,52 @@ void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
}
void PopulateShadowVoxel(const in vec3 playerPos) {
//int blockId = int(mc_Entity.x + 0.5);
uint voxelId = uint(mc_Entity.x + 0.5);
vec3 originPos = playerPos;
if (
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED
) {
#ifdef IRIS_FEATURE_BLOCK_EMISSION_ATTRIBUTE
if (voxelId == 0u && at_midBlock.w > 0) voxelId = uint(BLOCK_LIGHT_1 + at_midBlock.w - 1);
#endif
if (voxelId == 0u) voxelId = 1u;
originPos += at_midBlock.xyz/64.0;
}
#ifdef LPV_ENTITY_LIGHTS
if (
((renderStage == MC_RENDER_STAGE_ENTITIES && (currentRenderedItemId > 0 || entityId > 0)) || renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES)
) {
if (renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES) {
if (blockEntityId > 0)
voxelId = uint(blockEntityId);
}
else if (currentRenderedItemId > 0 && currentRenderedItemId < 1000) {
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_BLAZE:
case ENTITY_END_CRYSTAL:
// case ENTITY_FIREBALL_SMALL:
case ENTITY_GLOW_SQUID:
case ENTITY_MAGMA_CUBE:
case ENTITY_SPECTRAL_ARROW:
case ENTITY_TNT:
voxelId = uint(entityId);
break;
}
}
}
#endif
if (voxelId > 0u)
SetVoxelBlock(originPos, voxelId);
}