-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📖 Add VdbReader
struct with read_grid()
functionality to allow users to specify which grid to load
#41
Conversation
VdbReader
struct with read_grid()
functionality to allow users to specify which grid to load from the available ones VdbReader
struct with read_grid()
functionality to allow users to specify which grid to load
…ve header, while exposing a `read_grid(name)` API to load specific grids
66ce223
to
afa0a29
Compare
|
||
let grid = read_vdb::<_, half::f16>(&mut reader).unwrap(); | ||
let mut vdb_reader = VdbReader::new(BufReader::new(f)).unwrap(); | ||
let grid = vdb_reader.read_grid::<half::f16>("density").unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
https://github.com/Traverse-Research/vdb-rs/pull/41/files?diff=unified&w=1 (Which enables "ignore whitespace") so that all reindented code isn't counted as "changed" :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks simple on the surface, not sure if we should more cautiously document that read_grid
loosely uses name
(how about just using ==
, and adding an accessor function that returns the names of all the grids available?).
Feels like some helper functions don't need to become associated functions, even if it simplifies some repetitive generics and trait bounds.
…necessity to `find()` on a vector. Also expose function to retrieve all the available descriptor names.
This PR removes the
read_vdb
function in favor of the new approach of having the user create aVdbReader
class, which takes ownership over a reader and parses theArchiveHeader
and the vector ofGridDescriptor
s.The
VdbReader
then exposes aread_grid
function on which the user can specify the type of the grid data and the name of the grid being requested.