floodfill propagation

This commit is contained in:
NULL511 2024-05-01 16:32:25 -04:00
parent c4b51fcf9a
commit 2f6b51bbff
10 changed files with 1083 additions and 14 deletions

790
shaders/lib/blocks.glsl Normal file
View File

@ -0,0 +1,790 @@
#define BLOCK_WATER 10
#define BLOCK_ALLIUM 100
#define BLOCK_AZALEA 101
#define BLOCK_AZURE_BLUET 102
#define BLOCK_BAMBOO 103
#define BLOCK_BEETROOTS 104
#define BLOCK_BIG_DRIPLEAF 105
#define BLOCK_BIG_DRIPLEAF_STEM 106
#define BLOCK_BLUE_ORCHID 107
#define BLOCK_BROWN_MUSHROOM_PLANT 108
#define BLOCK_CARROTS 109
#define BLOCK_CAVE_VINE 110
#define BLOCK_CHORUS_FLOWER 111
#define BLOCK_CORNFLOWER 112
#define BLOCK_CRIMSON_FUNGUS 113
#define BLOCK_CRIMSON_ROOTS 114
#define BLOCK_DANDELION 115
#define BLOCK_DEAD_BUSH 116
#define BLOCK_FERN 117
#define BLOCK_GRASS 118
#define BLOCK_HANGING_ROOTS 119
#define BLOCK_KELP 120
#define BLOCK_LARGE_FERN_LOWER 121
#define BLOCK_LARGE_FERN_UPPER 122
#define BLOCK_LILAC_LOWER 123
#define BLOCK_LILAC_UPPER 124
#define BLOCK_LILY_OF_THE_VALLEY 125
#define BLOCK_LILY_PAD 126
#define BLOCK_MANGROVE_PROPAGULE 127
#define BLOCK_NETHER_SPROUTS 128
#define BLOCK_NETHER_WART 129
#define BLOCK_OXEYE_DAISY 130
#define BLOCK_PEONY_LOWER 131
#define BLOCK_PEONY_UPPER 132
#define BLOCK_PINK_PETALS 133
#define BLOCK_PITCHER_CROP 134
#define BLOCK_PITCHER_PLANT 135
#define BLOCK_POPPY 136
#define BLOCK_POTATOES 137
#define BLOCK_RED_MUSHROOM_PLANT 138
#define BLOCK_ROSE_BUSH_LOWER 139
#define BLOCK_ROSE_BUSH_UPPER 140
#define BLOCK_SAPLING 141
#define BLOCK_SCULK_VEIN 142
#define BLOCK_SEA_PICKLE_DRY_1 143
#define BLOCK_SEA_PICKLE_DRY_2 144
#define BLOCK_SEA_PICKLE_DRY_3 145
#define BLOCK_SEA_PICKLE_DRY_4 146
#define BLOCK_SEAGRASS 147
#define BLOCK_SMALL_DRIPLEAF 148
#define BLOCK_SPORE_BLOSSOM 149
#define BLOCK_SUGAR_CANE 150
#define BLOCK_SUNFLOWER_LOWER 151
#define BLOCK_SUNFLOWER_UPPER 152
#define BLOCK_SWEET_BERRY_BUSH 153
#define BLOCK_TALL_GRASS_LOWER 154
#define BLOCK_TALL_GRASS_UPPER 155
#define BLOCK_TORCHFLOWER 156
#define BLOCK_TULIP 157
#define BLOCK_TWISTING_VINES 158
#define BLOCK_VINE 159
#define BLOCK_WARPED_FUNGUS 160
#define BLOCK_WARPED_ROOTS 161
#define BLOCK_WEEPING_VINES 162
#define BLOCK_WHEAT 163
#define BLOCK_WITHER_ROSE 164
#define BLOCK_MUSHROOM_SPORES 165
#define BLOCK_AMETHYST 200
#define BLOCK_AMETHYST_BUD_LARGE 201
#define BLOCK_AMETHYST_BUD_MEDIUM 202
#define BLOCK_AMETHYST_BUD_SMALL 203
#define BLOCK_AMETHYST_CLUSTER 204
#define BLOCK_BEACON 205
#define BLOCK_BLAST_FURNACE_LIT_N 206
#define BLOCK_BLAST_FURNACE_LIT_E 207
#define BLOCK_BLAST_FURNACE_LIT_S 208
#define BLOCK_BLAST_FURNACE_LIT_W 209
#define BLOCK_BREWING_STAND 210
#define BLOCK_CAMPFIRE_LIT_N_S 211
#define BLOCK_CAMPFIRE_LIT_W_E 212
#define BLOCK_CAVEVINE_BERRIES 213
#define BLOCK_COMPARATOR_LIT 214
#define BLOCK_COPPER_BULB_LIT 215
#define BLOCK_COPPER_BULB_EXPOSED_LIT 216
#define BLOCK_COPPER_BULB_OXIDIZED_LIT 217
#define BLOCK_COPPER_BULB_WEATHERED_LIT 218
#define BLOCK_CRYING_OBSIDIAN 219
#define BLOCK_DIAMOND 220
#define BLOCK_EMERALD 221
#define BLOCK_END_ROD 222
#define BLOCK_FIRE 223
#define BLOCK_FROGLIGHT_OCHRE 224
#define BLOCK_FROGLIGHT_PEARLESCENT 225
#define BLOCK_FROGLIGHT_VERDANT 226
#define BLOCK_FURNACE_LIT_N 227
#define BLOCK_FURNACE_LIT_E 228
#define BLOCK_FURNACE_LIT_S 229
#define BLOCK_FURNACE_LIT_W 230
#define BLOCK_GLOWSTONE 231
#define BLOCK_GLOW_LICHEN 232
#define BLOCK_LAPIS 233
#define BLOCK_JACK_O_LANTERN_N 234
#define BLOCK_JACK_O_LANTERN_E 235
#define BLOCK_JACK_O_LANTERN_S 236
#define BLOCK_JACK_O_LANTERN_W 237
#define BLOCK_LANTERN_CEIL 238
#define BLOCK_LANTERN_FLOOR 239
#define BLOCK_LAVA 240
#define BLOCK_LIGHT_1 241
#define BLOCK_LIGHT_2 242
#define BLOCK_LIGHT_3 243
#define BLOCK_LIGHT_4 244
#define BLOCK_LIGHT_5 245
#define BLOCK_LIGHT_6 246
#define BLOCK_LIGHT_7 247
#define BLOCK_LIGHT_8 248
#define BLOCK_LIGHT_9 249
#define BLOCK_LIGHT_10 250
#define BLOCK_LIGHT_11 251
#define BLOCK_LIGHT_12 252
#define BLOCK_LIGHT_13 253
#define BLOCK_LIGHT_14 254
#define BLOCK_LIGHT_15 255
#define BLOCK_LIGHTING_ROD_POWERED 256
#define BLOCK_MAGMA 257
#define BLOCK_NETHER_PORTAL 258
#define BLOCK_RAIL_POWERED 259
#define BLOCK_REDSTONE 260
#define BLOCK_REDSTONE_ILLUMINATOR_14 261
#define BLOCK_REDSTONE_ILLUMINATOR_13 262
#define BLOCK_REDSTONE_ILLUMINATOR_12 263
#define BLOCK_REDSTONE_ILLUMINATOR_11 264
#define BLOCK_REDSTONE_ILLUMINATOR_10 265
#define BLOCK_REDSTONE_ILLUMINATOR_9 266
#define BLOCK_REDSTONE_ILLUMINATOR_8 267
#define BLOCK_REDSTONE_ILLUMINATOR_7 268
#define BLOCK_REDSTONE_ILLUMINATOR_6 269
#define BLOCK_REDSTONE_ILLUMINATOR_5 270
#define BLOCK_REDSTONE_ILLUMINATOR_4 271
#define BLOCK_REDSTONE_ILLUMINATOR_3 272
#define BLOCK_REDSTONE_ILLUMINATOR_2 273
#define BLOCK_REDSTONE_ILLUMINATOR_1 274
#define BLOCK_REDSTONE_ILLUMINATOR_0 275
#define BLOCK_REDSTONE_LAMP_LIT 276
#define BLOCK_REDSTONE_ORE_LIT 277
#define BLOCK_REDSTONE_TORCH_FLOOR_LIT 278
#define BLOCK_REDSTONE_TORCH_WALL_N_LIT 279
#define BLOCK_REDSTONE_TORCH_WALL_E_LIT 280
#define BLOCK_REDSTONE_TORCH_WALL_S_LIT 281
#define BLOCK_REDSTONE_TORCH_WALL_W_LIT 282
#define BLOCK_REDSTONE_WIRE_1 283
#define BLOCK_REDSTONE_WIRE_2 284
#define BLOCK_REDSTONE_WIRE_3 285
#define BLOCK_REDSTONE_WIRE_4 286
#define BLOCK_REDSTONE_WIRE_5 287
#define BLOCK_REDSTONE_WIRE_6 288
#define BLOCK_REDSTONE_WIRE_7 289
#define BLOCK_REDSTONE_WIRE_8 290
#define BLOCK_REDSTONE_WIRE_9 291
#define BLOCK_REDSTONE_WIRE_10 292
#define BLOCK_REDSTONE_WIRE_11 293
#define BLOCK_REDSTONE_WIRE_12 294
#define BLOCK_REDSTONE_WIRE_13 295
#define BLOCK_REDSTONE_WIRE_14 296
#define BLOCK_REDSTONE_WIRE_15 297
#define BLOCK_REPEATER_LIT 298
#define BLOCK_RESPAWN_ANCHOR_4 299
#define BLOCK_RESPAWN_ANCHOR_3 300
#define BLOCK_RESPAWN_ANCHOR_2 301
#define BLOCK_RESPAWN_ANCHOR_1 302
#define BLOCK_SCULK_CATALYST 303
#define BLOCK_SEA_LANTERN 304
#define BLOCK_SEA_PICKLE_WET_1 305
#define BLOCK_SEA_PICKLE_WET_2 306
#define BLOCK_SEA_PICKLE_WET_3 307
#define BLOCK_SEA_PICKLE_WET_4 308
#define BLOCK_SHROOMLIGHT 309
#define BLOCK_SMOKER_LIT_N 310
#define BLOCK_SMOKER_LIT_E 311
#define BLOCK_SMOKER_LIT_S 312
#define BLOCK_SMOKER_LIT_W 313
#define BLOCK_SOUL_CAMPFIRE_LIT_N_S 314
#define BLOCK_SOUL_CAMPFIRE_LIT_W_E 315
#define BLOCK_SOUL_FIRE 316
#define BLOCK_SOUL_LANTERN_CEIL 317
#define BLOCK_SOUL_LANTERN_FLOOR 318
#define BLOCK_SOUL_TORCH_FLOOR 319
#define BLOCK_SOUL_TORCH_WALL_N 320
#define BLOCK_SOUL_TORCH_WALL_E 321
#define BLOCK_SOUL_TORCH_WALL_S 322
#define BLOCK_SOUL_TORCH_WALL_W 323
#define BLOCK_TORCH_FLOOR 324
#define BLOCK_TORCH_WALL_N 325
#define BLOCK_TORCH_WALL_E 326
#define BLOCK_TORCH_WALL_S 327
#define BLOCK_TORCH_WALL_W 328
#define BLOCK_CREATE_XP 329
#define BLOCK_ROSE_QUARTZ_LAMP_LIT 330
#define BLOCK_DECO_LAMP_BLUE_LIT 331
#define BLOCK_DECO_LAMP_GREEN_LIT 332
#define BLOCK_DECO_LAMP_RED_LIT 333
#define BLOCK_DECO_LAMP_YELLOW_LIT 334
#define BLOCK_STREET_LAMP_LIT 335
#define BLOCK_SOUL_STREET_LAMP_LIT 336
#define BLOCK_PAPER_LAMP_LIT_BLACK 337
#define BLOCK_PAPER_LAMP_LIT_BLUE 338
#define BLOCK_PAPER_LAMP_LIT_BROWN 339
#define BLOCK_PAPER_LAMP_LIT_CYAN 340
#define BLOCK_PAPER_LAMP_LIT_GRAY 341
#define BLOCK_PAPER_LAMP_LIT_GREEN 342
#define BLOCK_PAPER_LAMP_LIT_LIGHT_BLUE 343
#define BLOCK_PAPER_LAMP_LIT_LIGHT_GRAY 344
#define BLOCK_PAPER_LAMP_LIT_LIME 345
#define BLOCK_PAPER_LAMP_LIT_MAGENTA 346
#define BLOCK_PAPER_LAMP_LIT_ORANGE 347
#define BLOCK_PAPER_LAMP_LIT_PINK 348
#define BLOCK_PAPER_LAMP_LIT_PURPLE 349
#define BLOCK_PAPER_LAMP_LIT_RED 350
#define BLOCK_PAPER_LAMP_LIT_WHITE 351
#define BLOCK_PAPER_LAMP_LIT_YELLOW 352
#define BLOCK_LAMP_LIT_BLACK 353
#define BLOCK_LAMP_LIT_BLUE 354
#define BLOCK_LAMP_LIT_BROWN 355
#define BLOCK_LAMP_LIT_CYAN 356
#define BLOCK_LAMP_LIT_GRAY 357
#define BLOCK_LAMP_LIT_GREEN 358
#define BLOCK_LAMP_LIT_LIGHT_BLUE 359
#define BLOCK_LAMP_LIT_LIGHT_GRAY 360
#define BLOCK_LAMP_LIT_LIME 361
#define BLOCK_LAMP_LIT_MAGENTA 362
#define BLOCK_LAMP_LIT_ORANGE 363
#define BLOCK_LAMP_LIT_PINK 364
#define BLOCK_LAMP_LIT_PURPLE 365
#define BLOCK_LAMP_LIT_RED 366
#define BLOCK_LAMP_LIT_WHITE 367
#define BLOCK_LAMP_LIT_YELLOW 368
#define BLOCK_CEILING_LIGHT_LIT_BLACK 369
#define BLOCK_CEILING_LIGHT_LIT_BLUE 370
#define BLOCK_CEILING_LIGHT_LIT_BROWN 371
#define BLOCK_CEILING_LIGHT_LIT_CYAN 372
#define BLOCK_CEILING_LIGHT_LIT_GRAY 373
#define BLOCK_CEILING_LIGHT_LIT_GREEN 374
#define BLOCK_CEILING_LIGHT_LIT_LIGHT_BLUE 375
#define BLOCK_CEILING_LIGHT_LIT_LIGHT_GRAY 376
#define BLOCK_CEILING_LIGHT_LIT_LIME 377
#define BLOCK_CEILING_LIGHT_LIT_MAGENTA 378
#define BLOCK_CEILING_LIGHT_LIT_ORANGE 379
#define BLOCK_CEILING_LIGHT_LIT_PINK 380
#define BLOCK_CEILING_LIGHT_LIT_PURPLE 381
#define BLOCK_CEILING_LIGHT_LIT_RED 382
#define BLOCK_CEILING_LIGHT_LIT_WHITE 383
#define BLOCK_CEILING_LIGHT_LIT_YELLOW 384
#define BLOCK_END_STONE_LAMP 385
#define BLOCK_ANVIL_N_S 400
#define BLOCK_ANVIL_W_E 401
#define BLOCK_BED_HEAD_N 402
#define BLOCK_BED_HEAD_E 403
#define BLOCK_BED_HEAD_S 404
#define BLOCK_BED_HEAD_W 405
#define BLOCK_BED_FOOT_N 406
#define BLOCK_BED_FOOT_E 407
#define BLOCK_BED_FOOT_S 408
#define BLOCK_BED_FOOT_W 409
#define BLOCK_BELL_FLOOR_N_S 410
#define BLOCK_BELL_FLOOR_W_E 411
#define BLOCK_BELL_WALL_N 412
#define BLOCK_BELL_WALL_E 413
#define BLOCK_BELL_WALL_S 414
#define BLOCK_BELL_WALL_W 415
#define BLOCK_BELL_WALL_N_S 416
#define BLOCK_BELL_WALL_W_E 417
#define BLOCK_BELL_CEILING 418
#define BLOCK_CACTUS 419
#define BLOCK_CAKE 420
#define BLOCK_CAMPFIRE_N_S 421
#define BLOCK_CAMPFIRE_W_E 422
#define BLOCK_CANDLE_CAKE 423
#define BLOCK_CANDLE_CAKE_LIT 424
#define BLOCK_CANDLES_1 425
#define BLOCK_CANDLES_2 426
#define BLOCK_CANDLES_3 427
#define BLOCK_CANDLES_4 428
#define BLOCK_PLAIN_CANDLES_LIT_1 429
#define BLOCK_PLAIN_CANDLES_LIT_2 430
#define BLOCK_PLAIN_CANDLES_LIT_3 431
#define BLOCK_PLAIN_CANDLES_LIT_4 432
#define BLOCK_BLACK_CANDLES_LIT_1 433
#define BLOCK_BLACK_CANDLES_LIT_2 434
#define BLOCK_BLACK_CANDLES_LIT_3 435
#define BLOCK_BLACK_CANDLES_LIT_4 436
#define BLOCK_BLUE_CANDLES_LIT_1 437
#define BLOCK_BLUE_CANDLES_LIT_2 438
#define BLOCK_BLUE_CANDLES_LIT_3 439
#define BLOCK_BLUE_CANDLES_LIT_4 440
#define BLOCK_BROWN_CANDLES_LIT_1 441
#define BLOCK_BROWN_CANDLES_LIT_2 442
#define BLOCK_BROWN_CANDLES_LIT_3 443
#define BLOCK_BROWN_CANDLES_LIT_4 444
#define BLOCK_CYAN_CANDLES_LIT_1 445
#define BLOCK_CYAN_CANDLES_LIT_2 446
#define BLOCK_CYAN_CANDLES_LIT_3 447
#define BLOCK_CYAN_CANDLES_LIT_4 448
#define BLOCK_GRAY_CANDLES_LIT_1 449
#define BLOCK_GRAY_CANDLES_LIT_2 450
#define BLOCK_GRAY_CANDLES_LIT_3 451
#define BLOCK_GRAY_CANDLES_LIT_4 452
#define BLOCK_GREEN_CANDLES_LIT_1 453
#define BLOCK_GREEN_CANDLES_LIT_2 454
#define BLOCK_GREEN_CANDLES_LIT_3 455
#define BLOCK_GREEN_CANDLES_LIT_4 456
#define BLOCK_LIGHT_BLUE_CANDLES_LIT_1 457
#define BLOCK_LIGHT_BLUE_CANDLES_LIT_2 458
#define BLOCK_LIGHT_BLUE_CANDLES_LIT_3 459
#define BLOCK_LIGHT_BLUE_CANDLES_LIT_4 460
#define BLOCK_LIGHT_GRAY_CANDLES_LIT_1 461
#define BLOCK_LIGHT_GRAY_CANDLES_LIT_2 462
#define BLOCK_LIGHT_GRAY_CANDLES_LIT_3 463
#define BLOCK_LIGHT_GRAY_CANDLES_LIT_4 464
#define BLOCK_LIME_CANDLES_LIT_1 465
#define BLOCK_LIME_CANDLES_LIT_2 466
#define BLOCK_LIME_CANDLES_LIT_3 467
#define BLOCK_LIME_CANDLES_LIT_4 468
#define BLOCK_MAGENTA_CANDLES_LIT_1 469
#define BLOCK_MAGENTA_CANDLES_LIT_2 470
#define BLOCK_MAGENTA_CANDLES_LIT_3 471
#define BLOCK_MAGENTA_CANDLES_LIT_4 472
#define BLOCK_ORANGE_CANDLES_LIT_1 473
#define BLOCK_ORANGE_CANDLES_LIT_2 474
#define BLOCK_ORANGE_CANDLES_LIT_3 475
#define BLOCK_ORANGE_CANDLES_LIT_4 476
#define BLOCK_PINK_CANDLES_LIT_1 477
#define BLOCK_PINK_CANDLES_LIT_2 478
#define BLOCK_PINK_CANDLES_LIT_3 479
#define BLOCK_PINK_CANDLES_LIT_4 480
#define BLOCK_PURPLE_CANDLES_LIT_1 481
#define BLOCK_PURPLE_CANDLES_LIT_2 482
#define BLOCK_PURPLE_CANDLES_LIT_3 483
#define BLOCK_PURPLE_CANDLES_LIT_4 484
#define BLOCK_RED_CANDLES_LIT_1 485
#define BLOCK_RED_CANDLES_LIT_2 486
#define BLOCK_RED_CANDLES_LIT_3 487
#define BLOCK_RED_CANDLES_LIT_4 488
#define BLOCK_WHITE_CANDLES_LIT_1 489
#define BLOCK_WHITE_CANDLES_LIT_2 490
#define BLOCK_WHITE_CANDLES_LIT_3 491
#define BLOCK_WHITE_CANDLES_LIT_4 492
#define BLOCK_YELLOW_CANDLES_LIT_1 493
#define BLOCK_YELLOW_CANDLES_LIT_2 494
#define BLOCK_YELLOW_CANDLES_LIT_3 495
#define BLOCK_YELLOW_CANDLES_LIT_4 496
#define BLOCK_CANDLES_LIT_1 497
#define BLOCK_CANDLES_LIT_2 498
#define BLOCK_CANDLES_LIT_3 499
#define BLOCK_CANDLES_LIT_4 500
#define BLOCK_CANDLE_HOLDER_LIT_1 501
#define BLOCK_CANDLE_HOLDER_LIT_2 502
#define BLOCK_CANDLE_HOLDER_LIT_3 503
#define BLOCK_CANDLE_HOLDER_LIT_4 504
#define BLOCK_CARPET 505
#define BLOCK_CAULDRON 506
#define BLOCK_CAULDRON_LAVA 507
#define BLOCK_CHEST_N 508
#define BLOCK_CHEST_E 509
#define BLOCK_CHEST_S 510
#define BLOCK_CHEST_W 511
#define BLOCK_CHEST_LEFT_N 512
#define BLOCK_CHEST_LEFT_E 513
#define BLOCK_CHEST_LEFT_S 514
#define BLOCK_CHEST_LEFT_W 515
#define BLOCK_CHEST_RIGHT_N 516
#define BLOCK_CHEST_RIGHT_E 517
#define BLOCK_CHEST_RIGHT_S 518
#define BLOCK_CHEST_RIGHT_W 519
#define BLOCK_COCOA_0_N 520
#define BLOCK_COCOA_0_E 521
#define BLOCK_COCOA_0_W 522
#define BLOCK_COCOA_0_S 523
#define BLOCK_COCOA_1_N 524
#define BLOCK_COCOA_1_E 525
#define BLOCK_COCOA_1_W 526
#define BLOCK_COCOA_1_S 527
#define BLOCK_COCOA_2_N 528
#define BLOCK_COCOA_2_E 529
#define BLOCK_COCOA_2_W 530
#define BLOCK_COCOA_2_S 531
#define BLOCK_COMPARATOR 532
#define BLOCK_COMPOSTER 533
#define BLOCK_DAYLIGHT_DETECTOR 534
#define BLOCK_DECORATED_POT 535
#define BLOCK_ENCHANTING_TABLE 536
#define BLOCK_END_PORTAL_FRAME 537
#define BLOCK_FLOWER_POT 538
#define BLOCK_GRINDSTONE_FLOOR_N_S 539
#define BLOCK_GRINDSTONE_FLOOR_W_E 540
#define BLOCK_GRINDSTONE_WALL_N 541
#define BLOCK_GRINDSTONE_WALL_E 542
#define BLOCK_GRINDSTONE_WALL_S 543
#define BLOCK_GRINDSTONE_WALL_W 544
#define BLOCK_HOPPER_DOWN 545
#define BLOCK_HOPPER_N 546
#define BLOCK_HOPPER_E 547
#define BLOCK_HOPPER_S 548
#define BLOCK_HOPPER_W 549
#define BLOCK_LECTERN 550
#define BLOCK_LIGHTNING_ROD_N 551
#define BLOCK_LIGHTNING_ROD_E 552
#define BLOCK_LIGHTNING_ROD_S 553
#define BLOCK_LIGHTNING_ROD_W 554
#define BLOCK_LIGHTNING_ROD_UP 555
#define BLOCK_LIGHTNING_ROD_DOWN 556
#define BLOCK_PATHWAY 557
#define BLOCK_PISTON_EXTENDED_N 558
#define BLOCK_PISTON_EXTENDED_E 559
#define BLOCK_PISTON_EXTENDED_S 560
#define BLOCK_PISTON_EXTENDED_W 561
#define BLOCK_PISTON_EXTENDED_UP 562
#define BLOCK_PISTON_EXTENDED_DOWN 563
#define BLOCK_PISTON_HEAD_N 564
#define BLOCK_PISTON_HEAD_E 565
#define BLOCK_PISTON_HEAD_S 566
#define BLOCK_PISTON_HEAD_W 567
#define BLOCK_PISTON_HEAD_UP 568
#define BLOCK_PISTON_HEAD_DOWN 569
#define BLOCK_POTTED_PLANT 570
#define BLOCK_PRESSURE_PLATE 571
#define BLOCK_PRESSURE_PLATE_DOWN 572
#define BLOCK_REPEATER 573
#define BLOCK_SCULK_SENSOR 574
#define BLOCK_SCULK_SHRIEKER 575
#define BLOCK_SHULKER_BOX 576
#define BLOCK_SIGN_WALL_N 577
#define BLOCK_SIGN_WALL_E 578
#define BLOCK_SIGN_WALL_S 579
#define BLOCK_SIGN_WALL_W 580
#define BLOCK_SNIFFER_EGG 581
#define BLOCK_SNOW_LAYERS_1 582
#define BLOCK_SNOW_LAYERS_2 583
#define BLOCK_SNOW_LAYERS_3 584
#define BLOCK_SNOW_LAYERS_4 585
#define BLOCK_SNOW_LAYERS_5 586
#define BLOCK_SNOW_LAYERS_6 587
#define BLOCK_SNOW_LAYERS_7 588
#define BLOCK_STONECUTTER 589
#define BLOCK_CREATE_BASIN 590
#define BLOCK_CREATE_BLAZE_BURNER 591
#define BLOCK_CREATE_CHUTE 592
#define BLOCK_CREATE_CLUTCH_X 593
#define BLOCK_CREATE_CLUTCH_Y 594
#define BLOCK_CREATE_CLUTCH_Z 595
#define BLOCK_CREATE_CONTENT_OBSERVER_N 596
#define BLOCK_CREATE_CONTENT_OBSERVER_E 597
#define BLOCK_CREATE_CONTENT_OBSERVER_S 598
#define BLOCK_CREATE_CONTENT_OBSERVER_W 599
#define BLOCK_CREATE_COPYCAT_PANEL_N 600
#define BLOCK_CREATE_COPYCAT_PANEL_E 601
#define BLOCK_CREATE_COPYCAT_PANEL_S 602
#define BLOCK_CREATE_COPYCAT_PANEL_W 603
#define BLOCK_CREATE_COPYCAT_PANEL_UP 604
#define BLOCK_CREATE_COPYCAT_PANEL_DOWN 605
#define BLOCK_CREATE_COPYCAT_STEP_BOTTOM_N 606
#define BLOCK_CREATE_COPYCAT_STEP_BOTTOM_E 607
#define BLOCK_CREATE_COPYCAT_STEP_BOTTOM_S 608
#define BLOCK_CREATE_COPYCAT_STEP_BOTTOM_W 609
#define BLOCK_CREATE_COPYCAT_STEP_TOP_N 610
#define BLOCK_CREATE_COPYCAT_STEP_TOP_E 611
#define BLOCK_CREATE_COPYCAT_STEP_TOP_S 612
#define BLOCK_CREATE_COPYCAT_STEP_TOP_W 613
#define BLOCK_CREATE_DEPOT 614
#define BLOCK_CREATE_DISPLAY_BOARD_N_S 615
#define BLOCK_CREATE_DISPLAY_BOARD_W_E 616
#define BLOCK_CREATE_ENCASED_FAN_N 617
#define BLOCK_CREATE_ENCASED_FAN_E 618
#define BLOCK_CREATE_ENCASED_FAN_S 619
#define BLOCK_CREATE_ENCASED_FAN_W 620
#define BLOCK_CREATE_ENCASED_FAN_UP 621
#define BLOCK_CREATE_ENCASED_FAN_DOWN 622
#define BLOCK_CREATE_GEARBOX_X 623
#define BLOCK_CREATE_GEARBOX_Y 624
#define BLOCK_CREATE_GEARBOX_Z 625
#define BLOCK_CREATE_GEARSHIFT_X 626
#define BLOCK_CREATE_GEARSHIFT_Y 627
#define BLOCK_CREATE_GEARSHIFT_Z 628
#define BLOCK_CREATE_GIRDER_X 629
#define BLOCK_CREATE_GIRDER_X_TOP 630
#define BLOCK_CREATE_GIRDER_X_BOTTOM 631
#define BLOCK_CREATE_GIRDER_X_TOP_BOTTOM 632
#define BLOCK_CREATE_GIRDER_Y 633
#define BLOCK_CREATE_GIRDER_Z 634
#define BLOCK_CREATE_GIRDER_Z_TOP 635
#define BLOCK_CREATE_GIRDER_Z_BOTTOM 636
#define BLOCK_CREATE_GIRDER_Z_TOP_BOTTOM 637
#define BLOCK_CREATE_GIRDER_XZ 638
#define BLOCK_CREATE_ITEM_DRAIN 639
#define BLOCK_CREATE_MILLSTONE 640
#define BLOCK_CREATE_NIXIE_TUBE_FLOOR_N_S 641
#define BLOCK_CREATE_NIXIE_TUBE_FLOOR_W_E 642
#define BLOCK_CREATE_NIXIE_TUBE_CEIL_N_S 643
#define BLOCK_CREATE_NIXIE_TUBE_CEIL_W_E 644
#define BLOCK_CREATE_NIXIE_TUBE_WALL_N 645
#define BLOCK_CREATE_NIXIE_TUBE_WALL_E 646
#define BLOCK_CREATE_NIXIE_TUBE_WALL_S 647
#define BLOCK_CREATE_NIXIE_TUBE_WALL_W 648
#define BLOCK_CREATE_PIPE_U_D 649
#define BLOCK_CREATE_PIPE_N_S 650
#define BLOCK_CREATE_PIPE_W_E 651
#define BLOCK_CREATE_PIPE_N_W 652
#define BLOCK_CREATE_PIPE_N_E 653
#define BLOCK_CREATE_PIPE_S_W 654
#define BLOCK_CREATE_PIPE_S_E 655
#define BLOCK_CREATE_PIPE_U_N 656
#define BLOCK_CREATE_PIPE_U_E 657
#define BLOCK_CREATE_PIPE_U_S 658
#define BLOCK_CREATE_PIPE_U_W 659
#define BLOCK_CREATE_PIPE_D_N 660
#define BLOCK_CREATE_PIPE_D_E 661
#define BLOCK_CREATE_PIPE_D_S 662
#define BLOCK_CREATE_PIPE_D_W 663
#define BLOCK_CREATE_SCAFFOLDING_BOTTOM 664
#define BLOCK_CREATE_SEAT 665
#define BLOCK_CREATE_SHAFT_X 666
#define BLOCK_CREATE_SHAFT_Y 667
#define BLOCK_CREATE_SHAFT_Z 668
#define BLOCK_CREATE_SPEED_CONTROLLER_X 669
#define BLOCK_CREATE_SPEED_CONTROLLER_Z 670
#define BLOCK_CREATE_SPOUT 671
#define BLOCK_CREATE_SUPPORT_VERTICAL 672
#define BLOCK_CREATE_SUPPORT_N_S 673
#define BLOCK_CREATE_SUPPORT_W_E 674
#define BLOCK_CREATE_TRACK_SIGNAL 675
#define BLOCK_CREATE_TRACK_STATION 676
#define BLOCK_CREATE_WEIGHTED_EJECTOR_N_S 677
#define BLOCK_CREATE_WEIGHTED_EJECTOR_W_E 678
#define BLOCK_CRANK_UP 679
#define BLOCK_CRANK_DOWN 680
#define BLOCK_CRANK_N 681
#define BLOCK_CRANK_E 682
#define BLOCK_CRANK_S 683
#define BLOCK_CRANK_W 684
#define BLOCK_FAUCET_N 685
#define BLOCK_FAUCET_E 686
#define BLOCK_FAUCET_S 687
#define BLOCK_FAUCET_W 688
#define BLOCK_BUTTON_FLOOR_N_S 689
#define BLOCK_BUTTON_FLOOR_W_E 690
#define BLOCK_BUTTON_CEILING_N_S 691
#define BLOCK_BUTTON_CEILING_W_E 692
#define BLOCK_BUTTON_WALL_N 693
#define BLOCK_BUTTON_WALL_E 694
#define BLOCK_BUTTON_WALL_S 695
#define BLOCK_BUTTON_WALL_W 696
#define BLOCK_CHORUS_DOWN 697
#define BLOCK_CHORUS_UP_DOWN 698
#define BLOCK_CHORUS_OTHER 699
#define BLOCK_DOOR_N 700
#define BLOCK_DOOR_E 701
#define BLOCK_DOOR_S 702
#define BLOCK_DOOR_W 703
#define BLOCK_TRAPDOOR_BOTTOM 704
#define BLOCK_TRAPDOOR_MIN 704
#define BLOCK_TRAPDOOR_TOP 705
#define BLOCK_TRAPDOOR_N 706
#define BLOCK_TRAPDOOR_E 707
#define BLOCK_TRAPDOOR_S 708
#define BLOCK_TRAPDOOR_W 709
#define BLOCK_TRAPDOOR_MAX 709
#define BLOCK_LEVER_FLOOR_N_S 710
#define BLOCK_LEVER_FLOOR_W_E 711
#define BLOCK_LEVER_CEILING_N_S 712
#define BLOCK_LEVER_CEILING_W_E 713
#define BLOCK_LEVER_WALL_N 714
#define BLOCK_LEVER_WALL_E 715
#define BLOCK_LEVER_WALL_S 716
#define BLOCK_LEVER_WALL_W 717
#define BLOCK_TRIPWIRE_HOOK_N 718
#define BLOCK_TRIPWIRE_HOOK_E 719
#define BLOCK_TRIPWIRE_HOOK_S 720
#define BLOCK_TRIPWIRE_HOOK_W 721
#define BLOCK_SLAB_TOP 722
#define BLOCK_SLAB_BOTTOM 723
#define BLOCK_SLAB_VERTICAL_N 724
#define BLOCK_SLAB_VERTICAL_E 725
#define BLOCK_SLAB_VERTICAL_S 726
#define BLOCK_SLAB_VERTICAL_W 727
#define BLOCK_STAIRS_BOTTOM_N 728
#define BLOCK_STAIRS_MIN 728
#define BLOCK_STAIRS_BOTTOM_E 729
#define BLOCK_STAIRS_BOTTOM_S 730
#define BLOCK_STAIRS_BOTTOM_W 731
#define BLOCK_STAIRS_BOTTOM_INNER_S_E 732
#define BLOCK_STAIRS_BOTTOM_INNER_S_W 733
#define BLOCK_STAIRS_BOTTOM_INNER_N_W 734
#define BLOCK_STAIRS_BOTTOM_INNER_N_E 735
#define BLOCK_STAIRS_BOTTOM_OUTER_N_W 736
#define BLOCK_STAIRS_BOTTOM_OUTER_N_E 737
#define BLOCK_STAIRS_BOTTOM_OUTER_S_E 738
#define BLOCK_STAIRS_BOTTOM_OUTER_S_W 739
#define BLOCK_STAIRS_TOP_N 740
#define BLOCK_STAIRS_TOP_E 741
#define BLOCK_STAIRS_TOP_S 742
#define BLOCK_STAIRS_TOP_W 743
#define BLOCK_STAIRS_TOP_INNER_S_E 744
#define BLOCK_STAIRS_TOP_INNER_S_W 745
#define BLOCK_STAIRS_TOP_INNER_N_W 746
#define BLOCK_STAIRS_TOP_INNER_N_E 747
#define BLOCK_STAIRS_TOP_OUTER_N_W 748
#define BLOCK_STAIRS_TOP_OUTER_N_E 749
#define BLOCK_STAIRS_TOP_OUTER_S_E 750
#define BLOCK_STAIRS_TOP_OUTER_S_W 751
#define BLOCK_STAIRS_MAX 751
#define BLOCK_FENCE_POST 752
#define BLOCK_FENCE_N 753
#define BLOCK_FENCE_E 754
#define BLOCK_FENCE_S 755
#define BLOCK_FENCE_W 756
#define BLOCK_FENCE_N_S 757
#define BLOCK_FENCE_W_E 758
#define BLOCK_FENCE_N_W 759
#define BLOCK_FENCE_N_E 760
#define BLOCK_FENCE_S_W 761
#define BLOCK_FENCE_S_E 762
#define BLOCK_FENCE_W_N_E 763
#define BLOCK_FENCE_W_S_E 764
#define BLOCK_FENCE_N_W_S 765
#define BLOCK_FENCE_N_E_S 766
#define BLOCK_FENCE_ALL 767
#define BLOCK_FENCE_GATE_CLOSED_N_S 768
#define BLOCK_FENCE_GATE_CLOSED_W_E 769
#define BLOCK_WALL_POST 770
#define BLOCK_WALL_MIN 770
#define BLOCK_WALL_POST_LOW_N 771
#define BLOCK_WALL_POST_LOW_E 772
#define BLOCK_WALL_POST_LOW_S 773
#define BLOCK_WALL_POST_LOW_W 774
#define BLOCK_WALL_POST_LOW_N_S 775
#define BLOCK_WALL_POST_LOW_W_E 776
#define BLOCK_WALL_POST_LOW_N_W 777
#define BLOCK_WALL_POST_LOW_N_E 778
#define BLOCK_WALL_POST_LOW_S_W 779
#define BLOCK_WALL_POST_LOW_S_E 780
#define BLOCK_WALL_POST_LOW_N_W_S 781
#define BLOCK_WALL_POST_LOW_N_E_S 782
#define BLOCK_WALL_POST_LOW_W_N_E 783
#define BLOCK_WALL_POST_LOW_W_S_E 784
#define BLOCK_WALL_POST_LOW_ALL 785
#define BLOCK_WALL_POST_TALL_N 786
#define BLOCK_WALL_POST_TALL_E 787
#define BLOCK_WALL_POST_TALL_S 788
#define BLOCK_WALL_POST_TALL_W 789
#define BLOCK_WALL_POST_TALL_N_S 790
#define BLOCK_WALL_POST_TALL_W_E 791
#define BLOCK_WALL_POST_TALL_N_W 792
#define BLOCK_WALL_POST_TALL_N_E 793
#define BLOCK_WALL_POST_TALL_S_W 794
#define BLOCK_WALL_POST_TALL_S_E 795
#define BLOCK_WALL_POST_TALL_N_W_S 796
#define BLOCK_WALL_POST_TALL_N_E_S 797
#define BLOCK_WALL_POST_TALL_W_N_E 798
#define BLOCK_WALL_POST_TALL_W_S_E 799
#define BLOCK_WALL_POST_TALL_ALL 800
#define BLOCK_WALL_POST_TALL_N_LOW_S 801
#define BLOCK_WALL_POST_TALL_E_LOW_W 802
#define BLOCK_WALL_POST_TALL_S_LOW_N 803
#define BLOCK_WALL_POST_TALL_W_LOW_E 804
#define BLOCK_WALL_POST_TALL_N_S_LOW_W_E 805
#define BLOCK_WALL_POST_TALL_W_E_LOW_N_S 806
#define BLOCK_WALL_POST_TALL_N_W_LOW_S_E 807
#define BLOCK_WALL_POST_TALL_N_E_LOW_S_W 808
#define BLOCK_WALL_POST_TALL_S_W_LOW_N_E 809
#define BLOCK_WALL_POST_TALL_S_E_LOW_N_W 810
#define BLOCK_WALL_LOW_N_S 811
#define BLOCK_WALL_LOW_W_E 812
#define BLOCK_WALL_LOW_N_W 813
#define BLOCK_WALL_LOW_N_E 814
#define BLOCK_WALL_LOW_S_W 815
#define BLOCK_WALL_LOW_S_E 816
#define BLOCK_WALL_LOW_ALL 817
#define BLOCK_WALL_TALL_N_S 818
#define BLOCK_WALL_TALL_W_E 819
#define BLOCK_WALL_TALL_N_W 820
#define BLOCK_WALL_TALL_N_E 821
#define BLOCK_WALL_TALL_S_W 822
#define BLOCK_WALL_TALL_S_E 823
#define BLOCK_WALL_TALL_ALL 824
#define BLOCK_WALL_TALL_N_S_LOW_W_E 825
#define BLOCK_WALL_TALL_W_E_LOW_N_S 826
#define BLOCK_WALL_MAX 826
#define BLOCK_HONEY 827
#define BLOCK_LEAVES 828
#define BLOCK_LEAVES_CHERRY 829
#define BLOCK_POWDER_SNOW 830
#define BLOCK_ROOTS 831
#define BLOCK_SLIME 832
#define BLOCK_SNOW 833
#define BLOCK_STAINED_GLASS_BLACK 834
#define BLOCK_STAINED_GLASS_BLUE 835
#define BLOCK_STAINED_GLASS_BROWN 836
#define BLOCK_STAINED_GLASS_CYAN 837
#define BLOCK_STAINED_GLASS_GRAY 838
#define BLOCK_STAINED_GLASS_GREEN 839
#define BLOCK_STAINED_GLASS_LIGHT_BLUE 840
#define BLOCK_STAINED_GLASS_LIGHT_GRAY 841
#define BLOCK_STAINED_GLASS_LIME 842
#define BLOCK_STAINED_GLASS_MAGENTA 843
#define BLOCK_STAINED_GLASS_ORANGE 844
#define BLOCK_STAINED_GLASS_PINK 845
#define BLOCK_STAINED_GLASS_PURPLE 846
#define BLOCK_STAINED_GLASS_RED 847
#define BLOCK_STAINED_GLASS_WHITE 848
#define BLOCK_STAINED_GLASS_YELLOW 849
#define BLOCK_TINTED_GLASS 850
#define BLOCK_CANDLE_HOLDER_UNLIT 851
#define BLOCK_CHAIN 900
#define BLOCK_COBWEB 901
#define BLOCK_CORAL 902
#define BLOCK_CORAL_FAN 903
#define BLOCK_CORAL_WALL_FAN 904
#define BLOCK_FENCE_GATE_OPEN 905
#define BLOCK_GLASS 906
#define BLOCK_GLASS_PANE 907
#define BLOCK_ICE 908
#define BLOCK_IRON_BARS 909
#define BLOCK_LADDER 910
#define BLOCK_LIGHT_0 911
#define BLOCK_POINTED_DRIPSTONE 912
#define BLOCK_RAIL 913
#define BLOCK_REDSTONE_TORCH 914
#define BLOCK_REDSTONE_WIRE 915
#define BLOCK_SCAFFOLDING 916
#define BLOCK_SPAWNER 917
#define BLOCK_STEM 918
#define BLOCK_TRIPWIRE 919
#define BLOCK_TURTLE_EGG 920
#define BLOCK_WALL_NONE 921
#define BLOCK_BIGGLOBE_CHARRED_GRASS 922
#define BLOCK_BIGGLOBE_FLINT 923
#define BLOCK_BIGGLOBE_ROCK 924
#define BLOCK_BIGGLOBE_STICK 925
#define BLOCK_BIGGLOBE_WART_WEED 926
#define BLOCK_CREATE_CUCKOO_CLOCK 927
#define BLOCK_CREATE_FUNNEL 928
#define BLOCK_CREATE_GLASS_DOOR 929
#define BLOCK_CREATE_GLASS_TRAPDOOR 930
#define BLOCK_CREATE_GANTRY_SHAFT_POWERED 931
#define BLOCK_CREATE_LADDER 932
#define BLOCK_CREATE_MOTOR 933
#define BLOCK_CREATE_PISTON_POLE 934
#define BLOCK_CREATE_REDSTONE_LINK 935
#define BLOCK_CREATE_SPEEDOMETER 936
#define BLOCK_CREATE_STRESSOMETER 937
#define BLOCK_CREATE_TRACK 938
#define BLOCK_CREATE_WINDOW_PANE 939
#define BLOCK_DECO_CATWALK 940
#define BLOCK_DECO_CATWALK_STAIRS 941
#define BLOCK_MESH_FENCE 942
#define BLOCK_DECO_LAMP_UNLIT 943
#define BLOCK_DECO_DECAL 944
#define BLOCK_DECO_PLACARD 945
#define BLOCK_STREET_LAMP_UNLIT 946
#define BLOCK_SOUL_STREET_LAMP_UNLIT 947
#define BLOCK_STREET_LAMP_SUPPORT 948
#define BLOCK_PAPER_LAMP_UNLIT 949
#define BLOCK_WIND_VANE 950
#define BLOCK_MI_PIPE 951
#define BLOCK_BLUE_ICE 1000
#define BLOCK_BROWN_MUSHROOM 1001
#define BLOCK_BUDDING_AMETHYST 1002
#define BLOCK_CALCITE 1003
#define BLOCK_COAL 1004
#define BLOCK_CONCRETE 1005
#define BLOCK_COPPER 1006
#define BLOCK_COPPER_EXPOSED 1007
#define BLOCK_COPPER_WEATHERED 1008
#define BLOCK_GLAZED_TERRACOTTA 1009
#define BLOCK_GOLD 1010
#define BLOCK_HONEYCOMB 1011
#define BLOCK_IRON 1012
#define BLOCK_MUD 1013
#define BLOCK_MUSHROOM_STEM 1014
#define BLOCK_NETHERRACK 1015
#define BLOCK_OBSIDIAN 1016
#define BLOCK_PACKED_ICE 1017
#define BLOCK_POLISHED 1018
#define BLOCK_PURPUR 1019
#define BLOCK_QUARTZ 1020
#define BLOCK_RAW_COPPER 1021
#define BLOCK_RAW_GOLD 1022
#define BLOCK_RAW_IRON 1023
#define BLOCK_REDSTONE_ILLUMINATOR_OFF 1024
#define BLOCK_RED_MUSHROOM 1025
#define BLOCK_WOOL 1026

