Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/assets/opensb/rendering/opengl20.frag
diff options
context:
space:
mode:
Diffstat (limited to 'assets/opensb/rendering/opengl20.frag')
-rw-r--r--assets/opensb/rendering/opengl20.frag10
1 files changed, 9 insertions, 1 deletions
diff --git a/assets/opensb/rendering/opengl20.frag b/assets/opensb/rendering/opengl20.frag
index 92a121f..a57c029 100644
--- a/assets/opensb/rendering/opengl20.frag
+++ b/assets/opensb/rendering/opengl20.frag
@@ -6,7 +6,9 @@ uniform sampler2D texture2;
uniform sampler2D texture3;
uniform bool lightMapEnabled;
uniform vec2 lightMapSize;
+uniform vec2 tileLightMapSize;
uniform sampler2D lightMap;
+uniform sampler2D tileLightMap;
uniform float lightMapMultiplier;
varying vec2 fragmentTextureCoordinate;
@@ -53,6 +55,12 @@ vec4 bicubicSample(sampler2D texture, vec2 texcoord, vec2 texscale) {
mix(sample1, sample0, sx), sy);
}
+vec4 sampleLightMap(vec2 texcoord, vec2 texscale) {
+ vec4 a = bicubicSample(lightMap, texcoord, texscale);
+ vec4 b = bicubicSample(tileLightMap, texcoord, texscale);
+ return mix(a, b, b.z);
+}
+
void main() {
vec4 texColor;
if (fragmentTextureIndex > 2.9) {
@@ -70,6 +78,6 @@ void main() {
vec4 finalColor = texColor * fragmentColor;
float finalLightMapMultiplier = fragmentLightMapMultiplier * lightMapMultiplier;
if (lightMapEnabled && finalLightMapMultiplier > 0.0)
- finalColor.rgb *= bicubicSample(lightMap, fragmentLightMapCoordinate, 1.0 / lightMapSize).rgb * finalLightMapMultiplier;
+ finalColor.rgb *= sampleLightMap(fragmentLightMapCoordinate, 1.0 / lightMapSize).rgb * finalLightMapMultiplier;
gl_FragColor = finalColor;
} \ No newline at end of file