Fixed iterators, added more tests, reorganized glium.rs, formating done.#4
Fixed iterators, added more tests, reorganized glium.rs, formating done.#4igorbologovv wants to merge 17 commits intoDimev:mainfrom
Conversation
# Conflicts: # Cargo.lock # Cargo.toml # src/iter.rs # src/traits.rs
|
Nice! |
Dimev
left a comment
There was a problem hiding this comment.
What I found on first glance (will try running all changes later.
Not sure if I agree with making ChunkContainer public API.
Thanks for the extra tests!
| /// A Lod Vector for use in a quadtree. | ||
| /// It subdivides into 4 children of equal size. | ||
| #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug, Hash)] | ||
| //#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Default, Debug, Hash)] |
There was a problem hiding this comment.
This comment probably doesn't need to be here anymore
| let min_difference = min.depth - level; | ||
| let max_difference = max.depth - level; | ||
|
|
||
| // println!("diff {:?}, {:?}, {:?}", self_difference, min_difference,max_difference); |
| let max_x = max.x >> max_difference; | ||
| let max_y = max.y >> max_difference; | ||
|
|
||
| // dbg!(min_x, min_y, max_x, max_y); |
| max_depth: u64, | ||
| max_depth: u8, | ||
| ) -> ChunksInBoundIter<L> { | ||
| debug_assert!( |
There was a problem hiding this comment.
Not sure if I like this.
For me it would make more sense that it simply returns no chunks if the bounds are empty
src/iter.rs
Outdated
| } | ||
|
|
||
| impl SafeRngRange for rand::rngs::ThreadRng { | ||
| //#[no_panic] |
src/iter.rs
Outdated
| ((b.x - a.x) + 1) * ((b.y - a.y) + 1) * ((b.z - a.z) + 1) | ||
| } | ||
| ///The same unit test as test_bounds juts for OctVec: | ||
| /// //todo check it once again |
There was a problem hiding this comment.
This one too, and add a space for the doc comment
src/iter.rs
Outdated
| struct Chunk { | ||
| visible: bool, | ||
| cache_state: i32, | ||
| // 0 is new, 1 is merged, 2 is cached, 3 is both |
src/iter.rs
Outdated
| 4 => (position.x as i32 - r).pow(2) + (position.y as i32 - r).pow(2) < r, | ||
| _ => false, | ||
| }; | ||
| // dbg!(position); |
| /// | ||
| /// // then check if we are inside the AABB | ||
| /// self.depth as u64 <= max_depth | ||
| /// self.depth <= max_depth |
src/tree.rs
Outdated
| pub(crate) chunk: C, | ||
| pub(crate) index: usize, | ||
| pub(crate) position: L, | ||
| pub struct ChunkContainer<C: Sized, L: LodVec> { |
There was a problem hiding this comment.
This isn't intended to be public API IMO
| @@ -1,3 +1,4 @@ | |||
| //#![feature(generic_const_exprs)] | |||
There was a problem hiding this comment.
I'd prefere this to not need nightly
glium:
After changes in glium, state: selected was fixed, when rendering somehow;
iter.rs:
-fixed unit test test_bounds and renamed into test_bounds_quadtree
-added unit test for octree named test_bounds_octree()
-parameter depth was changed from u64 to u8 in all files(2.pow(256) is a bit too much);
coords.rs:
tree.rs:
implemented with_capacity for initing preallocated memory for chunks and nodes;
lib.rs:
all doctests are fixed, warnings are fixed;