From d9a8e723014c32b659b03bbd622519782a95e65e Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 9 Oct 2023 21:37:07 -0700 Subject: [PATCH] lib expects u8 slice --- src/load_bsp.rs | 12 ++++++++++-- src/main.rs | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/load_bsp.rs b/src/load_bsp.rs index b08bb52..2f54eb3 100644 --- a/src/load_bsp.rs +++ b/src/load_bsp.rs @@ -1,9 +1,16 @@ -pub fn generate_indexed_models(input:R) -> crate::model::IndexedModelInstances{ +pub fn generate_indexed_models(input:&mut R) -> crate::model::IndexedModelInstances{ let mut spawn_point=glam::Vec3::ZERO; let mut indexed_models=Vec::new(); - match bsp::Bsp::read(input){ + let mut s=Vec::new(); + + match input.read_to_end(&mut s){ + Ok(guac)=>println!("readed to string {:?}", guac), + Err(e)=>println!("faile {:?}",e), + } + + match vbsp::Bsp::read(s.as_slice()){ Ok(guac)=>println!("we got the guac {:?}", guac), Err(e)=>println!("rotten {:?}",e), } @@ -12,5 +19,6 @@ pub fn generate_indexed_models(input:R) -> crate: textures:Vec::new(), models:indexed_models, spawn_point, + modes:Vec::new(), } } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 2185079..0ddd76b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -879,7 +879,7 @@ impl framework::Example for GlobalState { }, } }, - b"VBSP"=>Some(load_bsp::generate_indexed_models(input)), + b"VBSP"=>Some(load_bsp::generate_indexed_models(&mut input)), //b"SNFM"=>Some(sniffer::generate_indexed_models(input)), //b"SNFB"=>Some(sniffer::load_bot(input)), other=>{