glouw/andvaranaut

focal length used in the wrong sense

glouw opened this issue · 0 comments

glouw commented

https://github.com/yellingintothefan/water/blob/0e3ebf69d93d974ab0d08b48992723d11eaffb5a/Scanline.c#L24

offset can be simplified with the focal length. original xfocal() is wrongly named and can be removed. xfcast() can be removed too. fov changes must then change the focal length and not focal diameter.

const float weight = r.traceline.fov.a.x / r.traceline.corrected.x;
for(int x = 0; x < r.projection.clamped.bot; x++)
{
    const float offset = weight / (1.0 - (float) x / r.projection.mid);
    const Point where = wheres[sl.sdl.yres - 1 - x] = xlerp(r.traceline.trace, offset);
    ...