diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-05-30 17:00:07 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-05-30 17:01:58 -0600 |
commit | 1b2a77ba356407268b078062fa9ab4ff9853d348 (patch) | |
tree | 2414df5baac242b1c1024867db63b05572895519 /libdimension | |
parent | eb020a7251cdd1671218448f9456a6a6f30e59d5 (diff) | |
download | dimension-1b2a77ba356407268b078062fa9ab4ff9853d348.tar.xz |
Precompute objects in dmnsn_raytrace_scene() rather than dmnsn_new_prtree().
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/dimension/scene.h | 2 | ||||
-rw-r--r-- | libdimension/prtree.c | 11 | ||||
-rw-r--r-- | libdimension/raytrace.c | 6 |
3 files changed, 8 insertions, 11 deletions
diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h index 56addd0..6831048 100644 --- a/libdimension/dimension/scene.h +++ b/libdimension/dimension/scene.h @@ -25,6 +25,8 @@ #ifndef DIMENSION_SCENE_H #define DIMENSION_SCENE_H +#include <stdbool.h> + enum { DMNSN_RENDER_NONE = 0, DMNSN_RENDER_PIGMENT = 1 << 0, diff --git a/libdimension/prtree.c b/libdimension/prtree.c index a806850..b99c7e1 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -436,15 +436,6 @@ dmnsn_pseudo_prtree_leaves(const dmnsn_pseudo_prtree *pseudo) return leaves; } -/* Pre-calculate bounding box transformations, etc. */ -static void -dmnsn_precompute_objects(const dmnsn_array *objects) -{ - DMNSN_ARRAY_FOREACH (dmnsn_object **, object, objects) { - dmnsn_object_precompute(*object); - } -} - /* Split the unbounded objects into a new list */ static dmnsn_list * dmnsn_split_unbounded(dmnsn_list *objects) @@ -473,8 +464,6 @@ dmnsn_split_unbounded(dmnsn_list *objects) dmnsn_prtree * dmnsn_new_prtree(const dmnsn_array *objects) { - dmnsn_precompute_objects(objects); - dmnsn_list *leaves = dmnsn_list_from_array(objects); dmnsn_list *unbounded = dmnsn_split_unbounded(leaves); diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c index 2c389dc..8adde41 100644 --- a/libdimension/raytrace.c +++ b/libdimension/raytrace.c @@ -75,6 +75,12 @@ static int dmnsn_raytrace_scene_thread(void *ptr) { dmnsn_raytrace_payload *payload = ptr; + + /* Pre-calculate bounding box transformations, etc. */ + DMNSN_ARRAY_FOREACH (dmnsn_object **, object, payload->scene->objects) { + dmnsn_object_precompute(*object); + } + payload->prtree = dmnsn_new_prtree(payload->scene->objects); dmnsn_raytrace_payload *payloads; |