17
shaders/lib/hsv.glsl Normal file
View File

@ -0,0 +1,17 @@
vec3 RgbToHsv(const in vec3 c) {
const vec4 K = vec4(0.0, -1.0, 2.0, -3.0) / 3.0;
const float e = 1.0e-10;
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 HsvToRgb(const in vec3 c) {
const vec4 K = vec4(3.0, 2.0, 1.0, 9.0) / 3.0;
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, saturate(p - K.xxx), c.y);
}

View File

@ -0,0 +1,29 @@
struct LpvBlockData { // 12 x1280 =?
uint data; // 4
uint LightColor; // 4
uint LightRangeSize; // 4
// uint LightMetadata;
};
#ifdef RENDER_SETUP
layout(binding = 0) writeonly buffer lpvBlockData
#else
layout(binding = 0) readonly buffer lpvBlockData
#endif
{
LpvBlockData LpvBlockMap[];
};
uint BuildBlockLpvData(uint mixMask, float mixWeight) {
uint data = uint(saturate(mixWeight) * 255.0);
data = data | (mixMask << 8);
return data;
}
void ParseBlockLpvData(const in uint data, out uint mixMask, out float mixWeight) {
mixWeight = (data & 0xFF) / 255.0;
mixMask = (data >> 8) & 0xFF;
}

