Skip to content

Commit

Permalink
Merge pull request #53 from MIERUNE/feature/quantization-process-to-o…
Browse files Browse the repository at this point in the history
…ptional

quantization process to optional
  • Loading branch information
nokonoko1203 authored Jan 28, 2025
2 parents 788f3b8 + 06ccde0 commit 1295ceb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ After installing Rust, download this repository.
- `min`: Specify the minimum zoom level you want to output.
- `max`: Specify the maximum zoom level you want to output.
- `max-memory-mb`: Specify the number of MB of memory available for conversion.
- `quantize`: Perform quantization.
- `--gzip-compress`: The output 3D Tiles are compressed using gzip. The file extension dose not change.

In the repository root, the following commands can be executed.
Expand All @@ -45,7 +46,8 @@ point_tiler --input app/examples/data/sample.las \
--output-epsg 4979 \
--min 15 \
--max 18 \
--max-memory-mb 8192 \
--max-memory-mb 8193 \
--quantize \
--gzip-compress
```

Expand Down
14 changes: 13 additions & 1 deletion app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use gzp::{
};
use itertools::Itertools as _;
use log::LevelFilter;
use pcd_exporter::gltf::generate_glb;
use pcd_parser::reader::csv::CsvPointReader;
use pcd_parser::reader::las::LasPointReader;
use pcd_parser::reader::PointReader;
Expand Down Expand Up @@ -74,6 +75,9 @@ struct Cli {
#[arg(long, default_value_t = 4 * 1024)]
max_memory_mb: usize,

#[arg(long)]
quantize: bool,

#[arg(long)]
gzip_compress: bool,
}
Expand Down Expand Up @@ -214,6 +218,7 @@ fn export_tiles_to_glb(
output_path: &Path,
min_zoom: u8,
max_zoom: u8,
quantize: bool,
gzip_compress: bool,
) -> std::io::Result<Vec<TileContent>> {
let mut all_tiles = Vec::new();
Expand Down Expand Up @@ -258,7 +263,12 @@ fn export_tiles_to_glb(

let glb_path = output_path.join(&tile_content.content_path);
fs::create_dir_all(glb_path.parent().unwrap()).unwrap();
let glb = generate_quantized_glb(decimated).unwrap();

let glb = if quantize {
generate_quantized_glb(decimated).unwrap()
} else {
generate_glb(decimated).unwrap()
};

if gzip_compress {
let file = File::create(glb_path).unwrap();
Expand Down Expand Up @@ -372,6 +382,7 @@ fn main() {
log::info!("min zoom: {}", args.min);
log::info!("max zoom: {}", args.max);
log::info!("max memory mb: {}", args.max_memory_mb);
log::info!("quantize: {}", args.quantize);
log::info!("gzip compress: {}", args.gzip_compress);

let start = std::time::Instant::now();
Expand Down Expand Up @@ -541,6 +552,7 @@ fn main() {
&output_path,
min_zoom,
max_zoom,
args.quantize,
args.gzip_compress,
)
.unwrap();
Expand Down

0 comments on commit 1295ceb

Please sign in to comment.