leaflet-city-mapper 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -11
- package/cucumber.mjs +9 -9
- package/dist/leaflet-city-mapper-src.js +3546 -2493
- package/dist/leaflet-city-mapper-src.js.map +4 -4
- package/dist/leaflet-city-mapper-worker-src.js +955 -0
- package/dist/leaflet-city-mapper-worker-src.js.map +7 -0
- package/dist/leaflet-city-mapper-worker.js +2 -0
- package/dist/leaflet-city-mapper-worker.js.map +7 -0
- package/dist/leaflet-city-mapper.js +3 -3
- package/dist/leaflet-city-mapper.js.map +4 -4
- package/libs/leaflet-lens.js +15 -3
- package/libs/leaflet.js +1 -1
- package/package.json +3 -2
- package/src/{camera → animations}/cancelCameraAnimation.js +5 -3
- package/src/{core → animations}/cancelGridFade.js +3 -2
- package/src/animations/endZoom.js +27 -0
- package/src/{camera → animations}/mapAnimateCamera.js +7 -5
- package/src/{scene → animations}/onZoomAnim.js +5 -4
- package/src/{scene → animations}/renderPendingZoomAnimation.js +4 -2
- package/src/{camera → animations}/runCameraAnimations.js +8 -6
- package/src/{core → animations}/runGridFades.js +4 -3
- package/src/{camera → animations}/scheduleCameraAnimation.js +3 -2
- package/src/animations/scheduleGridFade.js +16 -0
- package/src/{scene → animations}/startZoom.js +3 -2
- package/src/{rendering → animations}/synchronizeZoomView.js +10 -8
- package/src/{rendering → animations}/updateZoomCamera.js +11 -8
- package/src/archives/decodeDirectory.js +1 -1
- package/src/archives/findTile.js +3 -3
- package/src/archives/getDirectoryEntries.js +5 -4
- package/src/archives/getHeader.js +10 -6
- package/src/archives/getTileData.js +3 -3
- package/src/archives/getZxy.js +8 -7
- package/src/archives/loadDirectory.js +3 -3
- package/src/archives/loadSource.js +3 -2
- package/src/archives/{read.js → readArchiveRange.js} +7 -5
- package/src/camera/cameraMapReady.js +3 -2
- package/src/camera/cleanupCameraMap.js +8 -6
- package/src/camera/fitCameraBounds.js +3 -3
- package/src/camera/initializeCameraMap.js +6 -4
- package/src/camera/mapCamera.js +1 -1
- package/src/camera/mapContainerPointToLayerPoint.js +2 -2
- package/src/camera/mapGetBearing.js +3 -2
- package/src/camera/mapGetBounds.js +2 -2
- package/src/camera/mapGetBoundsZoom.js +2 -2
- package/src/camera/mapGetPitch.js +3 -2
- package/src/camera/mapLayerPointToContainerPoint.js +2 -2
- package/src/camera/mapLimitCenter.js +1 -1
- package/src/camera/mapLimitOffset.js +1 -1
- package/src/camera/mapPanBy.js +2 -2
- package/src/camera/mapPanInside.js +1 -1
- package/src/camera/mapResetNorthPitch.js +1 -1
- package/src/camera/mapSetBearing.js +1 -1
- package/src/camera/mapSetPitch.js +1 -1
- package/src/camera/mapSetPitchAndBearing.js +5 -3
- package/src/{rendering → camera}/updateMapCamera.js +19 -15
- package/src/{scene/updateCamera.js → camera/updateSceneCamera.js} +1 -1
- package/src/camera/updateSky.js +10 -9
- package/src/collision/collectIntersections.js +16 -0
- package/src/collision/collider.js +24 -9
- package/src/collision/countCrossings.js +15 -0
- package/src/collision/insideMesh.js +33 -0
- package/src/collision/insideWalker.js +46 -0
- package/src/collision/readTriangle.js +7 -4
- package/src/collision/setTrafficNormal.js +9 -0
- package/src/collision/trafficCollision.js +55 -0
- package/src/collision/vertexCount.js +3 -0
- package/src/{utils → colors}/parseColor.js +1 -1
- package/src/controls/addCameraHandler.js +5 -3
- package/src/controls/adjustCameraDrag.js +4 -3
- package/src/controls/cameraControls.js +14 -5
- package/src/controls/cameraDragClick.js +7 -7
- package/src/controls/cameraDragContextMenu.js +1 -1
- package/src/controls/cameraDragDown.js +2 -2
- package/src/controls/cameraDragEnd.js +1 -1
- package/src/controls/cameraDragMove.js +2 -2
- package/src/controls/changeCameraTouch.js +6 -3
- package/src/controls/cleanupCameraTouch.js +7 -5
- package/src/controls/dragCamera.js +1 -1
- package/src/controls/endCameraTouchEvent.js +1 -1
- package/src/controls/moveCameraTouch.js +5 -3
- package/src/controls/removeCameraDrag.js +1 -1
- package/src/controls/shiftRotateWheel.js +1 -1
- package/src/controls/startCameraTouch.js +6 -4
- package/src/core/adjustCameraMarkerPan.js +3 -3
- package/src/core/cameraCircleBounds.js +1 -1
- package/src/core/cameraMarkerDrag.js +1 -1
- package/src/core/cameraMarkerOnDrag.js +1 -1
- package/src/core/closestCameraLayerPoint.js +1 -1
- package/src/core/initializeGridContainer.js +1 -1
- package/src/core/initializeNativeLayer.js +9 -8
- package/src/core/layerCallInitHooks.js +4 -3
- package/src/core/markerSetIcon.js +1 -1
- package/src/core/markerSetPos.js +2 -2
- package/src/core/markerSetRotation.js +1 -1
- package/src/core/markerUpdateZIndex.js +5 -4
- package/src/core/popupAdjustPan.js +1 -1
- package/src/core/popupUpdatePosition.js +1 -1
- package/src/core/redrawPath.js +1 -1
- package/src/core/removeLayer.js +4 -3
- package/src/core/tooltipSetPosition.js +1 -1
- package/src/core/updateGridOpacity.js +3 -3
- package/src/core/whenReady.js +11 -0
- package/src/geometry/addBridges.js +13 -8
- package/src/{sources → geometry}/addGeneratedTriangle.js +1 -1
- package/src/{sources/addTriangle.js → geometry/appendAreaTriangle.js} +5 -5
- package/src/geometry/assembleAreaGeometry.js +41 -0
- package/src/{core → geometry}/boundsQuad.js +1 -1
- package/src/geometry/bridgePolygon.js +3 -3
- package/src/geometry/buildExtrudedPolygon.js +10 -0
- package/src/geometry/buildProjectedPoint.js +21 -0
- package/src/{sources/buildAreaPolygon.js → geometry/buildProjectedPolygon.js} +25 -29
- package/src/geometry/circleGeometry.js +1 -1
- package/src/geometry/computeBounds.js +19 -8
- package/src/geometry/conformModelToTerrain.js +17 -11
- package/src/{models → geometry}/createModelGeometry.js +5 -4
- package/src/geometry/disk.js +1 -1
- package/src/geometry/indexBridge.js +5 -4
- package/src/geometry/lampPostGeometry.js +2 -2
- package/src/geometry/lightGeometry.js +1 -1
- package/src/geometry/lineJoin.js +1 -1
- package/src/{core → geometry}/markerQuadCorners.js +9 -6
- package/src/geometry/nativeGeometry.js +1 -1
- package/src/geometry/polygon.js +1 -1
- package/src/geometry/roofCoverage.js +11 -8
- package/src/geometry/roofFootprint.js +13 -10
- package/src/geometry/segment.js +1 -1
- package/src/{shadows → geometry}/shadowBounds.js +1 -1
- package/src/geometry/surface.js +1 -1
- package/src/{terrain → geometry}/terrainBuffers.js +7 -5
- package/src/geometry/terrainTileGeometry.js +19 -0
- package/src/geometry/treeGeometry.js +2 -2
- package/src/globals/geometryWorkerUrl.js +3 -0
- package/src/globals/nativeMethodHandlers.js +14 -14
- package/src/{scene → gpu}/initializeRendererResources.js +10 -9
- package/src/gpu/initializeSharedRenderer.js +52 -0
- package/src/gpu/mountRenderer.js +26 -0
- package/src/{scene → gpu}/releaseRenderer.js +2 -2
- package/src/gpu/rendererDeviceError.js +16 -0
- package/src/gpu/rendererDeviceLost.js +16 -0
- package/src/{rendering/reportCompilation.js → gpu/reportShaderCompilation.js} +3 -3
- package/src/gpu/requestAdapter.js +12 -0
- package/src/gpu/requestDevice.js +9 -0
- package/src/index.js +8 -13
- package/src/layer-controls/layerCountTitle.js +6 -0
- package/src/layer-controls/renderLayerCount.js +20 -0
- package/src/{scene → layer-controls}/updateLayerCount.js +24 -22
- package/src/lighting/lightGrid.js +1 -1
- package/src/lighting/updatePointLights.js +13 -10
- package/src/{rendering → materials}/createProgram.js +13 -12
- package/src/{models/materialFor.js → materials/modelMaterialFor.js} +3 -3
- package/src/materials/terrainRasterProgram.js +58 -0
- package/src/models/applyModelTransform.js +8 -7
- package/src/models/createModelContext.js +3 -3
- package/src/models/loadModel.js +17 -12
- package/src/models/loadModelResources.js +7 -6
- package/src/models/modelNode.js +4 -5
- package/src/{core → native}/disposeNativeLayer.js +10 -10
- package/src/{core → native}/handleNativeMapEvent.js +5 -4
- package/src/{core → native}/initNativeGPU.js +9 -6
- package/src/native/isCurrentNativeLayer.js +7 -0
- package/src/{core → native}/nativeEventSource.js +3 -3
- package/src/{core → native}/nativeEvents.js +1 -1
- package/src/{core → native}/nativeLayer.js +16 -37
- package/src/{core → native}/nativeLayerMethod.js +14 -5
- package/src/{core → native}/pruneNativeResources.js +5 -5
- package/src/{core → native}/putNativeMesh.js +3 -3
- package/src/{core → native}/quadNativeMesh.js +1 -1
- package/src/native/readyNativeGPU.js +10 -0
- package/src/{core → native}/refreshNativeLayer.js +8 -7
- package/src/{core → native}/refreshNativeLayerContract.js +3 -2
- package/src/{core → native}/removeNativeEvents.js +1 -1
- package/src/{core → native}/removeTargets.js +3 -2
- package/src/native/reorderNativeLayer.js +17 -0
- package/src/{core → native}/styleNativeMesh.js +3 -2
- package/src/{core → native}/syncGridLayer.js +1 -1
- package/src/{core → native}/syncImageOverlay.js +1 -1
- package/src/{core → native}/syncMarker.js +1 -1
- package/src/{core → native}/syncVectorLayer.js +2 -2
- package/src/{core → native}/synchronizeNativeLayer.js +4 -3
- package/src/native/updateNativeLayerView.js +10 -0
- package/src/picking/findFeature.js +13 -9
- package/src/picking/hit.js +16 -8
- package/src/picking/onClick.js +3 -2
- package/src/picking/onPointerLeave.js +3 -2
- package/src/picking/onPointerMove.js +12 -6
- package/src/picking/raycast.js +29 -24
- package/src/picking/setHighlight.js +9 -8
- package/src/picking/shouldSkipOther.js +3 -2
- package/src/picking/showFeature.js +19 -14
- package/src/{camera/angles.js → projections/cameraAngles.js} +2 -2
- package/src/{camera → projections}/groundBounds.js +2 -2
- package/src/projections/localPosition.js +11 -0
- package/src/{camera/project.js → projections/projectCameraPoint.js} +2 -2
- package/src/{sources → projections}/projectRing.js +8 -9
- package/src/projections/projectTreePoint.js +17 -0
- package/src/{camera/animationPoint.js → projections/transformZoomAnimationPoint.js} +3 -2
- package/src/projections/walkerLocalPosition.js +18 -0
- package/src/raster/addRasterTile.js +38 -28
- package/src/raster/createRasterMesh.js +24 -19
- package/src/raster/finishRasterAttachment.js +17 -0
- package/src/raster/finishRasterTile.js +22 -19
- package/src/raster/initRaster.js +24 -15
- package/src/raster/isRasterLoading.js +8 -0
- package/src/raster/loadRasterTile.js +8 -7
- package/src/raster/onPMTileAdd.js +9 -8
- package/src/raster/onPMTileRemove.js +6 -5
- package/src/raster/pruneRasterTiles.js +19 -13
- package/src/raster/pumpRasterTiles.js +8 -6
- package/src/raster/readyRaster.js +3 -2
- package/src/raster/registerTerrainTile.js +8 -6
- package/src/raster/releaseRasterTile.js +14 -11
- package/src/raster/releaseRasterTiles.js +13 -10
- package/src/raster/removeRasterTile.js +8 -6
- package/src/raster/retainRasterTiles.js +5 -4
- package/src/raster/setPMTileOpacity.js +4 -4
- package/src/raster/setPMTileZIndex.js +4 -4
- package/src/raster/setRasterOpacity.js +8 -6
- package/src/raster/setRasterTerrain.js +12 -9
- package/src/raster/setRasterZIndex.js +8 -6
- package/src/raster/updateAttachedTiles.js +6 -5
- package/src/raster/updateRasterTiles.js +20 -15
- package/src/rendering/collectFrameMeshes.js +16 -9
- package/src/rendering/collectVisibleMesh.js +18 -9
- package/src/rendering/createMesh.js +11 -9
- package/src/rendering/disposeMesh.js +3 -3
- package/src/rendering/drawGeometry.js +9 -7
- package/src/rendering/drawSceneMeshes.js +9 -7
- package/src/rendering/prepareFrameBuffer.js +6 -5
- package/src/rendering/prepareFrameMeshes.js +9 -6
- package/src/rendering/prepareFrameUniforms.js +9 -6
- package/src/rendering/prepareMeshUniforms.js +1 -1
- package/src/rendering/render.js +39 -32
- package/src/rendering/resizeRenderer.js +17 -15
- package/src/rendering/revealRoofMesh.js +25 -6
- package/src/scene/{layerLayerAdd.js → addRegisteredLayer.js} +13 -9
- package/src/scene/addSceneLayer.js +4 -3
- package/src/scene/attachLayer.js +7 -6
- package/src/scene/attachSharedScene.js +69 -0
- package/src/scene/callLayer.js +7 -5
- package/src/scene/cancelUpdate.js +6 -5
- package/src/scene/failAttachment.js +6 -5
- package/src/scene/get3DEvents.js +5 -3
- package/src/scene/getLocation.js +3 -2
- package/src/scene/init3D.js +28 -26
- package/src/scene/initializeLayer.js +6 -4
- package/src/scene/isNativeLayer.js +3 -2
- package/src/scene/layerInitialize.js +11 -6
- package/src/scene/onAdd3DLayer.js +30 -24
- package/src/scene/onMapChange.js +5 -4
- package/src/scene/onRemove3DLayer.js +53 -35
- package/src/scene/ready3D.js +22 -13
- package/src/scene/releaseSharedScene.js +31 -25
- package/src/scene/removeLayerEvents.js +12 -9
- package/src/scene/removeSceneLayer.js +3 -2
- package/src/scene/renderPendingMapChange.js +7 -4
- package/src/scene/renderPendingUpdates.js +9 -6
- package/src/scene/restoreObject.js +15 -13
- package/src/scene/scheduleSceneUpdate.js +25 -0
- package/src/shaders/materialShaders.js +2 -2
- package/src/shadows/bindSunlight.js +4 -3
- package/src/shadows/drawShadowMeshes.js +4 -3
- package/src/shadows/renderSunlight.js +6 -5
- package/src/shadows/resizeSunlight.js +7 -6
- package/src/shadows/shadowMatrix.js +2 -2
- package/src/sources/attachAreaMesh.js +25 -20
- package/src/sources/buildArea.js +21 -22
- package/src/sources/buildAreaFeature.js +16 -10
- package/src/sources/buildAreaFeatures.js +14 -0
- package/src/sources/buildAreaPoint.js +3 -21
- package/src/sources/extrusionStyle.js +2 -2
- package/src/sources/initializeGeoJSON.js +3 -2
- package/src/sources/matchesAreaTile.js +7 -0
- package/src/sources/pendingSourceAreas.js +3 -2
- package/src/sources/prepareAreaGeometryJob.js +24 -0
- package/src/sources/projectAreaPolygons.js +15 -0
- package/src/sources/pumpSourceAreas.js +37 -0
- package/src/sources/releaseArea.js +10 -8
- package/src/sources/setGeoJSONData.js +4 -3
- package/src/sources/sourceAreaContext.js +18 -17
- package/src/sources/updateArea.js +25 -21
- package/src/sources/{updateStatus.js → updateSourceStatus.js} +5 -4
- package/src/sunlight/{addTo.js → addTimeControlToMap.js} +1 -1
- package/src/sunlight/addTimeLayer.js +3 -2
- package/src/sunlight/atmosphere.js +2 -2
- package/src/sunlight/initSunlight.js +5 -5
- package/src/sunlight/{initialize.js → initializeTimeControl.js} +5 -3
- package/src/sunlight/onAddSun.js +5 -4
- package/src/sunlight/onRemoveSun.js +1 -1
- package/src/sunlight/removeSun.js +7 -5
- package/src/sunlight/removeTimeLayer.js +3 -2
- package/src/sunlight/requestSunlightRender.js +9 -0
- package/src/sunlight/updateCelestialDisc.js +1 -1
- package/src/sunlight/updateSky.js +4 -2
- package/src/sunlight/updateSun.js +8 -6
- package/src/sunlight/useSelectedTime.js +4 -3
- package/src/terrain/applyTerrain.js +16 -13
- package/src/terrain/clearLayerTerrain.js +3 -2
- package/src/terrain/getElevation.js +9 -5
- package/src/terrain/initTerrain.js +11 -6
- package/src/terrain/loadTerrain.js +29 -20
- package/src/terrain/loadTerrainTiles.js +4 -3
- package/src/terrain/mapElevationOf.js +7 -0
- package/src/terrain/onTerrainAdd.js +14 -10
- package/src/terrain/onTerrainChange.js +4 -3
- package/src/terrain/onTerrainRemove.js +35 -21
- package/src/terrain/readyTerrainOf.js +7 -0
- package/src/terrain/setLayerTerrain.js +3 -2
- package/src/terrain/setTerrainHeight.js +19 -14
- package/src/terrain/terrainElevation.js +1 -1
- package/src/terrain/terrainTileQueue.js +11 -9
- package/src/{core → textures}/addImageState.js +1 -1
- package/src/{core/addRasterImage.js → textures/attachRasterImage.js} +1 -1
- package/src/{rendering → textures}/collectRoofTiles.js +3 -2
- package/src/{rendering → textures}/composeRoofAtlas.js +9 -7
- package/src/textures/destroyTexture.js +10 -0
- package/src/{models/textureFor.js → textures/modelTextureFor.js} +5 -4
- package/src/{core → textures}/nativeImageError.js +1 -1
- package/src/{core → textures}/nativeImageRefresh.js +2 -2
- package/src/{core/textureFor.js → textures/nativeTextureFor.js} +7 -6
- package/src/{rendering → textures}/rebuildRoofAtlas.js +12 -9
- package/src/{core → textures}/removeImageState.js +1 -1
- package/src/{rendering → textures}/resizeRoofTexture.js +5 -4
- package/src/textures/updateRoofAtlas.js +23 -0
- package/src/textures/updateRoofRaster.js +29 -0
- package/src/{core → textures}/uploadCanvasTexture.js +2 -2
- package/src/traffic/addTraffic.js +1 -1
- package/src/traffic/disposeTrafficObject.js +5 -3
- package/src/traffic/drawTrafficRoute.js +1 -1
- package/src/traffic/groundTraffic.js +6 -6
- package/src/traffic/initTraffic.js +3 -3
- package/src/traffic/loadedTrafficLanes.js +1 -1
- package/src/traffic/locateTraffic.js +3 -3
- package/src/traffic/placeTraffic.js +2 -1
- package/src/traffic/prepareTraffic.js +4 -3
- package/src/traffic/rebaseTraffic.js +3 -2
- package/src/traffic/rebuildTrafficMesh.js +1 -1
- package/src/traffic/removeTraffic.js +1 -1
- package/src/traffic/startTraffic.js +1 -1
- package/src/traffic/tickTraffic.js +4 -3
- package/src/traffic/trafficNow.js +3 -2
- package/src/traffic/updateTraffic.js +3 -2
- package/src/traffic/updateTrafficLights.js +4 -2
- package/src/vehicles/boatBenches.js +1 -1
- package/src/vehicles/boatModel.js +1 -1
- package/src/vehicles/busModel.js +1 -1
- package/src/vehicles/carModel.js +1 -1
- package/src/vehicles/metroModel.js +1 -1
- package/src/vehicles/tramModel.js +1 -1
- package/src/walk/{step.js → animateWalker.js} +15 -19
- package/src/walk/createWalk.js +15 -11
- package/src/walk/initWalk.js +4 -4
- package/src/walk/landWalker.js +38 -0
- package/src/walk/moveWalker.js +5 -4
- package/src/walk/{onAdd.js → onAddWalkControl.js} +3 -1
- package/src/walk/{onRemove.js → onRemoveWalkControl.js} +1 -1
- package/src/walk/{onKey.js → onWalkKey.js} +1 -1
- package/src/walk/{onTerrain.js → onWalkTerrain.js} +1 -1
- package/src/walk/{place.js → placeWalker.js} +2 -2
- package/src/walk/resolveWalkerPosition.js +28 -0
- package/src/walk/{start.js → startWalking.js} +8 -5
- package/src/walk/{stop.js → stopWalking.js} +4 -4
- package/src/walk/{toggle.js → toggleWalking.js} +2 -2
- package/src/walk/updateWalkerFrame.js +19 -0
- package/src/weakmaps/addedByLayer.js +1 -0
- package/src/weakmaps/archiveHeaderByLayer.js +1 -0
- package/src/weakmaps/areasByLayer.js +1 -0
- package/src/weakmaps/bridgeMeshByLayer.js +1 -0
- package/src/weakmaps/bridgesByLayer.js +1 -0
- package/src/weakmaps/cameraAnimationByMap.js +1 -0
- package/src/weakmaps/cameraBearingByMap.js +1 -0
- package/src/weakmaps/cameraByLayer.js +1 -0
- package/src/weakmaps/cameraDraggableByMap.js +1 -0
- package/src/weakmaps/cameraFields.js +37 -0
- package/src/weakmaps/cameraFrameByMap.js +1 -0
- package/src/weakmaps/cameraHandlersByMap.js +1 -0
- package/src/weakmaps/cameraMaps.js +1 -0
- package/src/weakmaps/cameraPitchByMap.js +1 -0
- package/src/weakmaps/cameraReadyByMap.js +1 -0
- package/src/weakmaps/cameraTouchStateByMap.js +1 -0
- package/src/weakmaps/cameraViewByMap.js +1 -0
- package/src/weakmaps/cameraZIndexOffsetByLayer.js +1 -0
- package/src/weakmaps/containerByLayer.js +1 -0
- package/src/weakmaps/controlByLayer.js +1 -0
- package/src/weakmaps/countStatusByLayer.js +1 -0
- package/src/weakmaps/cursorByLayer.js +1 -0
- package/src/weakmaps/demByLayer.js +1 -0
- package/src/weakmaps/directoriesByLayer.js +1 -0
- package/src/weakmaps/etagByLayer.js +1 -0
- package/src/weakmaps/eventMapByLayer.js +1 -0
- package/src/weakmaps/eventsByLayer.js +1 -0
- package/src/weakmaps/fadeFrameByLayer.js +1 -0
- package/src/weakmaps/fadeVersionByLayer.js +1 -0
- package/src/weakmaps/frameByLayer.js +1 -0
- package/src/weakmaps/geojsonByLayer.js +1 -0
- package/src/weakmaps/geometryWorkersByMap.js +1 -0
- package/src/weakmaps/groupByLayer.js +1 -0
- package/src/weakmaps/headerByLayer.js +1 -0
- package/src/weakmaps/highlightedFeatureByLayer.js +1 -0
- package/src/weakmaps/hoveredFeatureByLayer.js +1 -0
- package/src/weakmaps/inflightByLayer.js +1 -0
- package/src/weakmaps/kindByLayer.js +1 -0
- package/src/weakmaps/layersByLayer.js +1 -0
- package/src/weakmaps/loadingTilesByLayer.js +1 -0
- package/src/weakmaps/locationByLayer.js +1 -0
- package/src/weakmaps/modelByLayer.js +1 -0
- package/src/weakmaps/modelUrlByLayer.js +1 -0
- package/src/weakmaps/nativeGPUBackByMap.js +1 -0
- package/src/weakmaps/nativeGPUByLayer.js +1 -0
- package/src/weakmaps/nativeGPUOrderByMap.js +1 -0
- package/src/weakmaps/pitchSkyByMap.js +1 -0
- package/src/weakmaps/pointerEventsByLayer.js +1 -0
- package/src/weakmaps/pruneAfterByLayer.js +1 -0
- package/src/weakmaps/pruneVersionByLayer.js +1 -0
- package/src/weakmaps/pruneWantedByLayer.js +1 -0
- package/src/weakmaps/queuedByLayer.js +1 -0
- package/src/weakmaps/rasterGeometryByLayer.js +1 -0
- package/src/weakmaps/rasterProgramByLayer.js +1 -0
- package/src/weakmaps/rasterTilesByLayer.js +1 -0
- package/src/weakmaps/rasterVersionByLayer.js +1 -0
- package/src/weakmaps/raycasterByLayer.js +1 -0
- package/src/weakmaps/readyByLayer.js +1 -0
- package/src/weakmaps/rendererByLayer.js +1 -0
- package/src/weakmaps/rendererReadyByLayer.js +1 -0
- package/src/weakmaps/roofRasterByLayer.js +1 -0
- package/src/weakmaps/roofRastersByLayer.js +1 -0
- package/src/weakmaps/rootByLayer.js +1 -0
- package/src/weakmaps/rotateControlByMap.js +1 -0
- package/src/weakmaps/sceneFields.js +159 -0
- package/src/weakmaps/sceneLayers.js +1 -0
- package/src/weakmaps/sceneOriginByLayer.js +1 -0
- package/src/weakmaps/shadowMeshesByLayer.js +1 -0
- package/src/weakmaps/sharedByLayer.js +1 -0
- package/src/weakmaps/sizeByLayer.js +1 -0
- package/src/weakmaps/state3dByLayer.js +1 -0
- package/src/weakmaps/sunlightByMap.js +1 -0
- package/src/weakmaps/terrain3DByLayer.js +1 -0
- package/src/weakmaps/terrain3DByMap.js +1 -0
- package/src/weakmaps/terrainArchiveByLayer.js +1 -0
- package/src/weakmaps/terrainBaseYByLayer.js +1 -0
- package/src/weakmaps/terrainBoundsByLayer.js +1 -0
- package/src/weakmaps/terrainControllerByLayer.js +1 -0
- package/src/weakmaps/terrainGridsByLayer.js +1 -0
- package/src/weakmaps/terrainLoadingByLayer.js +1 -0
- package/src/weakmaps/terrainOriginElevationByLayer.js +1 -0
- package/src/weakmaps/terrainPromiseByLayer.js +1 -0
- package/src/weakmaps/terrainReadyByLayer.js +1 -0
- package/src/weakmaps/terrainRequestByLayer.js +1 -0
- package/src/weakmaps/terrainSourceByLayer.js +1 -0
- package/src/weakmaps/terrainTilesByLayer.js +1 -0
- package/src/weakmaps/terrainZoomByLayer.js +1 -0
- package/src/weakmaps/tileZoomByLayer.js +1 -0
- package/src/weakmaps/timeControlByMap.js +1 -0
- package/src/weakmaps/tooltipByLayer.js +1 -0
- package/src/weakmaps/touchPitchByMap.js +1 -0
- package/src/weakmaps/touchRotateByMap.js +1 -0
- package/src/weakmaps/typeByLayer.js +1 -0
- package/src/weakmaps/urlByLayer.js +1 -0
- package/src/weakmaps/visibleMeshesByLayer.js +1 -0
- package/src/weakmaps/walkerByLayer.js +1 -0
- package/src/weakmaps/wantedRasterTilesByLayer.js +1 -0
- package/src/weakmaps/zoomLevelByLayer.js +1 -0
- package/src/weakmaps/zoomTransitionsByLayer.js +1 -0
- package/src/weakmaps/zoomViewByLayer.js +1 -0
- package/src/workers/acquireGeometryWorker.js +29 -0
- package/src/workers/buildAreaInWorker.js +40 -0
- package/src/workers/closeGeometryWorkers.js +11 -0
- package/src/workers/createGeometryWorker.js +19 -0
- package/src/workers/geometryWorker.js +14 -0
- package/src/workers/settleGeometryWorker.js +10 -0
- package/src/workers/startGeometryWorker.js +16 -0
- package/src/core/bringNativeLayerToBack.js +0 -8
- package/src/core/bringNativeLayerToFront.js +0 -8
- package/src/core/current.js +0 -6
- package/src/core/localPosition.js +0 -10
- package/src/core/readyNativeGPU.js +0 -9
- package/src/core/reorderNativeLayer.js +0 -9
- package/src/core/scheduleGridFade.js +0 -14
- package/src/core/updateNativeLayerView.js +0 -9
- package/src/geometry/dot.js +0 -6
- package/src/geometry/push.js +0 -3
- package/src/globals/cameraByMap.js +0 -1
- package/src/raster/finishAttachment.js +0 -15
- package/src/raster/isLoading.js +0 -7
- package/src/raster/terrainTileGeometry.js +0 -16
- package/src/rendering/destroyTexture.js +0 -9
- package/src/rendering/sortMeshes.js +0 -6
- package/src/rendering/updateRoofAtlas.js +0 -20
- package/src/rendering/updateRoofRaster.js +0 -25
- package/src/scene/attach.js +0 -54
- package/src/scene/endZoom.js +0 -23
- package/src/scene/initializeSharedRenderer.js +0 -45
- package/src/scene/layerCountTitle.js +0 -4
- package/src/scene/mountRenderer.js +0 -25
- package/src/scene/ready.js +0 -9
- package/src/scene/renderLayerCount.js +0 -13
- package/src/scene/rendererDeviceError.js +0 -14
- package/src/scene/rendererDeviceLost.js +0 -14
- package/src/scene/requestAdapter.js +0 -12
- package/src/scene/requestDevice.js +0 -9
- package/src/scene/update.js +0 -23
- package/src/sources/projectedTree.js +0 -19
- package/src/sources/pump.js +0 -44
- package/src/sunlight/render.js +0 -9
- package/src/terrain/rasterProgram.js +0 -51
- package/src/walk/land.js +0 -32
- package/src/walk/local.js +0 -18
- /package/src/{camera → animations}/mapStopPitchBearingAnimation.js +0 -0
- /package/src/{core → animations}/runMarkerPanFrame.js +0 -0
- /package/src/{core → animations}/scheduleMarkerPan.js +0 -0
- /package/src/archives/{varint.js → readVarint.js} +0 -0
- /package/src/{sunlight → astronomy}/horizontalPosition.js +0 -0
- /package/src/{sunlight → astronomy}/moonPosition.js +0 -0
- /package/src/{sunlight → astronomy}/solarPosition.js +0 -0
- /package/src/{sunlight → astronomy}/solarTime.js +0 -0
- /package/src/{scene → camera}/createSceneCamera.js +0 -0
- /package/src/{sunlight/rgb.js → colors/formatRGB.js} +0 -0
- /package/src/{utils/channel.js → colors/hslChannel.js} +0 -0
- /package/src/{sunlight/mix.js → colors/mixColor.js} +0 -0
- /package/src/{utils → colors}/toSRGB.js +0 -0
- /package/src/controls/{editable.js → isEditableTarget.js} +0 -0
- /package/src/geometry/{nativeTriangle.js → appendNativeTriangle.js} +0 -0
- /package/src/{traffic → geometry}/appendRouteDash.js +0 -0
- /package/src/{traffic → geometry}/appendRouteSegment.js +0 -0
- /package/src/geometry/{build.js → buildGeometryParts.js} +0 -0
- /package/src/geometry/{lampRing.js → createLampRing.js} +0 -0
- /package/src/{raster/createGeometry.js → geometry/createRasterQuadGeometry.js} +0 -0
- /package/src/geometry/{treeRing.js → createTreeRing.js} +0 -0
- /package/src/geometry/{cross.js → crossVector.js} +0 -0
- /package/src/{sources → geometry}/generateTreeGeometry.js +0 -0
- /package/src/{sources → geometry}/instanceAreaGeometry.js +0 -0
- /package/src/{traffic/along.js → geometry/interpolateRoute.js} +0 -0
- /package/src/{core → geometry}/markerImageBounds.js +0 -0
- /package/src/{shadows → geometry}/meshShadowBounds.js +0 -0
- /package/src/geometry/{below.js → offsetBelowGround.js} +0 -0
- /package/src/{scene → geometry}/restoreGeometry.js +0 -0
- /package/src/{traffic → geometry}/routeGeometry.js +0 -0
- /package/src/geometry/{sub.js → subtractVector.js} +0 -0
- /package/src/{terrain → geometry}/terrainGrid.js +0 -0
- /package/src/geometry/{visit.js → visitNativeCoordinates.js} +0 -0
- /package/src/{scene → gpu}/showWebGPUWarning.js +0 -0
- /package/src/{scene → layer-controls}/placeEntry.js +0 -0
- /package/src/{scene → layer-controls}/placeEntryElement.js +0 -0
- /package/src/{scene → layer-controls}/placeUnderEntry.js +0 -0
- /package/src/{scene → layer-controls}/removeEntry.js +0 -0
- /package/src/{scene → layer-controls}/replaceEntry.js +0 -0
- /package/src/{scene → layer-controls}/runPlacements.js +0 -0
- /package/src/{scene → layer-controls}/underEntry.js +0 -0
- /package/src/lighting/{visitCells.js → visitLightGridCells.js} +0 -0
- /package/src/{rendering → materials}/createProgramLayout.js +0 -0
- /package/src/{rendering → materials}/createProgramUniforms.js +0 -0
- /package/src/{rendering → materials}/prepareMeshCutout.js +0 -0
- /package/src/{shaders → materials}/validateRoofMaterial.js +0 -0
- /package/src/{core → native}/beforeNativeRender.js +0 -0
- /package/src/{core → native}/bypassNativeEvent.js +0 -0
- /package/src/{core → native}/compareNativeHits.js +0 -0
- /package/src/{core → native}/forwardNativeError.js +0 -0
- /package/src/{core → native}/hideTargets.js +0 -0
- /package/src/{core → native}/nativeAddLatLng.js +0 -0
- /package/src/{core → native}/nativeBringToBack.js +0 -0
- /package/src/{core → native}/nativeBringToFront.js +0 -0
- /package/src/{core → native}/nativeRedraw.js +0 -0
- /package/src/{core → native}/nativeSetBounds.js +0 -0
- /package/src/{core → native}/nativeSetIcon.js +0 -0
- /package/src/{core → native}/nativeSetLatLng.js +0 -0
- /package/src/{core → native}/nativeSetLatLngs.js +0 -0
- /package/src/{core → native}/nativeSetOpacity.js +0 -0
- /package/src/{core → native}/nativeSetRadius.js +0 -0
- /package/src/{core → native}/nativeSetStyle.js +0 -0
- /package/src/{core → native}/nativeSetUrl.js +0 -0
- /package/src/{core → native}/nativeSetZIndex.js +0 -0
- /package/src/{core → native}/nativeSetZIndexOffset.js +0 -0
- /package/src/{core → native}/refreshNativeEvent.js +0 -0
- /package/src/{core → native}/rejectNativeReady.js +0 -0
- /package/src/{core → native}/resolveNativeReady.js +0 -0
- /package/src/{core → native}/restoreNativeEvents.js +0 -0
- /package/src/{core → native}/updateNativeHover.js +0 -0
- /package/src/{camera/displayPoint.js → projections/displayContainerPoint.js} +0 -0
- /package/src/{core → projections}/localPixel.js +0 -0
- /package/src/{core → projections}/localPixelForGeometry.js +0 -0
- /package/src/{core → projections}/markerCameraIconPoint.js +0 -0
- /package/src/{geometry/bridgeLocal.js → projections/projectBridgePoint.js} +0 -0
- /package/src/{sunlight → projections}/projectCelestialBody.js +0 -0
- /package/src/{camera/pointOf.js → projections/toPoint.js} +0 -0
- /package/src/{camera → projections}/verticalGroundY.js +0 -0
- /package/src/raster/{reportError.js → reportRasterError.js} +0 -0
- /package/src/scene/{emptyNode.js → createSceneNode.js} +0 -0
- /package/src/scene/{reportError.js → reportLayerError.js} +0 -0
- /package/src/sunlight/{onAdd.js → onAddTimeControl.js} +0 -0
- /package/src/sunlight/{remove.js → removeTimeControl.js} +0 -0
- /package/src/terrain/{sample.js → sampleTerrainTile.js} +0 -0
- /package/src/{rendering → textures}/bindMeshTextures.js +0 -0
- /package/src/{rendering → textures}/compareRoofTiles.js +0 -0
- /package/src/{rendering/destroyAfterSubmission.js → textures/destroyTextureAfterSubmission.js} +0 -0
- /package/src/{rendering → textures}/ensureRoofBlit.js +0 -0
- /package/src/{models/loadImage.js → textures/loadModelImage.js} +0 -0
- /package/src/{models/textureSampler.js → textures/modelTextureSampler.js} +0 -0
- /package/src/{rendering → textures}/prepareMeshTextures.js +0 -0
- /package/src/{scene → textures}/restoreMaterialTextures.js +0 -0
- /package/src/{rendering → textures}/textureBinding.js +0 -0
- /package/src/{rendering → textures}/uploadMeshTexture.js +0 -0
- /package/src/{core → textures}/uploadNativeImage.js +0 -0
- /package/src/{rendering → textures}/uploadRoofTile.js +0 -0
- /package/src/traffic/{toLanes.js → featuresToTrafficLanes.js} +0 -0
- /package/src/traffic/{tooltip.js → trafficTooltip.js} +0 -0
- /package/src/{scene → transforms}/composeLocalTransform.js +0 -0
- /package/src/{models/nodeMatrix.js → transforms/modelNodeMatrix.js} +0 -0
- /package/src/{core → transforms}/transformNativePoint.js +0 -0
- /package/src/{scene → transforms}/updateWorldMatrix.js +0 -0
- /package/src/{scene → transforms}/worldMatrixChanged.js +0 -0
- /package/src/vehicles/{carriage.js → buildCarriage.js} +0 -0
- /package/src/vehicles/{mirror.js → mirrorVehiclePart.js} +0 -0
- /package/src/walk/{initialize.js → initializeWalkControl.js} +0 -0
- /package/src/walk/{blocked.js → isWalkBlocked.js} +0 -0
- /package/src/walk/{onBlur.js → onWalkBlur.js} +0 -0
- /package/src/walk/{onPointer.js → onWalkPointer.js} +0 -0
- /package/src/{globals → weakmaps}/boundsMethods.js +0 -0
- /package/src/{globals → weakmaps}/closestMethods.js +0 -0
- /package/src/{globals → weakmaps}/colliders.js +0 -0
- /package/src/{globals → weakmaps}/dragByHandler.js +0 -0
- /package/src/{globals → weakmaps}/dragStates.js +0 -0
- /package/src/{globals → weakmaps}/gridInitializers.js +0 -0
- /package/src/{globals → weakmaps}/imageStates.js +0 -0
- /package/src/{globals → weakmaps}/nativeEventMaps.js +0 -0
- /package/src/{globals → weakmaps}/nativeRenderByLayer.js +0 -0
- /package/src/{globals → weakmaps}/rendererDevices.js +0 -0
- /package/src/{globals → weakmaps}/renderers.js +0 -0
- /package/src/{globals → weakmaps}/sceneByLayer.js +0 -0
- /package/src/{globals → weakmaps}/sunByMap.js +0 -0
- /package/src/{globals → weakmaps}/sunlightByControl.js +0 -0
- /package/src/{globals → weakmaps}/touchByContainer.js +0 -0
- /package/src/{globals → weakmaps}/trafficByLayer.js +0 -0
- /package/src/{globals → weakmaps}/walkByMap.js +0 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { queuedByLayer } from '../weakmaps/queuedByLayer.js';
|
|
2
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
3
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
4
|
+
|
|
1
5
|
import { pendingMapChanges } from '../globals/pendingMapChanges.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
|
|
6
|
-
import { update } from './
|
|
9
|
+
import { update } from './scheduleSceneUpdate.js';
|
|
7
10
|
import { render } from '../rendering/render.js';
|
|
8
11
|
|
|
9
12
|
export function renderPendingMapChange() {
|
|
10
13
|
const layer = pendingMapChanges.shift();
|
|
11
|
-
|
|
12
|
-
if (
|
|
14
|
+
queuedByLayer.set(layer, false);
|
|
15
|
+
if (sharedByLayer.get(layer) !== layer || !rendererByLayer.get(layer)) return;
|
|
13
16
|
if (layer._map._animatingZoom) update(layer);
|
|
14
17
|
else render(layer);
|
|
15
18
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { frameByLayer } from '../weakmaps/frameByLayer.js';
|
|
2
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
3
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
4
|
+
|
|
1
5
|
import { pendingUpdates } from '../globals/pendingUpdates.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
6
|
|
|
4
7
|
|
|
5
8
|
|
|
@@ -9,12 +12,12 @@ export function renderPendingUpdates() {
|
|
|
9
12
|
const updates = /* alloc */ [...pendingUpdates];
|
|
10
13
|
pendingUpdates.clear();
|
|
11
14
|
let failure;
|
|
12
|
-
let
|
|
13
|
-
for (
|
|
14
|
-
|
|
15
|
-
if (
|
|
15
|
+
let layer;
|
|
16
|
+
for (layer of updates) {
|
|
17
|
+
frameByLayer.set(layer, null);
|
|
18
|
+
if (sharedByLayer.get(layer) !== layer || !rendererByLayer.get(layer)) continue;
|
|
16
19
|
try {
|
|
17
|
-
render(
|
|
20
|
+
render(layer);
|
|
18
21
|
} catch (error) {
|
|
19
22
|
failure ||= error;
|
|
20
23
|
}
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
2
3
|
|
|
3
4
|
|
|
4
|
-
import { createProgram } from '../rendering/createProgram.js';
|
|
5
|
-
import { restoreGeometry } from './restoreGeometry.js';
|
|
6
|
-
import { restoreMaterialTextures } from './restoreMaterialTextures.js';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { createProgram } from '../materials/createProgram.js';
|
|
7
|
+
import { restoreGeometry } from '../geometry/restoreGeometry.js';
|
|
8
|
+
import { restoreMaterialTextures } from '../textures/restoreMaterialTextures.js';
|
|
9
|
+
|
|
10
|
+
export function restoreObject(object, layer) {
|
|
11
|
+
const shared = sharedByLayer.get(layer);
|
|
10
12
|
let texture;
|
|
11
|
-
if (object.geometry && object.geometry.device !==
|
|
13
|
+
if (object.geometry && object.geometry.device !== rendererByLayer.get(shared).device) {
|
|
12
14
|
const geometry = object.geometry;
|
|
13
15
|
const material = object.program._layerMaterial;
|
|
14
|
-
const device =
|
|
16
|
+
const device = rendererByLayer.get(shared).device;
|
|
15
17
|
restoreGeometry(geometry, device);
|
|
16
18
|
object.bindGroup = null;
|
|
17
19
|
if (object.boundTextures) object.boundTextures.length = 0;
|
|
18
20
|
else object.boundTextures = /* alloc */ [];
|
|
19
21
|
restoreMaterialTextures(material, device);
|
|
20
22
|
object.program.pipelineCache.clear();
|
|
21
|
-
object.program = createProgram(
|
|
23
|
+
object.program = createProgram(layer, material);
|
|
22
24
|
object.device = device;
|
|
23
25
|
}
|
|
24
|
-
if (object.texture && object.texture.device !==
|
|
26
|
+
if (object.texture && object.texture.device !== rendererByLayer.get(shared).device) {
|
|
25
27
|
texture = object.texture;
|
|
26
|
-
texture.device =
|
|
27
|
-
texture.texture =
|
|
28
|
+
texture.device = rendererByLayer.get(shared).device;
|
|
29
|
+
texture.texture = rendererByLayer.get(shared).device.createTexture(/* alloc */ {
|
|
28
30
|
size: /* alloc */ [object.texture.image.width, object.texture.image.height],
|
|
29
31
|
format: object.texture.format,
|
|
30
32
|
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
|
31
33
|
});
|
|
32
|
-
texture.sampler =
|
|
34
|
+
texture.sampler = rendererByLayer.get(shared).device.createSampler(texture.samplerOptions);
|
|
33
35
|
texture.uploaded = null;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { frameByLayer } from '../weakmaps/frameByLayer.js';
|
|
2
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
3
|
+
|
|
4
|
+
import { pendingUpdates } from '../globals/pendingUpdates.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
import { render } from "../rendering/render.js";
|
|
8
|
+
|
|
9
|
+
import { renderPendingUpdates } from './renderPendingUpdates.js';
|
|
10
|
+
|
|
11
|
+
/** Scene graph, shared camera and frame rendering. */
|
|
12
|
+
/** Content changes: render once on the next animation frame. */
|
|
13
|
+
export function update(layer) {
|
|
14
|
+
const shared = sharedByLayer.get(layer);
|
|
15
|
+
if (!shared) return layer;
|
|
16
|
+
if (shared !== layer) {
|
|
17
|
+
update(shared);
|
|
18
|
+
return layer;
|
|
19
|
+
}
|
|
20
|
+
if (frameByLayer.get(layer) != null) return layer;
|
|
21
|
+
const first = pendingUpdates.values().next().value;
|
|
22
|
+
pendingUpdates.add(layer);
|
|
23
|
+
frameByLayer.set(layer, first ? frameByLayer.get(first) : requestAnimationFrame(renderPendingUpdates));
|
|
24
|
+
return layer;
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultMaterial } from '../globals/defaultMaterial.js';
|
|
2
|
-
import { textureBinding } from '../
|
|
3
|
-
import { validateRoofMaterial } from '
|
|
2
|
+
import { textureBinding } from '../textures/textureBinding.js';
|
|
3
|
+
import { validateRoofMaterial } from '../materials/validateRoofMaterial.js';
|
|
4
4
|
import { materialVertexShader } from './materialVertexShader.js';
|
|
5
5
|
import { materialSurfaceShader } from './materialSurfaceShader.js';
|
|
6
6
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { sunBindGroup } from '../globals/sunBindGroup.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
export function bindSunlight(layer) {
|
|
7
|
-
const sun =
|
|
8
|
-
sun.bindGroup =
|
|
8
|
+
const sun = rendererByLayer.get(layer).sunlight;
|
|
9
|
+
sun.bindGroup = rendererByLayer.get(layer).device.createBindGroup((
|
|
9
10
|
sunBindGroup.layout = sun.layout,
|
|
10
11
|
sunBindGroup.entries[0].resource.buffer = sun.buffer,
|
|
11
12
|
sunBindGroup.entries[1].resource = sun.texture.createView(),
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { shadowPass } from '../globals/shadowPass.js';
|
|
2
4
|
import { shadowBindGroup } from '../globals/shadowBindGroup.js';
|
|
3
5
|
import { shadowOffsets } from '../globals/shadowOffsets.js';
|
|
4
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
export function drawShadowMeshes(
|
|
8
|
-
const renderer =
|
|
8
|
+
export function drawShadowMeshes(layer, encoder, meshes) {
|
|
9
|
+
const renderer = rendererByLayer.get(layer), device = renderer.device, sun = renderer.sunlight;
|
|
9
10
|
const pass = encoder.beginRenderPass((
|
|
10
11
|
shadowPass.depthStencilAttachment.view = sun.texture.createView(),
|
|
11
12
|
shadowPass
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
|
|
2
3
|
import { disabledShadow } from '../globals/disabledShadow.js';
|
|
3
4
|
import { shadowValues } from '../globals/shadowValues.js';
|
|
4
5
|
|
|
@@ -10,8 +11,8 @@ import { resizeSunlight } from './resizeSunlight.js';
|
|
|
10
11
|
|
|
11
12
|
/** One shared directional depth map. Off-screen but loaded geometry can cast shadows. */
|
|
12
13
|
|
|
13
|
-
export function renderSunlight(
|
|
14
|
-
const renderer =
|
|
14
|
+
export function renderSunlight(layer, encoder, meshes, sunlight) {
|
|
15
|
+
const renderer = rendererByLayer.get(layer), device = renderer.device, sun = renderer.sunlight;
|
|
15
16
|
if (!meshes.length || !sunlight || sunlight.altitude < 3) {
|
|
16
17
|
if (!sun.enabled) return;
|
|
17
18
|
device.queue.writeBuffer(sun.buffer, 0, disabledShadow);
|
|
@@ -22,7 +23,7 @@ export function renderSunlight(backend, encoder, meshes, sunlight) {
|
|
|
22
23
|
if (shadowCacheMatches(sun, meshes, sunlight)) return;
|
|
23
24
|
const values = shadowValues;
|
|
24
25
|
sun.enabled = true;
|
|
25
|
-
resizeSunlight(
|
|
26
|
+
resizeSunlight(layer, Math.min(2048, device.limits.maxTextureDimension2D));
|
|
26
27
|
values.set(shadowMatrix(meshes, sunlight));
|
|
27
28
|
values[16] = 1;
|
|
28
29
|
device.queue.writeBuffer(sun.buffer, 0, values);
|
|
@@ -34,7 +35,7 @@ export function renderSunlight(backend, encoder, meshes, sunlight) {
|
|
|
34
35
|
break;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
drawShadowMeshes(
|
|
38
|
+
drawShadowMeshes(layer, encoder, meshes);
|
|
38
39
|
const snapshots = /* alloc */ new Map();
|
|
39
40
|
let mesh2;
|
|
40
41
|
for (mesh2 of meshes) {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { shadowTexture } from '../globals/shadowTexture.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
import { bindSunlight } from './bindSunlight.js';
|
|
6
|
-
import { destroyTexture } from '../
|
|
7
|
+
import { destroyTexture } from '../textures/destroyTexture.js';
|
|
7
8
|
|
|
8
|
-
export function resizeSunlight(
|
|
9
|
-
const device =
|
|
9
|
+
export function resizeSunlight(layer, size) {
|
|
10
|
+
const device = rendererByLayer.get(layer).device, sun = rendererByLayer.get(layer).sunlight;
|
|
10
11
|
if (sun.size === size) return;
|
|
11
|
-
if (sun.texture) destroyTexture(
|
|
12
|
+
if (sun.texture) destroyTexture(layer, sun.texture);
|
|
12
13
|
sun.size = size;
|
|
13
14
|
sun.texture = device.createTexture((
|
|
14
15
|
shadowTexture.size[0] = size,
|
|
@@ -17,5 +18,5 @@ export function resizeSunlight(backend, size) {
|
|
|
17
18
|
shadowTexture
|
|
18
19
|
));
|
|
19
20
|
|
|
20
|
-
bindSunlight(
|
|
21
|
+
bindSunlight(layer);
|
|
21
22
|
}
|
|
@@ -3,8 +3,8 @@ import { shadowCamera } from '../globals/shadowCamera.js';
|
|
|
3
3
|
import { shadowLow } from '../globals/shadowLow.js';
|
|
4
4
|
import { shadowHigh } from '../globals/shadowHigh.js';
|
|
5
5
|
|
|
6
|
-
import { shadowBounds } from '
|
|
7
|
-
import { updateCamera } from '../
|
|
6
|
+
import { shadowBounds } from '../geometry/shadowBounds.js';
|
|
7
|
+
import { updateCamera } from '../camera/updateSceneCamera.js';
|
|
8
8
|
|
|
9
9
|
export function shadowMatrix(meshes, sunlight) {
|
|
10
10
|
const { min, max } = shadowBounds(meshes, sharedShadowBounds);
|
|
@@ -1,29 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
3
|
+
|
|
2
4
|
import { nextId } from '../globals/nextId.js';
|
|
3
5
|
|
|
4
6
|
|
|
5
|
-
import { emptyNode } from '../scene/
|
|
6
|
-
import { createProgram } from '../
|
|
7
|
+
import { emptyNode } from '../scene/createSceneNode.js';
|
|
8
|
+
import { createProgram } from '../materials/createProgram.js';
|
|
7
9
|
|
|
8
10
|
import { setParent } from '../scene/setParent.js';
|
|
9
|
-
import { update } from '../scene/
|
|
10
|
-
import { instanceAreaGeometry } from '
|
|
11
|
+
import { update } from '../scene/scheduleSceneUpdate.js';
|
|
12
|
+
import { instanceAreaGeometry } from '../geometry/instanceAreaGeometry.js';
|
|
11
13
|
|
|
12
14
|
export function attachAreaMesh(context) {
|
|
13
|
-
const { backend, area } = context;
|
|
15
|
+
const { backend: layer, area } = context;
|
|
14
16
|
if (!context.positions.length) {
|
|
15
17
|
area.mesh = null, area.buildings = 0, area.skipped = context.skipped, area.done = true;
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
18
|
-
const device =
|
|
19
|
-
const data = instanceAreaGeometry(context);
|
|
20
|
+
const device = rendererByLayer.get(layer).device;
|
|
21
|
+
const data = context.preparedGeometry || instanceAreaGeometry(context);
|
|
20
22
|
const attributes = /* alloc */ {
|
|
21
|
-
position: /* alloc */ { size: 3, data: /* alloc */ new Float32Array(data.positions) },
|
|
22
|
-
normal: /* alloc */ { size: 3, data: /* alloc */ new Float32Array(data.normals) },
|
|
23
|
-
color: /* alloc */ { size: 3, data: /* alloc */ new Float32Array(data.colors) },
|
|
23
|
+
position: /* alloc */ { size: 3, data: data.positions instanceof Float32Array ? data.positions : /* alloc */ new Float32Array(data.positions) },
|
|
24
|
+
normal: /* alloc */ { size: 3, data: data.normals instanceof Float32Array ? data.normals : /* alloc */ new Float32Array(data.normals) },
|
|
25
|
+
color: /* alloc */ { size: 3, data: data.colors instanceof Float32Array ? data.colors : /* alloc */ new Float32Array(data.colors) },
|
|
24
26
|
};
|
|
25
27
|
if (data.instanceOffsets) attributes.instanceOffset = /* alloc */ { size: 4, data: data.instanceOffsets };
|
|
26
|
-
if (
|
|
28
|
+
if (layer.options.nightLight) attributes.uv = /* alloc */ {
|
|
29
|
+
size: 2, data: context.uvs instanceof Float32Array ? context.uvs : /* alloc */ new Float32Array(context.uvs),
|
|
30
|
+
};
|
|
27
31
|
let name, attribute;
|
|
28
32
|
for (name in attributes) {
|
|
29
33
|
attribute = attributes[name];
|
|
@@ -36,6 +40,7 @@ export function attachAreaMesh(context) {
|
|
|
36
40
|
}
|
|
37
41
|
const meshGeometry = /* alloc */ {
|
|
38
42
|
device,
|
|
43
|
+
bounds: data.bounds,
|
|
39
44
|
attributes,
|
|
40
45
|
drawRange: /* alloc */ { start: 0, count: attributes.position.count },
|
|
41
46
|
};
|
|
@@ -43,13 +48,13 @@ export function attachAreaMesh(context) {
|
|
|
43
48
|
...emptyNode(),
|
|
44
49
|
device,
|
|
45
50
|
geometry: meshGeometry,
|
|
46
|
-
program: createProgram(
|
|
51
|
+
program: createProgram(layer, /* alloc */ {
|
|
47
52
|
instanced: Boolean(data.instanceOffsets),
|
|
48
|
-
vertexColors: true, roofTexture:
|
|
49
|
-
wallTexture:
|
|
50
|
-
nightLight: Boolean(
|
|
51
|
-
alphaMode:
|
|
52
|
-
doubleSided: Boolean(
|
|
53
|
+
vertexColors: true, roofTexture: layer.options.roofTexture,
|
|
54
|
+
wallTexture: layer.options.wallTexture,
|
|
55
|
+
nightLight: Boolean(layer.options.nightLight),
|
|
56
|
+
alphaMode: layer.options.nightLight ? 'BLEND' : undefined,
|
|
57
|
+
doubleSided: Boolean(layer.options.nightLight),
|
|
53
58
|
}),
|
|
54
59
|
id: nextId.value++,
|
|
55
60
|
renderOrder: 0,
|
|
@@ -59,6 +64,6 @@ export function attachAreaMesh(context) {
|
|
|
59
64
|
area.buildings = context.featureFaces.length;
|
|
60
65
|
area.skipped = context.skipped;
|
|
61
66
|
area.done = true;
|
|
62
|
-
setParent(area.mesh,
|
|
63
|
-
update(
|
|
67
|
+
setParent(area.mesh, rootByLayer.get(layer));
|
|
68
|
+
update(layer);
|
|
64
69
|
}
|
package/src/sources/buildArea.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { geojsonByLayer } from '../weakmaps/geojsonByLayer.js';
|
|
2
|
+
import { inflightByLayer } from '../weakmaps/inflightByLayer.js';
|
|
3
|
+
import { cameraViewByMap } from '../weakmaps/cameraViewByMap.js';
|
|
3
4
|
|
|
4
5
|
|
|
5
|
-
import { buildAreaFeature } from './buildAreaFeature.js';
|
|
6
6
|
import { attachAreaMesh } from './attachAreaMesh.js';
|
|
7
7
|
import { loadSource } from '../archives/loadSource.js';
|
|
8
8
|
import { sourceAreaContext } from './sourceAreaContext.js';
|
|
9
|
-
import { pump } from './
|
|
9
|
+
import { pump } from './pumpSourceAreas.js';
|
|
10
|
+
import { buildAreaInWorker } from '../workers/buildAreaInWorker.js';
|
|
11
|
+
import { buildAreaFeatures } from './buildAreaFeatures.js';
|
|
10
12
|
|
|
11
|
-
export async function buildArea(
|
|
12
|
-
let feature;
|
|
13
|
+
export async function buildArea(layer, area, map) {
|
|
13
14
|
try {
|
|
14
15
|
await /* alloc */ new Promise(requestAnimationFrame);
|
|
15
|
-
await
|
|
16
|
+
await cameraViewByMap.get(map);
|
|
16
17
|
if (area.request.signal.aborted) return;
|
|
17
|
-
const data = await loadSource(
|
|
18
|
+
const data = await loadSource(layer, area);
|
|
18
19
|
if (area.request.signal.aborted) return;
|
|
19
20
|
if (data?.type !== 'FeatureCollection' || !Array.isArray(data.features)) {
|
|
20
21
|
throw /* alloc */ new Error('Invalid GeoJSON response');
|
|
21
22
|
}
|
|
22
|
-
if (
|
|
23
|
+
if (geojsonByLayer.get(layer) && typeof layer.options.style !== 'function') {
|
|
23
24
|
throw /* alloc */ new Error('style must be a function');
|
|
24
25
|
}
|
|
25
|
-
const context = sourceAreaContext(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (performance.now() >= deadline) {
|
|
30
|
-
await /* alloc */ new Promise(requestAnimationFrame);
|
|
31
|
-
if (area.request.signal.aborted) return;
|
|
32
|
-
deadline = performance.now() + 4;
|
|
33
|
-
}
|
|
34
|
-
buildAreaFeature(context, feature);
|
|
26
|
+
const context = sourceAreaContext(layer, area, map);
|
|
27
|
+
// ponytail: feature-count cutoff avoids startup overhead; count vertices if giant single polygons matter.
|
|
28
|
+
if (layer.options.worker !== false && typeof Worker !== 'undefined' && data.features.length >= 64) {
|
|
29
|
+
context.jobs = /* alloc */ [];
|
|
35
30
|
}
|
|
31
|
+
await buildAreaFeatures(context, area, data.features);
|
|
32
|
+
if (area.request.signal.aborted) return;
|
|
33
|
+
if (context.jobs) await buildAreaInWorker(context, area.request.signal);
|
|
34
|
+
if (area.request.signal.aborted) return;
|
|
36
35
|
attachAreaMesh(context);
|
|
37
36
|
} catch (error) {
|
|
38
37
|
if (!area.request.signal.aborted) {
|
|
39
38
|
area.error = error.message;
|
|
40
|
-
|
|
39
|
+
layer.fire('error', /* alloc */ { error });
|
|
41
40
|
}
|
|
42
41
|
} finally {
|
|
43
|
-
|
|
44
|
-
pump(
|
|
42
|
+
inflightByLayer.set(layer, inflightByLayer.get(layer) - 1);
|
|
43
|
+
pump(layer, map);
|
|
45
44
|
}
|
|
46
45
|
}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import { L } from '../globals/L.js';
|
|
2
1
|
import { buildAreaPoint } from './buildAreaPoint.js';
|
|
3
|
-
import { buildAreaPolygon } from '
|
|
4
|
-
import { parseColor } from '../
|
|
2
|
+
import { buildAreaPolygon } from '../geometry/buildExtrudedPolygon.js';
|
|
3
|
+
import { parseColor } from '../colors/parseColor.js';
|
|
5
4
|
import { featureAnchor } from './featureAnchor.js';
|
|
6
5
|
import { extrusionStyle } from './extrusionStyle.js';
|
|
6
|
+
import { prepareAreaGeometryJob } from './prepareAreaGeometryJob.js';
|
|
7
|
+
import { matchesAreaTile } from './matchesAreaTile.js';
|
|
7
8
|
|
|
8
9
|
export function buildAreaFeature(context, feature) {
|
|
9
|
-
const { backend, area, map } = context;
|
|
10
|
+
const { backend: layer, area, map } = context;
|
|
10
11
|
const coords = area.coords;
|
|
11
|
-
const coordinates = featureAnchor(feature,
|
|
12
|
+
const coordinates = featureAnchor(feature, layer.options.nightLight);
|
|
12
13
|
const geometry = feature.geometry, isTree = geometry.type === 'Point';
|
|
13
14
|
const lon = coordinates[0], lat = coordinates[1];
|
|
14
|
-
if (coords)
|
|
15
|
-
|
|
16
|
-
if (Math.floor(anchor.x / 256) !== coords.x || Math.floor(anchor.y / 256) !== coords.y) return;
|
|
17
|
-
}
|
|
18
|
-
const style = extrusionStyle(backend, feature);
|
|
15
|
+
if (!matchesAreaTile(map, coords, lon, lat)) return;
|
|
16
|
+
const style = extrusionStyle(layer, feature);
|
|
19
17
|
if (style === null) {
|
|
20
18
|
context.skipped++;
|
|
21
19
|
return;
|
|
22
20
|
}
|
|
23
21
|
const { top, bottom = 0, color = 0xd9b38c } = style;
|
|
24
22
|
const baseColor = parseColor(color);
|
|
23
|
+
if (context.jobs) {
|
|
24
|
+
prepareAreaGeometryJob(context, feature, lon, lat, style, baseColor);
|
|
25
|
+
context.featureFaces.push(/* alloc */ {
|
|
26
|
+
id: feature.id ?? feature.properties?.objectid ?? JSON.stringify(geometry),
|
|
27
|
+
properties: feature.properties, baseColor,
|
|
28
|
+
});
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
25
31
|
const vertexStart = context.positions.length / 3;
|
|
26
32
|
if (isTree) buildAreaPoint(context, feature, lon, lat, style, baseColor);
|
|
27
33
|
let polygon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { buildAreaFeature } from './buildAreaFeature.js';
|
|
2
|
+
|
|
3
|
+
export async function buildAreaFeatures(context, area, features) {
|
|
4
|
+
let deadline = performance.now() + 4, feature;
|
|
5
|
+
for (feature of features) {
|
|
6
|
+
if (area.request.signal.aborted) return;
|
|
7
|
+
if (performance.now() >= deadline) {
|
|
8
|
+
await /* alloc */ new Promise(requestAnimationFrame);
|
|
9
|
+
if (area.request.signal.aborted) return;
|
|
10
|
+
deadline = performance.now() + 4;
|
|
11
|
+
}
|
|
12
|
+
buildAreaFeature(context, feature);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
import { projectedTree } from '
|
|
2
|
-
import {
|
|
3
|
-
import { lampPostGeometry } from '../geometry/lampPostGeometry.js';
|
|
4
|
-
import { lightGeometry } from '../geometry/lightGeometry.js';
|
|
5
|
-
import { treeGeometry } from '../geometry/treeGeometry.js';
|
|
1
|
+
import { projectedTree } from '../projections/projectTreePoint.js';
|
|
2
|
+
import { buildProjectedPoint } from '../geometry/buildProjectedPoint.js';
|
|
6
3
|
|
|
7
4
|
export function buildAreaPoint(context, feature, lon, lat, style, baseColor) {
|
|
8
|
-
const { backend } = context;
|
|
9
|
-
const { top } = style;
|
|
10
5
|
const projected = projectedTree(context, lon, lat);
|
|
11
|
-
|
|
12
|
-
if (!Number.isFinite(style.lightFlux) || style.lightFlux <= 0) throw /* alloc */ new Error('Invalid light flux');
|
|
13
|
-
const support = feature.properties?.cod_ouvrag || `${lon},${lat}`;
|
|
14
|
-
if (style.poleRadius > 0 && !context.supports.has(support)) {
|
|
15
|
-
generateTreeGeometry(context, lampPostGeometry, projected, style);
|
|
16
|
-
context.supports.add(support);
|
|
17
|
-
}
|
|
18
|
-
generateTreeGeometry(context, lightGeometry, projected, style);
|
|
19
|
-
context.lights.push(/* alloc */ {
|
|
20
|
-
position: /* alloc */ [projected.x, projected.ground + top, -projected.y],
|
|
21
|
-
radius: Math.hypot(top, style.lightRadius), color: /* alloc */ [baseColor.r, baseColor.g, baseColor.b],
|
|
22
|
-
flux: style.lightFlux,
|
|
23
|
-
});
|
|
24
|
-
} else generateTreeGeometry(context, treeGeometry, projected, style);
|
|
6
|
+
buildProjectedPoint(context, projected, style, baseColor, feature.properties?.cod_ouvrag || `${lon},${lat}`);
|
|
25
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function extrusionStyle(
|
|
2
|
-
const style =
|
|
1
|
+
export function extrusionStyle(layer, feature) {
|
|
2
|
+
const style = layer.options.style(feature);
|
|
3
3
|
if (style === null) return null;
|
|
4
4
|
if (!style || typeof style !== 'object') throw /* alloc */ new Error('style must return an extrusion style or null');
|
|
5
5
|
const { top, bottom = 0 } = style;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { geojsonByLayer } from '../weakmaps/geojsonByLayer.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
import { setGeoJSONLayerData } from './setGeoJSONLayerData.js';
|
|
5
6
|
import { init3D } from '../scene/init3D.js';
|
|
6
7
|
|
|
7
8
|
export function initializeGeoJSON(layer, options) {
|
|
8
|
-
|
|
9
|
+
geojsonByLayer.set(layer, true);
|
|
9
10
|
init3D(layer, options);
|
|
10
11
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { L } from '../globals/L.js';
|
|
2
|
+
|
|
3
|
+
export function matchesAreaTile(map, coords, lon, lat) {
|
|
4
|
+
if (!coords) return true;
|
|
5
|
+
const anchor = map.project(/* alloc */ new L.LatLng(lat, lon), coords.z);
|
|
6
|
+
return Math.floor(anchor.x / 256) === coords.x && Math.floor(anchor.y / 256) === coords.y;
|
|
7
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { areasByLayer } from '../weakmaps/areasByLayer.js';
|
|
2
|
+
|
|
2
3
|
import { compareDistance } from '../utils/compareDistance.js';
|
|
3
4
|
|
|
4
5
|
export function pendingSourceAreas(layers, map) {
|
|
5
6
|
const pending = /* alloc */ [];
|
|
6
7
|
let layer, area, center;
|
|
7
8
|
for (layer of layers) {
|
|
8
|
-
for (area of
|
|
9
|
+
for (area of areasByLayer.get(layer).values()) {
|
|
9
10
|
if (area.started || area.request.signal.aborted) continue;
|
|
10
11
|
center = area.coords && map.project(map.getCenter(), area.coords.z).divideBy(256);
|
|
11
12
|
pending.push(/* alloc */ {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { projectedTree } from '../projections/projectTreePoint.js';
|
|
2
|
+
import { parseColor } from '../colors/parseColor.js';
|
|
3
|
+
import { projectAreaPolygons } from './projectAreaPolygons.js';
|
|
4
|
+
|
|
5
|
+
export function prepareAreaGeometryJob(context, feature, lon, lat, style, baseColor) {
|
|
6
|
+
const geometry = feature.geometry;
|
|
7
|
+
const polygons = projectAreaPolygons(context, geometry);
|
|
8
|
+
const point = geometry.type === 'Point' ? projectedTree(context, lon, lat) : null;
|
|
9
|
+
const nightLight = context.backend.options.nightLight;
|
|
10
|
+
const crownColor = point ? parseColor(style.color ?? (nightLight ? undefined : 0x4f823b)) : baseColor;
|
|
11
|
+
const trunkColor = point && !nightLight ? parseColor(style.trunkColor ?? 0x72513a) : null;
|
|
12
|
+
context.jobs.push(/* alloc */ {
|
|
13
|
+
point, polygons, baseColor: /* alloc */ { r: baseColor.r, g: baseColor.g, b: baseColor.b },
|
|
14
|
+
support: feature.properties?.cod_ouvrag || `${lon},${lat}`,
|
|
15
|
+
style: /* alloc */ {
|
|
16
|
+
top: style.top, bottom: style.bottom ?? 0,
|
|
17
|
+
color: /* alloc */ { r: crownColor.r, g: crownColor.g, b: crownColor.b },
|
|
18
|
+
trunkColor: trunkColor ? /* alloc */ { r: trunkColor.r, g: trunkColor.g, b: trunkColor.b } : undefined,
|
|
19
|
+
trunkRadius: style.trunkRadius, crownRadius: style.crownRadius,
|
|
20
|
+
crownBottom: style.crownBottom, crownShape: style.crownShape,
|
|
21
|
+
poleRadius: style.poleRadius, lightRadius: style.lightRadius, lightFlux: style.lightFlux,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { projectRing } from '../projections/projectRing.js';
|
|
2
|
+
|
|
3
|
+
export function projectAreaPolygons(context, geometry) {
|
|
4
|
+
const rings = geometry.type === 'Polygon' ? /* alloc */ [geometry.coordinates]
|
|
5
|
+
: geometry.type === 'MultiPolygon' ? geometry.coordinates : /* alloc */ [];
|
|
6
|
+
const polygons = /* alloc */ [];
|
|
7
|
+
let polygon, ring, paths;
|
|
8
|
+
for (polygon of rings) {
|
|
9
|
+
if (!polygon.length) throw /* alloc */ new Error('Empty GeoJSON polygon');
|
|
10
|
+
paths = /* alloc */ [];
|
|
11
|
+
for (ring of polygon) paths.push(projectRing(context, ring));
|
|
12
|
+
polygons.push(paths);
|
|
13
|
+
}
|
|
14
|
+
return polygons;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { areasByLayer } from '../weakmaps/areasByLayer.js';
|
|
2
|
+
import { geojsonByLayer } from '../weakmaps/geojsonByLayer.js';
|
|
3
|
+
import { inflightByLayer } from '../weakmaps/inflightByLayer.js';
|
|
4
|
+
import { layersByLayer } from '../weakmaps/layersByLayer.js';
|
|
5
|
+
import { urlByLayer } from '../weakmaps/urlByLayer.js';
|
|
6
|
+
|
|
7
|
+
import { renderers } from '../weakmaps/renderers.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import { updateStatus } from './updateSourceStatus.js';
|
|
12
|
+
|
|
13
|
+
import { buildArea } from './buildArea.js';
|
|
14
|
+
import { pendingSourceAreas } from './pendingSourceAreas.js';
|
|
15
|
+
|
|
16
|
+
/** Share four load/build slots across source layers, nearest ground blocks first. */
|
|
17
|
+
export function pump(layer, map = layer._map) {
|
|
18
|
+
const shared = map && renderers.get(map);
|
|
19
|
+
if (!shared) return;
|
|
20
|
+
const layers = /* alloc */ [];
|
|
21
|
+
let sourceLayer, area, areaBackend;
|
|
22
|
+
for (sourceLayer of layersByLayer.get(shared)) {
|
|
23
|
+
if (Number.isFinite(inflightByLayer.get(sourceLayer)) && areasByLayer.get(sourceLayer) && (urlByLayer.get(sourceLayer) || geojsonByLayer.get(sourceLayer))) layers.push(sourceLayer);
|
|
24
|
+
}
|
|
25
|
+
const pending = pendingSourceAreas(layers, map);
|
|
26
|
+
let inflight = 0;
|
|
27
|
+
for (sourceLayer of layers) inflight += inflightByLayer.get(sourceLayer);
|
|
28
|
+
for ({ layer: areaBackend, area } of pending) {
|
|
29
|
+
if (inflight >= 4) break;
|
|
30
|
+
if (inflightByLayer.get(areaBackend) >= 2) continue;
|
|
31
|
+
area.started = true;
|
|
32
|
+
inflightByLayer.set(areaBackend, inflightByLayer.get(areaBackend) + 1);
|
|
33
|
+
inflight++;
|
|
34
|
+
buildArea(areaBackend, area, map);
|
|
35
|
+
}
|
|
36
|
+
for (sourceLayer of layers) updateStatus(sourceLayer);
|
|
37
|
+
}
|