View File

@ -1,6 +1,8 @@
const uint LpvSize = uint(exp2(LPV_SIZE));
layout(rgba8) uniform image3D imgLpv1;
layout(rgba8) uniform image3D imgLpv2;
layout(r16ui) uniform uimage3D imgVoxelMask;
const uint LpvSize = uint(exp2(LPV_SIZE));
const uvec3 LpvSize3 = uvec3(LpvSize);
// #if defined RENDER_SHADOWCOMP || defined RENDER_GBUFFER
// layout(r16ui) uniform uimage2D imgVoxelMask;
@ -9,3 +11,5 @@ layout(r16ui) uniform uimage3D imgVoxelMask;
// #else
// layout(r16ui) uniform readonly uimage2D imgVoxelMask;
// #endif
#define LIGHT_NONE 0

View File

@ -0,0 +1,6 @@
layout(r16ui) uniform uimage3D imgVoxelMask;
const uint VoxelSize = uint(exp2(LPV_SIZE));
const uvec3 VoxelSize3 = uvec3(VoxelSize);
#define BLOCK_EMPTY 0

View File

@ -0,0 +1,12 @@
uint GetVoxelBlock(const in ivec3 voxelPos) {
// TODO: exit early if outside bounds
return imageLoad(imgVoxelMask, voxelPos).r;
}
uint GetVoxelBlock(const in vec3 playerPos) {
vec3 cameraOffset = fract(cameraPosition);
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
// TODO: exit early if outside bounds
return imageLoad(imgVoxelMask, voxelPos).r;
}

