Skip to content

Commit

Permalink
Add the data path to Engine configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Dec 11, 2023
1 parent ba600c6 commit 8577eb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ pub struct Object {
#[derive(serde::Deserialize)]
pub struct Engine {
pub shader_path: String,
pub data_path: String,
}
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ pub struct Engine {
track_hot_reloads: bool,
workers: Vec<choir::WorkerHandle>,
choir: Arc<choir::Choir>,
data_path: String,
}

impl ops::Index<JointHandle> for Engine {
Expand Down Expand Up @@ -326,6 +327,7 @@ impl Engine {
track_hot_reloads: false,
workers,
choir,
data_path: config.data_path.clone(),
}
}

Expand Down Expand Up @@ -617,7 +619,7 @@ impl Engine {
let mut visuals = Vec::new();
for visual in config.visuals.iter() {
let (model, task) = self.asset_hub.models.load(
format!("data/{}", visual.model),
format!("{}/{}", self.data_path, visual.model),
blade_render::model::Meta {
generate_tangents: true,
},
Expand Down Expand Up @@ -673,7 +675,7 @@ impl Engine {
convex,
border_radius,
} => {
let trimesh = trimesh::load(&format!("data/{}", model));
let trimesh = trimesh::load(&format!("{}/{}", self.data_path, model));
if convex && border_radius != 0.0 {
ColliderBuilder::round_convex_mesh(
trimesh.points,
Expand Down Expand Up @@ -758,7 +760,7 @@ impl Engine {
if path.is_empty() {
self.environment_map = None;
} else {
let full = format!("data/{}", path);
let full = format!("{}/{}", self.data_path, path);
let (handle, task) = self.asset_hub.textures.load(
full,
blade_render::texture::Meta {
Expand Down

0 comments on commit 8577eb9

Please sign in to comment.