bsp_loader: Bsp named field

This commit is contained in:
Quaternions 2025-02-04 12:01:39 -08:00
parent ad6584d82a
commit dbca48f051

@ -43,10 +43,12 @@ impl From<loader::MeshError> for LoadError{
Self::Mesh(value) Self::Mesh(value)
} }
} }
pub struct Bsp(vbsp::Bsp); pub struct Bsp{
bsp:vbsp::Bsp,
}
impl AsRef<vbsp::Bsp> for Bsp{ impl AsRef<vbsp::Bsp> for Bsp{
fn as_ref(&self)->&vbsp::Bsp{ fn as_ref(&self)->&vbsp::Bsp{
&self.0 &self.bsp
} }
} }
@ -59,8 +61,10 @@ pub fn read<R:std::io::Read>(mut input:R)->Result<Bsp,ReadError>{
vbsp::Bsp::read(s.as_slice()).map(Bsp::new).map_err(ReadError::Bsp) vbsp::Bsp::read(s.as_slice()).map(Bsp::new).map_err(ReadError::Bsp)
} }
impl Bsp{ impl Bsp{
pub const fn new(value:vbsp::Bsp)->Self{ pub fn new(bsp:vbsp::Bsp)->Self{
Self(value) Self{
bsp,
}
} }
pub fn to_snf(&self,failure_mode:LoadFailureMode,vpk_list:&[vpk::VPK])->Result<strafesnet_common::map::CompleteMap,LoadError>{ pub fn to_snf(&self,failure_mode:LoadFailureMode,vpk_list:&[vpk::VPK])->Result<strafesnet_common::map::CompleteMap,LoadError>{
let mut texture_deferred_loader=RenderConfigDeferredLoader::new(); let mut texture_deferred_loader=RenderConfigDeferredLoader::new();