summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-11-09 21:59:13 -0500
committerTavian Barnes <tavianator@gmail.com>2009-11-09 21:59:13 -0500
commit5f37c6b3ca7b447ad8a4dc5fd84604342e32e59d (patch)
tree2cc077706168760bd26a2f1dc83372652e90742d
parent531368437bfb865247204fa78235428028170081 (diff)
downloaddimension-5f37c6b3ca7b447ad8a4dc5fd84604342e32e59d.tar.xz
Raytrace one row of pixels per thread.
The theory is that if the next ray shot is closer to the previous ray, the k-D splay tree will work better because we're more likely to hit the same object.
-rw-r--r--libdimension/raytrace.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 74bfefc..3a266a2 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -227,12 +227,9 @@ dmnsn_raytrace_scene_impl(dmnsn_progress *progress, dmnsn_scene *scene,
width = scene->canvas->x;
height = scene->canvas->y;
- /* Initialize `x' */
- x = width + index;
-
/* Iterate through each pixel */
- for (y = 0; y < height; ++y) {
- for (x -= width; x < width; x += threads) {
+ for (y = index; y < height; y += threads) {
+ for (x = 0; x < width; ++x) {
/* Set the pixel to the background color */
color = scene->background;