Some minor code formatting cleanup and debug printing.
This commit is contained in:
parent
ef31093dcb
commit
848d0afd40
|
@ -122,8 +122,6 @@ impl AssemblyBuilder {
|
|||
|
||||
pub fn build(mut self) -> Assembly {
|
||||
// Shrink storage to minimum.
|
||||
// However, don't shrink shader storage, because there are pointers to
|
||||
// that data that could get invalidated.
|
||||
self.instances.shrink_to_fit();
|
||||
self.xforms.shrink_to_fit();
|
||||
self.objects.shrink_to_fit();
|
||||
|
@ -135,6 +133,8 @@ impl AssemblyBuilder {
|
|||
1,
|
||||
|inst| &bbs[bis[inst.id]..bis[inst.id + 1]]);
|
||||
|
||||
println!("Assembly BVH Depth: {}", object_accel.tree_depth());
|
||||
|
||||
Assembly {
|
||||
instances: self.instances,
|
||||
xforms: self.xforms,
|
||||
|
|
|
@ -47,11 +47,13 @@ impl BVH {
|
|||
bvh.bounds_cache.clear();
|
||||
bvh.bounds_cache.shrink_to_fit();
|
||||
|
||||
println!("BVH Depth: {}", bvh.depth);
|
||||
|
||||
bvh
|
||||
}
|
||||
|
||||
pub fn tree_depth(&self) -> usize {
|
||||
self.depth
|
||||
}
|
||||
|
||||
fn acc_bounds<'a, T, F>(&mut self, objects1: &mut [T], bounder: &F)
|
||||
where F: 'a + Fn(&T) -> &'a [BBox]
|
||||
{
|
||||
|
|
|
@ -183,7 +183,7 @@ impl<'a> Iterator for DataTreeFilterInternalIter<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<(&'a str, Option<&'a str>, &'a Vec<DataTree<'a>>)> {
|
||||
loop {
|
||||
match self.iter.next() {
|
||||
match self.iter.next() {
|
||||
Some(&DataTree::Internal{type_name, ident, ref children}) => {
|
||||
if type_name == self.type_name {
|
||||
return Some((type_name, ident, children));
|
||||
|
|
|
@ -60,7 +60,10 @@ pub fn parse_assembly(tree: &DataTree) -> Result<Assembly, PsyParseError> {
|
|||
// MeshSurface
|
||||
"MeshSurface" => {
|
||||
if let &DataTree::Internal {ident: Some(ident), ..} = child {
|
||||
builder.add_object(ident, Object::Surface(Box::new(try!(parse_mesh_surface(&child)))));
|
||||
builder.add_object(
|
||||
ident,
|
||||
Object::Surface(Box::new(try!(parse_mesh_surface(&child))))
|
||||
);
|
||||
} else {
|
||||
// TODO: error condition of some kind, because no ident
|
||||
panic!();
|
||||
|
|
Loading…
Reference in New Issue
Block a user