1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-12-24 01:36:19 +01:00

Fix floor depth

This commit is contained in:
Miloslav Číž 2018-09-01 12:10:45 +02:00
parent 471b989fcb
commit bfbc84ed7a

View file

@ -586,8 +586,8 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
for (int32_t i = y; i >= middleRow; --i)
{
p.position.y = i;
_pixelFunction(p);
p.depth = (_camera.resolution.y - i) * _floorDepthStep + floorCameraDiff;
_pixelFunction(p);
}
}
@ -603,7 +603,7 @@ void render(Camera cam, ArrayFunction arrayFunc, PixelFunction pixelFunc,
cam.position.y / UNITS_PER_SQUARE) -1 * cam.height;
// TODO
_floorDepthStep = (10 * UNITS_PER_SQUARE) / cam.resolution.y;
_floorDepthStep = (16 * UNITS_PER_SQUARE) / cam.resolution.y;
castRaysMultiHit(cam,arrayFunc,_columnFunction,constraints);
}