mod pclparser;
mod renderer;
mod viewer;
use anyhow::Result;
use clap::{crate_authors, crate_version, Clap};
use kiss3d::resource::{AllocationType, BufferType, GPUVec};
use kiss3d::window::Window;
use pclparser::read_kitti_bin_file;
use renderer::PointCloudRenderer;
use viewer::AppState;
use viewercloud::{PointCloud, PointCloudGPU};
#[derive(Clap)]
#[clap(version = crate_version!(), author = crate_authors!())]
struct Opts {
pointcloud_file: String,
annotations_file: Option<String>,
inferences_file: Option<String>,
}
fn main() -> Result<()> {
let opts: Opts = Opts::parse();
let pointcloud_file = opts.pointcloud_file;
println!("Value for pointcloud_file: {}", pointcloud_file);
if let Some(annotations_file) = opts.annotations_file {
println!("Using input annotations_file: {}", annotations_file);
}
if let Some(inferences_file) = opts.inferences_file {
println!("Using input inferences_file: {}", inferences_file);
}
let pcl_data: PointCloud = read_kitti_bin_file(pointcloud_file)?;
let point_cloud_data: PointCloudGPU = GPUVec::new(pcl_data.data, BufferType::Array, AllocationType::StreamDraw);
let window = Window::new_with_size("KITII velodyne point_cloud", 1500, 1000);
let app = AppState {
point_cloud_renderer: PointCloudRenderer::new(2.0, point_cloud_data),
};
window.render_loop(app);
Ok(())
}