View File

@ -1,5 +1,7 @@
void SetVoxelBlock(const in vec3 playerPos, const in uint blockId) {
vec3 cameraOffset = fract(cameraPosition);
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + LpvSize/2u));
ivec3 voxelPos = ivec3(floor(playerPos + cameraOffset + VoxelSize/2u));
// TODO: exit early if outside bounds
imageStore(imgVoxelMask, voxelPos, uvec4(blockId));
}

View File

@ -612,17 +612,21 @@ uniform.float.shadowMaxProj = 150.0/abs(sunPosY)
###############################
#if defined LPV_ENABLED && defined IRIS_FEATURE_CUSTOM_IMAGES
bufferObject.0=20480
#if LPV_SIZE == 8
image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 256 256 256
image.imgLpv1=none RGBA RGBA8 BYTE false false 256 256 256
image.imgLpv2=none RGBA RGBA8 BYTE false false 256 256 256
image.imgVoxelMask = none RED_INTEGER R16UI UNSIGNED_SHORT true false 256 256 256
image.imgLpv1 = none RGBA RGBA8 BYTE false false 256 256 256
image.imgLpv2 = none RGBA RGBA8 BYTE false false 256 256 256
#elif LPV_SIZE == 7
image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 128 128 128
image.imgLpv1=none RGBA RGBA8 BYTE false false 128 128 128
image.imgLpv2=none RGBA RGBA8 BYTE false false 128 128 128
image.imgVoxelMask = none RED_INTEGER R16UI UNSIGNED_SHORT true false 128 128 128
image.imgLpv1 = none RGBA RGBA8 BYTE false false 128 128 128
image.imgLpv2 = none RGBA RGBA8 BYTE false false 128 128 128
#elif LPV_SIZE == 6
image.imgVoxelMask=none RED_INTEGER R16UI UNSIGNED_SHORT true false 64 64 64
image.imgLpv1=none RGBA RGBA8 BYTE false false 64 64 64
image.imgLpv2=none RGBA RGBA8 BYTE false false 64 64 64
image.imgVoxelMask = none RED_INTEGER R16UI UNSIGNED_SHORT true false 64 64 64
image.imgLpv1 = none RGBA RGBA8 BYTE false false 64 64 64
image.imgLpv2 = none RGBA RGBA8 BYTE false false 64 64 64
#endif
#else
program.shadowcomp.enabled = false
#endif

