tweak spotlight pos

main
Dominik Madarász 2024-08-30 16:18:04 +02:00
parent cf25895f60
commit aa64db6e7f
1 changed files with 9 additions and 1 deletions

View File

@ -90,6 +90,7 @@ int main(int argc, char** argv) {
sky = skybox(flag("--mie") ? 0 : SKY_DIRS[SKY_DIR], 0);
sm = shadowmap(512, 4096);
// sm.blur_pcf = 1;
// sm.blur_scale
mdl = model(OBJ_MDLS[OBJ_MDL], 0);
shader_bind(mdl.program);
cubemap_sh_shader(&sky.cubemap);
@ -139,11 +140,15 @@ int main(int argc, char** argv) {
if (input_down(KEY_SPACE)) camera_spot = !camera_spot;
if (mode == SPOT && camera_spot) {
lights[0].pos = cam.position;
lights[0].pos = add3(lights[0].pos, scale3(cam.lookdir, 1.5f));
vec3 rhs = cross3(cam.lookdir, vec3(0,1,0));
lights[0].pos = add3(lights[0].pos, scale3(rhs, 0.5));
lights[0].dir = cam.lookdir;
}
if (mode == DIR) {
lights[0].pos = cam.position;
lights[0].dir = vec3(1,-1,-1);
}
@ -159,6 +164,9 @@ int main(int argc, char** argv) {
lights[1].pos.z += cosf(window_time()*4)*6.0;
lights[2].pos = cam.position;
lights[2].pos = add3(lights[2].pos, scale3(cam.lookdir, 1.5f));
vec3 rhs = cross3(cam.lookdir, vec3(0,1,0));
lights[2].pos = add3(lights[2].pos, scale3(rhs, 0.5));
lights[2].dir = cam.lookdir;
lights[3].dir = vec3(1,-1,-1);