Display a textured cube with Raylib #2

Merged
kornerr merged 6 commits from ray into master 2026-10-18 10:16:40 +00:00
Showing only changes of commit 6b70219fef - Show all commits
+8 -2
View File
@@ -140,13 +140,19 @@ static const char *SR_MAIN_FS =
"\n" "\n"
"out vec4 finalColor;\n" "out vec4 finalColor;\n"
"\n" "\n"
"bool isPixelInShadowMap(vec3 proj)\n"
"{\n"
" return proj.x >= 0.0 && proj.x <= 1.0 &&\n"
" proj.y >= 0.0 && proj.y <= 1.0 &&\n"
" proj.z >= 0.0 && proj.z <= 1.0;\n"
"}\n"
"\n"
"float shadowFactor()\n" "float shadowFactor()\n"
"{\n" "{\n"
" vec3 proj = vLightClip.xyz / vLightClip.w;\n" " vec3 proj = vLightClip.xyz / vLightClip.w;\n"
" proj = proj * 0.5 + 0.5;\n" " proj = proj * 0.5 + 0.5;\n"
"\n" "\n"
" if (proj.z > 1.0 || proj.z < 0.0) return 0.0;\n" " if (!isPixelInShadowMap(proj)) return 0.0;\n"
" if (proj.x < 0.0 || proj.x > 1.0 || proj.y < 0.0 || proj.y > 1.0) return 0.0;\n"
"\n" "\n"
" int radius = int(u_shadowSoftness);\n" " int radius = int(u_shadowSoftness);\n"
" vec2 texel = 1.0 / vec2(textureSize(u_shadowMap, 0));\n" " vec2 texel = 1.0 / vec2(textureSize(u_shadowMap, 0));\n"