View File

@ -50,8 +50,8 @@ uniform int entityId;
#include "/lib/bokeh.glsl"
#ifdef IS_LPV_ENABLED
#include "/lib/lpv_common.glsl"
#include "/lib/lpv_write.glsl"
#include "/lib/voxel_common.glsl"
#include "/lib/voxel_write.glsl"
#endif
const float PI48 = 150.796447372*WAVY_SPEED;
@ -185,6 +185,7 @@ void main() {
#endif
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
// TODO: limit to blocks; entities later
SetVoxelBlock(playerpos, blockId);
#endif

View File

@ -0,0 +1,204 @@
#version 430 compatibility
#include "/lib/settings.glsl"
layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in;
#if LPV_SIZE == 8
const ivec3 workGroups = ivec3(32, 32, 32);
#elif LPV_SIZE == 7
const ivec3 workGroups = ivec3(16, 16, 16);
#elif LPV_SIZE == 6
const ivec3 workGroups = ivec3(8, 8, 8);
#endif
#ifdef IS_LPV_ENABLED
shared vec4 lpvSharedData[10*10*10];
shared uint voxelSharedData[10*10*10];
const vec2 LpvBlockSkyFalloff = vec2(0.96, 0.96);
const vec2 LpvBlockSkyRange = vec2(1.0, 24.0);
const ivec3 lpvFlatten = ivec3(1, 10, 100);
#define GAMMA 2.2
#define EPSILON 1e-6
// varying vec2 texcoord;
// uniform sampler2D tex;
// uniform sampler2D noisetex;
uniform int frameCounter;
// uniform float frameTimeCounter;
uniform vec3 cameraPosition;
// varying vec4 color;
// #include "/lib/waterBump.glsl"
#include "/lib/hsv.glsl"
#include "/lib/blocks.glsl"
#include "/lib/lpv_common.glsl"
#include "/lib/lpv_blocks.glsl"
#include "/lib/voxel_common.glsl"
#include "/lib/voxel_read.glsl"
// uniform mat4 gbufferProjectionInverse;
// uniform mat4 gbufferModelViewInverse;
// uniform mat4 gbufferModelView;
// uniform mat4 shadowModelView;
// uniform mat4 shadowModelViewInverse;
// uniform mat4 shadowProjection;
int sumOf(ivec3 vec) {return vec.x + vec.y + vec.z;}
vec3 RGBToLinear(const in vec3 color) {
return pow(color, vec3(GAMMA));
}
vec3 Lpv_RgbToHsv(const in vec3 lightColor, const in float lightRange) {
vec3 lightValue = RgbToHsv(lightColor);
lightValue.b = lightRange / LpvBlockSkyRange.x;
return lightValue;
}
vec4 GetLpvValue(in ivec3 texCoord) {
if (clamp(texCoord, ivec3(0), ivec3(LpvSize) - 1) != texCoord) return vec4(0.0);
vec4 lpvSample = (frameCounter % 2) == 0
? imageLoad(imgLpv2, texCoord)
: imageLoad(imgLpv1, texCoord);
lpvSample.ba = exp2(lpvSample.ba * LpvBlockSkyRange) - 1.0;
lpvSample.rgb = HsvToRgb(lpvSample.rgb);
return lpvSample;
}
int getSharedCoord(ivec3 pos) {
return sumOf(pos * lpvFlatten);
}
vec4 sampleShared(ivec3 pos) {
return lpvSharedData[getSharedCoord(pos + 1)];
}
vec4 sampleShared(ivec3 pos, int mask_index) {
int shared_index = getSharedCoord(pos + 1);
float mixWeight = 1.0;
uint mixMask = 0xFFFF;
uint blockId = voxelSharedData[shared_index];
if (blockId > 0 && blockId != BLOCK_EMPTY)
ParseBlockLpvData(LpvBlockMap[blockId].data, mixMask, mixWeight);
return lpvSharedData[shared_index] * ((mixMask >> mask_index) & 1u);// * mixWeight;
}
vec4 mixNeighbours(const in ivec3 fragCoord, const in uint mask) {
vec4 nX1 = sampleShared(fragCoord + ivec3(-1, 0, 0), 1) * ((mask ) & 1u);
vec4 nX2 = sampleShared(fragCoord + ivec3( 1, 0, 0), 0) * ((mask >> 1) & 1u);
vec4 nY1 = sampleShared(fragCoord + ivec3( 0, -1, 0), 3) * ((mask >> 2) & 1u);
vec4 nY2 = sampleShared(fragCoord + ivec3( 0, 1, 0), 2) * ((mask >> 3) & 1u);
vec4 nZ1 = sampleShared(fragCoord + ivec3( 0, 0, -1), 5) * ((mask >> 4) & 1u);
vec4 nZ2 = sampleShared(fragCoord + ivec3( 0, 0, 1), 4) * ((mask >> 5) & 1u);
const vec4 avgFalloff = (1.0/6.0) * LpvBlockSkyFalloff.xxxy;
return (nX1 + nX2 + nY1 + nY2 + nZ1 + nZ2) * avgFalloff;
}
void PopulateSharedIndex(const in ivec3 imgCoordOffset, const in ivec3 workGroupOffset, const in uint i) {
ivec3 pos = workGroupOffset + ivec3(i / lpvFlatten) % 10;
ivec3 lpvPos = imgCoordOffset + pos;
lpvSharedData[i] = GetLpvValue(lpvPos);
voxelSharedData[i] = GetVoxelBlock(lpvPos);
}
void PopulateShared() {
uint i = uint(gl_LocalInvocationIndex) * 2u;
if (i >= 1000u) return;
// ivec3 voxelOffset = GetLPVVoxelOffset();
ivec3 imgCoordOffset = ivec3(0);//GetLPVFrameOffset();
ivec3 workGroupOffset = ivec3(gl_WorkGroupID * gl_WorkGroupSize) - 1;
PopulateSharedIndex(imgCoordOffset, workGroupOffset, i);
PopulateSharedIndex(imgCoordOffset, workGroupOffset, i + 1u);
}
#endif
////////////////////////////// VOID MAIN //////////////////////////////
void main() {
#ifdef IS_LPV_ENABLED
uvec3 chunkPos = gl_WorkGroupID * gl_WorkGroupSize;
if (any(greaterThanEqual(chunkPos, LpvSize3))) return;
PopulateShared();
barrier();
ivec3 imgCoord = ivec3(gl_GlobalInvocationID);
if (any(greaterThanEqual(imgCoord, LpvSize3))) return;
// vec3 blockLocalPos = gridCell * LIGHT_BIN_SIZE + blockCell - VoxelBlockCenter + cameraOffset + 0.5;
// vec3 viewDir = gbufferModelViewInverse[2].xyz;
vec3 lpvCenter = vec3(0.0);//GetLpvCenter(cameraPosition, viewDir);
vec3 blockLocalPos = imgCoord - lpvCenter + 0.5;
vec4 lightValue = vec4(0.0);
uint mixMask = 0xFFFF;
vec3 tint = vec3(1.0);
uint blockId = voxelSharedData[getSharedCoord(ivec3(gl_LocalInvocationID) + 1)];
float mixWeight = blockId == BLOCK_EMPTY ? 1.0 : 0.0;
LpvBlockData blockData = LpvBlockMap[blockId];
if (blockId > 0 && blockId != BLOCK_EMPTY)
ParseBlockLpvData(blockData.data, mixMask, mixWeight);
#ifdef LPV_GLASS_TINT
if (blockId >= BLOCK_HONEY && blockId <= BLOCK_TINTED_GLASS) {
tint = GetLightGlassTint(blockId);
mixWeight = 1.0;
}
#endif
if (mixWeight > EPSILON) {
vec4 lightMixed = mixNeighbours(ivec3(gl_LocalInvocationID), mixMask);
lightMixed.rgb *= mixWeight * tint;
lightValue += lightMixed;
}
lightValue.rgb = RgbToHsv(lightValue.rgb);
lightValue.ba = log2(lightValue.ba + 1.0) / LpvBlockSkyRange;
#if LIGHTING_MODE >= LIGHTING_MODE_FLOODFILL
if (blockId > 0 && blockId != BLOCK_EMPTY) {
//uint lightType = LpvBlockMap[blockId].lightType;
//if (lightType != LIGHT_NONE && lightType != LIGHT_IGNORED) {
//StaticLightData lightInfo = StaticLightMap[lightType];
vec3 lightColor = unpackUnorm4x8(blockData.LightColor).rgb;
vec2 lightRangeSize = unpackUnorm4x8(blockData.LightRangeSize).xy;
float lightRange = lightRangeSize.x * 255.0;
lightColor = RGBToLinear(lightColor);
// #ifdef LIGHTING_FLICKER
// vec2 lightNoise = GetDynLightNoise(cameraPosition + blockLocalPos);
// ApplyLightFlicker(lightColor, lightType, lightNoise);
// #endif
lightValue.rgb = Lpv_RgbToHsv(lightColor, lightRange);
//}
}
#endif
if (frameCounter % 2 == 0)
imageStore(imgLpv1, imgCoord, lightValue);
else
imageStore(imgLpv2, imgCoord, lightValue);
#endif
}