fixed missing last tile, and changed bvh node to binary
[cyberay] / src / rt.c
index 18b7f17..020c51f 100644 (file)
--- a/src/rt.c
+++ b/src/rt.c
@@ -33,8 +33,8 @@ int fbsize(int width, int height)
        if(!(fbptr = malloc(width * height * sizeof *fb.pixels))) {
                return -1;
        }
-       xtiles = width / TILESZ;
-       ytiles = height / TILESZ;
+       xtiles = (width + TILESZ - 1) / TILESZ;
+       ytiles = (height + TILESZ - 1) / TILESZ;
        if(!(tileptr = malloc(xtiles * ytiles * sizeof *tiles))) {
                free(fbptr);
                return -1;