entity.properties template; lpv hand-light prep

This commit is contained in:
NULL511 2024-05-06 11:54:30 -04:00
parent 81fb07c371
commit bfcf3e1805
12 changed files with 120 additions and 49 deletions

View File

@ -67,6 +67,8 @@ flat varying float HELD_ITEM_BRIGHTNESS;
#endif
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
uniform int heldItemId2;
uniform int frameCounter;
#include "/lib/hsv.glsl"

View File

@ -107,6 +107,9 @@ uniform vec3 nsunColor;
#endif
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
uniform int heldItemId2;
#include "/lib/hsv.glsl"
#include "/lib/lpv_common.glsl"
#include "/lib/lpv_render.glsl"

View File

@ -123,6 +123,11 @@ flat varying vec3 WsunVec;
flat varying vec3 unsigned_WsunVec;
flat varying float exposure;
#ifdef IS_LPV_ENABLED
uniform int heldItemId;
uniform int heldItemId2;
#endif
#define diagonal3(m) vec3((m)[0].x, (m)[1].y, m[2].z)
#define projMAD(m, v) (diagonal3(m) * (v) + (m)[3].xyz)

View File

@ -131,9 +131,6 @@ void main() {
uint tintData = LpvBlockMap[blockId].Tint;
tintColor = unpackUnorm4x8(tintData).rgb;
}
if (blockId > 0u) {
vec4 lightColorRange = unpackUnorm4x8(LpvBlockMap[blockId].ColorRange);
float lightRange = lightColorRange.a * 255.0;

View File

@ -3,11 +3,18 @@ entity.1201= player
entity.1202=minecraft:lightning_bolt weather2:lightning_bolt
## misc stuff
entity.1203= ender_dragon wither
entity.1301= item_frame item_display
entity.1302= spectral_arrow bigglobe:torch_arrow
entity.1303= tnt firework_rocket
entity.1203=blaze
entity.1204=ender_dragon wither
entity.1205=item_frame item_display
entity.1206=magma_cube
entity.1207=tnt firework_rocket
entity.1208=spectral_arrow bigglobe:torch_arrow
################################################
###### SUB-SURFACE SCATTERING
@ -17,8 +24,8 @@ entity.1303= tnt firework_rocket
entity.1401=giant ghast elder_guardian
## weak sss (same as weak sss for blocks)
entity.1402 = furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin blaze creeper drowned endermite evoker guardian hoglin husk magma_cube phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama
#removed: player
entity.1402=furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama
#removed: player blaze magma_cube
################################################
###### REFLECTIVE TRANSLUCENTS

View File

@ -1,3 +1,14 @@
#ifdef IS_LPV_ENABLED
vec3 GetHandLight(const in int itemId) {
if (itemId < 1000) {
// TODO: block lights
}
else {
// TODO: item lights
}
}
#endif
vec3 DoAmbientLightColor(
vec3 lpvPos,
vec3 SkyColor,
@ -24,9 +35,6 @@ vec3 DoAmbientLightColor(
vec4 lpvSample = SampleLpvLinear(lpvPos);
vec3 LpvTorchLight = GetLpvBlockLight(lpvSample);
// TODO: needs work, just binary transition for now
// float LpvFadeF = clamp(lpvPos, vec3(0.0), LpvSize3 - 1.0) == lpvPos ? 1.0 : 0.0;
// i gotchu
float fadeLength = 10.0; // in blocks
vec3 cubicRadius = clamp( min(((LpvSize3-1.0) - lpvPos)/fadeLength, lpvPos/fadeLength) ,0.0,1.0);
@ -35,6 +43,12 @@ vec3 DoAmbientLightColor(
LpvFadeF = 1.0 - pow(1.0-pow(LpvFadeF,1.5),3.0); // make it nice and soft :)
TorchLight = mix(TorchLight,LpvTorchLight/5.0, LpvFadeF);
if (heldItemId > 0)
TorchLight += GetHandLight(heldItemId);
if (heldItemId2 > 0)
TorchLight += GetHandLight(heldItemId2);
#endif
return IndirectLight + TorchLight * TorchBrightness_autoAdjust;

View File

@ -1,10 +1,11 @@
#define ENTITY_PLAYER 1201
#define ENTITY_LIGHTNING 1202
//#define ENTITY_DRAGON_WITHER 1203
#define ENTITY_ITEM_FRAME 1301
#define ENTITY_SPECTRAL_ARROW 1302
#define ENTITY_TNT 1303
#define ENTITY_BLAZE 1203
#define ENTITY_DRAGON_WITHER 1204
#define ENTITY_ITEM_FRAME 1205
#define ENTITY_MAGMA_CUBE 1206
#define ENTITY_TNT 1207
#define ENTITY_SPECTRAL_ARROW 1208
#define ENTITY_SSS_MEDIUM 1401
#define ENTITY_SSS_WEAK 1402
#define ENTITY_SLIME 1403

View File

@ -687,6 +687,8 @@ const vec3 aerochrome_color = mix(vec3(1.0, 0.0, 0.0), vec3(0.715, 0.303, 0.631)
#define LPV_REDSTONE_LIGHTS
//#define LPV_COLORED_CANDLES
#define LPV_NOSHADOW_HACK
#ifdef LPV_ENABLED
#ifdef IRIS_FEATURE_CUSTOM_IMAGES
#define IS_LPV_ENABLED

View File

@ -0,0 +1,45 @@
#= ENTITY_PLAYER
entity.1201= player
#= ENTITY_LIGHTNING
entity.*= minecraft:lightning_bolt weather2:lightning_bolt
## misc stuff
#= ENTITY_BLAZE
entity.*= blaze
#= ENTITY_DRAGON_WITHER
entity.*= ender_dragon wither
#= ENTITY_ITEM_FRAME
entity.*= item_frame item_display
#= ENTITY_MAGMA_CUBE
entity.*= magma_cube
#= ENTITY_TNT
entity.*= tnt firework_rocket
#= ENTITY_SPECTRAL_ARROW
entity.*= spectral_arrow bigglobe:torch_arrow
################################################
###### SUB-SURFACE SCATTERING
################################################
## medium sss (same as strong sss for blocks)
#= ENTITY_SSS_MEDIUM
entity.1401 = giant ghast elder_guardian
## weak sss (same as weak sss for blocks)
#= ENTITY_SSS_WEAK
entity.* = furnace_minecart sheep frog chicken iron_golem snow_golem polar_bear zombie_horse armor_stand arrow squid bat cat cod cow donkey fox horse mooshroom mule ocelot parrot pig piglin polar_bear pufferfish rabbit salmon strider tropical_fish turtle villager wandering_trader bee cave_spider dolphin enderman llama panda spider wolf zombified_piglin creeper drowned endermite evoker guardian hoglin husk phantom piglin_brute pillager ravager silverfish stray vex vindicator witch zoglin zombie zombie_villager trader_llama
#removed: player blaze magma_cube
################################################
###### REFLECTIVE TRANSLUCENTS
################################################
#= ENTITY_SLIME
entity.* = slime

View File

@ -37,8 +37,12 @@ Read the terms of modification and sharing before changing something below pleas
void main() {
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
#ifdef LPV_NOSHADOW_HACK
vec3 playerpos = gl_Vertex.xyz;
#else
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
#endif
if (
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
@ -60,20 +64,16 @@ void main() {
uint voxelId = 0u;
if (currentRenderedItemId > 0) {
if (entityId == ENTITY_PLAYER) {
if (currentRenderedItemId < 1000)
voxelId = uint(currentRenderedItemId);
}
else if (entityId != ENTITY_ITEM_FRAME)
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_BLAZE:
case ENTITY_MAGMA_CUBE:
case ENTITY_SPECTRAL_ARROW:
voxelId = uint(BLOCK_TORCH);
break;
// TODO: blaze, magma_cube
}
}

View File

@ -213,21 +213,16 @@ void main() {
uint voxelId = 0u;
if (currentRenderedItemId > 0) {
if (entityId == ENTITY_PLAYER) {
// TODO: remove once hand-light is added
if (currentRenderedItemId < 1000)
voxelId = uint(currentRenderedItemId);
}
else if (entityId != ENTITY_ITEM_FRAME)
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_BLAZE:
case ENTITY_MAGMA_CUBE:
case ENTITY_SPECTRAL_ARROW:
voxelId = uint(BLOCK_TORCH);
break;
// TODO: blaze, magma_cube
}
}

View File

@ -37,8 +37,12 @@ Read the terms of modification and sharing before changing something below pleas
void main() {
#if defined IS_LPV_ENABLED && defined MC_GL_EXT_shader_image_load_store
#ifdef LPV_NOSHADOW_HACK
vec3 playerpos = gl_Vertex.xyz;
#else
vec3 position = mat3(gl_ModelViewMatrix) * vec3(gl_Vertex) + gl_ModelViewMatrix[3].xyz;
vec3 playerpos = mat3(shadowModelViewInverse) * position + shadowModelViewInverse[3].xyz;
#endif
if (
renderStage == MC_RENDER_STAGE_TERRAIN_SOLID || renderStage == MC_RENDER_STAGE_TERRAIN_TRANSLUCENT ||
@ -60,20 +64,16 @@ void main() {
uint voxelId = 0u;
if (currentRenderedItemId > 0) {
if (entityId == ENTITY_PLAYER) {
if (currentRenderedItemId < 1000)
voxelId = uint(currentRenderedItemId);
}
else if (entityId != ENTITY_ITEM_FRAME)
if (entityId != ENTITY_ITEM_FRAME && entityId != ENTITY_PLAYER)
voxelId = uint(currentRenderedItemId);
}
else {
switch (entityId) {
case ENTITY_BLAZE:
case ENTITY_MAGMA_CUBE:
case ENTITY_SPECTRAL_ARROW:
voxelId = uint(BLOCK_TORCH);
break;
// TODO: blaze, magma_cube
}
}