From cf586253932e04f3c5a2be2c3d6d3ff5b1301ce0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 12 Sep 2017 14:11:01 -0700 Subject: ray: don't assume x_alpha is 0 at begin or y_step Currently fragments always start at the left edge of the frame, but when switching to a tiling fragmenter this is no longer true and causes visible errors. --- src/modules/ray/ray_camera.c | 2 +- src/modules/ray/ray_camera.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/ray') diff --git a/src/modules/ray/ray_camera.c b/src/modules/ray/ray_camera.c index 8a06aa3..e7792f2 100644 --- a/src/modules/ray/ray_camera.c +++ b/src/modules/ray/ray_camera.c @@ -81,5 +81,5 @@ void ray_camera_frame_begin(ray_camera_t *camera, fb_fragment_t *fragment, ray_r frame->cur_e = ray_3f_lerp(&frame->ne, &frame->se, frame->y_alpha); ray->origin = camera->position; - ray->direction = ray_3f_normalize(&frame->cur_w); + ray->direction = ray_3f_nlerp(&frame->cur_w, &frame->cur_e, frame->x_alpha); } diff --git a/src/modules/ray/ray_camera.h b/src/modules/ray/ray_camera.h index b0c874a..191d614 100644 --- a/src/modules/ray/ray_camera.h +++ b/src/modules/ray/ray_camera.h @@ -69,7 +69,7 @@ static inline int ray_camera_frame_y_step(ray_camera_frame_t *frame) frame->y_alpha += frame->y_delta; frame->cur_w = ray_3f_lerp(&frame->nw, &frame->sw, frame->y_alpha); frame->cur_e = ray_3f_lerp(&frame->ne, &frame->se, frame->y_alpha); - frame->ray->direction = ray_3f_normalize(&frame->cur_w); + frame->ray->direction = ray_3f_nlerp(&frame->cur_w, &frame->cur_e, frame->x_alpha); return 1; } -- cgit v1.2.3