From 2c4eea5b261a19b970a2f74b2ba3c20756526931 Mon Sep 17 00:00:00 2001 From: NULL511 Date: Wed, 1 May 2024 16:59:19 -0400 Subject: [PATCH] floodfill static block/light data --- shaders/lib/blocks.glsl | 792 +--------------------------------- shaders/lib/lpv_render.glsl | 216 ++++++++++ shaders/world0/setup.csh | 59 +++ shaders/world0/shadowcomp.csh | 36 +- 4 files changed, 287 insertions(+), 816 deletions(-) create mode 100644 shaders/lib/lpv_render.glsl create mode 100644 shaders/world0/setup.csh diff --git a/shaders/lib/blocks.glsl b/shaders/lib/blocks.glsl index 32db8cf..06492ab 100644 --- a/shaders/lib/blocks.glsl +++ b/shaders/lib/blocks.glsl @@ -1,790 +1,2 @@ -#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 +#define BLOCK_WATER 8 +#define BLOCK_LIGHT_SOURCES 10005 diff --git a/shaders/lib/lpv_render.glsl b/shaders/lib/lpv_render.glsl new file mode 100644 index 0000000..1533662 --- /dev/null +++ b/shaders/lib/lpv_render.glsl @@ -0,0 +1,216 @@ +vec4 cubic(const in float v) { + vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; + vec4 s = n * n * n; + float x = s.x; + float y = s.y - 4.0 * s.x; + float z = s.z - 4.0 * s.y + 6.0 * s.x; + float w = 6.0 - x - y - z; + return vec4(x, y, z, w) * (1.0/6.0); +} + +float LpvVoxelTest(const in ivec3 voxelCoord) { + ivec3 gridCell = ivec3(floor(voxelCoord / LIGHT_BIN_SIZE)); + uint gridIndex = GetVoxelGridCellIndex(gridCell); + ivec3 blockCell = voxelCoord - gridCell * LIGHT_BIN_SIZE; + + uint blockId = GetVoxelBlockMask(blockCell, gridIndex); + return IsTraceOpenBlock(blockId) ? 1.0 : 0.0; +} + +vec4 SampleLpvNearest(const in ivec3 lpvPos) { + vec4 lpvSample = (frameCounter % 2) == 0 + #ifndef RENDER_GBUFFER + ? texelFetch(texLPV_1, lpvPos, 0) + : texelFetch(texLPV_2, lpvPos, 0); + #else + ? texelFetch(texLPV_2, lpvPos, 0) + : texelFetch(texLPV_1, lpvPos, 0); + #endif + + lpvSample.rgb = HsvToRgb(lpvSample.rgb); + + return lpvSample / DynamicLightRangeF; +} + +vec4 SampleLpvLinear(const in vec3 lpvPos) { + // vec3 pos = lpvPos - 0.49999; + vec3 pos = lpvPos - 0.5; + ivec3 lpvCoord = ivec3(floor(pos)); + vec3 lpvF = fract(pos); + + vec4 sample_x1y1z1 = SampleLpvNearest(lpvCoord + ivec3(0, 0, 0)); + vec4 sample_x2y1z1 = SampleLpvNearest(lpvCoord + ivec3(1, 0, 0)); + vec4 sample_x1y2z1 = SampleLpvNearest(lpvCoord + ivec3(0, 1, 0)); + vec4 sample_x2y2z1 = SampleLpvNearest(lpvCoord + ivec3(1, 1, 0)); + + vec4 sample_x1y1z2 = SampleLpvNearest(lpvCoord + ivec3(0, 0, 1)); + vec4 sample_x2y1z2 = SampleLpvNearest(lpvCoord + ivec3(1, 0, 1)); + vec4 sample_x1y2z2 = SampleLpvNearest(lpvCoord + ivec3(0, 1, 1)); + vec4 sample_x2y2z2 = SampleLpvNearest(lpvCoord + ivec3(1, 1, 1)); + + #ifdef LPV_VOXEL_TEST + vec3 lpvCameraOffset = fract(cameraPosition); + vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE; + ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5); + + float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0)); + float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0)); + float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0)); + float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0)); + + float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1)); + float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1)); + float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1)); + float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1)); + + sample_x1y1z1 *= voxel_x1y1z1; + sample_x2y1z1 *= voxel_x2y1z1; + sample_x1y2z1 *= voxel_x1y2z1; + sample_x2y2z1 *= voxel_x2y2z1; + + sample_x1y1z2 *= voxel_x1y1z2; + sample_x2y1z2 *= voxel_x2y1z2; + sample_x1y2z2 *= voxel_x1y2z2; + sample_x2y2z2 *= voxel_x2y2z2; + + + // TODO: Add special checks for avoiding diagonal blending between occluded edges/corners + + // TODO: preload voxel grid into array + // then prevent blending if all but current and opposing quadrants are empty + + // ivec3 iq = 1 - ivec3(step(vec3(0.5), lpvF)); + // float voxel_iqx = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(iq.x, 0, 0)); + // float voxel_iqy = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, iq.y, 0)); + // float voxel_iqz = 1.0 - LpvVoxelTest(ivec3(voxelPos) + ivec3(0, 0, iq.z)); + // float voxel_corner = 1.0 - voxel_iqx * voxel_iqy * voxel_iqz; + + // float voxel_y1 = LpvVoxelTest(ivec3(voxelPos + vec3(0, 0, 0))); + // sample_x1y1z1 *= voxel_y1; + // sample_x2y1z1 *= voxel_y1; + // sample_x1y1z2 *= voxel_y1; + // sample_x2y1z2 *= voxel_y1; + + // float voxel_y2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0)); + // sample_x1y2z1 *= voxel_y2; + // sample_x2y2z1 *= voxel_y2; + // sample_x1y2z2 *= voxel_y2; + // sample_x2y2z2 *= voxel_y2; + #endif + + vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, lpvF.x); + vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, lpvF.x); + + vec4 sample_y1z2 = mix(sample_x1y1z2, sample_x2y1z2, lpvF.x); + vec4 sample_y2z2 = mix(sample_x1y2z2, sample_x2y2z2, lpvF.x); + + vec4 sample_z1 = mix(sample_y1z1, sample_y2z1, lpvF.y); + vec4 sample_z2 = mix(sample_y1z2, sample_y2z2, lpvF.y); + + return mix(sample_z1, sample_z2, lpvF.z);// * voxel_corner; +} + +vec4 SampleLpvCubic(in vec3 lpvPos) { + vec3 pos = lpvPos - 0.5; + vec3 texF = fract(pos); + pos = floor(pos); + + vec4 cubic_x = cubic(texF.x); + vec4 cubic_y = cubic(texF.y); + vec4 cubic_z = cubic(texF.z); + + vec3 pos_min = pos - 0.5; + vec3 pos_max = pos + 1.5; + + vec3 s_min = vec3(cubic_x.x, cubic_y.x, cubic_z.x) + vec3(cubic_x.y, cubic_y.y, cubic_z.y); + vec3 s_max = vec3(cubic_x.z, cubic_y.z, cubic_z.z) + vec3(cubic_x.w, cubic_y.w, cubic_z.w); + + vec3 offset_min = pos_min + vec3(cubic_x.y, cubic_y.y, cubic_z.y) / s_min; + vec3 offset_max = pos_max + vec3(cubic_x.w, cubic_y.w, cubic_z.w) / s_max; + + vec4 sample_x1y1z1 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_max.z)); + vec4 sample_x2y1z1 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_max.z)); + vec4 sample_x1y2z1 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_max.z)); + vec4 sample_x2y2z1 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_max.z)); + + vec4 sample_x1y1z2 = SampleLpvLinear(vec3(offset_max.x, offset_max.y, offset_min.z)); + vec4 sample_x2y1z2 = SampleLpvLinear(vec3(offset_min.x, offset_max.y, offset_min.z)); + vec4 sample_x1y2z2 = SampleLpvLinear(vec3(offset_max.x, offset_min.y, offset_min.z)); + vec4 sample_x2y2z2 = SampleLpvLinear(vec3(offset_min.x, offset_min.y, offset_min.z)); + + #ifdef LPV_VOXEL_TEST + vec3 lpvCameraOffset = fract(cameraPosition); + vec3 voxelCameraOffset = fract(cameraPosition / LIGHT_BIN_SIZE) * LIGHT_BIN_SIZE; + ivec3 voxelPos = ivec3(lpvPos - SceneLPVCenter + VoxelBlockCenter + voxelCameraOffset - lpvCameraOffset + 0.5); + + float voxel_x1y1z1 = LpvVoxelTest(voxelPos + ivec3(1, 1, 1)); + float voxel_x2y1z1 = LpvVoxelTest(voxelPos + ivec3(0, 1, 1)); + float voxel_x1y2z1 = LpvVoxelTest(voxelPos + ivec3(1, 0, 1)); + float voxel_x2y2z1 = LpvVoxelTest(voxelPos + ivec3(0, 0, 1)); + + float voxel_x1y1z2 = LpvVoxelTest(voxelPos + ivec3(1, 1, 0)); + float voxel_x2y1z2 = LpvVoxelTest(voxelPos + ivec3(0, 1, 0)); + float voxel_x1y2z2 = LpvVoxelTest(voxelPos + ivec3(1, 0, 0)); + float voxel_x2y2z2 = LpvVoxelTest(voxelPos + ivec3(0, 0, 0)); + + sample_x1y1z1 *= voxel_x1y1z1; + sample_x2y1z1 *= voxel_x2y1z1; + sample_x1y2z1 *= voxel_x1y2z1; + sample_x2y2z1 *= voxel_x2y2z1; + + sample_x1y1z2 *= voxel_x1y1z2; + sample_x2y1z2 *= voxel_x2y1z2; + sample_x1y2z2 *= voxel_x1y2z2; + sample_x2y2z2 *= voxel_x2y2z2; + #endif + + vec3 mixF = s_min / (s_min + s_max); + + vec4 sample_y1z1 = mix(sample_x1y1z1, sample_x2y1z1, mixF.x); + vec4 sample_y2z1 = mix(sample_x1y2z1, sample_x2y2z1, mixF.x); + + vec4 sample_y1z2 = mix(sample_x1y1z2, sample_x2y1z2, mixF.x); + vec4 sample_y2z2 = mix(sample_x1y2z2, sample_x2y2z2, mixF.x); + + vec4 sample_z1 = mix(sample_y1z1, sample_y2z1, mixF.y); + vec4 sample_z2 = mix(sample_y1z2, sample_y2z2, mixF.y); + + return mix(sample_z1, sample_z2, mixF.z); +} + +vec4 SampleLpv(const in vec3 samplePos) { + #if LPV_SAMPLE_MODE == LPV_SAMPLE_CUBIC + vec4 lpvSample = SampleLpvCubic(samplePos); + #elif LPV_SAMPLE_MODE == LPV_SAMPLE_LINEAR + vec4 lpvSample = SampleLpvLinear(samplePos); + #else + ivec3 coord = ivec3(samplePos); + vec4 lpvSample = SampleLpvNearest(coord); + #endif + + return lpvSample; +} + +vec4 SampleLpv(const in vec3 lpvPos, const in vec3 geoNormal, const in vec3 texNormal) { + #if MATERIAL_NORMALS != 0 + vec3 samplePos = lpvPos - 0.5 * geoNormal + texNormal; + #else + vec3 samplePos = lpvPos + 0.5 * geoNormal; + #endif + + return SampleLpv(samplePos); +} + +// vec3 GetLpvBlockLight(in vec4 lpvSample, const in float power) { +// return (lpvSample.rgb * LPV_BLOCKLIGHT_SCALE) / 8.0 * DynamicLightBrightness; +// } + +vec3 GetLpvBlockLight(const in vec4 lpvSample) { + // return GetLpvBlockLight(lpvSample, 1.0); + return (1.0/8.0) * (lpvSample.rgb * LPV_BLOCKLIGHT_SCALE) * DynamicLightBrightness; +} + +float GetLpvSkyLight(const in vec4 lpvSample) { + float skyLight = saturate(lpvSample.a); + return _pow2(skyLight); +} diff --git a/shaders/world0/setup.csh b/shaders/world0/setup.csh new file mode 100644 index 0000000..d2fd305 --- /dev/null +++ b/shaders/world0/setup.csh @@ -0,0 +1,59 @@ +#version 430 compatibility + +#define RENDER_SETUP + +#include "/lib/settings.glsl" + +layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +const ivec3 workGroups = ivec3(4, 5, 1); + +#ifdef IS_LPV_ENABLED + #include "/lib/lpv_blocks.glsl" + + + vec3 GetSceneLightColor(const in uint blockId) { + if (blockId == 10005) return vec3(1.0); + return vec3(0.0); + } + + float GetSceneLightRange(const in uint blockId) { + if (blockId == 10005) return 12.0; + return 0.0; + } + + void GetLpvBlockMask(const in uint blockId, out float mixWeight, out uint mixMask) { + mixWeight = 0.0; + mixMask = 0xFFFF; + } +#endif + + +void main() { + #ifdef IS_LPV_ENABLED + uint blockId = uint(gl_GlobalInvocationID.x + gl_GlobalInvocationID.y * 32); + //if (blockId >= 1280) return; + + LpvBlockData block; + + uint mixMask; + float mixWeight; + GetLpvBlockMask(blockId, mixWeight, mixMask); + block.data = BuildBlockLpvData(mixMask, mixWeight); + + // vec3 lightOffset = GetSceneLightOffset(lightType); + vec3 lightColor = GetSceneLightColor(blockId); + float lightRange = GetSceneLightRange(blockId); + float lightSize = 0.0;//GetSceneLightSize(lightType); + // bool lightTraced = GetLightTraced(lightType); + // bool lightSelfTraced = GetLightSelfTraced(lightType); + + // light.Offset = packSnorm4x8(vec4(lightOffset, 0.0)); + block.LightColor = packUnorm4x8(vec4(lightColor, 0.0)); + block.LightRangeSize = packUnorm4x8(vec4(lightRange/255.0, lightSize, 0.0, 0.0)); + // light.LightMetadata = (lightTraced ? 1u : 0u); + // light.LightMetadata |= (lightSelfTraced ? 1u : 0u) << 1u; + + LpvBlockMap[blockId] = block; + #endif +} diff --git a/shaders/world0/shadowcomp.csh b/shaders/world0/shadowcomp.csh index ec191b2..504a165 100644 --- a/shaders/world0/shadowcomp.csh +++ b/shaders/world0/shadowcomp.csh @@ -24,15 +24,9 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; #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" @@ -40,12 +34,7 @@ layout (local_size_x = 8, local_size_y = 8, local_size_z = 8) in; #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;} @@ -141,8 +130,6 @@ void main() { 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; @@ -176,23 +163,20 @@ void main() { #if LIGHTING_MODE >= LIGHTING_MODE_FLOODFILL if (blockId > 0 && blockId != BLOCK_EMPTY) { - //uint lightType = LpvBlockMap[blockId].lightType; + vec3 lightColor = unpackUnorm4x8(blockData.LightColor).rgb; + vec2 lightRangeSize = unpackUnorm4x8(blockData.LightRangeSize).xy; + float lightRange = lightRangeSize.x * 255.0; - //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); - lightColor = RGBToLinear(lightColor); - - // #ifdef LIGHTING_FLICKER - // vec2 lightNoise = GetDynLightNoise(cameraPosition + blockLocalPos); - // ApplyLightFlicker(lightColor, lightType, lightNoise); - // #endif + // #ifdef LIGHTING_FLICKER + // vec2 lightNoise = GetDynLightNoise(cameraPosition + blockLocalPos); + // ApplyLightFlicker(lightColor, lightType, lightNoise); + // #endif + if (lightRange > EPSILON) { lightValue.rgb = Lpv_RgbToHsv(lightColor, lightRange); - //} + } } #endif