Open Pessimistress opened 3 years ago
cc @kylebarron @ibgreen @alasarr
This sounds great. Approved from my side.
Happy to help write the docs on how to use loaders.gl with deck. Do you want to get a skeleton page in place so I see how it is intended to integrate with the rest of the docs?
Some comments:
This makes it pointless to exclude GLTFLoader from the ScenegraphLayer from bundle size optimization perspective.
Not completely true, as there is a use case where the ScenegraphLayer can be provided with a programmatically built up scenegraph from luma.gl. But we don't have any examples showing how to do this, and I doubt it is being used, so I agree that we might as well include the loader.
When possible, *WorkerLoader should be used instead of the regular loader. This makes the bundle footprint negligible, without breaking the existing behavior.
If the bundle size issue is particularly worrisome, we could certainly build the non-worker loaders as separately loadable scripts as well. This is not done today, but the DracoLoader
loads all the Draco libraries dynamically even when using the non-worker version so we have a good starting point there.
Note that a couple of issues in loaders.gl recently have been around how to use the loaders in air-gapped/no-network environments. Not sure how important this is for deck (use of tiled layers would presumably be ruled out), but it is nice if the user can provide the bundled, non-worker loader as an override. This should be possible with the loaders
prop in this proposal, so all good.
MVTLoader and TerrainLoader by default run on webworkers, but the full parser code is still bundled with the main app.
Yes... just curious as to whether we use the output in binary form? If not we are probably not getting optimal performance here.
Background
deck.gl core includes two loaders: json and image
MVTLayer
MVTLoader
@loaders.gl/mvt
TerrainLayer
TerrainLoader
@loaders.gl/terrain
ScenegraphLayer
GLTFLoader
registerLoaders
Tile3DLayer
Tiles3DLoader
@loaders.gl/3d-tiles
,@loaders.gl/gltf
,@loaders.gl/draco
loader
propThere are multiple design inconsistencies here:
ScenegraphLayer
is the only layer that does not bundle the required loader nor specify a loaders.gl package as dependency. The user is required to install and import the loader themselves.@loaders.gl/gltf
has to be explicitly installed when usingScenegraphLayer
, because it's pulled in by@loaders.gl/3d-tiles
which is the dependency of a different submodule.MVTLoader
andTerrainLoader
by default run on webworkers, but the full parser code is still bundled with the main app.TerrainLayer
support other loaders, e.g. quantized mesh terrain.Tiles3DLoader
has a significant bundle footprint. It also includesGLTFLoader
andDracoLoader
. This makes it pointless to excludeGLTFLoader
from theScenegraphLayer
from bundle size optimization perspective.Tile3DLayer
allows the user to replace the default loader by specifying theloader
prop, however the default loader will be bundled regardless.Proposal
High-level principles
*WorkerLoader
should be used instead of the regular loader. This makes the bundle footprint negligible, without breaking the existing behavior.Roadmap
loaders
prop to base Layer classMVTLayer
andTerrainLayer
should useprops.loaders
instead of hard-coded loadersGLTFLoader
toScenegraphLayer
by defaultTiles3DLoader
fromTile3DLayer
defaults, markloader
prop deprecated forloaders
MVTWorkerLoader
andTerrainWorkerLoader