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
|
@@ -3,7 +3,7 @@ import { speed as sharedSpeed } from '../globals/speed.js';
|
|
|
3
3
|
import { trafficEmptyOptions } from '../globals/trafficEmptyOptions.js';
|
|
4
4
|
import { vehicles } from '../globals/vehicles.js';
|
|
5
5
|
import { trafficShader } from '../globals/trafficShader.js';
|
|
6
|
-
import { trafficByLayer } from '../
|
|
6
|
+
import { trafficByLayer } from '../weakmaps/trafficByLayer.js';
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -16,9 +16,9 @@ import { trafficByLayer } from '../globals/trafficByLayer.js';
|
|
|
16
16
|
* in metres, `name`/`description` for the default tooltip. The status line (count and vehicle type) sits under the layer's entry in the layers control.
|
|
17
17
|
* L.Control.Time on the same map drives the time; without one, vehicles run live.
|
|
18
18
|
*/
|
|
19
|
-
import { build } from '../geometry/
|
|
19
|
+
import { build } from '../geometry/buildGeometryParts.js';
|
|
20
20
|
import { init3D } from '../scene/init3D.js';
|
|
21
|
-
import { tooltip } from './
|
|
21
|
+
import { tooltip } from './trafficTooltip.js';
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { along } from '
|
|
1
|
+
import { along } from '../geometry/interpolateRoute.js';
|
|
2
2
|
|
|
3
|
-
export function locateTraffic(state, trip) {
|
|
3
|
+
export function locateTraffic(state, trip, target) {
|
|
4
4
|
const { points, lengths, length } = trip.lane;
|
|
5
5
|
let distance = trip.distance + state.elapsed * trip.speed;
|
|
6
6
|
distance -= length * Math.floor(distance / length);
|
|
7
|
-
const position = along(points, lengths, distance);
|
|
7
|
+
const position = along(points, lengths, distance, target);
|
|
8
8
|
position.x -= position.dz * state.side;
|
|
9
9
|
position.z += position.dx * state.side;
|
|
10
10
|
return position;
|
|
@@ -4,10 +4,11 @@ export function placeTraffic(state) {
|
|
|
4
4
|
if (!state.mesh || !state.stale) return;
|
|
5
5
|
state.stale = false;
|
|
6
6
|
const { position, normal } = state.mesh.geometry.attributes;
|
|
7
|
+
const target = state.position ||= /* alloc */ {};
|
|
7
8
|
let i, trip, cx, y, cz, dx, dz, k, o, lx, lz, nx, nz;
|
|
8
9
|
for (i = 0; i < state.trips.length; i++) {
|
|
9
10
|
trip = state.trips[i];
|
|
10
|
-
({ x: cx, y, z: cz, dx, dz } = locateTraffic(state, trip));
|
|
11
|
+
({ x: cx, y, z: cz, dx, dz } = locateTraffic(state, trip, target));
|
|
11
12
|
for (k = 0, o = i * state.stride; k < state.stride; k += 3, o += 3) {
|
|
12
13
|
lx = state.template.position[k], lz = state.template.position[k + 2], nx = state.template.normal[k], nz = state.template.normal[k + 2];
|
|
13
14
|
position.data[o] = cx - lx * dz - lz * dx;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { locationByLayer } from '../weakmaps/locationByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { radians } from '../globals/radians.js';
|
|
2
4
|
import { L } from '../globals/L.js';
|
|
3
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
import { disposeTrafficObject } from './disposeTrafficObject.js';
|
|
@@ -8,8 +9,8 @@ import { groundTraffic } from './groundTraffic.js';
|
|
|
8
9
|
|
|
9
10
|
export function prepareTraffic(state) {
|
|
10
11
|
const { layer, lanes } = state;
|
|
11
|
-
const crs = layer._map.options.crs, origin = crs.project(
|
|
12
|
-
const metres = Math.cos(
|
|
12
|
+
const crs = layer._map.options.crs, origin = crs.project(locationByLayer.get(layer));
|
|
13
|
+
const metres = Math.cos(locationByLayer.get(layer).lat * radians);
|
|
13
14
|
let lane, lat, lng, point, i;
|
|
14
15
|
for (lane of lanes) {
|
|
15
16
|
lane.points = /* alloc */ [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
import { destroyTrafficGpu } from './destroyTrafficGpu.js';
|
|
@@ -6,7 +7,7 @@ import { trafficStorage } from './trafficStorage.js';
|
|
|
6
7
|
import { uploadTrafficLanes } from './uploadTrafficLanes.js';
|
|
7
8
|
|
|
8
9
|
export function rebaseTraffic(state) {
|
|
9
|
-
const { device } =
|
|
10
|
+
const { device } = rendererByLayer.get(state.layer);
|
|
10
11
|
if (state.gpu?.device !== device) {
|
|
11
12
|
destroyTrafficGpu(state);
|
|
12
13
|
const template = /* alloc */ new Float32Array(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { trafficEmptyOptions } from '../globals/trafficEmptyOptions.js';
|
|
2
|
-
import { build } from '../geometry/
|
|
2
|
+
import { build } from '../geometry/buildGeometryParts.js';
|
|
3
3
|
import { createTrafficMesh } from './createTrafficMesh.js';
|
|
4
4
|
import { disposeTrafficObject } from './disposeTrafficObject.js';
|
|
5
5
|
import { trafficBounds } from './trafficBounds.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { underEntry } from '../
|
|
1
|
+
import { underEntry } from '../layer-controls/underEntry.js';
|
|
2
2
|
|
|
3
3
|
export function startTraffic(state) {
|
|
4
4
|
state.layer._map.off('simulationtimechange layerremove', state.update).on('simulationtimechange layerremove', state.update);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
import { update as updateScene } from '../scene/scheduleSceneUpdate.js';
|
|
5
6
|
import { trafficNow } from './trafficNow.js';
|
|
6
7
|
import { refreshTrafficTrips } from './refreshTrafficTrips.js';
|
|
7
8
|
import { updateTrafficPose } from './updateTrafficPose.js';
|
|
@@ -9,7 +10,7 @@ import { updateTrafficPose } from './updateTrafficPose.js';
|
|
|
9
10
|
export function tickTraffic(state) {
|
|
10
11
|
state.frame = undefined;
|
|
11
12
|
if (!state.ready || !state.layer._map) return;
|
|
12
|
-
if (!
|
|
13
|
+
if (!rendererByLayer.get(state.layer)) { state.frame = requestAnimationFrame(state.tick); return; }
|
|
13
14
|
if (state.mesh && !(state.mesh.geometry.attributes.position.buffer.usage & GPUBufferUsage.STORAGE)) {
|
|
14
15
|
state.tripsKey = null;
|
|
15
16
|
state.nextCheck = -Infinity;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { timeControlByMap } from '../weakmaps/timeControlByMap.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
export function trafficNow(state) {
|
|
5
|
-
const control =
|
|
6
|
+
const control = timeControlByMap.get(state.layer._map);
|
|
6
7
|
const live = control ? control.live : true;
|
|
7
8
|
return /* alloc */ {
|
|
8
9
|
live, time: live ? /* alloc */ new Date() : control.time,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { controlByLayer } from '../weakmaps/controlByLayer.js';
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
import { loadTraffic } from './loadTraffic.js';
|
|
5
6
|
|
|
6
7
|
export function updateTraffic(state, event) {
|
|
7
|
-
if (event?.layer && !
|
|
8
|
+
if (event?.layer && !controlByLayer.get(event.layer)?.time) return;
|
|
8
9
|
cancelAnimationFrame(state.frame);
|
|
9
10
|
loadTraffic(state);
|
|
10
11
|
state.tick();
|
|
@@ -3,10 +3,12 @@ import { locateTraffic } from './locateTraffic.js';
|
|
|
3
3
|
export function updateTrafficLights(state) {
|
|
4
4
|
state.litAt = performance.now();
|
|
5
5
|
const lights = /* alloc */ [];
|
|
6
|
+
const target = state.position ||= /* alloc */ {};
|
|
6
7
|
let trip, x, y, z, dx, dz, lx, ly, lz, light;
|
|
7
8
|
for (trip of state.trips) {
|
|
8
|
-
({ x, y, z, dx, dz } = locateTraffic(state, trip));
|
|
9
|
-
for (
|
|
9
|
+
({ x, y, z, dx, dz } = locateTraffic(state, trip, target));
|
|
10
|
+
for (light of state.lights) {
|
|
11
|
+
[lx, ly, lz] = light.position;
|
|
10
12
|
lights.push(/* alloc */ {
|
|
11
13
|
...light, position: /* alloc */ [x - lx * dz - lz * dx, y + ly, z + lx * dx - lz * dz],
|
|
12
14
|
});
|
package/src/vehicles/busModel.js
CHANGED
package/src/vehicles/carModel.js
CHANGED
|
@@ -1,45 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
|
+
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
3
|
+
|
|
2
4
|
import { limbs } from '../globals/limbs.js';
|
|
3
5
|
import { parts } from '../globals/parts.js';
|
|
4
6
|
import { moves } from '../globals/moves.js';
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
import * as createMesh from '../rendering/createMesh.js';
|
|
8
|
-
import { build } from '../geometry/
|
|
10
|
+
import { build } from '../geometry/buildGeometryParts.js';
|
|
9
11
|
|
|
10
|
-
import {
|
|
11
|
-
import { local } from './local.js';
|
|
12
|
-
import { place } from './place.js';
|
|
13
|
-
import { land } from './land.js';
|
|
14
|
-
import { moveWalker } from './moveWalker.js';
|
|
12
|
+
import { local } from '../projections/walkerLocalPosition.js';
|
|
15
13
|
import { stepWalkerHeight } from './stepWalkerHeight.js';
|
|
16
|
-
import {
|
|
14
|
+
import { resolveWalkerPosition } from './resolveWalkerPosition.js';
|
|
15
|
+
import { updateWalkerFrame } from './updateWalkerFrame.js';
|
|
17
16
|
|
|
18
17
|
export function step(now) {
|
|
19
18
|
const layer = this.layer;
|
|
20
19
|
this.frame = requestAnimationFrame(this.step);
|
|
21
20
|
const dt = Math.min(0.1, (now - (this.last ?? now)) / 1000);
|
|
22
21
|
this.last = now;
|
|
23
|
-
if (!
|
|
22
|
+
if (!rendererByLayer.get(layer)) return;
|
|
24
23
|
let changed = false;
|
|
25
24
|
let part, key;
|
|
25
|
+
if (now >= this.nextClearanceCheck) {
|
|
26
|
+
this.nextClearanceCheck = now + 250;
|
|
27
|
+
if (resolveWalkerPosition.call(this)) changed = true;
|
|
28
|
+
}
|
|
26
29
|
if (!this.meshes) {
|
|
27
30
|
this.meshes = /* alloc */ [];
|
|
28
31
|
for ([part] of limbs) this.meshes.push(createMesh.createMesh(layer, build(parts[part])));
|
|
29
32
|
changed = true;
|
|
30
33
|
}
|
|
31
|
-
const previousY =
|
|
32
|
-
local.call(this, this.local)[1] *
|
|
34
|
+
const previousY = rootByLayer.get(layer).position[1] +
|
|
35
|
+
local.call(this, this.local)[1] * rootByLayer.get(layer).scale[1];
|
|
33
36
|
if (stepWalkerHeight.call(this, dt)) changed = true;
|
|
34
37
|
let forward = 0, turn = 0;
|
|
35
38
|
for (key of this.keys) { forward += moves[key]?.[0] || 0; turn += moves[key]?.[1] || 0; }
|
|
36
39
|
forward = Math.sign(forward); turn = Math.sign(turn);
|
|
37
|
-
|
|
38
|
-
if (forward) {
|
|
39
|
-
moveWalker.call(this, forward, dt);
|
|
40
|
-
changed = true;
|
|
41
|
-
}
|
|
42
|
-
if (changed) land.call(this, previousY);
|
|
43
|
-
if (updateWalkerView.call(this, forward, turn, dt)) changed = true;
|
|
44
|
-
if (changed) place.call(this);
|
|
40
|
+
updateWalkerFrame(this, previousY, forward, turn, dt, changed);
|
|
45
41
|
}
|
package/src/walk/createWalk.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
import { typeByLayer } from '../weakmaps/typeByLayer.js';
|
|
2
|
+
import { walkerByLayer } from '../weakmaps/walkerByLayer.js';
|
|
3
|
+
|
|
1
4
|
import { L } from '../globals/L.js';
|
|
2
|
-
import { sceneByLayer } from '../globals/sceneByLayer.js';
|
|
3
5
|
|
|
4
6
|
|
|
5
7
|
import { init3D } from '../scene/init3D.js';
|
|
6
|
-
import { onBlur } from './
|
|
7
|
-
import { onKey } from './
|
|
8
|
-
import { onPointer } from './
|
|
9
|
-
import { onTerrain } from './
|
|
10
|
-
import { start } from './
|
|
11
|
-
import { step } from './
|
|
12
|
-
import { stop } from './
|
|
13
|
-
import { toggle } from './
|
|
8
|
+
import { onBlur } from './onWalkBlur.js';
|
|
9
|
+
import { onKey } from './onWalkKey.js';
|
|
10
|
+
import { onPointer } from './onWalkPointer.js';
|
|
11
|
+
import { onTerrain } from './onWalkTerrain.js';
|
|
12
|
+
import { start } from './startWalking.js';
|
|
13
|
+
import { step } from './animateWalker.js';
|
|
14
|
+
import { stop } from './stopWalking.js';
|
|
15
|
+
import { toggle } from './toggleWalking.js';
|
|
14
16
|
|
|
15
17
|
export function createWalk(control, {
|
|
16
18
|
speed,
|
|
@@ -18,7 +20,7 @@ export function createWalk(control, {
|
|
|
18
20
|
...options
|
|
19
21
|
}) {
|
|
20
22
|
const layer = /* alloc */ new L.Layer();
|
|
21
|
-
|
|
23
|
+
typeByLayer.set(layer, 'walk');
|
|
22
24
|
init3D(layer, options);
|
|
23
25
|
const keys = /* alloc */ new Set();
|
|
24
26
|
const container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
|
|
@@ -46,13 +48,15 @@ export function createWalk(control, {
|
|
|
46
48
|
meshes: null,
|
|
47
49
|
frame: null,
|
|
48
50
|
last: undefined,
|
|
51
|
+
nextClearanceCheck: 0,
|
|
49
52
|
swing: 0,
|
|
50
53
|
verticalSpeed: 0,
|
|
51
54
|
saved: null,
|
|
52
55
|
hitData: null,
|
|
53
56
|
local: null,
|
|
54
|
-
state: control.walker =
|
|
57
|
+
state: control.walker = /* alloc */ { latlng: null, heading: 0, phase: 0, height: 0 }
|
|
55
58
|
}
|
|
59
|
+
walkerByLayer.set(layer, context.state);
|
|
56
60
|
context.step = step.bind(context);
|
|
57
61
|
context.onKey = onKey.bind(context);
|
|
58
62
|
context.onBlur = onBlur.bind(context);
|
package/src/walk/initWalk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { L } from '../globals/L.js';
|
|
2
|
-
import { initialize } from './
|
|
3
|
-
import { onAdd } from './
|
|
4
|
-
import { onRemove } from './
|
|
2
|
+
import { initialize } from './initializeWalkControl.js';
|
|
3
|
+
import { onAdd } from './onAddWalkControl.js';
|
|
4
|
+
import { onRemove } from './onRemoveWalkControl.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Third-person walk mode, toggled by a map button (and Esc): a pedestrian at the map centre runs with W/S (or ↑/↓) and
|
|
@@ -9,7 +9,7 @@ import { onRemove } from './onRemove.js';
|
|
|
9
9
|
* (bearing, pitch); the wheel changes the camera distance.
|
|
10
10
|
* The walker follows the terrain, bridges included, and `control.walker` exposes `{ latlng, heading, phase }`.
|
|
11
11
|
* Options: `speed` (m/s, default 70), `distance` (camera distance in metres, default 20), `position` (button corner, default 'bottomright').
|
|
12
|
-
*
|
|
12
|
+
* Buildings, trees, models, streetlights and traffic block movement; the walker is moved out of newly loaded obstacles.
|
|
13
13
|
*/
|
|
14
14
|
L.Control.Walk = L.Control.extend({
|
|
15
15
|
options: { position: 'bottomright', speed: 70, distance: 20 },
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { kindByLayer } from '../weakmaps/kindByLayer.js';
|
|
2
|
+
import { layersByLayer } from '../weakmaps/layersByLayer.js';
|
|
3
|
+
import { raycasterByLayer } from '../weakmaps/raycasterByLayer.js';
|
|
4
|
+
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
5
|
+
import { sceneByLayer } from '../weakmaps/sceneByLayer.js';
|
|
6
|
+
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
7
|
+
|
|
8
|
+
import { intersectMeshes } from '../collision/intersectMeshes.js';
|
|
9
|
+
import { traverse } from '../scene/traverse.js';
|
|
10
|
+
import { updateWorldMatrix } from '../transforms/updateWorldMatrix.js';
|
|
11
|
+
import { collectVisibleMesh } from '../picking/collectVisibleMesh.js';
|
|
12
|
+
import { shouldSkipOther } from '../picking/shouldSkipOther.js';
|
|
13
|
+
import { local } from '../projections/walkerLocalPosition.js';
|
|
14
|
+
|
|
15
|
+
export function land(previousY) {
|
|
16
|
+
const ray = raycasterByLayer.get(this.layer)
|
|
17
|
+
const feet = local.call(this, this.local), root = rootByLayer.get(this.layer);
|
|
18
|
+
const x = root.position[0] + feet[0] * root.scale[0];
|
|
19
|
+
const y = root.position[1] + feet[1] * root.scale[1];
|
|
20
|
+
const z = root.position[2] + feet[2] * root.scale[2];
|
|
21
|
+
if (y > previousY || this.verticalSpeed > 0) return;
|
|
22
|
+
updateWorldMatrix(sceneByLayer.get(this.layer));
|
|
23
|
+
ray.origin[0] = x; ray.origin[1] = previousY + 0.01; ray.origin[2] = z;
|
|
24
|
+
ray.direction[0] = 0; ray.direction[1] = -1; ray.direction[2] = 0;
|
|
25
|
+
ray.meshes.length = 0;
|
|
26
|
+
let layer, hit;
|
|
27
|
+
for (layer of layersByLayer.get(sharedByLayer.get(this.layer))) {
|
|
28
|
+
if (shouldSkipOther(layer, this.layer) || kindByLayer.get(layer) === 'raster' || layer.options.nightLight) continue;
|
|
29
|
+
traverse(rootByLayer.get(layer), collectVisibleMesh, ray.meshes);
|
|
30
|
+
}
|
|
31
|
+
for (hit of intersectMeshes(ray, ray.meshes)) {
|
|
32
|
+
if (hit.point[1] < y - 0.001) break;
|
|
33
|
+
this.state.height += (hit.point[1] - y) / root.scale[1];
|
|
34
|
+
this.verticalSpeed = 0;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
ray.meshes.length = 0;
|
|
38
|
+
}
|
package/src/walk/moveWalker.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
2
|
+
|
|
1
3
|
import { L } from '../globals/L.js';
|
|
2
4
|
import { radians } from '../globals/radians.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { blocked } from './blocked.js';
|
|
5
|
+
import { local } from '../projections/walkerLocalPosition.js';
|
|
6
|
+
import { blocked } from './isWalkBlocked.js';
|
|
6
7
|
|
|
7
8
|
export function moveWalker(forward, dt) {
|
|
8
9
|
const metres = forward * this.speed * dt, { lat, lng } = this.state.latlng;
|
|
9
|
-
const { position, scale } =
|
|
10
|
+
const { position, scale } = rootByLayer.get(this.layer);
|
|
10
11
|
let east = Math.sin(this.state.heading) * metres, north = Math.cos(this.state.heading) * metres;
|
|
11
12
|
const feet = local.call(this, this.local);
|
|
12
13
|
let i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { walkByMap } from '../
|
|
1
|
+
import { walkByMap } from '../weakmaps/walkByMap.js';
|
|
2
2
|
|
|
3
3
|
export function onAdd(map) {
|
|
4
4
|
let state = walkByMap.get(map);
|
|
@@ -12,6 +12,8 @@ export function onAdd(map) {
|
|
|
12
12
|
hitData: /* alloc */ {
|
|
13
13
|
x: 0, y: 0, z: 0, dx: 0, dz: 0, reach: 0, best: 0, found: false,
|
|
14
14
|
seen: /* alloc */ new Set(),
|
|
15
|
+
intersections: /* alloc */ [],
|
|
16
|
+
nodes: /* alloc */ [],
|
|
15
17
|
normal: /* alloc */ [0, 0],
|
|
16
18
|
},
|
|
17
19
|
local: /* alloc */ [0, 0, 0],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { limbs } from '../globals/limbs.js';
|
|
2
2
|
|
|
3
|
-
import { update } from '../scene/
|
|
3
|
+
import { update } from '../scene/scheduleSceneUpdate.js';
|
|
4
4
|
|
|
5
|
-
import { local } from '
|
|
5
|
+
import { local } from '../projections/walkerLocalPosition.js';
|
|
6
6
|
|
|
7
7
|
export function place() {
|
|
8
8
|
const [x, y, z] = local.call(this, this.local);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { L } from '../globals/L.js';
|
|
2
|
+
import { insideWalker } from '../collision/insideWalker.js';
|
|
3
|
+
|
|
4
|
+
export function resolveWalkerPosition() {
|
|
5
|
+
if (!this.saved || !insideWalker(this)) return false;
|
|
6
|
+
const map = this.layer._map;
|
|
7
|
+
const origin = this.state.latlng;
|
|
8
|
+
const height = this.state.height;
|
|
9
|
+
let distance, angle, candidate;
|
|
10
|
+
for (distance = 0.5; distance <= 20; distance += 0.5) {
|
|
11
|
+
for (angle = 0; angle < Math.PI * 2; angle += Math.PI / 4) {
|
|
12
|
+
candidate = /* alloc */ new L.LatLng(
|
|
13
|
+
origin.lat + Math.cos(angle) * distance / 111320,
|
|
14
|
+
origin.lng + Math.sin(angle) * distance / (111320 * Math.cos(origin.lat * Math.PI / 180))
|
|
15
|
+
);
|
|
16
|
+
this.state.latlng = candidate;
|
|
17
|
+
this.state.height = 0;
|
|
18
|
+
if (!insideWalker(this)) {
|
|
19
|
+
this.verticalSpeed = 0;
|
|
20
|
+
map.setView(candidate, map.getZoom(), /* alloc */ { animate: false });
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
this.state.latlng = origin;
|
|
26
|
+
this.state.height = height;
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
@@ -5,11 +5,12 @@ import { sceneWalkHandlers } from '../globals/sceneWalkHandlers.js';
|
|
|
5
5
|
import { mapGetPitch } from '../camera/mapGetPitch.js';
|
|
6
6
|
import { mapGetBearing } from '../camera/mapGetBearing.js';
|
|
7
7
|
import { mapSetPitch } from '../camera/mapSetPitch.js';
|
|
8
|
-
import { step } from './
|
|
9
|
-
import { onKey } from './
|
|
10
|
-
import { onBlur } from './
|
|
11
|
-
import { onPointer } from './
|
|
12
|
-
import { onTerrain } from './
|
|
8
|
+
import { step } from './animateWalker.js';
|
|
9
|
+
import { onKey } from './onWalkKey.js';
|
|
10
|
+
import { onBlur } from './onWalkBlur.js';
|
|
11
|
+
import { onPointer } from './onWalkPointer.js';
|
|
12
|
+
import { onTerrain } from './onWalkTerrain.js';
|
|
13
|
+
import { resolveWalkerPosition } from './resolveWalkerPosition.js';
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
export function start() {
|
|
@@ -34,6 +35,7 @@ export function start() {
|
|
|
34
35
|
this.state.heading = -mapGetBearing(map) * radians;
|
|
35
36
|
map.setView(this.state.latlng, zoom, /* alloc */ { animate: false });
|
|
36
37
|
mapSetPitch(map, 75);
|
|
38
|
+
resolveWalkerPosition.call(this);
|
|
37
39
|
L.DomEvent.on(document, 'keydown keyup', this.onKey);
|
|
38
40
|
L.DomEvent.on(window, 'blur', this.onBlur);
|
|
39
41
|
L.DomEvent.on(map.getContainer(), 'pointerdown pointermove pointerup pointercancel', this.onPointer);
|
|
@@ -42,5 +44,6 @@ export function start() {
|
|
|
42
44
|
this.button.style.background = '#e4e4e4';
|
|
43
45
|
this.hint.style.display = '';
|
|
44
46
|
this.last = undefined;
|
|
47
|
+
this.nextClearanceCheck = 0;
|
|
45
48
|
this.frame = requestAnimationFrame(this.step);
|
|
46
49
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { L } from '../globals/L.js';
|
|
2
2
|
import { mapSetPitch } from '../camera/mapSetPitch.js';
|
|
3
3
|
import * as disposeMesh from '../rendering/disposeMesh.js';
|
|
4
|
-
import { onKey } from './
|
|
5
|
-
import { onBlur } from './
|
|
6
|
-
import { onPointer } from './
|
|
7
|
-
import { onTerrain } from './
|
|
4
|
+
import { onKey } from './onWalkKey.js';
|
|
5
|
+
import { onBlur } from './onWalkBlur.js';
|
|
6
|
+
import { onPointer } from './onWalkPointer.js';
|
|
7
|
+
import { onTerrain } from './onWalkTerrain.js';
|
|
8
8
|
|
|
9
9
|
export function stop() {
|
|
10
10
|
const map = this.layer._map;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { wrap } from '../utils/wrap.js';
|
|
2
|
+
import { place } from './placeWalker.js';
|
|
3
|
+
import { land } from './landWalker.js';
|
|
4
|
+
import { moveWalker } from './moveWalker.js';
|
|
5
|
+
import { updateWalkerView } from './updateWalkerView.js';
|
|
6
|
+
|
|
7
|
+
export function updateWalkerFrame(walker, previousY, forward, turn, dt, changed) {
|
|
8
|
+
if (turn) {
|
|
9
|
+
walker.state.heading = wrap(walker.state.heading + turn * 2.5 * dt);
|
|
10
|
+
changed = true;
|
|
11
|
+
}
|
|
12
|
+
if (forward) {
|
|
13
|
+
moveWalker.call(walker, forward, dt);
|
|
14
|
+
changed = true;
|
|
15
|
+
}
|
|
16
|
+
if (changed) land.call(walker, previousY);
|
|
17
|
+
if (updateWalkerView.call(walker, forward, turn, dt)) changed = true;
|
|
18
|
+
if (changed) place.call(walker);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const addedByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const archiveHeaderByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const areasByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const bridgeMeshByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const bridgesByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cameraAnimationByMap = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cameraBearingByMap = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cameraByLayer = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const cameraDraggableByMap = new WeakMap();
|