diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-16 01:16:33 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-16 01:16:33 +0000 |
commit | 6b4dc860466ce4794b346533162291046a6ee96c (patch) | |
tree | 2ce3f61711ea6a5688462f605a4e5913e1cb7a4e /libdimension/objects.c | |
parent | c3619e541564d5133a3ccdaeb79588d37d46a3db (diff) | |
download | dimension-6b4dc860466ce4794b346533162291046a6ee96c.tar.xz |
New C++ wrapper for dmnsn_texture*.
Diffstat (limited to 'libdimension/objects.c')
-rw-r--r-- | libdimension/objects.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libdimension/objects.c b/libdimension/objects.c index 780c06b..3c772d1 100644 --- a/libdimension/objects.c +++ b/libdimension/objects.c @@ -100,7 +100,7 @@ dmnsn_new_cube() dmnsn_object *cube = dmnsn_new_object(); if (cube) { cube->intersection_fn = &dmnsn_cube_intersection_fn; - cube->inside_fn = &dmnsn_cube_inside_fn; + cube->inside_fn = &dmnsn_cube_inside_fn; } return cube; } @@ -126,7 +126,7 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line) /* x = 1.0 */ t_temp = (1.0 - line.x0.x)/line.n.x; - p = dmnsn_line_point(line, t); + p = dmnsn_line_point(line, t_temp); if (p.y >= -1.0 && p.y <= 1.0 && p.z >= -1.0 && p.z <= 1.0 && t_temp >= 0.0 && (t < 0.0 || t_temp < t)) { t = t_temp; @@ -136,16 +136,16 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line) if (line.n.y != 0.0) { /* y = -1.0 */ t_temp = (-1.0 - line.x0.y)/line.n.y; - p = dmnsn_line_point(line, t); - if (p.y >= -1.0 && p.y <= 1.0 && p.z >= -1.0 && p.z <= 1.0 + p = dmnsn_line_point(line, t_temp); + if (p.x >= -1.0 && p.x <= 1.0 && p.z >= -1.0 && p.z <= 1.0 && t_temp >= 0.0 && (t < 0.0 || t_temp < t)) { t = t_temp; } /* y = 1.0 */ t_temp = (1.0 - line.x0.y)/line.n.y; - p = dmnsn_line_point(line, t); - if (p.y >= -1.0 && p.y <= 1.0 && p.z >= -1.0 && p.z <= 1.0 + p = dmnsn_line_point(line, t_temp); + if (p.x >= -1.0 && p.x <= 1.0 && p.z >= -1.0 && p.z <= 1.0 && t_temp >= 0.0 && (t < 0.0 || t_temp < t)) { t = t_temp; } @@ -154,16 +154,16 @@ dmnsn_cube_intersection_fn(const dmnsn_object *cube, dmnsn_line line) if (line.n.z != 0.0) { /* z = -1.0 */ t_temp = (-1.0 - line.x0.z)/line.n.z; - p = dmnsn_line_point(line, t); - if (p.y >= -1.0 && p.y <= 1.0 && p.z >= -1.0 && p.z <= 1.0 + p = dmnsn_line_point(line, t_temp); + if (p.x >= -1.0 && p.x <= 1.0 && p.y >= -1.0 && p.y <= 1.0 && t_temp >= 0.0 && (t < 0.0 || t_temp < t)) { t = t_temp; } /* z = 1.0 */ t_temp = (1.0 - line.x0.z)/line.n.z; - p = dmnsn_line_point(line, t); - if (p.y >= -1.0 && p.y <= 1.0 && p.z >= -1.0 && p.z <= 1.0 + p = dmnsn_line_point(line, t_temp); + if (p.x >= -1.0 && p.x <= 1.0 && p.y >= -1.0 && p.y <= 1.0 && t_temp >= 0.0 && (t < 0.0 || t_temp < t)) { t = t_temp; } |