strafe-project/src/load_bsp.rs

29 lines
654 B
Rust
Raw Normal View History

2023-10-02 15:28:57 -07:00
2024-01-08 17:31:51 -08:00
pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R)->Result<crate::model::IndexedModelInstances,vbsp::BspError>{
2023-10-09 21:37:07 -07:00
let mut s=Vec::new();
match input.read_to_end(&mut s){
2024-01-08 17:31:51 -08:00
Ok(_)=>(),
Err(e)=>println!("load_bsp::generate_indexed_models read_to_end failed: {:?}",e),
2023-10-09 21:37:07 -07:00
}
2024-01-08 17:31:51 -08:00
2023-10-09 21:37:07 -07:00
match vbsp::Bsp::read(s.as_slice()){
2024-01-08 17:31:51 -08:00
Ok(bsp)=>{
let mut spawn_point=crate::integer::Planar64Vec3::ZERO;
2023-10-02 15:28:57 -07:00
2024-01-08 17:31:51 -08:00
let mut indexed_models=Vec::new();
Ok(crate::model::IndexedModelInstances{
textures:Vec::new(),
models:indexed_models,
spawn_point,
modes:Vec::new(),
})
},
Err(e)=>{
println!("rotten {:?}",e);
Err(e)
},
2023-10-02 15:28:57 -07:00
}
}