pmndrs / gltfjsx

🎮 Turns GLTFs into JSX components
https://gltf.pmnd.rs
MIT License
4.45k stars 290 forks source link

👋 Usage feedback and suggestions #134

Open itsdouges opened 2 years ago

itsdouges commented 2 years ago

Hello! I've started to use gltfjsx to import custom models into my r3f app, and have some suggestions that would be useful for myself. The context here is there is enough models that it isn't reasonable to manually curate them or even touch up the files after generating.

  1. Building from a folder instead of file - I have quite a few models that I'm building to JSX and the overhead of starting the CLI for them every time is significant
  2. Input/output args - I find myself never wants to dump the output to where I'm running the CLI, currently I've written a script to cd in and out of folders that I'm interested in (setting root while in a child folder is also awkward). Would be good to stop beating around the bush and specify where you want them. It might also make sense to introduce a configuration file or object in pkg json.
  3. Extra metadata for generated jsdoc - to prevent accidental touching would be great to have a generated md5 hash that I can lint against, if the contents hash is different, error!
  4. Use ref usage, is this needed? I don't see forward ref being used so it's not really doing anything? Should the output components have forward ref?
  5. Types for useGLTF - we're casting them, did we ever consider adding a generic to useGLTF instead? Is it the complexity of loading multiple assets at once that makes this complicated?
  6. Shadows, cast or receive - sometimes I find only wanting models to receive shadows not cast them, currently there is no way to set this, could update --shadows to take either cast or receive or both (defaults to both)
  7. Prettier - it would be great if it inherited the projects config rather than using its own (it's also spamming a deprecation notice during runs: "jsxBracketSameLine is deprecated"
  8. Metalness. My imported models have a metalness of 1 so they are unaffected by ambient light. I can fix this by changing their metalness to 0 but I don't want to modify the output. Is this a problem with how the model was exported from the 3d tool?

I'll comment more on this issue if I find further things when working with gltfjsx, also happy to contribute if these sound reasonable.

mattblackdev commented 1 year ago

PR addressing point # 2 - https://github.com/pmndrs/gltfjsx/pull/163

Adds --output, -o option to override output file name/path.

drcmda commented 1 year ago

all good points, #2 has been merged