do like dis

This commit is contained in:
Quaternions 2024-01-08 17:31:51 -08:00
parent a5941e24ef
commit 1d2afcc364
2 changed files with 19 additions and 15 deletions

View File

@ -1,24 +1,28 @@
pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R) -> crate::model::IndexedModelInstances{
let mut spawn_point=crate::integer::Planar64Vec3::ZERO;
let mut indexed_models=Vec::new();
pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R)->Result<crate::model::IndexedModelInstances,vbsp::BspError>{
let mut s=Vec::new(); let mut s=Vec::new();
match input.read_to_end(&mut s){ match input.read_to_end(&mut s){
Ok(guac)=>println!("readed to string {:?}", guac), Ok(_)=>(),
Err(e)=>println!("faile {:?}",e), Err(e)=>println!("load_bsp::generate_indexed_models read_to_end failed: {:?}",e),
} }
match vbsp::Bsp::read(s.as_slice()){ match vbsp::Bsp::read(s.as_slice()){
Ok(guac)=>println!("we got the guac {:?}", guac), Ok(bsp)=>{
Err(e)=>println!("rotten {:?}",e), let mut spawn_point=crate::integer::Planar64Vec3::ZERO;
}
crate::model::IndexedModelInstances{ let mut indexed_models=Vec::new();
textures:Vec::new(), Ok(crate::model::IndexedModelInstances{
models:indexed_models, textures:Vec::new(),
spawn_point, models:indexed_models,
modes:Vec::new(), spawn_point,
modes:Vec::new(),
})
},
Err(e)=>{
println!("rotten {:?}",e);
Err(e)
},
} }
} }

View File

@ -47,7 +47,7 @@ fn load_file(path: std::path::PathBuf)->Option<model::IndexedModelInstances>{
}, },
} }
}, },
b"VBSP"=>Some(load_bsp::generate_indexed_models(&mut input)), b"VBSP"=>load_bsp::generate_indexed_models(&mut input).ok(),
//b"SNFM"=>Some(sniffer::generate_indexed_models(input)), //b"SNFM"=>Some(sniffer::generate_indexed_models(input)),
//b"SNFB"=>Some(sniffer::load_bot(input)), //b"SNFB"=>Some(sniffer::load_bot(input)),
other=>{ other=>{