donmccurdy / three-gltf-viewer

Drag-and-drop preview for glTF 2.0 models in WebGL using three.js.
https://gltf-viewer.donmccurdy.com/
MIT License
2.09k stars 534 forks source link

chore: expose app and gltf #305

Closed scarletsky closed 1 year ago

scarletsky commented 2 years ago

Expose app and gltf for debugging models.

donmccurdy commented 2 years ago

Hi @scarletsky! I'm OK with this change, but would like to understand how this information is helpful for debugging. Do you mind saying a more about how it's used?

You may also find https://gltf.report/ helpful. Printing data in the script tab will show original information as found in the glTF file, rather than the three.js representation of that:

console.log( document.getRoot().listMaterials() );
Screen Shot 2022-08-23 at 9 28 37 AM
scarletsky commented 2 years ago

@donmccurdy Hi. For me, exposing app is to get camera information. Sometimes I drop a glb file and the camera will clip the scene unexpectly as the nearClip or farClip may too small or too large. Sometimes I just want to check the json part of glb file, and there is no way go get it, because the original viewer just expose the gltf scene to window.content.

donmccurdy commented 1 year ago

Sounds good, thank you!