mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 06:24:12 +01:00
Port the fixed lightmap shift to WorldContext
This commit is contained in:
parent
3856283353
commit
8efe8ed01e
@ -1,4 +1,5 @@
|
||||
#flwinclude <"create:context/std/fog.glsl">
|
||||
#flwinclude <"create:core/lightutil.glsl">
|
||||
|
||||
varying vec3 BoxCoord;
|
||||
uniform sampler3D uLightVolume;
|
||||
@ -23,6 +24,7 @@ void FLWFinalizeColor(vec4 color) {
|
||||
}
|
||||
|
||||
vec4 FLWLight(vec2 lightCoords) {
|
||||
vec2 lm = max(lightCoords, texture3D(uLightVolume, BoxCoord).rg);
|
||||
return texture2D(uLightMap, lm * 0.99609375 + 0.03125); // * 255/256 + 1/32
|
||||
lightCoords = max(lightCoords, texture3D(uLightVolume, BoxCoord).rg);
|
||||
|
||||
return texture2D(uLightMap, shiftLight(lightCoords));
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#flwinclude <"create:context/std/fog.glsl">
|
||||
#flwinclude <"create:core/lightutil.glsl">
|
||||
|
||||
uniform sampler2D uBlockAtlas;
|
||||
uniform sampler2D uLightMap;
|
||||
@ -20,6 +21,5 @@ void FLWFinalizeColor(vec4 color) {
|
||||
}
|
||||
|
||||
vec4 FLWLight(vec2 lightCoords) {
|
||||
vec2 lm = lightCoords * 0.9375 + 0.03125;
|
||||
return texture2D(uLightMap, lm);
|
||||
return texture2D(uLightMap, shiftLight(lightCoords));
|
||||
}
|
||||
|
@ -0,0 +1,4 @@
|
||||
// Adjust the [0,1] normalized lightmap value based on the texture matrix from LightTexture#enableLightmap
|
||||
vec2 shiftLight(vec2 lm) {
|
||||
return lm * 0.99609375 + 0.03125;// * 255/256 + 1/32
|
||||
}
|
Loading…
Reference in New Issue
Block a user