Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBX format (deserialize) #5

Open
asny opened this issue May 30, 2022 · 4 comments
Open

FBX format (deserialize) #5

asny opened this issue May 30, 2022 · 4 comments

Comments

@asny
Copy link
Owner

asny commented May 30, 2022

No description provided.

@asny asny changed the title Support FBX format FBX format (deserialize) May 30, 2022
@melMass
Copy link

melMass commented Mar 26, 2023

I came to ask instructions on implementing custom "parsers", I did not look closely in an IDE, but by glancing on GH I'm not sure how the loaders resolve to one type or another. Could you give pointers?

Thanks, I just started using three-d and I love its flexibility

EDIT: Found the entry:

three-d-asset/src/io.rs

Lines 155 to 183 in 0850040

impl Deserialize for crate::Scene {
fn deserialize(path: impl AsRef<Path>, raw_assets: &mut RawAssets) -> Result<Self> {
let path = raw_assets.match_path(path.as_ref())?;
match path.extension().map(|e| e.to_str().unwrap()).unwrap_or("") {
"gltf" | "glb" => {
#[cfg(not(feature = "gltf"))]
return Err(Error::FeatureMissing("gltf".to_string()));
#[cfg(feature = "gltf")]
gltf::deserialize_gltf(raw_assets, &path)
}
"obj" => {
#[cfg(not(feature = "obj"))]
return Err(Error::FeatureMissing("obj".to_string()));
#[cfg(feature = "obj")]
obj::deserialize_obj(raw_assets, &path)
}
"pcd" => {
#[cfg(not(feature = "pcd"))]
return Err(Error::FeatureMissing("pcd".to_string()));
#[cfg(feature = "pcd")]
pcd::deserialize_pcd(raw_assets, &path)
}
_ => Err(Error::FailedDeserialize(path.to_str().unwrap().to_string())),
}
}
}

Just not 100% sure about the wasm part but it seems to be handled at an higher level, anyhow I'll give it a go

@asny
Copy link
Owner Author

asny commented Mar 26, 2023

Thank you for the kind words 🙏 Sounds great you want to give it a go and yes, you found the right spot. And I think you should not worry too much about wasm. Of course there are some limitations on web (no threads for example) but if it works on native, it should be straight forward to get it to work on web.

@melMass
Copy link

melMass commented Mar 27, 2023

Nice I got a very basic version working (no object transforms, no materials) using the fbxcel crate.
I just found Amient's implementation: https://github.com/AmbientRun/Ambient/tree/main/crates/model_import/src/fbx
It looks quite feature complete and I will take inspiration from it for the materials this weekend! I'll propose a PR then or early next week

@asny
Copy link
Owner Author

asny commented Mar 28, 2023

Super nice 💪 Sounds like a good plan! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants