Skip to content

Commit

Permalink
fix: gltf model loading #644
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Aug 8, 2023
1 parent c648359 commit 5ed3497
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/model_import/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ fn material_filter_matches(filter: &MaterialFilter, mat: &PbrMaterialDesc) -> bo
// }
// }

pub const MODEL_EXTENSIONS: &[&str] = &["glb", "fbx", "obj", "x"];
pub const MODEL_EXTENSIONS: &[&str] = &["glb", "gltf", "fbx", "obj", "x"];

/// `../[path]`
pub fn dotdot_path(path: impl Into<RelativePathBuf>) -> RelativePathBuf {
Expand Down
8 changes: 6 additions & 2 deletions crates/model_import/src/model_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,12 @@ impl ModelCrate {
force_assimp: bool,
resolve_texture: TextureResolver,
) -> anyhow::Result<()> {
let is_fbx = url.extension().unwrap_or_default() == "fbx";
let is_glb = url.extension().unwrap_or_default() == "glb";
let ext = url.extension();
let ext = ext.as_deref();

let is_fbx = ext == Some("fbx");
let is_glb = ext == Some("glb") || ext == Some("gltf");

if force_assimp {
crate::assimp::import_url(assets, url, self, resolve_texture).await?;
} else if is_fbx {
Expand Down

0 comments on commit 5ed3497

Please sign in to comment.