diff --git a/main.c b/main.c index 5cf92e2..ccb5fe8 100644 --- a/main.c +++ b/main.c @@ -3848,6 +3848,8 @@ extern bool profiling; #else bool profiling; #endif +#else +const bool show_devtools = false; #endif Color debug_color = {1,0,0,1}; diff --git a/threedee.glsl b/threedee.glsl index b44fda7..e1a212c 100644 --- a/threedee.glsl +++ b/threedee.glsl @@ -48,6 +48,13 @@ float decodeDepth(vec4 rgba) { } float do_shadow_sample(sampler2D shadowMap, vec2 uv, float scene_depth) { + { + //WebGL does not support GL_CLAMP_TO_BORDER, or border colors at all it seems, so we have to check explicitly. + //This will probably slow down other versions which do support texture borders, but the current system does + // not provide a non-overly complex way to include/not-include this code based on the backend. So here it is. + if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) + return 1.0; + } float map_depth = decodeDepth(texture(shadowMap, uv)); map_depth += 0.001;//bias to counter self-shadowing return step(scene_depth, map_depth); diff --git a/web_specific_shader_header.glsl b/web_specific_shader_header.glsl new file mode 100644 index 0000000..16a0ba9 --- /dev/null +++ b/web_specific_shader_header.glsl @@ -0,0 +1,5 @@ +@block clamp_to_border + //WebGL does not support GL_CLAMP_TO_BORDER, or border colors at all it seems, so we have to check explicitly. + if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) + return 1.0; +@end \ No newline at end of file