diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-16 01:16:16 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-16 01:16:16 +0000 |
commit | 00997fa54c64b53618255b1e292d3db4d18b86af (patch) | |
tree | 45ffdb6c3b604fef398f6c01d8d78aa48e3231d6 /libdimension/dimension | |
parent | 8f01c5394dcce8f5d4e7102dacfcdea9d1f7b021 (diff) | |
download | dimension-00997fa54c64b53618255b1e292d3db4d18b86af.tar.xz |
New dmnsn_intersection* type for ray-object intersections.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/object.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index 901b366..fefb061 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -25,12 +25,27 @@ #ifndef DIMENSION_OBJECT_H #define DIMENSION_OBJECT_H +/* A type to represent a ray-object intersection */ +typedef struct { + /* The ray and point which intersected */ + dmnsn_line ray; + double t; + + /* The texture at the intersection point */ + const dmnsn_texture *texture; +} dmnsn_intersection; + +dmnsn_intersection *dmnsn_new_intersection(); +void dmnsn_delete_intersection(dmnsn_intersection *intersection); + /* Forward-declare dmnsn_object */ typedef struct dmnsn_object dmnsn_object; /* Object callback types */ -typedef dmnsn_array *dmnsn_object_intersections_fn(const dmnsn_object *object, - dmnsn_line line); + +typedef dmnsn_intersection * +dmnsn_object_intersection_fn(const dmnsn_object *object, dmnsn_line line); + typedef int dmnsn_object_inside_fn(const dmnsn_object *object, dmnsn_vector point); @@ -43,9 +58,9 @@ struct dmnsn_object { dmnsn_matrix trans; /* Callback functions */ - dmnsn_object_intersections_fn *intersections_fn; - dmnsn_object_inside_fn *inside_fn; - dmnsn_free_fn *free_fn; + dmnsn_object_intersection_fn *intersection_fn; + dmnsn_object_inside_fn *inside_fn; + dmnsn_free_fn *free_fn; /* Generic pointer for object info */ void *ptr; @@ -53,7 +68,6 @@ struct dmnsn_object { /* Allocate a dummy object */ dmnsn_object *dmnsn_new_object(); - /* Free an object */ void dmnsn_delete_object(dmnsn_object *object); |