From 1bb63feb2a2a1bb0a500d5cfb7c23a709c6d3bbe Mon Sep 17 00:00:00 2001 From: NULL511 Date: Fri, 3 May 2024 22:24:09 -0400 Subject: [PATCH] more lpv block mappings; add entity lights --- shaders/block.properties | 74 ++++++++++++++++++------------------ shaders/dimensions/setup.csh | 6 +++ shaders/lang/en_us.lang | 1 + shaders/lib/blocks.glsl | 69 ++++++++++++++++----------------- shaders/lib/lpv_render.glsl | 2 +- shaders/lib/settings.glsl | 1 + shaders/shaders.properties | 2 +- shaders/world0/shadow.vsh | 24 ++++++++++-- 8 files changed, 103 insertions(+), 76 deletions(-) diff --git a/shaders/block.properties b/shaders/block.properties index e7bdff3..1b3e5cd 100644 --- a/shaders/block.properties +++ b/shaders/block.properties @@ -61,74 +61,76 @@ block.103=amethyst_cluster block.104=beacon +block.105=brewing_stand -block.105=candle:candles=1:lit=true black_candle:candles=1:lit=true blue_candle:candles=1:lit=true brown_candle:candles=1:lit=true cyan_candle:candles=1:lit=true gray_candle:candles=1:lit=true green_candle:candles=1:lit=true light_blue_candle:candles=1:lit=true light_gray_candle:candles=1:lit=true lime_candle:candles=1:lit=true magenta_candle:candles=1:lit=true orange_candle:candles=1:lit=true pink_candle:candles=1:lit=true purple_candle:candles=1:lit=true red_candle:candles=1:lit=true white_candle:candles=1:lit=true yellow_candle:candles=1:lit=true -block.106=candle:candles=2:lit=true black_candle:candles=2:lit=true blue_candle:candles=2:lit=true brown_candle:candles=2:lit=true cyan_candle:candles=2:lit=true gray_candle:candles=2:lit=true green_candle:candles=2:lit=true light_blue_candle:candles=2:lit=true light_gray_candle:candles=2:lit=true lime_candle:candles=2:lit=true magenta_candle:candles=2:lit=true orange_candle:candles=2:lit=true pink_candle:candles=2:lit=true purple_candle:candles=2:lit=true red_candle:candles=2:lit=true white_candle:candles=2:lit=true yellow_candle:candles=2:lit=true -block.107=candle:candles=3:lit=true black_candle:candles=3:lit=true blue_candle:candles=3:lit=true brown_candle:candles=3:lit=true cyan_candle:candles=3:lit=true gray_candle:candles=3:lit=true green_candle:candles=3:lit=true light_blue_candle:candles=3:lit=true light_gray_candle:candles=3:lit=true lime_candle:candles=3:lit=true magenta_candle:candles=3:lit=true orange_candle:candles=3:lit=true pink_candle:candles=3:lit=true purple_candle:candles=3:lit=true red_candle:candles=3:lit=true white_candle:candles=3:lit=true yellow_candle:candles=3:lit=true -block.108=candle:candles=4:lit=true black_candle:candles=4:lit=true blue_candle:candles=4:lit=true brown_candle:candles=4:lit=true cyan_candle:candles=4:lit=true gray_candle:candles=4:lit=true green_candle:candles=4:lit=true light_blue_candle:candles=4:lit=true light_gray_candle:candles=4:lit=true lime_candle:candles=4:lit=true magenta_candle:candles=4:lit=true orange_candle:candles=4:lit=true pink_candle:candles=4:lit=true purple_candle:candles=4:lit=true red_candle:candles=4:lit=true white_candle:candles=4:lit=true yellow_candle:candles=4:lit=true -block.109=cave_vines_plant:berries=true cave_vines:berries=true +block.106=candle:candles=1:lit=true black_candle:candles=1:lit=true blue_candle:candles=1:lit=true brown_candle:candles=1:lit=true cyan_candle:candles=1:lit=true gray_candle:candles=1:lit=true green_candle:candles=1:lit=true light_blue_candle:candles=1:lit=true light_gray_candle:candles=1:lit=true lime_candle:candles=1:lit=true magenta_candle:candles=1:lit=true orange_candle:candles=1:lit=true pink_candle:candles=1:lit=true purple_candle:candles=1:lit=true red_candle:candles=1:lit=true white_candle:candles=1:lit=true yellow_candle:candles=1:lit=true +block.107=candle:candles=2:lit=true black_candle:candles=2:lit=true blue_candle:candles=2:lit=true brown_candle:candles=2:lit=true cyan_candle:candles=2:lit=true gray_candle:candles=2:lit=true green_candle:candles=2:lit=true light_blue_candle:candles=2:lit=true light_gray_candle:candles=2:lit=true lime_candle:candles=2:lit=true magenta_candle:candles=2:lit=true orange_candle:candles=2:lit=true pink_candle:candles=2:lit=true purple_candle:candles=2:lit=true red_candle:candles=2:lit=true white_candle:candles=2:lit=true yellow_candle:candles=2:lit=true +block.108=candle:candles=3:lit=true black_candle:candles=3:lit=true blue_candle:candles=3:lit=true brown_candle:candles=3:lit=true cyan_candle:candles=3:lit=true gray_candle:candles=3:lit=true green_candle:candles=3:lit=true light_blue_candle:candles=3:lit=true light_gray_candle:candles=3:lit=true lime_candle:candles=3:lit=true magenta_candle:candles=3:lit=true orange_candle:candles=3:lit=true pink_candle:candles=3:lit=true purple_candle:candles=3:lit=true red_candle:candles=3:lit=true white_candle:candles=3:lit=true yellow_candle:candles=3:lit=true +block.109=candle:candles=4:lit=true black_candle:candles=4:lit=true blue_candle:candles=4:lit=true brown_candle:candles=4:lit=true cyan_candle:candles=4:lit=true gray_candle:candles=4:lit=true green_candle:candles=4:lit=true light_blue_candle:candles=4:lit=true light_gray_candle:candles=4:lit=true lime_candle:candles=4:lit=true magenta_candle:candles=4:lit=true orange_candle:candles=4:lit=true pink_candle:candles=4:lit=true purple_candle:candles=4:lit=true red_candle:candles=4:lit=true white_candle:candles=4:lit=true yellow_candle:candles=4:lit=true -block.110=conduit +block.110=cave_vines_plant:berries=true cave_vines:berries=true -block.111=crying_obsidian +block.111=conduit -block.112=end_gateway +block.112=crying_obsidian -block.113=end_rod +block.113=end_gateway -block.114=fire campfire:lit=true +block.114=end_rod -block.115=ochre_froglight +block.115=fire campfire:lit=true -block.116=pearlescent_froglight +block.116=ochre_froglight -block.117=verdant_froglight +block.117=pearlescent_froglight -block.118=glow_lichen +block.118=verdant_froglight -block.119=glowstone +block.119=glow_lichen -block.120=jack_o_lantern +block.120=glowstone -block.121=lantern +block.121=jack_o_lantern -block.122=lava +block.122=lantern -block.123=magma_block +block.123=lava -block.124=redstone_lamp:lit=true +block.124=magma_block -block.125=redstone_torch:lit=true redstone_wall_torch:lit=true +block.125=redstone_lamp:lit=true -block.126=respawn_anchor:charges=4 +block.126=redstone_torch:lit=true redstone_wall_torch:lit=true -block.127=sculk_sensor:sculk_sensor_phase=active +block.127=respawn_anchor:charges=4 -block.128=sea_pickle:waterlogged=true:pickles=1 +block.128=sculk_sensor:sculk_sensor_phase=active -block.129=sea_pickle:waterlogged=true:pickles=2 +block.129=sea_pickle:waterlogged=true:pickles=1 -block.130=sea_pickle:waterlogged=true:pickles=3 +block.130=sea_pickle:waterlogged=true:pickles=2 -block.131=sea_pickle:waterlogged=true:pickles=4 +block.131=sea_pickle:waterlogged=true:pickles=3 -block.132=sea_lantern +block.132=sea_pickle:waterlogged=true:pickles=4 -block.133=shroomlight +block.133=sea_lantern -block.134=smoker:lit=true +block.134=shroomlight -block.135=soul_fire soul_campfire:lit=true +block.135=smoker:lit=true -block.136=soul_lantern +block.136=soul_fire soul_campfire:lit=true -block.137=soul_torch soul_wall_torch +block.137=soul_lantern -block.138=torch wall_torch +block.138=soul_torch soul_wall_torch -block.139=westerosblocks:safe_fire -block.140=conquest:white_paper_lantern conquest:yellow_paper_lantern conquest:small_red_paper_lantern conquest:chinese_palace_lantern conquest:campfire conquest:brazier conquest:hanging_brazier conquest:chandelier conquest:candelabra conquest:cross_chandelier conquest:iron_candelabrum_1 conquest:golden_candelabrum_1 conquest:candle conquest:hanging_candle_holder conquest:candle_in_a_lantern conquest:candles conquest:hand_candle conquest:torch_with_grille conquest:elven_hand_light conquest:ship_lantern conquest:victorian_lantern conquest:small_lantern conquest:big_lantern conquest:hanging_oil_lamp conquest:oil_lamp conquest:terracotta_oil_lamp conquest:invisible_light_low conquest:invisible_light_medium conquest:invisible_light +block.139=torch wall_torch + +block.140=westerosblocks:safe_fire +block.141=conquest:white_paper_lantern conquest:yellow_paper_lantern conquest:small_red_paper_lantern conquest:chinese_palace_lantern conquest:campfire conquest:brazier conquest:hanging_brazier conquest:chandelier conquest:candelabra conquest:cross_chandelier conquest:iron_candelabrum_1 conquest:golden_candelabrum_1 conquest:candle conquest:hanging_candle_holder conquest:candle_in_a_lantern conquest:candles conquest:hand_candle conquest:torch_with_grille conquest:elven_hand_light conquest:ship_lantern conquest:victorian_lantern conquest:small_lantern conquest:big_lantern conquest:hanging_oil_lamp conquest:oil_lamp conquest:terracotta_oil_lamp conquest:invisible_light_low conquest:invisible_light_medium conquest:invisible_light ####### ----- reflective translucents / glass ----- ####### diff --git a/shaders/dimensions/setup.csh b/shaders/dimensions/setup.csh index 1aad055..f7e156f 100644 --- a/shaders/dimensions/setup.csh +++ b/shaders/dimensions/setup.csh @@ -73,6 +73,11 @@ void main() { lightColor = vec3(1.0); lightRange = 15.0; break; + case BLOCK_BREWING_STAND: + lightColor = vec3(0.636, 0.509, 0.179); + lightRange = 1.0; + mixWeight = 0.8; + break; case BLOCK_CANDLES_LIT_1: lightColor = LightColor_Candles; lightRange = 3.0; @@ -394,6 +399,7 @@ void main() { break; } + // hack to increase light (if set) if (lightRange > 0.0) lightRange += 1.0; LpvBlockData block; diff --git a/shaders/lang/en_us.lang b/shaders/lang/en_us.lang index 3d37fb8..34501bc 100644 --- a/shaders/lang/en_us.lang +++ b/shaders/lang/en_us.lang @@ -78,6 +78,7 @@ screen.Direct_Light = Direct Light value.LPV_SIZE.6 = Small [64] value.LPV_SIZE.7 = Medium [128] value.LPV_SIZE.8 = Large [256] + option.LPV_ENTITY_LIGHTS = Entity Lights option.LPV_NORMAL_OFFSET = Normal-Offset diff --git a/shaders/lib/blocks.glsl b/shaders/lib/blocks.glsl index b02a0a7..2061e06 100644 --- a/shaders/lib/blocks.glsl +++ b/shaders/lib/blocks.glsl @@ -18,40 +18,41 @@ #define BLOCK_AMETHYST_BUD_MEDIUM 102 #define BLOCK_AMETHYST_CLUSTER 103 #define BLOCK_BEACON 104 -#define BLOCK_CANDLES_LIT_1 105 -#define BLOCK_CANDLES_LIT_2 106 -#define BLOCK_CANDLES_LIT_3 107 -#define BLOCK_CANDLES_LIT_4 108 -#define BLOCK_CAVE_VINE_BERRIES 109 -#define BLOCK_CONDUIT 110 -#define BLOCK_CRYING_OBSIDIAN 111 -#define BLOCK_END_GATEWAY 112 -#define BLOCK_END_ROD 113 -#define BLOCK_FIRE 114 -#define BLOCK_FROGLIGHT_OCHRE 115 -#define BLOCK_FROGLIGHT_PEARLESCENT 116 -#define BLOCK_FROGLIGHT_VERDANT 117 -#define BLOCK_GLOW_LICHEN 118 -#define BLOCK_GLOWSTONE 119 -#define BLOCK_JACK_O_LANTERN 120 -#define BLOCK_LANTERN 121 -#define BLOCK_LAVA 122 -#define BLOCK_MAGMA 123 -#define BLOCK_REDSTONE_LAMP_LIT 124 -#define BLOCK_REDSTONE_TORCH_LIT 125 -#define BLOCK_RESPAWN_ANCHOR_4 126 -#define BLOCK_SCULK_SENSOR_ACTIVE 127 -#define BLOCK_SEA_PICKLE_WET_1 128 -#define BLOCK_SEA_PICKLE_WET_2 129 -#define BLOCK_SEA_PICKLE_WET_3 130 -#define BLOCK_SEA_PICKLE_WET_4 131 -#define BLOCK_SEA_LANTERN 132 -#define BLOCK_SHROOMLIGHT 133 -#define BLOCK_SMOKER_LIT 134 -#define BLOCK_SOUL_FIRE 135 -#define BLOCK_SOUL_LANTERN 136 -#define BLOCK_SOUL_TORCH 137 -#define BLOCK_TORCH 138 +#define BLOCK_BREWING_STAND 105 +#define BLOCK_CANDLES_LIT_1 106 +#define BLOCK_CANDLES_LIT_2 107 +#define BLOCK_CANDLES_LIT_3 108 +#define BLOCK_CANDLES_LIT_4 109 +#define BLOCK_CAVE_VINE_BERRIES 110 +#define BLOCK_CONDUIT 111 +#define BLOCK_CRYING_OBSIDIAN 112 +#define BLOCK_END_GATEWAY 113 +#define BLOCK_END_ROD 114 +#define BLOCK_FIRE 115 +#define BLOCK_FROGLIGHT_OCHRE 116 +#define BLOCK_FROGLIGHT_PEARLESCENT 117 +#define BLOCK_FROGLIGHT_VERDANT 118 +#define BLOCK_GLOW_LICHEN 119 +#define BLOCK_GLOWSTONE 120 +#define BLOCK_JACK_O_LANTERN 121 +#define BLOCK_LANTERN 122 +#define BLOCK_LAVA 123 +#define BLOCK_MAGMA 124 +#define BLOCK_REDSTONE_LAMP_LIT 125 +#define BLOCK_REDSTONE_TORCH_LIT 126 +#define BLOCK_RESPAWN_ANCHOR_4 127 +#define BLOCK_SCULK_SENSOR_ACTIVE 128 +#define BLOCK_SEA_PICKLE_WET_1 129 +#define BLOCK_SEA_PICKLE_WET_2 130 +#define BLOCK_SEA_PICKLE_WET_3 131 +#define BLOCK_SEA_PICKLE_WET_4 132 +#define BLOCK_SEA_LANTERN 133 +#define BLOCK_SHROOMLIGHT 134 +#define BLOCK_SMOKER_LIT 135 +#define BLOCK_SOUL_FIRE 136 +#define BLOCK_SOUL_LANTERN 137 +#define BLOCK_SOUL_TORCH 138 +#define BLOCK_TORCH 139 #define BLOCK_GLASS 201 #define BLOCK_HONEY 202 #define BLOCK_ICE 203 diff --git a/shaders/lib/lpv_render.glsl b/shaders/lib/lpv_render.glsl index 24cba98..6151750 100644 --- a/shaders/lib/lpv_render.glsl +++ b/shaders/lib/lpv_render.glsl @@ -1,5 +1,5 @@ // LPV falloff curve -const float LpvBlockPower = 5.0; +const float LpvBlockPower = 4.0; // LPV block brightness scale const float LpvBlockBrightness = 2.0; diff --git a/shaders/lib/settings.glsl b/shaders/lib/settings.glsl index 79813b8..6ad9ec8 100644 --- a/shaders/lib/settings.glsl +++ b/shaders/lib/settings.glsl @@ -674,6 +674,7 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631) /////////////////////////////////////////// //#define LPV_ENABLED +#define LPV_ENTITY_LIGHTS #define LPV_NORMAL_OFFSET #define LPV_SIZE 7 // [6 7 8] diff --git a/shaders/shaders.properties b/shaders/shaders.properties index a230b53..9f32e9d 100644 --- a/shaders/shaders.properties +++ b/shaders/shaders.properties @@ -167,7 +167,7 @@ BLISS_SHADERS \ ### FloodFill screen.LPV.columns = 1 - screen.LPV = LPV_ENABLED LPV_SIZE LPV_NORMAL_OFFSET + screen.LPV = LPV_ENABLED LPV_SIZE LPV_ENTITY_LIGHTS LPV_NORMAL_OFFSET ######## WORLD screen.World.columns=1 diff --git a/shaders/world0/shadow.vsh b/shaders/world0/shadow.vsh index b766128..57982db 100644 --- a/shaders/world0/shadow.vsh +++ b/shaders/world0/shadow.vsh @@ -52,6 +52,7 @@ uniform int entityId; #ifdef IS_LPV_ENABLED attribute vec3 at_midBlock; + uniform int currentRenderedItemId; uniform int renderStage; #include "/lib/voxel_common.glsl" @@ -190,10 +191,8 @@ void main() { #if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store if ( - renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || - renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT || - renderStage == MC_RENDER_STAGE_TERRAIN_CUTOUT_MIPPED || - renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT + 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 ) { uint voxelId = uint(blockId); if (voxelId == 0u) voxelId = 1u; @@ -202,6 +201,23 @@ void main() { SetVoxelBlock(originPos, voxelId); } + + #ifdef LPV_ENTITY_LIGHTS + if ( + (currentRenderedItemId > 0 || entityId > 0) && + (renderStage == MC_RENDER_STAGE_BLOCK_ENTITIES || renderStage == MC_RENDER_STAGE_ENTITIES) + ) { + uint voxelId = uint(BLOCK_EMPTY); + + if (currentRenderedItemId > 0) voxelId = uint(currentRenderedItemId); + else { + // TODO: set from entityId + } + + if (voxelId > 0u) + SetVoxelBlock(playerpos, voxelId); + } + #endif #endif #ifdef WAVY_PLANTS