Run shadow render pass and compute light position in vertex shaders

This commit is contained in:
Camden Dixie O'Brien committed 2025-10-04 21:27:46 +01:00
1 parent 73340b3a39
commit 633a922e42
6 files changed
+121 -23

No files matched your search

+6 -3
View File
@@ -59,9 +59,12 @@ int main(int argc, char *argv[])
const vec3_t cam = { 0, 4, -8 };
const vec3_t tgt = { 0, 0, 0 };
const mat4_t view = mat4_lookat(cam, tgt, (vec3_t) { 0, 1, 0 });
const vec3_t up = { 0, 1, 0 };
const vec3_t light = { 2, 2, -1 };
const mat4_t view = mat4_lookat(cam, tgt, up);
const mat4_t proj = mat4_perspective((float)W / H, PI / 8, 0.1, 100.0);
const mat4_t vp = mat4_mul(proj, view);
const mat4_t light_vp = mat4_lookat(light, tgt, up);
mat4_t transforms[NELEMS(gpu_models)] = {
mat4_mul(
MAT4_TRANSLATE(1, 0, 0),
@@ -100,8 +103,8 @@ int main(int argc, char *argv[])
anim.bone_matrices,
};
gpu_render(
&gpu, vp, NELEMS(gpu_models), gpu_models, bone_matrices,
transforms);
&gpu, vp, light_vp, NELEMS(gpu_models), gpu_models,
bone_matrices, transforms);
}
// Clean up