#define get_scanlines(a, b, c) scanlines[(a)*total_triangles*3+(b)*3+c] #define get_scanline_coords(a, b, c) scanline_coords[(a)*total_triangles*4+(b)*4+c] #define max(x, y) ((x)>(y)?(x):(y)) #define min(x, y) ((x)<(y)?(x):(y)) #define abs(a) ((a)>0?(a):-(a)) #define round(x) (((x) - (long)(x) < 1) ? (long)(x) : ((long)(x) + 1)) #define square(x) ((x)*(x)) //calculations kernel #define triangle get_global_id(0) //put the coordinates for the point of intersection of lines (not segments) p1->p2 and p3->p4 in x, z. If there is no intersection it sets z to -1 #define intersect(x, z, x1, z1, x2, z2, x3, z3, x4, z4)\ m1 = (z2 - z1) / (int)(x2 - x1);\ b1 = z1 - m1*x1;\ m2 = (z4 - z3) / (int)(x4 - x3);\ b2 = z3 - m2*x3;\ if (abs(m1 - m2) <= 1 && abs(b2 - b1) <= 1) {\ x = x1;\ z = z1;\ }\ else if (abs(m1 - m2) <= 1) {\ z = -1;\ }\ else {\ x = 1;\ z = 1;\ } void kernel project_line(global long *triangles, global int *scanlines, global long *scanline_coords, const int width, const int fl, const int total_triangles) { //projecting int b=3; long x, y, z, x1, y1, z1, x2, y2, z2, x3, y3, sx, sz, ex, ez, rx, rz; int p, linked; int level = 0; int m1, m2, b1, b2; // only one point is behind the screen if (fl) { z = fl; x = fl; z1 = fl; x1 = fl; y1 = fl; x3 = fl; y3 = fl; linked = 1; } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } if (linked) { if (level < y3) { if (y) sx = min(x, x3); if (x3) sz = min(sx, y3); } } if (ex) { if (ex < width) { get_scanlines(level, triangle, 1) = ex; } else { intersect(rx, rz, (sx - width / 2)*sz / fl, sz, (ex - width / 2)*ez / fl, ez, 0, 0, width / 2, fl); get_scanline_coords(level, triangle, 2) = rx; } } }