Skip to content

Commit

Permalink
Expose a VdbReader class that parses the grid desctiptors and archi…
Browse files Browse the repository at this point in the history
…ve header, while exposing a `read_grid(name)` API to load specific grids
  • Loading branch information
EmilioLaiso committed Jul 11, 2023
1 parent 848525b commit afa0a29
Show file tree
Hide file tree
Showing 3 changed files with 511 additions and 490 deletions.
7 changes: 3 additions & 4 deletions examples/bevy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy_aabb_instancing::{
VertexPullingRenderPlugin, COLOR_MODE_SCALAR_HUE,
};
use smooth_bevy_cameras::{controllers::unreal::*, LookTransformPlugin};
use vdb_rs::{read_vdb, Index, Node};
use vdb_rs::{Index, Node, VdbReader};

use std::{error::Error, fs::File, io::BufReader};

Expand Down Expand Up @@ -50,9 +50,8 @@ fn setup(
.expect("Missing VDB filename as first argument");

let f = File::open(filename).unwrap();
let mut reader = BufReader::new(f);

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();
let tree = grid.tree;

let mesh = meshes.add(Mesh::from(shape::Cube { size: 0.01 }));
Expand Down
1 change: 0 additions & 1 deletion src/data_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::io::{Read, Seek, SeekFrom};
pub struct Grid<ValueTy> {
pub tree: Tree<ValueTy>,
pub transform: Map,
pub header: ArchiveHeader,
pub grid_descriptor: GridDescriptor,
}

Expand Down
Loading

0 comments on commit afa0a29

Please sign in to comment.