diff options
author | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-08 17:08:20 -0400 |
---|---|---|
committer | Anthony LaTorre <tlatorre9@gmail.com> | 2011-09-08 17:08:20 -0400 |
commit | 25de37ef26b8356d8fa012c709cd68c1fb327227 (patch) | |
tree | 784c5eb8cc139b6e9e08c1d610b400bd3fe2ac4c | |
parent | 56715fd2f364de5a8c17f0d689a02c03e08d99b8 (diff) | |
download | chroma-25de37ef26b8356d8fa012c709cd68c1fb327227.tar.gz chroma-25de37ef26b8356d8fa012c709cd68c1fb327227.tar.bz2 chroma-25de37ef26b8356d8fa012c709cd68c1fb327227.zip |
Geometry.build() waits until a certain number of triangles are grouped together before creating leaf nodes in the bounding volume hierarchy.
-rw-r--r-- | geometry.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/geometry.py b/geometry.py index 5b89110..f942222 100644 --- a/geometry.py +++ b/geometry.py @@ -235,8 +235,7 @@ class Geometry(object): return len(self.solids)-1 - @timeit - def build(self, bits=8, shift=3, use_cache=True): + def build(self, bits=11, shift=3, use_cache=True): """ Build the bounding volume hierarchy, material/surface code arrays, and color array for this geometry. If the bounding volume hierarchy is @@ -308,7 +307,7 @@ class Geometry(object): except IOError: pass else: - print 'loading cache.' + #print 'loading cache.' data = pickle.load(f) reorder = data.pop('reorder') @@ -341,6 +340,10 @@ class Geometry(object): unique_zvalues = np.unique(zvalues_mesh) + while unique_zvalues.size > zvalues_mesh.size/np.e: + zvalues_mesh = zvalues_mesh >> shift + unique_zvalues = np.unique(zvalues_mesh) + self.lower_bounds = np.empty((unique_zvalues.size,3), dtype=np.float32) self.upper_bounds = np.empty((unique_zvalues.size,3), dtype=np.float32) @@ -386,7 +389,8 @@ class Geometry(object): self.start_node = self.node_map.size - 1 if use_cache: - print >>sys.stderr, 'Writing BVH to cache directory...' + #print 'Writing BVH to cache directory...' + sys.stdout.flush() if not os.path.exists(cache_dir): os.makedirs(cache_dir) |