summaryrefslogtreecommitdiffstats
path: root/libdimension/raytrace.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:16 +0000
committerTavian Barnes <tavianator@gmail.com>2009-07-16 01:16:16 +0000
commit00997fa54c64b53618255b1e292d3db4d18b86af (patch)
tree45ffdb6c3b604fef398f6c01d8d78aa48e3231d6 /libdimension/raytrace.c
parent8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021 (diff)
downloaddimension-00997fa54c64b53618255b1e292d3db4d18b86af.tar.xz
New dmnsn_intersection* type for ray-object intersections.
Diffstat (limited to 'libdimension/raytrace.c')
-rw-r--r--libdimension/raytrace.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 03dcbab..75e857c 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -230,7 +230,7 @@ dmnsn_raytrace_shoot(dmnsn_scene *scene, dmnsn_color color,
{
dmnsn_line ray, ray_trans;
dmnsn_object *object;
- dmnsn_array *intersections;
+ dmnsn_intersection *intersection;
unsigned int i;
/* Get the ray corresponding to the (x,y)'th pixel */
@@ -243,14 +243,11 @@ dmnsn_raytrace_shoot(dmnsn_scene *scene, dmnsn_color color,
ray_trans = dmnsn_matrix_line_mul(object->trans, ray);
/* Test for intersections with objects */
- intersections = (*object->intersections_fn)(object, ray_trans);
+ intersection = (*object->intersection_fn)(object, ray_trans);
- if (dmnsn_array_size(intersections) > 0) {
+ if (intersection) {
color = dmnsn_color_from_XYZ(dmnsn_whitepoint);
}
-
- /* Delete the intersections array */
- dmnsn_delete_array(intersections);
}
return color;