add source
This commit is contained in:
parent
fdf8c7bdda
commit
72962f7a32
@ -8,7 +8,7 @@ edition = "2021"
|
|||||||
[features]
|
[features]
|
||||||
legacy = ["dep:lazy-regex"]
|
legacy = ["dep:lazy-regex"]
|
||||||
#roblox = []
|
#roblox = []
|
||||||
#source = []
|
source = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy-regex = { version = "3.1.0", optional = true }
|
lazy-regex = { version = "3.1.0", optional = true }
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
use std::io::Read;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use crate::texture::{Texture,Textures};
|
||||||
|
use strafesnet_common::model::{MeshId,TextureId};
|
||||||
|
pub struct Loader{
|
||||||
|
texture_paths:HashMap<PathBuf,TextureId>,
|
||||||
|
mesh_paths:HashMap<PathBuf,MeshId>,
|
||||||
|
}
|
||||||
|
impl Loader{
|
||||||
|
pub fn new()->Self{
|
||||||
|
Self{
|
||||||
|
texture_paths:HashMap::new(),
|
||||||
|
mesh_paths:HashMap::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//cannot fail atm
|
||||||
|
enum AcquireTextureError{}
|
||||||
|
enum AcquireMeshError{}
|
||||||
|
|
||||||
|
impl Loader{
|
||||||
|
fn acquire_texture_id(&mut self,name:&str)->Result<TextureId,AcquireTextureError>{
|
||||||
|
let texture_id=TextureId::new(self.texture_paths.len() as u32);
|
||||||
|
Ok(*self.texture_paths.entry(name.into()).or_insert(texture_id))
|
||||||
|
}
|
||||||
|
fn acquire_mesh_id(&mut self,name:&str)->Result<MeshId,AcquireMeshError>{
|
||||||
|
let texture_id=MeshId::new(self.mesh_paths.len() as u32);
|
||||||
|
Ok(*self.mesh_paths.entry(name.into()).or_insert(texture_id))
|
||||||
|
}
|
||||||
|
fn load_textures(&self)->Result<Textures,std::io::Error>{
|
||||||
|
Ok(Textures::new(Vec::new()))
|
||||||
|
}
|
||||||
|
// fn load_meshes(&self)->Result<Meshes,std::io::Error>{
|
||||||
|
// Ok(Meshes::new(Vec::new()))
|
||||||
|
// }
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user