leaflet-city-mapper 0.0.1 → 0.0.3
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 +61 -13
- package/cucumber.mjs +4 -0
- package/dist/leaflet-city-mapper.js +3 -1
- package/dist/leaflet-city-mapper.js.map +4 -4
- package/package.json +3 -4
- package/src/archives/decodeDirectory.js +32 -0
- package/src/archives/decodeHeader.js +19 -0
- package/src/archives/decompress.js +5 -0
- package/src/archives/getHeader.js +9 -0
- package/src/archives/getZxy.js +75 -0
- package/src/archives/loadDirectory.js +7 -0
- package/src/archives/loadSource.js +17 -0
- package/src/archives/read.js +29 -0
- package/src/archives/tileId.js +19 -0
- package/src/archives/varint.js +15 -0
- package/src/camera/angles.js +6 -0
- package/src/camera/animationPoint.js +8 -0
- package/src/camera/cameraMapReady.js +8 -0
- package/src/camera/cancelCameraAnimation.js +11 -0
- package/src/camera/cleanupCameraMap.js +11 -0
- package/src/camera/constrainCameraToBounds.js +3 -0
- package/src/camera/displayPoint.js +3 -0
- package/src/camera/fitCameraBounds.js +48 -0
- package/src/camera/groundBounds.js +11 -0
- package/src/camera/initializeCameraMap.js +25 -0
- package/src/camera/mapAnimateCamera.js +17 -0
- package/src/camera/mapCamera.js +123 -0
- package/src/camera/mapContainerPointToLayerPoint.js +7 -0
- package/src/camera/mapGetBearing.js +1 -0
- package/src/camera/mapGetBounds.js +14 -0
- package/src/camera/mapGetBoundsCenterZoom.js +7 -0
- package/src/camera/mapGetBoundsZoom.js +14 -0
- package/src/camera/mapGetCenterLayerPoint.js +5 -0
- package/src/camera/mapGetPitch.js +1 -0
- package/src/camera/mapLayerPointToContainerPoint.js +7 -0
- package/src/camera/mapLimitCenter.js +12 -0
- package/src/camera/mapLimitOffset.js +10 -0
- package/src/camera/mapPanBy.js +9 -0
- package/src/camera/mapPanInside.js +14 -0
- package/src/camera/mapResetNorth.js +1 -0
- package/src/camera/mapResetNorthPitch.js +1 -0
- package/src/camera/mapSetBearing.js +1 -0
- package/src/camera/mapSetPitch.js +1 -0
- package/src/camera/mapSetPitchAndBearing.js +14 -0
- package/src/camera/mapSetZoomAround.js +11 -0
- package/src/camera/mapStopPitchBearingAnimation.js +6 -0
- package/src/camera/mapTryAnimatedPan.js +9 -0
- package/src/camera/mapUpdateCameraOverlays.js +7 -0
- package/src/camera/pointOf.js +3 -0
- package/src/camera/project.js +20 -0
- package/src/camera/runCameraAnimations.js +28 -0
- package/src/camera/scheduleCameraAnimation.js +8 -0
- package/src/camera/updateSky.js +16 -0
- package/src/camera/verticalGroundY.js +4 -0
- package/src/collision/collectMeshes.js +5 -0
- package/src/collision/collider.js +63 -0
- package/src/collision/horizontalRay.js +12 -0
- package/src/collision/intersectMeshes.js +133 -0
- package/src/collision/sortHits.js +23 -0
- package/src/constants/CELL.js +4 -0
- package/src/constants/Compass.js +7 -0
- package/src/constants/ContainerResize.js +7 -0
- package/src/constants/HEIGHT.js +1 -0
- package/src/constants/PitchDrag.js +7 -0
- package/src/constants/ShiftRotate.js +7 -0
- package/src/constants/TILE_RADIUS.js +1 -0
- package/src/constants/TILE_SIZE.js +1 -0
- package/src/constants/TouchMode.js +6 -0
- package/src/constants/accessorSizes.js +1 -0
- package/src/constants/accessorTypes.js +8 -0
- package/src/constants/attachState.js +1 -0
- package/src/constants/cameraControlsState.js +1 -0
- package/src/constants/cityMapper.js +6 -0
- package/src/constants/colliders.js +2 -0
- package/src/constants/dark.js +1 -0
- package/src/constants/elevationWGSL.js +27 -0
- package/src/constants/glass.js +1 -0
- package/src/constants/headlight.js +1 -0
- package/src/constants/hull.js +1 -0
- package/src/constants/indexState.js +1 -0
- package/src/constants/limbs.js +9 -0
- package/src/constants/mapCameraState.js +1 -0
- package/src/constants/moves.js +11 -0
- package/src/constants/nativeEventMaps.js +1 -0
- package/src/constants/nativeLayerState.js +1 -0
- package/src/constants/nativeMethodHandlers.js +31 -0
- package/src/constants/onMapChangeState.js +1 -0
- package/src/constants/onZoomAnimState.js +1 -0
- package/src/constants/paints.js +10 -0
- package/src/constants/parts.js +19 -0
- package/src/constants/pendingUpdates.js +1 -0
- package/src/constants/pumpState.js +1 -0
- package/src/constants/renderers.js +2 -0
- package/src/constants/ringDirections.js +10 -0
- package/src/constants/roundProfile.js +1 -0
- package/src/constants/shirt.js +1 -0
- package/src/constants/skin.js +2 -0
- package/src/constants/speed.js +3 -0
- package/src/constants/taillight.js +1 -0
- package/src/constants/trafficShader.js +49 -0
- package/src/constants/trousers.js +1 -0
- package/src/constants/tyre.js +1 -0
- package/src/constants/underEntryState.js +1 -0
- package/src/constants/vehicles.js +40 -0
- package/src/constants/white.js +1 -0
- package/src/controls/acceptPitchDrag.js +4 -0
- package/src/controls/acceptRotateDrag.js +3 -0
- package/src/controls/adjustCameraDrag.js +10 -0
- package/src/controls/cameraControls.js +60 -0
- package/src/controls/cameraDragClick.js +9 -0
- package/src/controls/cameraDragContextMenu.js +8 -0
- package/src/controls/cameraDragDown.js +20 -0
- package/src/controls/cameraDragEnd.js +6 -0
- package/src/controls/cameraDragMove.js +23 -0
- package/src/controls/changeCameraTouch.js +14 -0
- package/src/controls/cleanupCameraTouch.js +24 -0
- package/src/controls/compassAddHooks.js +15 -0
- package/src/controls/compassOrientation.js +6 -0
- package/src/controls/compassRemoveHooks.js +5 -0
- package/src/controls/containerResizeAddHooks.js +8 -0
- package/src/controls/containerResizeRemoveHooks.js +5 -0
- package/src/controls/dragCamera.js +22 -0
- package/src/controls/editable.js +3 -0
- package/src/controls/endAllCameraDrags.js +7 -0
- package/src/controls/endAllCameraTouches.js +7 -0
- package/src/controls/endCameraTouch.js +11 -0
- package/src/controls/endCameraTouchEvent.js +5 -0
- package/src/controls/finishCameraDrag.js +9 -0
- package/src/controls/finishCompassPermission.js +16 -0
- package/src/controls/loadCameraControls.js +9 -0
- package/src/controls/moveCameraTouch.js +22 -0
- package/src/controls/notifyCameraTouchChange.js +1 -0
- package/src/controls/pitchDragAddHooks.js +6 -0
- package/src/controls/pitchDragRemoveHooks.js +5 -0
- package/src/controls/refreshRotateControl.js +7 -0
- package/src/controls/refreshRotateFocus.js +5 -0
- package/src/controls/removeCameraDrag.js +23 -0
- package/src/controls/resizeMap.js +3 -0
- package/src/controls/rotateButtonClick.js +7 -0
- package/src/controls/rotateButtonKeydown.js +11 -0
- package/src/controls/rotateControl.js +3 -0
- package/src/controls/rotateOnAdd.js +38 -0
- package/src/controls/rotateOnRemove.js +6 -0
- package/src/controls/shiftRotateAddHooks.js +8 -0
- package/src/controls/shiftRotateRemoveHooks.js +5 -0
- package/src/controls/shiftRotateWheel.js +9 -0
- package/src/controls/startCameraTouch.js +23 -0
- package/src/core/addImageState.js +7 -0
- package/src/core/addRasterImage.js +10 -0
- package/src/core/adjustCameraMarkerPan.js +22 -0
- package/src/core/beforeNativeRender.js +10 -0
- package/src/core/boundsQuad.js +11 -0
- package/src/core/bringNativeLayerToBack.js +3 -0
- package/src/core/bringNativeLayerToFront.js +3 -0
- package/src/core/cameraCircleBounds.js +6 -0
- package/src/core/cameraMarkerDrag.js +18 -0
- package/src/core/cameraMarkerOnDrag.js +8 -0
- package/src/core/cancelGridFade.js +10 -0
- package/src/core/closestCameraLayerPoint.js +7 -0
- package/src/core/compareNativeHits.js +3 -0
- package/src/core/current.js +3 -0
- package/src/core/disposeNativeLayer.js +35 -0
- package/src/core/fireRasterLoad.js +5 -0
- package/src/core/forwardNativeError.js +3 -0
- package/src/core/gridlayerGetEvents.js +7 -0
- package/src/core/gridlayerGetTiledPixelBounds.js +8 -0
- package/src/core/handleNativeMapEvent.js +47 -0
- package/src/core/hideTargets.js +16 -0
- package/src/core/initNativeGPU.js +21 -0
- package/src/core/initializeGridContainer.js +6 -0
- package/src/core/initializeNativeLayer.js +42 -0
- package/src/core/localPixel.js +5 -0
- package/src/core/localPixelForGeometry.js +6 -0
- package/src/core/localPosition.js +6 -0
- package/src/core/markerCameraIconPoint.js +9 -0
- package/src/core/markerGetEvents.js +5 -0
- package/src/core/markerInitInteraction.js +8 -0
- package/src/core/markerQuadCorners.js +31 -0
- package/src/core/markerSetIcon.js +9 -0
- package/src/core/markerSetPos.js +14 -0
- package/src/core/markerSetRotation.js +7 -0
- package/src/core/markerUpdateZIndex.js +8 -0
- package/src/core/nativeAddLatLng.js +3 -0
- package/src/core/nativeBringToBack.js +3 -0
- package/src/core/nativeBringToFront.js +3 -0
- package/src/core/nativeEvents.js +26 -0
- package/src/core/nativeImageError.js +8 -0
- package/src/core/nativeImageRefresh.js +7 -0
- package/src/core/nativeLayer.js +97 -0
- package/src/core/nativeLayerMethod.js +21 -0
- package/src/core/nativeRedraw.js +3 -0
- package/src/core/nativeSetBounds.js +3 -0
- package/src/core/nativeSetIcon.js +3 -0
- package/src/core/nativeSetLatLng.js +3 -0
- package/src/core/nativeSetLatLngs.js +3 -0
- package/src/core/nativeSetOpacity.js +3 -0
- package/src/core/nativeSetRadius.js +3 -0
- package/src/core/nativeSetStyle.js +3 -0
- package/src/core/nativeSetUrl.js +3 -0
- package/src/core/nativeSetZIndex.js +3 -0
- package/src/core/nativeSetZIndexOffset.js +3 -0
- package/src/core/popupAdjustPan.js +23 -0
- package/src/core/popupGetEvents.js +5 -0
- package/src/core/popupUpdatePosition.js +14 -0
- package/src/core/putNativeMesh.js +33 -0
- package/src/core/quadNativeMesh.js +15 -0
- package/src/core/readyNativeGPU.js +6 -0
- package/src/core/refreshNativeEvent.js +5 -0
- package/src/core/refreshNativeLayer.js +29 -0
- package/src/core/refreshNativeLayerContract.js +3 -0
- package/src/core/rejectNativeReady.js +3 -0
- package/src/core/removeImageState.js +8 -0
- package/src/core/removeNativeEvents.js +16 -0
- package/src/core/removeTargets.js +8 -0
- package/src/core/reorderNativeLayer.js +6 -0
- package/src/core/resolveNativeReady.js +3 -0
- package/src/core/restoreNativeEvents.js +6 -0
- package/src/core/runGridFades.js +14 -0
- package/src/core/runMarkerPanFrame.js +12 -0
- package/src/core/scheduleGridFade.js +9 -0
- package/src/core/scheduleMarkerPan.js +8 -0
- package/src/core/styleNativeMesh.js +10 -0
- package/src/core/syncGridLayer.js +22 -0
- package/src/core/syncImageOverlay.js +9 -0
- package/src/core/syncMarker.js +12 -0
- package/src/core/syncVectorLayer.js +26 -0
- package/src/core/synchronizeNativeLayer.js +35 -0
- package/src/core/textureFor.js +48 -0
- package/src/core/tooltipGetEvents.js +5 -0
- package/src/core/tooltipSetPosition.js +8 -0
- package/src/core/updateGridOpacity.js +23 -0
- package/src/core/updateNativeLayerView.js +6 -0
- package/src/core/uploadCanvasTexture.js +19 -0
- package/src/geometry/addBridges.js +88 -0
- package/src/geometry/below.js +3 -0
- package/src/geometry/box.js +3 -0
- package/src/geometry/bridgeElevation.js +19 -0
- package/src/geometry/bridgeLocal.js +4 -0
- package/src/geometry/build.js +19 -0
- package/src/geometry/circleAt.js +5 -0
- package/src/geometry/clipLine.js +23 -0
- package/src/geometry/clipSegment.js +19 -0
- package/src/geometry/computeBounds.js +33 -0
- package/src/geometry/conformModelToTerrain.js +67 -0
- package/src/geometry/cross.js +3 -0
- package/src/geometry/disk.js +11 -0
- package/src/geometry/diskAt.js +4 -0
- package/src/geometry/dot.js +6 -0
- package/src/geometry/emitter.js +8 -0
- package/src/geometry/lampPostGeometry.js +24 -0
- package/src/geometry/lampRing.js +11 -0
- package/src/geometry/lightGeometry.js +15 -0
- package/src/geometry/line.js +54 -0
- package/src/geometry/nativeGeometry.js +55 -0
- package/src/geometry/nativeTriangle.js +3 -0
- package/src/geometry/polygon.js +22 -0
- package/src/geometry/push.js +3 -0
- package/src/geometry/quad.js +4 -0
- package/src/geometry/roofCoverage.js +52 -0
- package/src/geometry/samePoint.js +3 -0
- package/src/geometry/segment.js +21 -0
- package/src/geometry/setVertexColor.js +15 -0
- package/src/geometry/sub.js +6 -0
- package/src/geometry/surface.js +17 -0
- package/src/geometry/treeGeometry.js +31 -0
- package/src/geometry/treeRing.js +14 -0
- package/src/geometry/triangle.js +12 -0
- package/src/geometry/vertexNormals.js +32 -0
- package/src/geometry/visit.js +9 -0
- package/src/index.js +98 -65
- package/src/lighting/cacheLightGrid.js +23 -0
- package/src/lighting/collectLightMeshes.js +6 -0
- package/src/lighting/lightGrid.js +42 -0
- package/src/lighting/updatePointLights.js +34 -0
- package/src/lighting/visitCells.js +15 -0
- package/src/lighting/worldLights.js +27 -0
- package/src/models/decodeModel.js +45 -0
- package/src/models/hasUnsupportedPrimitives.js +10 -0
- package/src/models/loadBuffer.js +6 -0
- package/src/models/loadImage.js +15 -0
- package/src/models/loadModel.js +69 -0
- package/src/models/materialFor.js +21 -0
- package/src/models/modelNode.js +93 -0
- package/src/models/nodeMatrix.js +22 -0
- package/src/models/readAccessor.js +53 -0
- package/src/models/readAccessorValues.js +16 -0
- package/src/models/textureFor.js +35 -0
- package/src/models/textureSampler.js +10 -0
- package/src/picking/collectVisibleMesh.js +4 -0
- package/src/picking/findFeature.js +49 -0
- package/src/picking/hit.js +23 -0
- package/src/picking/hitMesh.js +30 -0
- package/src/picking/onClick.js +13 -0
- package/src/picking/onPointerLeave.js +11 -0
- package/src/picking/onPointerMove.js +15 -0
- package/src/picking/pointerClick.js +5 -0
- package/src/picking/pointerLeave.js +5 -0
- package/src/picking/pointerMove.js +5 -0
- package/src/picking/raycast.js +59 -0
- package/src/picking/setHighlight.js +13 -0
- package/src/picking/shouldSkipOther.js +3 -0
- package/src/picking/showFeature.js +34 -0
- package/src/raster/addRasterTile.js +114 -0
- package/src/raster/comparePendingTiles.js +5 -0
- package/src/raster/createGeometry.js +22 -0
- package/src/raster/createRasterMesh.js +47 -0
- package/src/raster/finishAttachment.js +11 -0
- package/src/raster/finishRasterTile.js +47 -0
- package/src/raster/getRasterEvents.js +6 -0
- package/src/raster/getRasterTileSize.js +5 -0
- package/src/raster/initRaster.js +38 -0
- package/src/raster/isLoading.js +5 -0
- package/src/raster/loadRasterTile.js +10 -0
- package/src/raster/onPMTileAdd.js +10 -0
- package/src/raster/onPMTileRemove.js +8 -0
- package/src/raster/pruneRasterTiles.js +37 -0
- package/src/raster/pumpRasterTiles.js +22 -0
- package/src/raster/readyRaster.js +13 -0
- package/src/raster/registerTerrainTile.js +12 -0
- package/src/raster/releaseRasterTile.js +18 -0
- package/src/raster/releaseRasterTiles.js +15 -0
- package/src/raster/removeRasterTile.js +13 -0
- package/src/raster/reportError.js +6 -0
- package/src/raster/setPMTileOpacity.js +7 -0
- package/src/raster/setPMTileZIndex.js +7 -0
- package/src/raster/setRasterOpacity.js +11 -0
- package/src/raster/setRasterTerrain.js +21 -0
- package/src/raster/setRasterZIndex.js +11 -0
- package/src/raster/updateAttachedTiles.js +10 -0
- package/src/raster/updateRasterTiles.js +59 -0
- package/src/rendering/collectFrameMeshes.js +31 -0
- package/src/rendering/collectMeshes.js +36 -0
- package/src/rendering/compareMeshes.js +10 -0
- package/src/rendering/compareRoofTiles.js +4 -0
- package/src/rendering/composeRoofAtlas.js +52 -0
- package/src/rendering/createMesh.js +33 -0
- package/src/rendering/createProgram.js +92 -0
- package/src/rendering/destroyAfterSubmission.js +8 -0
- package/src/rendering/destroyTexture.js +6 -0
- package/src/rendering/disposeMesh.js +14 -0
- package/src/rendering/drawGeometry.js +129 -0
- package/src/rendering/drawSceneMeshes.js +51 -0
- package/src/rendering/ensureRoofBlit.js +40 -0
- package/src/rendering/prepareFrameMeshes.js +42 -0
- package/src/rendering/prepareFrameUniforms.js +49 -0
- package/src/rendering/rebuildRoofAtlas.js +67 -0
- package/src/rendering/render.js +57 -0
- package/src/rendering/reportCompilation.js +17 -0
- package/src/rendering/resizeRenderer.js +19 -0
- package/src/rendering/sortMeshes.js +6 -0
- package/src/rendering/synchronizeZoomView.js +34 -0
- package/src/rendering/textureBinding.js +7 -0
- package/src/rendering/updateMapCamera.js +32 -0
- package/src/rendering/updateRoofRaster.js +32 -0
- package/src/scene/attach.js +161 -0
- package/src/scene/attachLayer.js +10 -0
- package/src/scene/cancelUpdate.js +10 -0
- package/src/scene/emptyEvents.js +3 -0
- package/src/scene/emptyNode.js +11 -0
- package/src/scene/endZoom.js +16 -0
- package/src/scene/failAttachment.js +9 -0
- package/src/scene/get3DEvents.js +13 -0
- package/src/scene/init3D.js +30 -0
- package/src/scene/initializeLayer.js +16 -0
- package/src/scene/initializerFor.js +14 -0
- package/src/scene/layerInitialize.js +38 -0
- package/src/scene/layerLayerAdd.js +21 -0
- package/src/scene/onAdd3DLayer.js +35 -0
- package/src/scene/onMapChange.js +16 -0
- package/src/scene/onRemove3DLayer.js +69 -0
- package/src/scene/onZoomAnim.js +16 -0
- package/src/scene/placeEntry.js +11 -0
- package/src/scene/placeUnderEntry.js +8 -0
- package/src/scene/ready3D.js +25 -0
- package/src/scene/releaseRenderer.js +14 -0
- package/src/scene/removeEntry.js +6 -0
- package/src/scene/renderPendingMapChange.js +11 -0
- package/src/scene/renderPendingUpdates.js +19 -0
- package/src/scene/renderPendingZoomAnimation.js +7 -0
- package/src/scene/rendererDeviceError.js +10 -0
- package/src/scene/rendererDeviceLost.js +11 -0
- package/src/scene/replaceEntry.js +7 -0
- package/src/scene/reportError.js +3 -0
- package/src/scene/requestAdapter.js +12 -0
- package/src/scene/requestDevice.js +9 -0
- package/src/scene/resolveNextInitialization.js +12 -0
- package/src/scene/restoreObject.js +71 -0
- package/src/scene/runPlacements.js +7 -0
- package/src/scene/setParent.js +7 -0
- package/src/scene/showWebGPUWarning.js +16 -0
- package/src/scene/startZoom.js +5 -0
- package/src/scene/traverse.js +7 -0
- package/src/scene/underEntry.js +17 -0
- package/src/scene/update.js +19 -0
- package/src/scene/updateCamera.js +34 -0
- package/src/scene/updateWorldMatrix.js +48 -0
- package/src/{utils/shaders.js → shaders/materialShaders.js} +246 -237
- package/src/shadows/bindSunlight.js +12 -0
- package/src/shadows/drawShadowMeshes.js +48 -0
- package/src/shadows/ensureShadowPipeline.js +53 -0
- package/src/shadows/renderSunlight.js +46 -0
- package/src/shadows/resizeSunlight.js +15 -0
- package/src/shadows/shadowBounds.js +32 -0
- package/src/shadows/shadowCacheMatches.js +23 -0
- package/src/shadows/shadowMatrix.js +39 -0
- package/src/sources/addGeneratedTriangle.js +6 -0
- package/src/sources/addTriangle.js +17 -0
- package/src/sources/attachAreaMesh.js +58 -0
- package/src/sources/buildArea.js +42 -0
- package/src/sources/buildAreaFeature.js +41 -0
- package/src/sources/buildAreaPoint.js +25 -0
- package/src/sources/buildAreaPolygon.js +29 -0
- package/src/sources/compareAreaDistance.js +4 -0
- package/src/sources/generateTreeGeometry.js +11 -0
- package/src/sources/groundOffset.js +3 -0
- package/src/sources/initializeGeoJSON.js +8 -0
- package/src/sources/instanceAreaGeometry.js +29 -0
- package/src/sources/projectRing.js +20 -0
- package/src/sources/projectedTree.js +13 -0
- package/src/sources/pump.js +54 -0
- package/src/sources/releaseArea.js +22 -0
- package/src/sources/setGeoJSONData.js +12 -0
- package/src/sources/setGeoJSONLayerData.js +5 -0
- package/src/sources/sourceAreaContext.js +9 -0
- package/src/sources/updateArea.js +45 -0
- package/src/sources/updateStatus.js +12 -0
- package/src/sunlight/addTimeLayer.js +3 -0
- package/src/sunlight/addTo.js +10 -0
- package/src/sunlight/atmosphere.js +28 -0
- package/src/sunlight/horizontalPosition.js +16 -0
- package/src/sunlight/initSunlight.js +14 -0
- package/src/sunlight/initialize.js +11 -0
- package/src/sunlight/mix.js +6 -0
- package/src/sunlight/moonPosition.js +17 -0
- package/src/sunlight/onAdd.js +5 -0
- package/src/sunlight/onAddSun.js +66 -0
- package/src/sunlight/projectCelestialBody.js +13 -0
- package/src/sunlight/remove.js +7 -0
- package/src/sunlight/removeSun.js +15 -0
- package/src/sunlight/removeTimeLayer.js +3 -0
- package/src/sunlight/render.js +7 -0
- package/src/sunlight/rgb.js +6 -0
- package/src/sunlight/solarPosition.js +17 -0
- package/src/sunlight/styleTimeControl.js +7 -0
- package/src/sunlight/tickSun.js +5 -0
- package/src/sunlight/updateSky.js +20 -0
- package/src/sunlight/updateSun.js +34 -0
- package/src/sunlight/useLiveTime.js +6 -0
- package/src/sunlight/useSelectedTime.js +20 -0
- package/src/terrain/clearLayerTerrain.js +5 -0
- package/src/terrain/getElevation.js +10 -0
- package/src/terrain/initTerrain.js +20 -0
- package/src/terrain/loadReadyTerrain.js +5 -0
- package/src/terrain/loadTerrain.js +63 -0
- package/src/terrain/loadTerrainTiles.js +13 -0
- package/src/terrain/onTerrainAdd.js +21 -0
- package/src/terrain/onTerrainChange.js +14 -0
- package/src/terrain/onTerrainRemove.js +41 -0
- package/src/terrain/readBridges.js +4 -0
- package/src/terrain/sample.js +7 -0
- package/src/terrain/setLayerTerrain.js +5 -0
- package/src/terrain/setTerrainHeight.js +10 -0
- package/src/terrain/terrainAtlas.js +23 -0
- package/src/terrain/terrainElevation.js +20 -0
- package/src/terrain/terrainGrid.js +24 -0
- package/src/traffic/addTraffic.js +7 -0
- package/src/traffic/along.js +14 -0
- package/src/traffic/clockMinutes.js +6 -0
- package/src/traffic/compareDepartures.js +5 -0
- package/src/traffic/createTrafficMesh.js +7 -0
- package/src/traffic/destroyTrafficGpu.js +5 -0
- package/src/traffic/disposeTrafficObject.js +13 -0
- package/src/traffic/drawTrafficRoute.js +6 -0
- package/src/traffic/failTraffic.js +6 -0
- package/src/traffic/failedTrafficLoad.js +5 -0
- package/src/traffic/fetchTrafficLanes.js +10 -0
- package/src/traffic/groundTraffic.js +15 -0
- package/src/traffic/initTraffic.js +54 -0
- package/src/traffic/loadTraffic.js +15 -0
- package/src/traffic/loadedTrafficLanes.js +16 -0
- package/src/traffic/locateTraffic.js +9 -0
- package/src/traffic/moveTraffic.js +15 -0
- package/src/traffic/placeTraffic.js +21 -0
- package/src/traffic/prepareTraffic.js +25 -0
- package/src/traffic/readyTraffic.js +6 -0
- package/src/traffic/rebaseTraffic.js +58 -0
- package/src/traffic/rebuildTrafficMesh.js +28 -0
- package/src/traffic/removeTraffic.js +17 -0
- package/src/traffic/routeColor.js +6 -0
- package/src/traffic/routeGeometry.js +31 -0
- package/src/traffic/scheduledTrips.js +40 -0
- package/src/traffic/startTraffic.js +8 -0
- package/src/traffic/tickTraffic.js +57 -0
- package/src/traffic/toLanes.js +16 -0
- package/src/traffic/tooltip.js +11 -0
- package/src/traffic/trafficBounds.js +17 -0
- package/src/traffic/trafficNow.js +4 -0
- package/src/traffic/trafficStorage.js +5 -0
- package/src/traffic/tripsAt.js +27 -0
- package/src/traffic/updateTraffic.js +8 -0
- package/src/traffic/updateTrafficTerrain.js +12 -0
- package/src/traffic/vehicleOffsets.js +11 -0
- package/src/triangulation/area.js +9 -0
- package/src/triangulation/clean.js +18 -0
- package/src/triangulation/containsVertex.js +11 -0
- package/src/triangulation/cross.js +3 -0
- package/src/triangulation/crossesBoundary.js +8 -0
- package/src/triangulation/crossesRing.js +9 -0
- package/src/triangulation/equal.js +3 -0
- package/src/triangulation/inside.js +10 -0
- package/src/triangulation/insideHole.js +7 -0
- package/src/triangulation/intersects.js +11 -0
- package/src/triangulation/isClockWise.js +13 -0
- package/src/triangulation/minimumX.js +6 -0
- package/src/triangulation/on.js +4 -0
- package/src/triangulation/sortHoles.js +26 -0
- package/src/triangulation/triangulate.js +86 -0
- package/src/utils/channel.js +4 -0
- package/src/utils/compareDistance.js +3 -0
- package/src/utils/noOperation.js +1 -0
- package/src/utils/parseColor.js +42 -0
- package/src/utils/toSRGB.js +3 -0
- package/src/utils/wrap.js +3 -0
- package/src/vehicles/bicycleModel.js +23 -0
- package/src/vehicles/boatBenches.js +8 -0
- package/src/vehicles/boatModel.js +27 -0
- package/src/vehicles/busModel.js +6 -0
- package/src/vehicles/carModel.js +22 -0
- package/src/vehicles/carriage.js +19 -0
- package/src/vehicles/metroModel.js +9 -0
- package/src/vehicles/mirror.js +8 -0
- package/src/vehicles/pedestrianModel.js +17 -0
- package/src/vehicles/tramModel.js +9 -0
- package/src/walk/blocked.js +6 -0
- package/src/walk/createWalk.js +60 -0
- package/src/walk/initWalk.js +18 -0
- package/src/walk/initialize.js +6 -0
- package/src/walk/local.js +10 -0
- package/src/walk/onAdd.js +4 -0
- package/src/walk/onBlur.js +3 -0
- package/src/walk/onKey.js +12 -0
- package/src/walk/onPointer.js +13 -0
- package/src/walk/onRemove.js +4 -0
- package/src/walk/onTerrain.js +5 -0
- package/src/walk/place.js +18 -0
- package/src/walk/start.js +37 -0
- package/src/walk/step.js +53 -0
- package/src/walk/stop.js +27 -0
- package/src/walk/toggle.js +6 -0
- package/dist/scene/gpu.js +0 -3
- package/dist/scene/gpu.js.map +0 -7
- package/dist/scene/lighting.js +0 -9
- package/dist/scene/lighting.js.map +0 -7
- package/dist/scene/model.js +0 -2
- package/dist/scene/model.js.map +0 -7
- package/dist/scene/picking.js +0 -2
- package/dist/scene/picking.js.map +0 -7
- package/dist/scene/pmtiles.js +0 -2
- package/dist/scene/pmtiles.js.map +0 -7
- package/dist/scene/render.js +0 -15
- package/dist/scene/render.js.map +0 -7
- package/dist/scene/sources.js +0 -2
- package/dist/scene/sources.js.map +0 -7
- package/dist/types/3d.js +0 -2
- package/dist/types/3d.js.map +0 -7
- package/dist/types/geojson.js +0 -2
- package/dist/types/geojson.js.map +0 -7
- package/dist/types/pmtiles.js +0 -2
- package/dist/types/pmtiles.js.map +0 -7
- package/dist/types/sunlight.js +0 -2
- package/dist/types/sunlight.js.map +0 -7
- package/dist/types/terrain.js +0 -24
- package/dist/types/terrain.js.map +0 -7
- package/dist/types/traffic.js +0 -41
- package/dist/types/traffic.js.map +0 -7
- package/dist/types/walk.js +0 -2
- package/dist/types/walk.js.map +0 -7
- package/dist/utils/control.js +0 -2
- package/dist/utils/control.js.map +0 -7
- package/dist/utils/geometry.js +0 -2
- package/dist/utils/geometry.js.map +0 -7
- package/dist/utils/lighting.js +0 -2
- package/dist/utils/lighting.js.map +0 -7
- package/dist/utils/model.js +0 -2
- package/dist/utils/model.js.map +0 -7
- package/dist/utils/picking.js +0 -2
- package/dist/utils/picking.js.map +0 -7
- package/dist/utils/pmtiles.js +0 -2
- package/dist/utils/pmtiles.js.map +0 -7
- package/dist/utils/scene.js +0 -2
- package/dist/utils/scene.js.map +0 -7
- package/dist/utils/shaders.js +0 -203
- package/dist/utils/shaders.js.map +0 -7
- package/dist/utils/sun.js +0 -2
- package/dist/utils/sun.js.map +0 -7
- package/dist/utils/terrain.js +0 -2
- package/dist/utils/terrain.js.map +0 -7
- package/dist/utils/traffic.js +0 -2
- package/dist/utils/traffic.js.map +0 -7
- package/dist/utils/vehicles.js +0 -2
- package/dist/utils/vehicles.js.map +0 -7
- package/dist/utils/walk.js +0 -2
- package/dist/utils/walk.js.map +0 -7
- package/src/scene/gpu.js +0 -438
- package/src/scene/lighting.js +0 -193
- package/src/scene/model.js +0 -204
- package/src/scene/picking.js +0 -150
- package/src/scene/pmtiles.js +0 -94
- package/src/scene/render.js +0 -467
- package/src/scene/sources.js +0 -265
- package/src/types/3d.js +0 -337
- package/src/types/geojson.js +0 -42
- package/src/types/pmtiles.js +0 -143
- package/src/types/sunlight.js +0 -142
- package/src/types/terrain.js +0 -331
- package/src/types/traffic.js +0 -356
- package/src/types/walk.js +0 -219
- package/src/utils/control.js +0 -18
- package/src/utils/geometry.js +0 -256
- package/src/utils/lighting.js +0 -51
- package/src/utils/model.js +0 -178
- package/src/utils/picking.js +0 -119
- package/src/utils/pmtiles.js +0 -79
- package/src/utils/scene.js +0 -102
- package/src/utils/sun.js +0 -71
- package/src/utils/terrain.js +0 -78
- package/src/utils/traffic.js +0 -90
- package/src/utils/vehicles.js +0 -69
- package/src/utils/walk.js +0 -72
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ensureRoofBlit } from './ensureRoofBlit.js';
|
|
2
|
+
import { composeRoofAtlas } from './composeRoofAtlas.js';
|
|
3
|
+
import { destroyTexture } from './destroyTexture.js';
|
|
4
|
+
import { getRasterTileSize } from '../raster/getRasterTileSize.js';
|
|
5
|
+
|
|
6
|
+
export function rebuildRoofAtlas(backend, rasters, signature, now) {
|
|
7
|
+
const map = backend._map, renderer = backend.renderer;
|
|
8
|
+
const tiles = [];
|
|
9
|
+
let zoom = -Infinity;
|
|
10
|
+
let layer, tile, coords, size2;
|
|
11
|
+
for (layer of rasters) for (tile of layer._rasterTiles.values()) {
|
|
12
|
+
if (tile.done && !tile.request.signal.aborted && tile.image) {
|
|
13
|
+
tiles.push({ tile, layer });
|
|
14
|
+
zoom = Math.max(zoom, tile.coords.z);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!tiles.length) zoom = map.getZoom();
|
|
18
|
+
const bounds = new L.Bounds();
|
|
19
|
+
for ({ tile: { coords }, layer } of tiles) {
|
|
20
|
+
size2 = getRasterTileSize().multiplyBy(map.getZoomScale(zoom, coords.z));
|
|
21
|
+
bounds.extend(new L.Point(coords.x, coords.y).scaleBy(size2));
|
|
22
|
+
bounds.extend(new L.Point(coords.x + 1, coords.y + 1).scaleBy(size2));
|
|
23
|
+
}
|
|
24
|
+
const min = bounds.min || map.project(backend._sceneOrigin, zoom);
|
|
25
|
+
const size = bounds.isValid() ? bounds.getSize() : new L.Point(1, 1);
|
|
26
|
+
// ponytail: cap at 4096 px; virtual textures if wide views need native detail.
|
|
27
|
+
const limit = 4096;
|
|
28
|
+
const scale = Math.min(1, limit / Math.max(size.x, size.y));
|
|
29
|
+
const width = Math.max(1, Math.ceil(size.x * scale));
|
|
30
|
+
const height = Math.max(1, Math.ceil(size.y * scale));
|
|
31
|
+
const origin = map.project(backend._sceneOrigin, zoom);
|
|
32
|
+
const pixels = map.options.crs.scale(zoom) / (40075016.68557849 * Math.cos(backend._sceneOrigin.lat * Math.PI / 180));
|
|
33
|
+
const matrix = new DOMMatrix();
|
|
34
|
+
matrix.m11 = pixels / size.x; matrix.m33 = pixels / size.y;
|
|
35
|
+
matrix.m41 = (origin.x - min.x) / size.x; matrix.m43 = (origin.y - min.y) / size.y;
|
|
36
|
+
const texture = backend._roofRaster?.texture;
|
|
37
|
+
if (texture && (texture.width !== width || texture.height !== height)) {
|
|
38
|
+
destroyTexture(backend, texture.texture);
|
|
39
|
+
texture.texture = renderer.device.createTexture({
|
|
40
|
+
size: [width, height],
|
|
41
|
+
format: 'rgba8unorm',
|
|
42
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
|
43
|
+
});
|
|
44
|
+
texture.width = width;
|
|
45
|
+
texture.height = height;
|
|
46
|
+
}
|
|
47
|
+
backend._roofRaster = {
|
|
48
|
+
signature, updatedAt: now, matrix: Array.from(matrix.toFloat64Array()),
|
|
49
|
+
texture: texture || {
|
|
50
|
+
device: renderer.device,
|
|
51
|
+
texture: renderer.device.createTexture({
|
|
52
|
+
size: [width, height],
|
|
53
|
+
format: 'rgba8unorm',
|
|
54
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
|
55
|
+
}),
|
|
56
|
+
sampler: renderer.device.createSampler({
|
|
57
|
+
addressModeU: 'clamp-to-edge', addressModeV: 'clamp-to-edge',
|
|
58
|
+
}),
|
|
59
|
+
samplerOptions: { addressModeU: 'clamp-to-edge', addressModeV: 'clamp-to-edge' },
|
|
60
|
+
image: null, width, height,
|
|
61
|
+
format: 'rgba8unorm', srgb: false, flipY: false, uploaded: null,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
// Compose the atlas on the GPU: re-uploading a large canvas stalls Firefox for hundreds of ms.
|
|
65
|
+
ensureRoofBlit(renderer);
|
|
66
|
+
composeRoofAtlas(backend, tiles, zoom, min, size, width, height);
|
|
67
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { synchronizeZoomView } from './synchronizeZoomView.js';
|
|
2
|
+
import { resizeRenderer } from './resizeRenderer.js';
|
|
3
|
+
import { updateMapCamera } from './updateMapCamera.js';
|
|
4
|
+
import { collectFrameMeshes } from './collectFrameMeshes.js';
|
|
5
|
+
import { updateRoofRaster } from './updateRoofRaster.js';
|
|
6
|
+
import { prepareFrameMeshes } from './prepareFrameMeshes.js';
|
|
7
|
+
import { prepareFrameUniforms } from './prepareFrameUniforms.js';
|
|
8
|
+
import { drawSceneMeshes } from './drawSceneMeshes.js';
|
|
9
|
+
import { updateWorldMatrix } from "../scene/updateWorldMatrix.js";
|
|
10
|
+
import { renderSunlight } from '../shadows/renderSunlight.js';
|
|
11
|
+
import { cancelUpdate } from '../scene/cancelUpdate.js';
|
|
12
|
+
import { update } from '../scene/update.js';
|
|
13
|
+
import { pruneRasterTiles } from '../raster/pruneRasterTiles.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Rendering owner: CSS pixels -> scene metres -> perspective camera.
|
|
17
|
+
* Lights and transparent sort centers are converted into the current camera space.
|
|
18
|
+
* Without raster tiles, logical map projection supplies the same static alignment.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export function render(backend) {
|
|
22
|
+
cancelUpdate(backend);
|
|
23
|
+
if (backend._shared !== backend || !backend.renderer) return;
|
|
24
|
+
const map = backend._map;
|
|
25
|
+
const now = performance.now();
|
|
26
|
+
const size = map.getSize();
|
|
27
|
+
if (!size.x || !size.y) return;
|
|
28
|
+
synchronizeZoomView(backend, now);
|
|
29
|
+
resizeRenderer(backend, size);
|
|
30
|
+
updateMapCamera(backend, size);
|
|
31
|
+
updateWorldMatrix(backend.scene);
|
|
32
|
+
let sceneChanged = false;
|
|
33
|
+
let layer;
|
|
34
|
+
for (layer of backend._layers) {
|
|
35
|
+
if (!layer._beforeRender) continue;
|
|
36
|
+
layer._beforeRender();
|
|
37
|
+
sceneChanged = true;
|
|
38
|
+
}
|
|
39
|
+
const sunlight = map._sunlight;
|
|
40
|
+
collectFrameMeshes(backend, sunlight, sceneChanged);
|
|
41
|
+
const shadowMeshes = backend._shadowMeshes;
|
|
42
|
+
const renderer = backend.renderer;
|
|
43
|
+
const rasters = updateRoofRaster(backend, now);
|
|
44
|
+
const meshes = renderer.frameMeshes ||= [];
|
|
45
|
+
meshes.length = 0;
|
|
46
|
+
let appearing = prepareFrameMeshes(backend, rasters, now, meshes);
|
|
47
|
+
const encoder = renderer.device.createCommandEncoder();
|
|
48
|
+
prepareFrameUniforms(backend, meshes, shadowMeshes, sunlight);
|
|
49
|
+
renderSunlight(backend, encoder, shadowMeshes, sunlight);
|
|
50
|
+
drawSceneMeshes(backend, encoder, meshes);
|
|
51
|
+
renderer.device.queue.writeBuffer(renderer.uniformBuffer, 0, renderer.uniformData, 0, renderer.uniformSlot * 64);
|
|
52
|
+
renderer.device.queue.submit([encoder.finish()]);
|
|
53
|
+
for (layer of backend._layers) {
|
|
54
|
+
if (layer._wantedRasterTiles) appearing = pruneRasterTiles(layer) || appearing;
|
|
55
|
+
}
|
|
56
|
+
if (map._animatingZoom || appearing) update(backend);
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export async function reportCompilation(backend, pending) {
|
|
2
|
+
let info, message;
|
|
3
|
+
try {
|
|
4
|
+
const infos = await Promise.all(pending);
|
|
5
|
+
const errors = [];
|
|
6
|
+
for (info of infos) {
|
|
7
|
+
for (message of info.messages) if (message.type === 'error') errors.push(message.message);
|
|
8
|
+
}
|
|
9
|
+
if (errors.length) {
|
|
10
|
+
backend.fire('error', {
|
|
11
|
+
error: new Error(`Unable to compile Layer3D WGSL: ${errors.join('\n')}`),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
} catch (error) {
|
|
15
|
+
backend.fire('error', { error });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { destroyTexture } from './destroyTexture.js';
|
|
2
|
+
|
|
3
|
+
export function resizeRenderer(backend, size) {
|
|
4
|
+
if (!backend._size || !backend._size.equals(size)) {
|
|
5
|
+
backend.renderer.width = size.x;
|
|
6
|
+
backend.renderer.height = size.y;
|
|
7
|
+
backend.renderer.canvas.width = Math.round(size.x * backend.renderer.dpr);
|
|
8
|
+
backend.renderer.canvas.height = Math.round(size.y * backend.renderer.dpr);
|
|
9
|
+
backend.renderer.canvas.style.width = `${size.x}px`;
|
|
10
|
+
backend.renderer.canvas.style.height = `${size.y}px`;
|
|
11
|
+
if (backend.renderer.depthTexture) destroyTexture(backend, backend.renderer.depthTexture);
|
|
12
|
+
backend.renderer.depthTexture = backend.renderer.device.createTexture({
|
|
13
|
+
size: [backend.renderer.canvas.width, backend.renderer.canvas.height],
|
|
14
|
+
format: 'depth24plus',
|
|
15
|
+
usage: GPUTextureUsage.RENDER_ATTACHMENT,
|
|
16
|
+
});
|
|
17
|
+
backend._size = size;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function synchronizeZoomView(backend, now) {
|
|
2
|
+
const map = backend._map;
|
|
3
|
+
let animation, time, start;
|
|
4
|
+
if (map._animatingZoom) {
|
|
5
|
+
backend._zoomTransitions ||= new Map();
|
|
6
|
+
for (animation of map.getContainer().getAnimations({ subtree: true })) {
|
|
7
|
+
if (!(animation instanceof CSSTransition) || animation.transitionProperty !== 'transform' ||
|
|
8
|
+
!animation.effect.target.classList.contains('leaflet-zoom-animated') ||
|
|
9
|
+
backend._zoomTransitions.has(animation)) {
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
time = animation.currentTime || 0;
|
|
13
|
+
animation.pause();
|
|
14
|
+
backend._zoomTransitions.set(animation, { start: now, time });
|
|
15
|
+
}
|
|
16
|
+
// Freeze CSS between rendered frames: the compositor must not outrun the canvas.
|
|
17
|
+
for ([animation, { start, time }] of backend._zoomTransitions) {
|
|
18
|
+
animation.currentTime = Math.min(animation.effect.getComputedTiming().endTime, time + now - start);
|
|
19
|
+
}
|
|
20
|
+
if (backend._zoomView) {
|
|
21
|
+
const view = backend._zoomView;
|
|
22
|
+
let proxy;
|
|
23
|
+
for (animation of backend._zoomTransitions.keys()) {
|
|
24
|
+
if (animation.effect.target === map._proxy) { proxy = animation; break; }
|
|
25
|
+
}
|
|
26
|
+
const progress = proxy?.effect.getComputedTiming().progress ?? Math.min(1, (now - view.start) / 250);
|
|
27
|
+
const targetScale = map.getZoomScale(view.targetZoom, view.zoom), scale = 1 + (targetScale - 1) * progress;
|
|
28
|
+
const from = map.project(view.from, view.zoom), to = map.project(view.to, view.zoom);
|
|
29
|
+
map._cameraView = { zoom: map.getScaleZoom(scale, view.zoom),
|
|
30
|
+
center: map.unproject(from.add(to.subtract(from).multiplyBy(targetScale * progress / scale)), view.zoom) };
|
|
31
|
+
map._updateCameraOverlays();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function textureBinding(bindings, name, enabled) {
|
|
2
|
+
if (!enabled) return '';
|
|
3
|
+
const current = 3 + bindings.length * 2;
|
|
4
|
+
bindings.push({ name, texture: current, sampler: current + 1 });
|
|
5
|
+
return /* wgsl */ `@group(0) @binding(${current}) var ${name}: texture_2d<f32>;
|
|
6
|
+
@group(0) @binding(${current + 1}) var ${name}Sampler: sampler;`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { updateCamera } from "../scene/updateCamera.js";
|
|
2
|
+
import { getElevation } from "../terrain/getElevation.js";
|
|
3
|
+
|
|
4
|
+
export function updateMapCamera(backend, size) {
|
|
5
|
+
const map = backend._map;
|
|
6
|
+
// Match the map's perspective, including the intermediate view of an animated zoom.
|
|
7
|
+
const zoom = map._cameraView?.zoom ?? map.getZoom(), center = map._cameraView?.center ?? map.getCenter();
|
|
8
|
+
const pixelsPerMeter = map.options.crs.scale(zoom) / (40075016.68557849 * Math.cos(backend._sceneOrigin.lat * Math.PI / 180));
|
|
9
|
+
const offset = map.project(center, zoom).subtract(map.project(backend._sceneOrigin, zoom));
|
|
10
|
+
const distance = size.y * 1.5 / pixelsPerMeter;
|
|
11
|
+
const target = [
|
|
12
|
+
offset.x / pixelsPerMeter,
|
|
13
|
+
(map._terrain3D ? getElevation(map._terrain3D, center): undefined) ?? 0,
|
|
14
|
+
offset.y / pixelsPerMeter
|
|
15
|
+
];
|
|
16
|
+
const pitch = map.getPitch() * Math.PI / 180;
|
|
17
|
+
const bearing = map.getBearing() * Math.PI / 180;
|
|
18
|
+
const camera = backend.camera;
|
|
19
|
+
camera.fov = 2 * Math.atan(1 / 3) * 180 / Math.PI;
|
|
20
|
+
camera.aspect = size.x / size.y;
|
|
21
|
+
camera.near = Math.max(0.1, distance / 10000);
|
|
22
|
+
camera.far = Math.max(10000, distance * 10);
|
|
23
|
+
camera.position[0] = target[0] + Math.sin(bearing) * Math.sin(pitch) * distance;
|
|
24
|
+
camera.position[1] = target[1] + Math.cos(pitch) * distance;
|
|
25
|
+
camera.position[2] = target[2] + Math.cos(bearing) * Math.sin(pitch) * distance;
|
|
26
|
+
camera.up[0] = -Math.sin(bearing) * Math.cos(pitch);
|
|
27
|
+
camera.up[1] = Math.sin(pitch);
|
|
28
|
+
camera.up[2] = -Math.cos(bearing) * Math.cos(pitch);
|
|
29
|
+
camera.target[0] = target[0]; camera.target[1] = target[1]; camera.target[2] = target[2];
|
|
30
|
+
// Refresh the camera view, projection and combined projection-view matrices.
|
|
31
|
+
updateCamera(camera);
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { rebuildRoofAtlas } from './rebuildRoofAtlas.js';
|
|
2
|
+
import { destroyTexture } from './destroyTexture.js';
|
|
3
|
+
|
|
4
|
+
export function updateRoofRaster(backend, now) {
|
|
5
|
+
const map = backend._map;
|
|
6
|
+
const rasters = [];
|
|
7
|
+
let hasRoofTexture = false;
|
|
8
|
+
let layer;
|
|
9
|
+
for (layer of backend._layers) {
|
|
10
|
+
if (layer.options.roofTexture) { hasRoofTexture = true; break; }
|
|
11
|
+
}
|
|
12
|
+
if (hasRoofTexture) {
|
|
13
|
+
for (layer of Object.values(map._layers)) {
|
|
14
|
+
if (layer._type === 'pmtiles' && layer._rasterTiles && layer.options.opacity > 0) rasters.push(layer);
|
|
15
|
+
}
|
|
16
|
+
const signatures = [];
|
|
17
|
+
let loading = false;
|
|
18
|
+
for (layer of rasters) {
|
|
19
|
+
signatures.push(`${L.Util.stamp(layer)}:${layer._rasterVersion || 0}:${layer.options.opacity}:${layer.options.zIndex}`);
|
|
20
|
+
loading ||= Boolean(layer._loadingTiles);
|
|
21
|
+
}
|
|
22
|
+
const signature = signatures.join('|');
|
|
23
|
+
if (!backend._roofRaster || backend._roofRaster.signature !== signature &&
|
|
24
|
+
(!loading || now - backend._roofRaster.updatedAt >= 50)) {
|
|
25
|
+
rebuildRoofAtlas(backend, rasters, signature, now);
|
|
26
|
+
}
|
|
27
|
+
} else if (backend._roofRaster) {
|
|
28
|
+
destroyTexture(backend, backend._roofRaster.texture.texture);
|
|
29
|
+
backend._roofRaster = null;
|
|
30
|
+
}
|
|
31
|
+
return rasters;
|
|
32
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { cityMapper } from '../constants/cityMapper.js';
|
|
2
|
+
import { emptyNode } from './emptyNode.js';
|
|
3
|
+
import { setParent } from './setParent.js';
|
|
4
|
+
import { createProgram } from '../rendering/createProgram.js';
|
|
5
|
+
import { endZoom } from './endZoom.js';
|
|
6
|
+
import { onMapChange } from './onMapChange.js';
|
|
7
|
+
import { onZoomAnim } from './onZoomAnim.js';
|
|
8
|
+
import { render } from '../rendering/render.js';
|
|
9
|
+
import { startZoom } from './startZoom.js';
|
|
10
|
+
import { update } from './update.js';
|
|
11
|
+
import { updateArea } from '../sources/updateArea.js';
|
|
12
|
+
import { setTerrainHeight } from '../terrain/setTerrainHeight.js';
|
|
13
|
+
import { resizeSunlight } from '../shadows/resizeSunlight.js';
|
|
14
|
+
import { attachState } from '../constants/attachState.js';
|
|
15
|
+
import { noOperation } from '../utils/noOperation.js';
|
|
16
|
+
import { failAttachment } from './failAttachment.js';
|
|
17
|
+
import { requestAdapter } from './requestAdapter.js';
|
|
18
|
+
import { requestDevice } from './requestDevice.js';
|
|
19
|
+
import { rendererDeviceError } from './rendererDeviceError.js';
|
|
20
|
+
import { rendererDeviceLost } from './rendererDeviceLost.js';
|
|
21
|
+
import { restoreObject } from './restoreObject.js';
|
|
22
|
+
|
|
23
|
+
attachState.rendererDevices = new WeakMap();
|
|
24
|
+
|
|
25
|
+
/** WebGPU device attachment, materials/pipelines and draw calls. */
|
|
26
|
+
/**
|
|
27
|
+
* Join/create this map's shared scene and rebuild GPU objects if its context changed.
|
|
28
|
+
* Buffer/program handles belong to one context; typed arrays and decoded images do not.
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export async function attach(backend, map) {
|
|
33
|
+
let shared = cityMapper.renderers.get(map);
|
|
34
|
+
if (shared?._rendererReady) {
|
|
35
|
+
await shared._rendererReady.promise;
|
|
36
|
+
}
|
|
37
|
+
if (!shared) {
|
|
38
|
+
shared = backend;
|
|
39
|
+
backend._rendererReady = Promise.withResolvers();
|
|
40
|
+
backend._rendererReady.promise.catch(noOperation);
|
|
41
|
+
cityMapper.renderers.set(map, shared);
|
|
42
|
+
const canvas = document.createElement('canvas');
|
|
43
|
+
if (!navigator.gpu) {
|
|
44
|
+
failAttachment(new Error('Layer3D requires WebGPU'), backend, map);
|
|
45
|
+
}
|
|
46
|
+
const adapter = await requestAdapter(backend, map);
|
|
47
|
+
const device = await requestDevice(adapter, backend, map);
|
|
48
|
+
attachState.rendererDevices.set(device, map);
|
|
49
|
+
device.addEventListener('uncapturederror', rendererDeviceError);
|
|
50
|
+
Promise.all([device.lost, Promise.resolve(device)]).then(rendererDeviceLost);
|
|
51
|
+
const context = canvas.getContext('webgpu');
|
|
52
|
+
if (!context) {
|
|
53
|
+
device.destroy();
|
|
54
|
+
failAttachment(new Error('Unable to create a WebGPU canvas context'), backend, map);
|
|
55
|
+
}
|
|
56
|
+
const format = navigator.gpu.getPreferredCanvasFormat();
|
|
57
|
+
context.configure({ device, format, alphaMode: 'premultiplied' });
|
|
58
|
+
map.getContainer().querySelector('.leaflet-webgpu-warning')?.remove();
|
|
59
|
+
backend._shared = backend;
|
|
60
|
+
backend._layers = new Set();
|
|
61
|
+
backend._sceneOrigin = backend.location;
|
|
62
|
+
backend.scene = emptyNode();
|
|
63
|
+
// Perspective camera state: fov in degrees, near/far in scene metres.
|
|
64
|
+
backend.camera = {
|
|
65
|
+
position: [0, 0, 0],
|
|
66
|
+
up: [0, 1, 0],
|
|
67
|
+
target: [0, 0, 0],
|
|
68
|
+
viewMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
69
|
+
projectionMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
70
|
+
projectionViewMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
71
|
+
fov: 45,
|
|
72
|
+
aspect: 1,
|
|
73
|
+
near: 0.1,
|
|
74
|
+
far: 10000,
|
|
75
|
+
};
|
|
76
|
+
backend.renderer = {
|
|
77
|
+
device,
|
|
78
|
+
context,
|
|
79
|
+
format,
|
|
80
|
+
canvas,
|
|
81
|
+
dpr: Math.min(window.devicePixelRatio, 2)
|
|
82
|
+
};
|
|
83
|
+
const layout = device.createBindGroupLayout({
|
|
84
|
+
entries: [
|
|
85
|
+
{ binding: 0, visibility: GPUShaderStage.VERTEX | GPUShaderStage.FRAGMENT, buffer: { type: 'uniform' } },
|
|
86
|
+
{ binding: 1, visibility: GPUShaderStage.FRAGMENT, texture: { sampleType: 'depth' } },
|
|
87
|
+
{ binding: 2, visibility: GPUShaderStage.FRAGMENT, sampler: { type: 'comparison' } },
|
|
88
|
+
{ binding: 3, visibility: GPUShaderStage.FRAGMENT, buffer: { type: 'read-only-storage' } },
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
const buffer = backend.renderer.device.createBuffer({ size: 80, usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST });
|
|
92
|
+
const sampler = backend.renderer.device.createSampler({ compare: 'less-equal', minFilter: 'linear', magFilter: 'linear' });
|
|
93
|
+
const lights = backend.renderer.device.createBuffer({ size: 32, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
|
|
94
|
+
backend.renderer.sunlight = { layout, buffer, sampler, lights, size: 0 };
|
|
95
|
+
const values = new Float32Array(20);
|
|
96
|
+
values.set([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
97
|
+
backend.renderer.device.queue.writeBuffer(buffer, 0, values);
|
|
98
|
+
resizeSunlight(backend, 1);
|
|
99
|
+
const emptyImage = document.createElement('canvas');
|
|
100
|
+
emptyImage.width = 1;
|
|
101
|
+
emptyImage.height = 1;
|
|
102
|
+
backend.renderer.roofFallbackTexture = {
|
|
103
|
+
device,
|
|
104
|
+
texture: device.createTexture({
|
|
105
|
+
size: [1, 1],
|
|
106
|
+
format: 'rgba8unorm',
|
|
107
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT,
|
|
108
|
+
}),
|
|
109
|
+
sampler: device.createSampler({
|
|
110
|
+
addressModeU: 'clamp-to-edge', addressModeV: 'clamp-to-edge',
|
|
111
|
+
}),
|
|
112
|
+
image: emptyImage, format: 'rgba8unorm', srgb: false, uploaded: null,
|
|
113
|
+
};
|
|
114
|
+
shared._size = null;
|
|
115
|
+
canvas.className = 'leaflet-3d';
|
|
116
|
+
canvas.style.cssText = 'position:absolute;top:0;left:0;pointer-events:none';
|
|
117
|
+
canvas.setAttribute('role', 'img');
|
|
118
|
+
canvas.setAttribute('aria-label', backend.options.ariaLabel ?? '3D scene');
|
|
119
|
+
let pane = map.getPane('webgpuPane');
|
|
120
|
+
if (!pane) {
|
|
121
|
+
pane = map.createPane('webgpuPane', map.getContainer());
|
|
122
|
+
// The pitch sky uses 0 and may be inserted after this pane.
|
|
123
|
+
pane.style.zIndex = 1;
|
|
124
|
+
pane.style.pointerEvents = 'none';
|
|
125
|
+
}
|
|
126
|
+
pane.append(canvas);
|
|
127
|
+
map.on('move zoom rotate pitch resize viewreset layeradd layerremove', onMapChange, shared);
|
|
128
|
+
map.on('zoomstart', startZoom, shared);
|
|
129
|
+
map.on('zoomanim', onZoomAnim, shared);
|
|
130
|
+
map.on('zoomend', endZoom, shared);
|
|
131
|
+
backend._rendererReady.resolve();
|
|
132
|
+
delete shared._rendererReady;
|
|
133
|
+
render(shared);
|
|
134
|
+
cityMapper.renderers.set(map, shared);
|
|
135
|
+
}
|
|
136
|
+
const origin = map.options.crs.project(shared._sceneOrigin);
|
|
137
|
+
const point = map.options.crs.project(backend.location);
|
|
138
|
+
const metres = Math.cos(shared._sceneOrigin.lat * Math.PI / 180);
|
|
139
|
+
backend._terrainBaseY ??= backend.root.position[1];
|
|
140
|
+
backend.root.position[0] = (point.x - origin.x) * metres;
|
|
141
|
+
backend.root.position[1] = backend._terrainBaseY;
|
|
142
|
+
backend.root.position[2] = -(point.y - origin.y) * metres;
|
|
143
|
+
setTerrainHeight(backend);
|
|
144
|
+
// Each group's metres are measured at its own latitude, not the shared camera origin.
|
|
145
|
+
backend.root.scale.fill(metres / Math.cos(backend.location.lat * Math.PI / 180));
|
|
146
|
+
backend._shared = shared;
|
|
147
|
+
backend.renderer = shared.renderer;
|
|
148
|
+
backend.scene = shared.scene;
|
|
149
|
+
backend.camera = shared.camera;
|
|
150
|
+
shared._layers.add(backend);
|
|
151
|
+
setParent(backend.root, shared.scene);
|
|
152
|
+
const pendingObjects = [backend.root];
|
|
153
|
+
let object, i;
|
|
154
|
+
while (pendingObjects.length) {
|
|
155
|
+
object = pendingObjects.pop();
|
|
156
|
+
restoreObject(backend, shared, object);
|
|
157
|
+
for (i = object.children.length - 1; i >= 0; i--) pendingObjects.push(object.children[i]);
|
|
158
|
+
}
|
|
159
|
+
update(shared);
|
|
160
|
+
if ((backend.header && backend._type !== 'pmtiles') || backend._geojson) updateArea(backend);
|
|
161
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { pendingUpdates } from '../constants/pendingUpdates.js';
|
|
2
|
+
|
|
3
|
+
export function cancelUpdate(backend) {
|
|
4
|
+
const frame = backend._frame;
|
|
5
|
+
pendingUpdates.delete(backend);
|
|
6
|
+
backend._frame = null;
|
|
7
|
+
if (!pendingUpdates.size && frame != null) {
|
|
8
|
+
cancelAnimationFrame(frame);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { update } from './update.js';
|
|
2
|
+
|
|
3
|
+
/** Stop using the outgoing level after zoomend; the next redraw uses current tiles. */
|
|
4
|
+
|
|
5
|
+
export function endZoom() {
|
|
6
|
+
const backend = this;
|
|
7
|
+
let animation;
|
|
8
|
+
for (animation of backend._zoomTransitions?.keys() || []) animation.finish();
|
|
9
|
+
backend._zoomTransitions = null;
|
|
10
|
+
backend._zoomView = null;
|
|
11
|
+
delete backend._map._cameraView;
|
|
12
|
+
backend._map.getContainer().classList.remove('leaflet-camera-zoom');
|
|
13
|
+
backend._map._updateCameraOverlays();
|
|
14
|
+
backend._zoomLevel = null;
|
|
15
|
+
update(backend);
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { showWebGPUWarning } from './showWebGPUWarning.js';
|
|
2
|
+
import { cityMapper } from '../constants/cityMapper.js';
|
|
3
|
+
|
|
4
|
+
export function failAttachment(error, backend, map) {
|
|
5
|
+
showWebGPUWarning(map);
|
|
6
|
+
backend._rendererReady.reject(error);
|
|
7
|
+
cityMapper.renderers.delete(map);
|
|
8
|
+
throw error;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { updateArea } from '../sources/updateArea.js';
|
|
2
|
+
import { onTerrainChange } from '../terrain/onTerrainChange.js';
|
|
3
|
+
|
|
4
|
+
export function get3DEvents(layer) {
|
|
5
|
+
const events = {};
|
|
6
|
+
if (layer.url) {
|
|
7
|
+
events.moveend = events.zoomend = events.rotate = events.pitch = events.resize = updateArea.bind(null, layer);
|
|
8
|
+
}
|
|
9
|
+
if (layer._geojson || layer.url) {
|
|
10
|
+
events.terrainchange = onTerrainChange.bind(null, layer);
|
|
11
|
+
}
|
|
12
|
+
return events;
|
|
13
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { attach } from './attach.js';
|
|
2
|
+
import { emptyNode } from './emptyNode.js';
|
|
3
|
+
import { onAdd3DLayer } from './onAdd3DLayer.js';
|
|
4
|
+
import { onRemove3DLayer } from './onRemove3DLayer.js';
|
|
5
|
+
import { update } from './update.js';
|
|
6
|
+
import { updateArea } from '../sources/updateArea.js';
|
|
7
|
+
import { onTerrainChange } from '../terrain/onTerrainChange.js';
|
|
8
|
+
import { getHeader } from '../archives/getHeader.js';
|
|
9
|
+
import { loadModel } from '../models/loadModel.js';
|
|
10
|
+
import { get3DEvents } from './get3DEvents.js';
|
|
11
|
+
import { ready3D } from './ready3D.js';
|
|
12
|
+
|
|
13
|
+
export function init3D(layer, options = {}) {
|
|
14
|
+
layer._3d = true;
|
|
15
|
+
L.Util.setOptions(layer, { ariaLabel: '3D scene', ...options });
|
|
16
|
+
layer.onAdd = onAdd3DLayer.bind(null, layer);
|
|
17
|
+
layer.onRemove = onRemove3DLayer.bind(null, layer);
|
|
18
|
+
layer.getEvents = get3DEvents.bind(null, layer);
|
|
19
|
+
const isModel = !layer._geojson && /\.(glb|gltf)(?:[?#]|$)/i.test(layer.options.url);
|
|
20
|
+
layer.modelUrl = isModel ? layer.options.url : null;
|
|
21
|
+
layer.url = layer.options.url && !isModel && !layer._geojson ? new URL(layer.options.url, document.baseURI).href : null;
|
|
22
|
+
layer._directories = new Map();
|
|
23
|
+
if (layer.options.center) {
|
|
24
|
+
layer.location = new L.LatLng(layer.options.center[0], layer.options.center[1]);
|
|
25
|
+
}
|
|
26
|
+
layer._areas = new Map();
|
|
27
|
+
layer._inflight = 0;
|
|
28
|
+
layer._added = Promise.withResolvers();
|
|
29
|
+
queueMicrotask(ready3D.bind(null, layer));
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function initializeLayer(task) {
|
|
2
|
+
const { layer, ready } = task;
|
|
3
|
+
try {
|
|
4
|
+
if (task.error) throw task.error;
|
|
5
|
+
const map = layer._map;
|
|
6
|
+
map?.removeLayer(layer);
|
|
7
|
+
delete layer.onAdd;
|
|
8
|
+
delete layer.onRemove;
|
|
9
|
+
task.initialize(layer, task.settings);
|
|
10
|
+
map?.addLayer(layer);
|
|
11
|
+
return layer.ready === ready ? layer : layer.ready;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
layer.fire('error', { error });
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { initializeGeoJSON } from '../sources/initializeGeoJSON.js';
|
|
2
|
+
import { initRaster } from '../raster/initRaster.js';
|
|
3
|
+
import { initTerrain } from '../terrain/initTerrain.js';
|
|
4
|
+
import { initTraffic } from '../traffic/initTraffic.js';
|
|
5
|
+
|
|
6
|
+
export function initializerFor(type) {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case 'geojson': return initializeGeoJSON;
|
|
9
|
+
case 'pmtiles': return initRaster;
|
|
10
|
+
case 'terrain': return initTerrain;
|
|
11
|
+
case 'traffic': return initTraffic;
|
|
12
|
+
default: throw new Error(`Unknown layer type: ${type}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { indexState } from '../constants/indexState.js';
|
|
2
|
+
import { init3D } from './init3D.js';
|
|
3
|
+
import { noOperation } from '../utils/noOperation.js';
|
|
4
|
+
import { resolveNextInitialization } from './resolveNextInitialization.js';
|
|
5
|
+
import { initializeLayer } from './initializeLayer.js';
|
|
6
|
+
|
|
7
|
+
export function layerInitialize(options = {}) {
|
|
8
|
+
if (Object.getPrototypeOf(this) !== L.Layer.prototype || !options.source) {
|
|
9
|
+
if (indexState.layerProto.initialize) return indexState.layerProto.initialize.apply(this, arguments);
|
|
10
|
+
L.Util.setOptions(this, options);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
source: {
|
|
15
|
+
type = options.source.data?.type === 'FeatureCollection'
|
|
16
|
+
? 'geojson'
|
|
17
|
+
: /\.pmtiles(?:[?#]|$)/i.test(options.source.url) ? 'pmtiles' : '3d',
|
|
18
|
+
...source
|
|
19
|
+
},
|
|
20
|
+
...core
|
|
21
|
+
} = options;
|
|
22
|
+
const settings = { ...source, ...core };
|
|
23
|
+
L.Util.setOptions(this, core);
|
|
24
|
+
this._type = type;
|
|
25
|
+
if (type === '3d') {
|
|
26
|
+
init3D(this, settings);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.onAdd = noOperation;
|
|
30
|
+
this.onRemove = noOperation;
|
|
31
|
+
// ponytail: type methods (setOpacity, add, ...) exist only once `ready` resolves.
|
|
32
|
+
const task = { layer: this, type, settings, ready: null };
|
|
33
|
+
indexState.pendingInitializations.push(task);
|
|
34
|
+
indexState.loading = indexState.loading.catch(noOperation).then(resolveNextInitialization);
|
|
35
|
+
const ready = this.ready = indexState.loading.then(initializeLayer);
|
|
36
|
+
task.ready = ready;
|
|
37
|
+
ready.catch(noOperation);
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { indexState } from '../constants/indexState.js';
|
|
2
|
+
import { initNativeGPU } from '../core/initNativeGPU.js';
|
|
3
|
+
|
|
4
|
+
export function layerLayerAdd(event) {
|
|
5
|
+
const native = !this._3d && (
|
|
6
|
+
this instanceof L.GridLayer ||
|
|
7
|
+
this instanceof L.Polyline ||
|
|
8
|
+
this instanceof L.CircleMarker ||
|
|
9
|
+
this instanceof L.Marker && !(this.options.icon instanceof L.DivIcon) ||
|
|
10
|
+
this instanceof L.ImageOverlay && !(this instanceof L.VideoOverlay) && !(this instanceof L.SVGOverlay)
|
|
11
|
+
);
|
|
12
|
+
if (native) {
|
|
13
|
+
if (this instanceof L.GridLayer || this instanceof L.ImageOverlay) {
|
|
14
|
+
this.options.crossOrigin ||= true;
|
|
15
|
+
}
|
|
16
|
+
if (this instanceof L.Marker) this.options.icon.options.crossOrigin ||= true;
|
|
17
|
+
}
|
|
18
|
+
indexState.layerProto._layerAdd.call(this, event);
|
|
19
|
+
if (!native || !event.target.hasLayer(this)) return;
|
|
20
|
+
initNativeGPU(this, event.target);
|
|
21
|
+
}
|