Ask everyone; I want to load the gltf or 3dtile data folder (or zip) into cesium by dragging and dropping, similar to this(https://gltf-viewer.donmccurdy.com/). What should I do? At the same time, I found that the dragged file is not uploaded directly to the server, but loaded directly on the browser side, is that so? Very much looking forward to help, thanks.
There is support for drag-and-drop of some file types in CesiumJS, via the
viewerDragDropMixin. But glTF or 3D Tiles data is not (yet) supported for a variety of reasons.
For both file formats, there is the question of what exactly should be dropped: Both file formats may contain relative references to other files. E.g. the
tilest.json will refer to tile content via relative URIs. Similarly, the glTF asset may refer to textures or binary buffers via URIs.
(I think in Don McCurdy’s viewer, you can view a glTF with its external resources by dragging-and-dropping all relevant files. This may work for glTF in CesiumJS as well. For 3D Tiles, this would mean dragging-and-dropping a whole folder structure, and resolving the resources may be tricky, because 3D Tiles is supposed to load higher-resolution tiles only on demand…)
For glTF (and to a lesser extent, for a non-geo-located 3D Tiles asset) there is the additional question about how to determine the location and orientation (i.e. the ‘model matrix’) of the resulting asset. A first shot could be to place the asset at the drop location, but determining the actual orientation (rotation) would require some sort of further user interaction.
(There is a basic PR for drag-and-drop of glTF assets as GLB (glTF binary) files, but this is only a very experimental proof-of-concept - more work would have to go into that in order to create a sustainable and user-friendly solution for this)