Port the fixed lightmap shift to WorldContext
This commit is contained in:
parent
3856283353
commit
8efe8ed01e
3 changed files with 10 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
#flwinclude <"create:context/std/fog.glsl">
|
#flwinclude <"create:context/std/fog.glsl">
|
||||||
|
#flwinclude <"create:core/lightutil.glsl">
|
||||||
|
|
||||||
varying vec3 BoxCoord;
|
varying vec3 BoxCoord;
|
||||||
uniform sampler3D uLightVolume;
|
uniform sampler3D uLightVolume;
|
||||||
|
@ -23,6 +24,7 @@ void FLWFinalizeColor(vec4 color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 FLWLight(vec2 lightCoords) {
|
vec4 FLWLight(vec2 lightCoords) {
|
||||||
vec2 lm = max(lightCoords, texture3D(uLightVolume, BoxCoord).rg);
|
lightCoords = max(lightCoords, texture3D(uLightVolume, BoxCoord).rg);
|
||||||
return texture2D(uLightMap, lm * 0.99609375 + 0.03125); // * 255/256 + 1/32
|
|
||||||
|
return texture2D(uLightMap, shiftLight(lightCoords));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#flwinclude <"create:context/std/fog.glsl">
|
#flwinclude <"create:context/std/fog.glsl">
|
||||||
|
#flwinclude <"create:core/lightutil.glsl">
|
||||||
|
|
||||||
uniform sampler2D uBlockAtlas;
|
uniform sampler2D uBlockAtlas;
|
||||||
uniform sampler2D uLightMap;
|
uniform sampler2D uLightMap;
|
||||||
|
@ -20,6 +21,5 @@ void FLWFinalizeColor(vec4 color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 FLWLight(vec2 lightCoords) {
|
vec4 FLWLight(vec2 lightCoords) {
|
||||||
vec2 lm = lightCoords * 0.9375 + 0.03125;
|
return texture2D(uLightMap, shiftLight(lightCoords));
|
||||||
return texture2D(uLightMap, lm);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 a new issue