leaflet-city-mapper 0.0.9 → 0.1.1
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 +6 -46
- package/dist/README.md +18 -0
- package/dist/leaflet-city-mapper-src.js +279 -110
- package/dist/leaflet-city-mapper-src.js.map +4 -4
- package/dist/leaflet-city-mapper-worker-src.js.map +2 -2
- package/dist/leaflet-city-mapper-worker.js.map +2 -2
- package/dist/leaflet-city-mapper.js +5 -5
- package/dist/leaflet-city-mapper.js.map +4 -4
- package/libs/README.md +18 -0
- package/libs/leaflet-lens.js +151 -151
- package/libs/leaflet.js +3 -3
- package/libs/openlayers-bindings.js +1129 -1129
- package/libs/openlayers-bindings.min.js.map +1 -1
- package/package.json +2 -4
- package/src/README.md +148 -0
- package/src/animations/README.md +30 -0
- package/src/animations/cancelCameraAnimation.js +13 -11
- package/src/animations/cancelGridFade.js +5 -3
- package/src/animations/endZoom.js +0 -5
- package/src/animations/mapAnimateCamera.js +13 -3
- package/src/animations/mapStopPitchBearingAnimation.js +8 -1
- package/src/animations/onZoomAnim.js +5 -4
- package/src/animations/renderPendingZoomAnimation.js +1 -4
- package/src/animations/runCameraAnimations.js +7 -4
- package/src/animations/runGridFades.js +1 -4
- package/src/animations/runMarkerPanFrame.js +1 -1
- package/src/animations/scheduleCameraAnimation.js +10 -8
- package/src/animations/scheduleGridFade.js +5 -4
- package/src/animations/scheduleMarkerPan.js +10 -6
- package/src/animations/startZoom.js +0 -3
- package/src/animations/synchronizeZoomView.js +6 -1
- package/src/animations/updateZoomCamera.js +21 -17
- package/src/archives/README.md +28 -0
- package/src/archives/decodeDirectory.js +13 -2
- package/src/archives/decodeHeader.js +9 -2
- package/src/archives/decompress.js +10 -0
- package/src/archives/findDirectoryEntry.js +17 -9
- package/src/archives/findTile.js +45 -31
- package/src/archives/getDirectoryEntries.js +28 -17
- package/src/archives/getHeader.js +7 -2
- package/src/archives/getTileData.js +26 -13
- package/src/archives/getZxy.js +11 -3
- package/src/archives/loadDirectory.js +10 -0
- package/src/archives/loadSource.js +12 -3
- package/src/archives/readArchiveRange.js +45 -31
- package/src/archives/readVarint.js +11 -2
- package/src/archives/tileId.js +11 -2
- package/src/astronomy/README.md +25 -0
- package/src/astronomy/horizontalPosition.js +11 -0
- package/src/astronomy/moonPosition.js +9 -2
- package/src/astronomy/solarPosition.js +9 -2
- package/src/astronomy/solarTime.js +21 -11
- package/src/camera/README.md +30 -0
- package/src/camera/cameraMapReady.js +6 -8
- package/src/camera/cleanupCameraMap.js +8 -10
- package/src/camera/constrainCameraToBounds.js +3 -2
- package/src/camera/createSceneCamera.js +25 -21
- package/src/camera/fitCameraBounds.js +9 -1
- package/src/camera/getBearing.js +10 -5
- package/src/camera/getPitch.js +10 -5
- package/src/camera/initializeCameraMap.js +1 -3
- package/src/camera/mapCamera.js +0 -2
- package/src/camera/mapContainerPointToLayerPoint.js +7 -2
- package/src/camera/mapGetBearing.js +7 -2
- package/src/camera/mapGetBounds.js +5 -2
- package/src/camera/mapGetBoundsCenterZoom.js +9 -2
- package/src/camera/mapGetBoundsZoom.js +9 -2
- package/src/camera/mapGetCenterLayerPoint.js +5 -1
- package/src/camera/mapGetPitch.js +7 -2
- package/src/camera/mapLayerPointToContainerPoint.js +7 -1
- package/src/camera/mapLimitCenter.js +9 -2
- package/src/camera/mapLimitOffset.js +12 -6
- package/src/camera/mapPanBy.js +10 -3
- package/src/camera/mapPanInside.js +8 -2
- package/src/camera/mapResetNorth.js +8 -0
- package/src/camera/mapResetNorthPitch.js +8 -0
- package/src/camera/mapSetBearing.js +10 -0
- package/src/camera/mapSetPitch.js +10 -0
- package/src/camera/mapSetPitchAndBearing.js +12 -3
- package/src/camera/mapSetZoomAround.js +9 -1
- package/src/camera/mapTryAnimatedPan.js +8 -1
- package/src/camera/mapUpdateCameraOverlays.js +6 -0
- package/src/camera/setBearing.js +13 -5
- package/src/camera/setPitch.js +13 -5
- package/src/camera/updateMapCamera.js +6 -4
- package/src/camera/updateSceneCamera.js +7 -1
- package/src/camera/updateSky.js +1 -3
- package/src/cog/README.md +29 -0
- package/src/cog/decodeCogTile.js +37 -24
- package/src/cog/finiteCogValues.js +12 -5
- package/src/cog/getCogAssetEntry.js +26 -15
- package/src/cog/getCogBase.js +22 -10
- package/src/cog/getCogHeader.js +10 -3
- package/src/cog/getCogProfile.js +25 -16
- package/src/cog/getCogTile.js +25 -12
- package/src/cog/getColorTile.js +38 -25
- package/src/cog/getElevationTile.js +29 -16
- package/src/cog/hasCogProjection.js +16 -9
- package/src/cog/initCog.js +13 -7
- package/src/cog/invalidCogFullResponse.js +10 -3
- package/src/cog/openCog.js +40 -30
- package/src/cog/openCogAsset.js +22 -14
- package/src/cog/readCog.js +39 -25
- package/src/cog/readCogBlock.js +19 -8
- package/src/cog/readCogBody.js +30 -20
- package/src/cog/readCogDirectories.js +32 -20
- package/src/cog/readCogDirectory.js +34 -21
- package/src/cog/readCogLevel.js +36 -27
- package/src/cog/readCogTag.js +28 -15
- package/src/cog/validCogDimensions.js +15 -6
- package/src/cog/validCogEncoding.js +18 -5
- package/src/cog/validCogGeoArrays.js +17 -8
- package/src/cog/validCogGrid.js +22 -9
- package/src/cog/validCogTileCoordinates.js +13 -4
- package/src/cog/validateCogContainer.js +17 -9
- package/src/cog/validateCogContentRange.js +18 -8
- package/src/cog/validateCogOffsets.js +19 -10
- package/src/cog/validateCogRange.js +16 -7
- package/src/cog/validateCogResponse.js +26 -15
- package/src/collision/README.md +28 -0
- package/src/collision/advanceFeature.js +13 -0
- package/src/collision/boxNormal.js +29 -0
- package/src/collision/cachedCollider.js +18 -0
- package/src/collision/collectIntersections.js +41 -16
- package/src/collision/collectMeshes.js +6 -0
- package/src/collision/collideTrip.js +56 -0
- package/src/collision/collider.js +28 -18
- package/src/collision/countCrossings.js +35 -15
- package/src/collision/enclosesOrigin.js +13 -0
- package/src/collision/flipsNormal.js +15 -0
- package/src/collision/hiddenLightHit.js +19 -8
- package/src/collision/horizontalRay.js +13 -1
- package/src/collision/indexTriangle.js +18 -11
- package/src/collision/insideMesh.js +47 -33
- package/src/collision/insideWalker.js +52 -46
- package/src/collision/intersectMeshes.js +40 -32
- package/src/collision/localRay.js +31 -21
- package/src/collision/mergeHits.js +19 -11
- package/src/collision/missesBox.js +13 -0
- package/src/collision/rayBounds.js +28 -19
- package/src/collision/readTriangle.js +32 -23
- package/src/collision/slabDistance.js +14 -0
- package/src/collision/slabMiss.js +14 -0
- package/src/collision/sortCrossings.js +17 -0
- package/src/collision/sortHits.js +9 -1
- package/src/collision/trafficBounds.js +24 -0
- package/src/collision/trafficCollision.js +30 -55
- package/src/collision/trafficRay.js +21 -0
- package/src/collision/transformTriangle.js +18 -9
- package/src/collision/transformVertices.js +18 -0
- package/src/collision/triangleDistance.js +34 -21
- package/src/collision/vertexCount.js +11 -3
- package/src/collision/worldHit.js +30 -18
- package/src/colors/README.md +25 -0
- package/src/colors/formatRGB.js +7 -0
- package/src/colors/hslChannel.js +10 -0
- package/src/colors/mixColor.js +10 -0
- package/src/colors/parseColor.js +4 -1
- package/src/colors/toSRGB.js +7 -0
- package/src/controls/README.md +26 -0
- package/src/controls/acceptPitchDrag.js +10 -3
- package/src/controls/acceptRotateDrag.js +9 -2
- package/src/controls/addCameraHandler.js +18 -11
- package/src/controls/adjustCameraDrag.js +8 -10
- package/src/controls/cameraControls.js +5 -4
- package/src/controls/cameraDragClick.js +5 -1
- package/src/controls/cameraDragContextMenu.js +10 -6
- package/src/controls/cameraDragDown.js +5 -2
- package/src/controls/cameraDragEnd.js +7 -3
- package/src/controls/cameraDragMove.js +24 -20
- package/src/controls/changeCameraTouch.js +12 -14
- package/src/controls/cleanupCameraTouch.js +1 -4
- package/src/controls/compassAddHooks.js +1 -0
- package/src/controls/compassOrientation.js +11 -5
- package/src/controls/compassRemoveHooks.js +3 -2
- package/src/controls/containerResizeAddHooks.js +1 -0
- package/src/controls/containerResizeRemoveHooks.js +3 -2
- package/src/controls/dragCamera.js +11 -2
- package/src/controls/endAllCameraDrags.js +1 -2
- package/src/controls/endAllCameraTouches.js +1 -2
- package/src/controls/endCameraTouch.js +18 -12
- package/src/controls/endCameraTouchEvent.js +5 -2
- package/src/controls/failCompassPermission.js +10 -4
- package/src/controls/finishCameraDrag.js +14 -8
- package/src/controls/finishCompassPermission.js +24 -17
- package/src/controls/isEditableTarget.js +9 -2
- package/src/controls/loadCameraControls.js +18 -9
- package/src/controls/moveCameraTouch.js +30 -27
- package/src/controls/notifyCameraTouchChange.js +1 -0
- package/src/controls/pitchDragAddHooks.js +1 -1
- package/src/controls/pitchDragRemoveHooks.js +1 -0
- package/src/controls/refreshRotateControl.js +2 -0
- package/src/controls/refreshRotateFocus.js +3 -2
- package/src/controls/removeCameraDrag.js +18 -15
- package/src/controls/resizeMap.js +7 -2
- package/src/controls/rotateButtonClick.js +15 -10
- package/src/controls/rotateButtonKeydown.js +16 -10
- package/src/controls/rotateControl.js +11 -3
- package/src/controls/rotateOnAdd.js +7 -1
- package/src/controls/rotateOnRemove.js +5 -0
- package/src/controls/shiftRotateAddHooks.js +1 -1
- package/src/controls/shiftRotateRemoveHooks.js +3 -2
- package/src/controls/shiftRotateWheel.js +11 -6
- package/src/controls/startCameraTouch.js +5 -2
- package/src/core/README.md +28 -0
- package/src/core/adjustCameraMarkerPan.js +7 -2
- package/src/core/cameraCircleBounds.js +5 -1
- package/src/core/cameraMarkerDrag.js +1 -2
- package/src/core/cameraMarkerOnDrag.js +13 -10
- package/src/core/closestCameraLayerPoint.js +7 -1
- package/src/core/constructLayer.js +16 -9
- package/src/core/extendLeafletClass.js +12 -5
- package/src/core/extendTerrainPixelBounds.js +41 -31
- package/src/core/fireRasterLoad.js +1 -1
- package/src/core/gridlayerGetEvents.js +5 -2
- package/src/core/gridlayerGetTiledPixelBounds.js +7 -1
- package/src/core/initializeGridContainer.js +1 -1
- package/src/core/initializeNativeLayer.js +1 -4
- package/src/core/layerAddInitHook.js +12 -7
- package/src/core/layerCallInitHooks.js +1 -2
- package/src/core/layerMergeOptions.js +14 -7
- package/src/core/markerGetEvents.js +5 -2
- package/src/core/markerInitInteraction.js +7 -4
- package/src/core/markerSetIcon.js +10 -5
- package/src/core/markerSetPos.js +5 -2
- package/src/core/markerSetRotation.js +19 -9
- package/src/core/markerUpdateZIndex.js +6 -4
- package/src/core/popupAdjustPan.js +5 -2
- package/src/core/popupGetEvents.js +5 -1
- package/src/core/popupUpdatePosition.js +1 -2
- package/src/core/projectNativePath.js +30 -23
- package/src/core/redrawPath.js +11 -6
- package/src/core/removeLayer.js +23 -20
- package/src/core/setRotation.js +12 -5
- package/src/core/tooltipGetEvents.js +5 -1
- package/src/core/tooltipSetPosition.js +5 -2
- package/src/core/updateGridOpacity.js +2 -1
- package/src/core/whenReady.js +11 -8
- package/src/geometry/README.md +29 -0
- package/src/geometry/addBridges.js +30 -28
- package/src/geometry/addGeneratedTriangle.js +7 -3
- package/src/geometry/appendAreaTriangle.js +32 -17
- package/src/geometry/appendNativeTriangle.js +17 -3
- package/src/geometry/appendRouteDash.js +33 -15
- package/src/geometry/appendRouteSegment.js +28 -15
- package/src/geometry/assembleAreaGeometry.js +48 -41
- package/src/geometry/boundsQuad.js +8 -0
- package/src/geometry/box.js +10 -0
- package/src/geometry/bridgeEdge.js +18 -11
- package/src/geometry/bridgeElevation.js +8 -1
- package/src/geometry/bridgeFaces.js +22 -15
- package/src/geometry/bridgePaths.js +19 -11
- package/src/geometry/bridgePolygon.js +37 -31
- package/src/geometry/bridgeSides.js +18 -11
- package/src/geometry/buildGeometryParts.js +7 -0
- package/src/geometry/buildProjectedPoint.js +32 -21
- package/src/geometry/buildProjectedPolygon.js +34 -25
- package/src/geometry/circleAt.js +18 -5
- package/src/geometry/circleGeometry.js +41 -35
- package/src/geometry/clipLine.js +8 -1
- package/src/geometry/clipSegment.js +9 -0
- package/src/geometry/computeBounds.js +5 -2
- package/src/geometry/conformModelToTerrain.js +6 -3
- package/src/geometry/createLampRing.js +8 -0
- package/src/geometry/createModelGeometry.js +44 -34
- package/src/geometry/createRasterQuadGeometry.js +7 -1
- package/src/geometry/createTreeRing.js +8 -1
- package/src/geometry/crossVector.js +15 -7
- package/src/geometry/dashValues.js +23 -14
- package/src/geometry/dashedSegment.js +33 -21
- package/src/geometry/disk.js +9 -0
- package/src/geometry/diskAt.js +16 -4
- package/src/geometry/emitter.js +18 -8
- package/src/geometry/fillNativePolygon.js +28 -20
- package/src/geometry/generateTreeGeometry.js +15 -9
- package/src/geometry/indexBridge.js +34 -28
- package/src/geometry/instanceAreaGeometry.js +37 -31
- package/src/geometry/interpolateRoute.js +10 -2
- package/src/geometry/lampPostGeometry.js +9 -2
- package/src/geometry/lightGeometry.js +9 -2
- package/src/geometry/line.js +28 -21
- package/src/geometry/lineJoin.js +35 -26
- package/src/geometry/markerImageBounds.js +20 -11
- package/src/geometry/markerQuadCorners.js +9 -3
- package/src/geometry/meshShadowBounds.js +33 -24
- package/src/geometry/nativeGeometry.js +9 -1
- package/src/geometry/offsetBelowGround.js +10 -3
- package/src/geometry/polygon.js +7 -0
- package/src/geometry/quad.js +23 -9
- package/src/geometry/restoreGeometry.js +29 -23
- package/src/geometry/roofCoverage.js +29 -22
- package/src/geometry/roofFootprint.js +36 -28
- package/src/geometry/routeGeometry.js +7 -2
- package/src/geometry/samePoint.js +11 -3
- package/src/geometry/segment.js +32 -23
- package/src/geometry/setVertexColor.js +1 -1
- package/src/geometry/shadowBounds.js +8 -0
- package/src/geometry/subtractRoofTile.js +28 -19
- package/src/geometry/subtractVector.js +8 -0
- package/src/geometry/surface.js +11 -1
- package/src/geometry/terrainBuffers.js +33 -26
- package/src/geometry/terrainGrid.js +7 -2
- package/src/geometry/terrainTileGeometry.js +24 -15
- package/src/geometry/treeGeometry.js +7 -4
- package/src/geometry/triangle.js +11 -0
- package/src/geometry/validateTree.js +19 -7
- package/src/geometry/vertexNormals.js +8 -2
- package/src/geometry/visitNativeCoordinates.js +7 -0
- package/src/globals/CELL.js +6 -2
- package/src/globals/Compass.js +5 -0
- package/src/globals/ContainerResize.js +5 -0
- package/src/globals/HEIGHT.js +5 -0
- package/src/globals/L.js +6 -1
- package/src/globals/PitchDrag.js +5 -0
- package/src/globals/README.md +28 -0
- package/src/globals/ShiftRotate.js +5 -0
- package/src/globals/TILE_RADIUS.js +5 -0
- package/src/globals/TILE_SIZE.js +5 -0
- package/src/globals/TouchMode.js +5 -0
- package/src/globals/alphaBlend.js +5 -0
- package/src/globals/archiveDecoder.js +5 -0
- package/src/globals/archiveNorthWest.js +5 -0
- package/src/globals/archiveSouthEast.js +5 -0
- package/src/globals/atmosphereColor.js +5 -0
- package/src/globals/atmosphereStops.js +5 -0
- package/src/globals/blobParts.js +5 -0
- package/src/globals/cameraAngles.js +5 -0
- package/src/globals/cameraAnimatedOptions.js +5 -0
- package/src/globals/cameraAnimationFrame.js +5 -0
- package/src/globals/cameraAnimations.js +5 -0
- package/src/globals/cameraBearingSensitivity.js +5 -0
- package/src/globals/cameraDragSensitivity.js +5 -0
- package/src/globals/cameraDrags.js +5 -0
- package/src/globals/cameraEmptyOptions.js +5 -0
- package/src/globals/cameraFocusOptions.js +5 -0
- package/src/globals/cameraFov.js +8 -3
- package/src/globals/cameraListenerOptions.js +5 -0
- package/src/globals/cameraTouchStates.js +5 -0
- package/src/globals/cameraZeroPadding.js +5 -0
- package/src/globals/cogTags.js +6 -1
- package/src/globals/colorLayout.js +5 -0
- package/src/globals/colorTexture.js +11 -6
- package/src/globals/coreEventTypes.js +5 -0
- package/src/globals/coreMatrixKeys.js +5 -0
- package/src/globals/coreQuadIndices.js +5 -0
- package/src/globals/coreQuadUV.js +5 -0
- package/src/globals/coreSampler.js +5 -0
- package/src/globals/coreWhite.js +5 -0
- package/src/globals/cosObliquity.js +8 -3
- package/src/globals/coverageTiles.js +5 -0
- package/src/globals/dark.js +5 -0
- package/src/globals/defaultMaterial.js +5 -0
- package/src/globals/degrees.js +6 -1
- package/src/globals/demBuffer.js +5 -0
- package/src/globals/demLayout.js +5 -0
- package/src/globals/demSize.js +5 -0
- package/src/globals/demTarget.js +5 -0
- package/src/globals/demTexture.js +5 -0
- package/src/globals/depthBindGroup.js +5 -0
- package/src/globals/depthTexture.js +5 -0
- package/src/globals/directoryReader.js +5 -0
- package/src/globals/disabledShadow.js +5 -0
- package/src/globals/drawEntries.js +5 -0
- package/src/globals/drawFrameEntry.js +5 -0
- package/src/globals/drawMeshEntry.js +5 -0
- package/src/globals/drawSamplerEntries.js +5 -0
- package/src/globals/drawTerrainEntry.js +5 -0
- package/src/globals/drawTextureEntries.js +5 -0
- package/src/globals/earthCirc.js +6 -1
- package/src/globals/elevationWGSL.js +2 -0
- package/src/globals/fragmentShader.js +5 -0
- package/src/globals/frameBuffer.js +5 -0
- package/src/globals/frameCommands.js +5 -0
- package/src/globals/frameLayoutEntry.js +5 -0
- package/src/globals/geometryDecoder.js +5 -0
- package/src/globals/geometryEmpty.js +5 -0
- package/src/globals/geometryImageOptions.js +5 -0
- package/src/globals/geometryPixelStates.js +5 -0
- package/src/globals/geometryQuaternion.js +5 -0
- package/src/globals/geometryScale.js +5 -0
- package/src/globals/geometrySemantics.js +5 -0
- package/src/globals/geometryTranslation.js +5 -0
- package/src/globals/geometryWorkerUrl.js +8 -3
- package/src/globals/glass.js +5 -0
- package/src/globals/gridEvents.js +5 -0
- package/src/globals/gridFadeFrame.js +5 -0
- package/src/globals/halfRadians.js +6 -1
- package/src/globals/headerBounds.js +5 -0
- package/src/globals/headerFlags.js +5 -0
- package/src/globals/headerOffsets.js +5 -0
- package/src/globals/headlight.js +5 -0
- package/src/globals/hull.js +5 -0
- package/src/globals/instanceLayout.js +5 -0
- package/src/globals/lampDirections.js +13 -8
- package/src/globals/layerControlAddItem.js +8 -3
- package/src/globals/layerProto.js +5 -0
- package/src/globals/leafletLayer.js +8 -3
- package/src/globals/lightScale.js +6 -1
- package/src/globals/limbs.js +5 -1
- package/src/globals/loading.js +5 -0
- package/src/globals/mapMethods.js +5 -0
- package/src/globals/markerMethods.js +5 -0
- package/src/globals/markerPanFrame.js +5 -0
- package/src/globals/meshBindGroup.js +5 -0
- package/src/globals/meshBuffer.js +5 -0
- package/src/globals/meshCopySize.js +5 -0
- package/src/globals/meshImage.js +5 -0
- package/src/globals/meshLayoutEntry.js +5 -0
- package/src/globals/meshOffsets.js +5 -0
- package/src/globals/meshPipeline.js +5 -0
- package/src/globals/meshStack.js +5 -0
- package/src/globals/meshTarget.js +5 -0
- package/src/globals/moves.js +5 -1
- package/src/globals/mvtTextDecoder.js +6 -1
- package/src/globals/nativeMethodHandlers.js +5 -0
- package/src/globals/nativeScalableStyleKeys.js +6 -1
- package/src/globals/nextId.js +5 -0
- package/src/globals/normalLayout.js +5 -0
- package/src/globals/paints.js +5 -0
- package/src/globals/parts.js +5 -0
- package/src/globals/pendingGridFades.js +5 -0
- package/src/globals/pendingInitializations.js +5 -0
- package/src/globals/pendingMapChanges.js +5 -0
- package/src/globals/pendingMarkerPan.js +5 -0
- package/src/globals/pendingPlacements.js +5 -0
- package/src/globals/pendingRasterLoads.js +5 -0
- package/src/globals/pendingUpdates.js +5 -0
- package/src/globals/pendingZoomAnimations.js +5 -0
- package/src/globals/pipelineLayout.js +5 -0
- package/src/globals/popupEvents.js +5 -0
- package/src/globals/popupPan.js +5 -0
- package/src/globals/popupPosition.js +5 -0
- package/src/globals/positionLayout.js +5 -0
- package/src/globals/programEntries.js +5 -0
- package/src/globals/programLayout.js +5 -0
- package/src/globals/radians.js +5 -0
- package/src/globals/rasterBuffer.js +5 -0
- package/src/globals/rasterIndices.js +5 -0
- package/src/globals/rasterNormals.js +5 -0
- package/src/globals/rasterPoint.js +5 -0
- package/src/globals/rasterPositions.js +5 -0
- package/src/globals/rasterSampler.js +5 -0
- package/src/globals/rasterTexture.js +5 -0
- package/src/globals/rasterUVs.js +5 -0
- package/src/globals/removeLayer.js +5 -0
- package/src/globals/renderEmpty.js +5 -0
- package/src/globals/ringDirections.js +5 -0
- package/src/globals/roofBindGroup.js +5 -0
- package/src/globals/roofBlitSampler.js +5 -0
- package/src/globals/roofBuffer.js +5 -0
- package/src/globals/roofCommands.js +5 -0
- package/src/globals/roofCopySize.js +5 -0
- package/src/globals/roofImage.js +5 -0
- package/src/globals/roofMin.js +5 -0
- package/src/globals/roofOpacities.js +5 -0
- package/src/globals/roofPass.js +5 -0
- package/src/globals/roofPipeline.js +5 -0
- package/src/globals/roofSampler.js +5 -0
- package/src/globals/roofShader.js +5 -0
- package/src/globals/roofSignatures.js +5 -0
- package/src/globals/roofSize.js +5 -0
- package/src/globals/roofTarget.js +5 -0
- package/src/globals/roofTexture.js +5 -0
- package/src/globals/roofTiles.js +5 -0
- package/src/globals/roundProfile.js +5 -0
- package/src/globals/samplerLayoutEntries.js +5 -0
- package/src/globals/sceneCleanupFields.js +5 -0
- package/src/globals/sceneEmptyOptions.js +5 -0
- package/src/globals/scenePass.js +5 -0
- package/src/globals/sceneSunlightUniforms.js +5 -0
- package/src/globals/sceneTransferFields.js +5 -0
- package/src/globals/sceneWalkHandlers.js +5 -0
- package/src/globals/shadowBindGroup.js +5 -0
- package/src/globals/shadowBounds.js +5 -0
- package/src/globals/shadowCamera.js +5 -0
- package/src/globals/shadowDepthLayout.js +5 -0
- package/src/globals/shadowHigh.js +5 -0
- package/src/globals/shadowInstanceLayouts.js +5 -0
- package/src/globals/shadowLayouts.js +5 -0
- package/src/globals/shadowLow.js +5 -0
- package/src/globals/shadowMeshLayout.js +5 -0
- package/src/globals/shadowOffsets.js +5 -0
- package/src/globals/shadowPass.js +5 -0
- package/src/globals/shadowPipeline.js +5 -0
- package/src/globals/shadowPipelineLayout.js +5 -0
- package/src/globals/shadowShader.js +5 -0
- package/src/globals/shadowTexture.js +5 -0
- package/src/globals/shadowValues.js +5 -0
- package/src/globals/shirt.js +5 -0
- package/src/globals/sinObliquity.js +8 -3
- package/src/globals/sizes.js +5 -0
- package/src/globals/skin.js +5 -0
- package/src/globals/speed.js +5 -1
- package/src/globals/sunBindGroup.js +5 -0
- package/src/globals/taillight.js +5 -0
- package/src/globals/tau.js +6 -1
- package/src/globals/terrainLayoutEntry.js +5 -0
- package/src/globals/textureLayoutEntries.js +5 -0
- package/src/globals/tiledBounds.js +5 -0
- package/src/globals/tooltipEvents.js +5 -0
- package/src/globals/tooltipPosition.js +5 -0
- package/src/globals/trafficClocks.js +5 -0
- package/src/globals/trafficEmptyList.js +5 -0
- package/src/globals/trafficEmptyOptions.js +5 -0
- package/src/globals/trafficRouteMaterial.js +5 -0
- package/src/globals/trafficShader.js +5 -1
- package/src/globals/triangleContexts.js +5 -0
- package/src/globals/trousers.js +5 -0
- package/src/globals/types.js +5 -0
- package/src/globals/tyre.js +5 -0
- package/src/globals/uVLayout.js +5 -0
- package/src/globals/vectorStyleNamedColors.js +13 -8
- package/src/globals/vectorTileEvents.js +6 -1
- package/src/globals/vehicles.js +2 -0
- package/src/globals/vertexShader.js +5 -0
- package/src/globals/wantedTiles.js +5 -0
- package/src/globals/white.js +5 -0
- package/src/globals/workerCogSource.js +6 -1
- package/src/gpu/README.md +29 -0
- package/src/gpu/initializeRendererResources.js +39 -34
- package/src/gpu/initializeSharedRenderer.js +51 -44
- package/src/gpu/mountRenderer.js +25 -19
- package/src/gpu/releaseRenderer.js +8 -0
- package/src/gpu/rendererDeviceError.js +5 -3
- package/src/gpu/rendererDeviceLost.js +5 -3
- package/src/gpu/reportShaderCompilation.js +8 -0
- package/src/gpu/requestAdapter.js +8 -0
- package/src/gpu/requestDevice.js +9 -0
- package/src/gpu/showWebGPUWarning.js +5 -0
- package/src/index.js +0 -2
- package/src/layer-controls/README.md +25 -0
- package/src/layer-controls/layerControlInputId.js +18 -11
- package/src/layer-controls/layerCountTitle.js +16 -6
- package/src/layer-controls/placeEntry.js +9 -0
- package/src/layer-controls/placeEntryElement.js +29 -22
- package/src/layer-controls/placeUnderEntry.js +7 -0
- package/src/layer-controls/removeEntry.js +1 -0
- package/src/layer-controls/renderLayerCount.js +28 -20
- package/src/layer-controls/replaceEntry.js +1 -2
- package/src/layer-controls/runPlacements.js +1 -2
- package/src/layer-controls/underEntry.js +6 -2
- package/src/layer-controls/updateLayerCount.js +5 -1
- package/src/lighting/README.md +28 -0
- package/src/lighting/cacheLightGrid.js +9 -1
- package/src/lighting/collectLightMeshes.js +7 -1
- package/src/lighting/lightGrid.js +10 -1
- package/src/lighting/updatePointLights.js +7 -3
- package/src/lighting/visitLightCells.js +26 -13
- package/src/lighting/visitLightGridCells.js +11 -0
- package/src/lighting/worldLights.js +8 -1
- package/src/lighting/writeLightCell.js +14 -5
- package/src/materials/README.md +28 -0
- package/src/materials/createProgram.js +8 -4
- package/src/materials/createProgramLayout.js +44 -36
- package/src/materials/createProgramUniforms.js +25 -18
- package/src/materials/modelMaterialFor.js +29 -21
- package/src/materials/prepareMeshCutout.js +21 -12
- package/src/materials/terrainRasterProgram.js +57 -50
- package/src/materials/validateRoofMaterial.js +17 -10
- package/src/models/README.md +27 -0
- package/src/models/applyModelTransform.js +16 -12
- package/src/models/buildModelNodes.js +24 -14
- package/src/models/createModelContext.js +24 -15
- package/src/models/decodeModel.js +13 -2
- package/src/models/hasUnsupportedPrimitives.js +7 -0
- package/src/models/loadBuffer.js +16 -6
- package/src/models/loadModel.js +10 -7
- package/src/models/loadModelResources.js +22 -14
- package/src/models/modelNode.js +11 -1
- package/src/models/normalizeAccessor.js +21 -11
- package/src/models/prepareModel.js +29 -19
- package/src/models/prepareModelGeometry.js +35 -25
- package/src/models/prepareModelPrimitive.js +25 -17
- package/src/models/readAccessor.js +10 -4
- package/src/models/readAccessorValue.js +16 -7
- package/src/models/readAccessorValues.js +17 -0
- package/src/models/readModelAttributes.js +32 -20
- package/src/models/readModelIndices.js +28 -16
- package/src/models/readSparseAccessor.js +31 -19
- package/src/models/releaseModelResources.js +15 -10
- package/src/mvt/README.md +28 -0
- package/src/mvt/addMvtCrossings.js +23 -17
- package/src/mvt/appendMvtBandTriangles.js +42 -31
- package/src/mvt/appendMvtCoordinates.js +20 -11
- package/src/mvt/appendMvtPolygonTriangles.js +29 -19
- package/src/mvt/beginMvtPath.js +19 -9
- package/src/mvt/closeMvtPath.js +16 -7
- package/src/mvt/collectMvtEdges.js +29 -19
- package/src/mvt/createMvtReader.js +14 -7
- package/src/mvt/decodeVectorTile.js +39 -32
- package/src/mvt/expectMvtWire.js +11 -3
- package/src/mvt/finishMvtPath.js +14 -5
- package/src/mvt/finiteMvtCoordinate.js +14 -7
- package/src/mvt/groupMvtPolygons.js +35 -25
- package/src/mvt/isMvtFallbackError.js +13 -6
- package/src/mvt/mergeMvtActiveEdges.js +18 -9
- package/src/mvt/mvtEdgeX.js +12 -4
- package/src/mvt/mvtPathsVertices.js +15 -8
- package/src/mvt/mvtPolygonPaths.js +19 -12
- package/src/mvt/numericMvtValue.js +11 -4
- package/src/mvt/readMvtFeature.js +46 -34
- package/src/mvt/readMvtField.js +17 -8
- package/src/mvt/readMvtGeometry.js +42 -29
- package/src/mvt/readMvtInteger.js +22 -12
- package/src/mvt/readMvtKnownValue.js +30 -21
- package/src/mvt/readMvtLayer.js +40 -31
- package/src/mvt/readMvtMessage.js +18 -10
- package/src/mvt/readMvtNumber.js +18 -9
- package/src/mvt/readMvtNumbers.js +18 -11
- package/src/mvt/readMvtString.js +14 -6
- package/src/mvt/readMvtValue.js +29 -19
- package/src/mvt/skipMvtField.js +22 -14
- package/src/mvt/sortMvtActiveEdges.js +20 -15
- package/src/mvt/sortedMvtLevels.js +29 -22
- package/src/mvt/takeMvtBytes.js +18 -8
- package/src/mvt/tessellateVectorRings.js +26 -19
- package/src/mvt/triangulateVectorRings.js +23 -19
- package/src/native/README.md +27 -0
- package/src/native/beforeNativeRender.js +21 -16
- package/src/native/bypassNativeEvent.js +21 -11
- package/src/native/canScaleNativeStyle.js +26 -17
- package/src/native/compareNativeHits.js +10 -2
- package/src/native/createNativeMesh.js +46 -31
- package/src/native/disposeNativeLayer.js +3 -2
- package/src/native/forwardNativeError.js +8 -3
- package/src/native/getGridTerrainTile.js +47 -34
- package/src/native/gridTerrainElevation.js +34 -26
- package/src/native/handleNativeMapEvent.js +9 -4
- package/src/native/hideTargets.js +6 -0
- package/src/native/initNativeGPU.js +6 -3
- package/src/native/isCurrentNativeLayer.js +9 -4
- package/src/native/loadGridTerrain.js +36 -26
- package/src/native/nativeAddLatLng.js +7 -0
- package/src/native/nativeBringToBack.js +7 -0
- package/src/native/nativeBringToFront.js +7 -0
- package/src/native/nativeEventSource.js +27 -18
- package/src/native/nativeEvents.js +5 -4
- package/src/native/nativeLayer.js +10 -6
- package/src/native/nativeLayerMethod.js +9 -2
- package/src/native/nativeProgram.js +28 -20
- package/src/native/nativeRedraw.js +7 -0
- package/src/native/nativeSetBounds.js +7 -0
- package/src/native/nativeSetIcon.js +7 -0
- package/src/native/nativeSetLatLng.js +7 -0
- package/src/native/nativeSetLatLngs.js +7 -0
- package/src/native/nativeSetOpacity.js +7 -0
- package/src/native/nativeSetRadius.js +7 -0
- package/src/native/nativeSetStyle.js +7 -0
- package/src/native/nativeSetUrl.js +7 -0
- package/src/native/nativeSetZIndex.js +7 -0
- package/src/native/nativeSetZIndexOffset.js +7 -0
- package/src/native/nativeTerrainElevation.js +27 -16
- package/src/native/nativeVectorGeometry.js +30 -23
- package/src/native/orderNativeGridLayer.js +20 -14
- package/src/native/prepareGridTerrainRequests.js +23 -16
- package/src/native/pruneNativeResources.js +25 -20
- package/src/native/putNativeMesh.js +14 -0
- package/src/native/quadNativeMesh.js +11 -1
- package/src/native/readyNativeGPU.js +10 -6
- package/src/native/refreshNativeEvent.js +5 -0
- package/src/native/refreshNativeLayer.js +5 -3
- package/src/native/refreshNativeLayerContract.js +5 -2
- package/src/native/rejectNativeReady.js +7 -2
- package/src/native/removeNativeEvents.js +18 -14
- package/src/native/removeTargets.js +5 -2
- package/src/native/reorderNativeLayer.js +5 -3
- package/src/native/resolveNativeReady.js +5 -2
- package/src/native/restoreNativeEvents.js +8 -5
- package/src/native/retainGridTerrain.js +15 -10
- package/src/native/styleNativeMesh.js +17 -11
- package/src/native/syncGridLayer.js +5 -1
- package/src/native/syncGridTile.js +28 -18
- package/src/native/syncImageOverlay.js +10 -5
- package/src/native/syncMarker.js +5 -0
- package/src/native/syncNativeStrokeAnchors.js +18 -12
- package/src/native/syncNativeStrokeZoom.js +34 -29
- package/src/native/syncTerrainGridTile.js +38 -28
- package/src/native/syncVectorLayer.js +5 -0
- package/src/native/synchronizeNativeLayer.js +5 -3
- package/src/native/terrainGridMesh.js +47 -34
- package/src/native/updateNativeHover.js +15 -7
- package/src/native/updateNativeLayerView.js +3 -3
- package/src/native/updateNativeStrokeRadius.js +14 -9
- package/src/picking/README.md +29 -0
- package/src/picking/collectVisibleMesh.js +8 -0
- package/src/picking/findFeature.js +4 -4
- package/src/picking/hit.js +14 -7
- package/src/picking/hitColliderCell.js +29 -19
- package/src/picking/hitMesh.js +8 -2
- package/src/picking/onClick.js +6 -5
- package/src/picking/onPointerLeave.js +5 -5
- package/src/picking/onPointerMove.js +6 -5
- package/src/picking/pointerClick.js +5 -0
- package/src/picking/pointerLeave.js +1 -0
- package/src/picking/pointerMove.js +5 -0
- package/src/picking/raycast.js +2 -4
- package/src/picking/setHighlight.js +6 -5
- package/src/picking/shouldSkipOther.js +8 -2
- package/src/picking/showFeature.js +7 -4
- package/src/picking/validateCameraInverse.js +15 -8
- package/src/projections/README.md +28 -0
- package/src/projections/cameraAngles.js +8 -1
- package/src/projections/displayContainerPoint.js +32 -23
- package/src/projections/groundBounds.js +9 -1
- package/src/projections/localPixel.js +8 -0
- package/src/projections/localPixelForGeometry.js +8 -1
- package/src/projections/localPosition.js +8 -2
- package/src/projections/markerCameraIconPoint.js +9 -1
- package/src/projections/projectBridgePoint.js +16 -4
- package/src/projections/projectCameraPoint.js +11 -1
- package/src/projections/projectCelestialBody.js +11 -2
- package/src/projections/projectRing.js +11 -1
- package/src/projections/projectTreePoint.js +9 -1
- package/src/projections/toPoint.js +12 -4
- package/src/projections/transformZoomAnimationPoint.js +16 -9
- package/src/projections/verticalGroundY.js +14 -3
- package/src/projections/walkerLocalPosition.js +7 -0
- package/src/raster/README.md +28 -0
- package/src/raster/addRasterTile.js +10 -2
- package/src/raster/comparePendingTiles.js +8 -0
- package/src/raster/createRasterMesh.js +6 -5
- package/src/raster/finishRasterAttachment.js +9 -4
- package/src/raster/finishRasterTile.js +11 -2
- package/src/raster/getRasterEvents.js +7 -0
- package/src/raster/getRasterTileSize.js +5 -1
- package/src/raster/initRaster.js +6 -3
- package/src/raster/isRasterLoading.js +7 -3
- package/src/raster/loadRasterTile.js +8 -3
- package/src/raster/onPMTileAdd.js +6 -3
- package/src/raster/onPMTileRemove.js +6 -3
- package/src/raster/pruneRasterTiles.js +7 -3
- package/src/raster/pumpRasterTiles.js +5 -4
- package/src/raster/rasterTileRange.js +32 -23
- package/src/raster/readyRaster.js +8 -3
- package/src/raster/registerTerrainTile.js +9 -3
- package/src/raster/releaseRasterTile.js +6 -3
- package/src/raster/releaseRasterTiles.js +5 -3
- package/src/raster/removeRasterTile.js +6 -3
- package/src/raster/reportRasterError.js +8 -0
- package/src/raster/retainRasterTiles.js +19 -14
- package/src/raster/setPMTileOpacity.js +8 -0
- package/src/raster/setPMTileZIndex.js +8 -0
- package/src/raster/setRasterOpacity.js +6 -3
- package/src/raster/setRasterTerrain.js +6 -3
- package/src/raster/setRasterZIndex.js +6 -3
- package/src/raster/updateAttachedTiles.js +9 -3
- package/src/raster/updateRasterTiles.js +5 -5
- package/src/rendering/README.md +32 -0
- package/src/rendering/collectFrameMeshes.js +7 -3
- package/src/rendering/collectMeshes.js +11 -0
- package/src/rendering/collectVisibleMesh.js +48 -39
- package/src/rendering/compareMeshDepth.js +14 -6
- package/src/rendering/compareMeshes.js +10 -1
- package/src/rendering/createMesh.js +8 -5
- package/src/rendering/disposeMesh.js +6 -0
- package/src/rendering/drawGeometry.js +9 -2
- package/src/rendering/drawPipeline.js +44 -34
- package/src/rendering/drawSceneMeshes.js +9 -3
- package/src/rendering/nativeStrokeExpansion.js +11 -4
- package/src/rendering/prepareFrameBuffer.js +22 -16
- package/src/rendering/prepareFrameMeshes.js +10 -3
- package/src/rendering/prepareFrameUniforms.js +8 -3
- package/src/rendering/prepareMeshUniforms.js +36 -27
- package/src/rendering/render.js +2 -5
- package/src/rendering/resizeRenderer.js +6 -3
- package/src/rendering/revealRoofMesh.js +43 -34
- package/src/scene/README.md +36 -0
- package/src/scene/addRegisteredLayer.js +5 -4
- package/src/scene/addSceneLayer.js +22 -16
- package/src/scene/attachLayer.js +8 -3
- package/src/scene/attachSharedScene.js +6 -1
- package/src/scene/callLayer.js +31 -25
- package/src/scene/cancelUpdate.js +5 -3
- package/src/scene/createLayer.js +12 -6
- package/src/scene/createSceneNode.js +5 -1
- package/src/scene/emptyEvents.js +5 -0
- package/src/scene/failAttachment.js +9 -3
- package/src/scene/get3DEvents.js +7 -3
- package/src/scene/getLocation.js +10 -6
- package/src/scene/init3D.js +6 -3
- package/src/scene/initializeLayer.js +9 -2
- package/src/scene/initializerFor.js +8 -0
- package/src/scene/isNativeLayer.js +17 -11
- package/src/scene/layerInitialize.js +7 -4
- package/src/scene/onAdd3DLayer.js +6 -4
- package/src/scene/onMapChange.js +0 -5
- package/src/scene/onRemove3DLayer.js +6 -5
- package/src/scene/ready3D.js +9 -3
- package/src/scene/releaseSharedScene.js +6 -2
- package/src/scene/removeLayerEvents.js +1 -3
- package/src/scene/removeSceneLayer.js +20 -14
- package/src/scene/renderPendingMapChange.js +1 -4
- package/src/scene/renderPendingUpdates.js +5 -4
- package/src/scene/reportLayerError.js +9 -3
- package/src/scene/resolveNextInitialization.js +5 -2
- package/src/scene/restoreObject.js +6 -3
- package/src/scene/scheduleSceneUpdate.js +7 -6
- package/src/scene/setParent.js +6 -2
- package/src/scene/traverse.js +7 -2
- package/src/shaders/README.md +29 -0
- package/src/shaders/materialBaseShader.js +26 -17
- package/src/shaders/materialShaders.js +9 -1
- package/src/shaders/materialSurfaceShader.js +60 -47
- package/src/shaders/materialVertexShader.js +89 -77
- package/src/shaders/nativeStrokeShader.js +13 -6
- package/src/shaders/roofVertexShader.js +16 -9
- package/src/shadows/README.md +28 -0
- package/src/shadows/bindSunlight.js +5 -3
- package/src/shadows/drawShadowMeshes.js +7 -2
- package/src/shadows/ensureShadowPipeline.js +7 -0
- package/src/shadows/renderSunlight.js +8 -4
- package/src/shadows/resizeSunlight.js +6 -3
- package/src/shadows/shadowCacheMatches.js +11 -1
- package/src/shadows/shadowMatrix.js +8 -1
- package/src/shadows/shadowMeshMatches.js +19 -11
- package/src/sources/README.md +33 -0
- package/src/sources/attachAreaMesh.js +5 -4
- package/src/sources/buildArea.js +13 -2
- package/src/sources/buildAreaFeature.js +7 -1
- package/src/sources/buildAreaFeatures.js +23 -14
- package/src/sources/compareAreaDistance.js +8 -0
- package/src/sources/extrusionStyle.js +21 -10
- package/src/sources/featureAnchor.js +21 -9
- package/src/sources/groundOffset.js +9 -2
- package/src/sources/initVectorTiles.js +21 -15
- package/src/sources/initializeGeoJSON.js +6 -3
- package/src/sources/isVectorTileSource.js +11 -4
- package/src/sources/matchesAreaTile.js +17 -7
- package/src/sources/pendingSourceAreas.js +26 -19
- package/src/sources/prepareAreaGeometryJob.js +34 -24
- package/src/sources/projectAreaPolygons.js +25 -15
- package/src/sources/pumpSourceAreas.js +6 -6
- package/src/sources/readyVectorTiles.js +17 -10
- package/src/sources/releaseArea.js +6 -4
- package/src/sources/setGeoJSONData.js +8 -3
- package/src/sources/setGeoJSONLayerData.js +7 -0
- package/src/sources/sourceAreaContext.js +9 -2
- package/src/sources/updateArea.js +5 -5
- package/src/sources/updateSourceStatus.js +6 -3
- package/src/sunlight/README.md +28 -0
- package/src/sunlight/addTimeControlToMap.js +17 -10
- package/src/sunlight/addTimeLayer.js +10 -5
- package/src/sunlight/atmosphere.js +9 -2
- package/src/sunlight/createSun.js +7 -0
- package/src/sunlight/initSunlight.js +5 -0
- package/src/sunlight/initializeTimeControl.js +15 -13
- package/src/sunlight/onAddSun.js +35 -26
- package/src/sunlight/onAddTimeControl.js +12 -5
- package/src/sunlight/onRemoveSun.js +10 -10
- package/src/sunlight/removeSun.js +22 -20
- package/src/sunlight/removeTimeControl.js +13 -7
- package/src/sunlight/removeTimeLayer.js +8 -5
- package/src/sunlight/requestSunlightRender.js +10 -7
- package/src/sunlight/styleTimeControl.js +13 -7
- package/src/sunlight/tickSun.js +10 -5
- package/src/sunlight/updateCelestialDisc.js +23 -12
- package/src/sunlight/updateSky.js +5 -3
- package/src/sunlight/updateSun.js +42 -40
- package/src/sunlight/useLiveTime.js +11 -6
- package/src/sunlight/useSelectedTime.js +24 -22
- package/src/terrain/README.md +30 -0
- package/src/terrain/applyTerrain.js +26 -20
- package/src/terrain/clearLayerTerrain.js +5 -3
- package/src/terrain/copyTerrainTile.js +20 -12
- package/src/terrain/getElevation.js +8 -5
- package/src/terrain/initTerrain.js +5 -3
- package/src/terrain/loadReadyTerrain.js +6 -5
- package/src/terrain/loadTerrain.js +10 -2
- package/src/terrain/loadTerrainTiles.js +10 -3
- package/src/terrain/mapElevationOf.js +19 -11
- package/src/terrain/onTerrainAdd.js +8 -4
- package/src/terrain/onTerrainChange.js +5 -5
- package/src/terrain/onTerrainRemove.js +6 -3
- package/src/terrain/readBridges.js +13 -4
- package/src/terrain/readyTerrainOf.js +14 -7
- package/src/terrain/sampleTerrainTile.js +16 -7
- package/src/terrain/setLayerTerrain.js +5 -3
- package/src/terrain/setTerrainHeight.js +5 -4
- package/src/terrain/terrainAtlas.js +8 -2
- package/src/terrain/terrainElevation.js +8 -2
- package/src/terrain/terrainTileQueue.js +31 -24
- package/src/textures/README.md +29 -0
- package/src/textures/addImageState.js +12 -7
- package/src/textures/attachRasterImage.js +1 -2
- package/src/textures/bindMeshTextures.js +57 -50
- package/src/textures/collectRoofTiles.js +21 -14
- package/src/textures/compareRoofTiles.js +8 -0
- package/src/textures/composeRoofAtlas.js +11 -3
- package/src/textures/destroyTexture.js +6 -4
- package/src/textures/destroyTextureAfterSubmission.js +9 -0
- package/src/textures/ensureRoofBlit.js +5 -0
- package/src/textures/loadModelImage.js +28 -18
- package/src/textures/modelTextureFor.js +45 -37
- package/src/textures/modelTextureSampler.js +7 -2
- package/src/textures/nativeImageError.js +5 -1
- package/src/textures/nativeImageRefresh.js +5 -2
- package/src/textures/nativeTextureFor.js +11 -3
- package/src/textures/prepareMeshTextures.js +31 -23
- package/src/textures/rebuildRoofAtlas.js +8 -3
- package/src/textures/removeImageState.js +11 -6
- package/src/textures/resizeRoofTexture.js +30 -23
- package/src/textures/restoreMaterialTextures.js +22 -16
- package/src/textures/textureBinding.js +9 -0
- package/src/textures/updateRoofAtlas.js +25 -19
- package/src/textures/updateRoofRaster.js +8 -0
- package/src/textures/uploadCanvasTexture.js +15 -0
- package/src/textures/uploadMeshTexture.js +32 -26
- package/src/textures/uploadNativeImage.js +26 -13
- package/src/textures/uploadRoofTile.js +29 -23
- package/src/traffic/README.md +30 -0
- package/src/traffic/addTraffic.js +5 -2
- package/src/traffic/clockMinutes.js +7 -0
- package/src/traffic/compareDepartures.js +8 -0
- package/src/traffic/createTrafficMesh.js +15 -4
- package/src/traffic/destroyTrafficGpu.js +5 -0
- package/src/traffic/disposeTrafficObject.js +14 -11
- package/src/traffic/drawTrafficRoute.js +5 -1
- package/src/traffic/failTraffic.js +12 -6
- package/src/traffic/failedTrafficLoad.js +9 -2
- package/src/traffic/featuresToTrafficLanes.js +8 -0
- package/src/traffic/fetchTrafficLanes.js +21 -10
- package/src/traffic/groundTraffic.js +5 -1
- package/src/traffic/initTraffic.js +17 -15
- package/src/traffic/loadTraffic.js +5 -0
- package/src/traffic/loadedTrafficLanes.js +19 -12
- package/src/traffic/locateTraffic.js +20 -11
- package/src/traffic/moveTraffic.js +21 -15
- package/src/traffic/placeTraffic.js +5 -0
- package/src/traffic/prepareTraffic.js +5 -3
- package/src/traffic/readyTraffic.js +8 -3
- package/src/traffic/rebaseTraffic.js +5 -3
- package/src/traffic/rebuildTrafficMesh.js +5 -1
- package/src/traffic/refreshTrafficTrips.js +42 -32
- package/src/traffic/removeTraffic.js +5 -2
- package/src/traffic/routeColor.js +13 -6
- package/src/traffic/scheduledTrips.js +5 -2
- package/src/traffic/startTraffic.js +10 -5
- package/src/traffic/tickTraffic.js +5 -3
- package/src/traffic/trafficBounds.js +5 -0
- package/src/traffic/trafficNow.js +14 -9
- package/src/traffic/trafficStatusText.js +13 -5
- package/src/traffic/trafficStorage.js +13 -5
- package/src/traffic/trafficTooltip.js +7 -0
- package/src/traffic/tripsAt.js +9 -2
- package/src/traffic/updateTraffic.js +11 -8
- package/src/traffic/updateTrafficLights.js +23 -18
- package/src/traffic/updateTrafficPose.js +15 -8
- package/src/traffic/updateTrafficTerrain.js +12 -7
- package/src/traffic/uploadTrafficLanes.js +27 -21
- package/src/traffic/vehicleOffsets.js +9 -3
- package/src/transforms/README.md +27 -0
- package/src/transforms/composeLocalTransform.js +23 -16
- package/src/transforms/modelNodeMatrix.js +7 -2
- package/src/transforms/transformNativePoint.js +19 -7
- package/src/transforms/updateWorldMatrix.js +5 -2
- package/src/transforms/worldMatrixChanged.js +26 -18
- package/src/triangulation/README.md +26 -0
- package/src/triangulation/area.js +7 -0
- package/src/triangulation/clean.js +9 -0
- package/src/triangulation/clipEars.js +32 -23
- package/src/triangulation/connectHole.js +30 -18
- package/src/triangulation/containsVertex.js +10 -0
- package/src/triangulation/cross.js +12 -3
- package/src/triangulation/crossesBoundary.js +10 -0
- package/src/triangulation/crossesRing.js +9 -0
- package/src/triangulation/equal.js +11 -3
- package/src/triangulation/inside.js +8 -0
- package/src/triangulation/insideHole.js +8 -0
- package/src/triangulation/intersects.js +21 -11
- package/src/triangulation/isClockWise.js +4 -1
- package/src/triangulation/mergeHoles.js +19 -11
- package/src/triangulation/minimumX.js +7 -0
- package/src/triangulation/on.js +13 -4
- package/src/triangulation/polygonRings.js +22 -14
- package/src/triangulation/sortHoles.js +7 -0
- package/src/triangulation/triangulate.js +3 -2
- package/src/triangulation/validateArea.js +19 -10
- package/src/utils/README.md +16 -0
- package/src/utils/compareDistance.js +11 -3
- package/src/utils/noOperation.js +1 -0
- package/src/utils/wrap.js +7 -0
- package/src/utils/yieldTask.js +12 -5
- package/src/vector-style/README.md +27 -0
- package/src/vector-style/appendQuotedStyleCharacter.js +30 -22
- package/src/vector-style/arrayContainsRange.js +18 -8
- package/src/vector-style/evaluateBoolean.js +31 -18
- package/src/vector-style/evaluateCoalesceOrCase.js +34 -21
- package/src/vector-style/evaluateComparison.js +29 -16
- package/src/vector-style/evaluateIExpression.js +21 -8
- package/src/vector-style/evaluateInput.js +16 -6
- package/src/vector-style/evaluateInterpolate.js +36 -27
- package/src/vector-style/evaluateMatch.js +21 -12
- package/src/vector-style/evaluateMath.js +26 -14
- package/src/vector-style/evaluateMembership.js +29 -18
- package/src/vector-style/evaluateNegation.js +26 -13
- package/src/vector-style/evaluatePrimitive.js +21 -9
- package/src/vector-style/evaluateStep.js +20 -11
- package/src/vector-style/evaluateStyle.js +43 -33
- package/src/vector-style/evaluateToExpression.js +27 -14
- package/src/vector-style/fillVectorPaint.js +26 -17
- package/src/vector-style/lineVectorPaint.js +31 -21
- package/src/vector-style/parseFunctionalColor.js +23 -14
- package/src/vector-style/parseHexColor.js +20 -13
- package/src/vector-style/parseVectorStyle.js +20 -13
- package/src/vector-style/readPaintValue.js +17 -6
- package/src/vector-style/removeTrailingCommas.js +19 -12
- package/src/vector-style/scaleDashArray.js +25 -13
- package/src/vector-style/skipStyleComment.js +20 -9
- package/src/vector-style/stripStyleComments.js +28 -21
- package/src/vector-style/styleColor.js +18 -11
- package/src/vector-style/validateVectorLayers.js +18 -10
- package/src/vector-style/vectorPaint.js +17 -8
- package/src/vector-style/visibleStyle.js +16 -7
- package/src/vector-tiles/README.md +30 -0
- package/src/vector-tiles/appendVectorBatch.js +34 -22
- package/src/vector-tiles/attachVectorTileBatch.js +25 -17
- package/src/vector-tiles/attachVectorTileBatches.js +26 -15
- package/src/vector-tiles/compareVectorLabelPriority.js +11 -3
- package/src/vector-tiles/compareVectorTileDistance.js +11 -3
- package/src/vector-tiles/configureVectorTileLayer.js +8 -0
- package/src/vector-tiles/createVectorLabel.js +37 -22
- package/src/vector-tiles/forwardVectorTileError.js +10 -5
- package/src/vector-tiles/loadVectorSprite.js +14 -5
- package/src/vector-tiles/loadVectorTile.js +45 -36
- package/src/vector-tiles/onVectorTileAdd.js +44 -39
- package/src/vector-tiles/onVectorTileMessage.js +15 -10
- package/src/vector-tiles/onVectorTileRemove.js +25 -20
- package/src/vector-tiles/onVectorTileWorkerError.js +16 -11
- package/src/vector-tiles/paintVectorTileBatch.js +18 -12
- package/src/vector-tiles/prepareVectorLabel.js +34 -25
- package/src/vector-tiles/prepareVectorStyleLayer.js +38 -30
- package/src/vector-tiles/prepareVectorTile.js +29 -16
- package/src/vector-tiles/projectVectorPaths.js +25 -15
- package/src/vector-tiles/projectVectorPoint.js +15 -6
- package/src/vector-tiles/projectVectorTriangles.js +28 -18
- package/src/vector-tiles/pruneVectorTiles.js +14 -11
- package/src/vector-tiles/pumpVectorTiles.js +21 -18
- package/src/vector-tiles/readTileJSON.js +27 -17
- package/src/vector-tiles/readVectorStyle.js +28 -17
- package/src/vector-tiles/refreshVectorTiles.js +8 -5
- package/src/vector-tiles/reserveVectorLabelCells.js +14 -6
- package/src/vector-tiles/retireVectorTileGroup.js +20 -13
- package/src/vector-tiles/revokeVectorWorkerUrl.js +14 -9
- package/src/vector-tiles/rotateVectorLabel.js +19 -12
- package/src/vector-tiles/rotateVectorLabels.js +9 -6
- package/src/vector-tiles/simplifyVectorPath.js +29 -21
- package/src/vector-tiles/updateVectorLabelMarker.js +36 -27
- package/src/vector-tiles/updateVectorLabelStyle.js +14 -8
- package/src/vector-tiles/updateVectorTileLabels.js +33 -28
- package/src/vector-tiles/updateVectorTilePaint.js +25 -20
- package/src/vector-tiles/updateVectorTiles.js +32 -29
- package/src/vector-tiles/validateVectorTileZooms.js +15 -6
- package/src/vector-tiles/vectorFeaturePaint.js +25 -15
- package/src/vector-tiles/vectorFeaturePaths.js +26 -16
- package/src/vector-tiles/vectorFeatureZoom.js +18 -8
- package/src/vector-tiles/vectorLabelAnchors.js +31 -24
- package/src/vector-tiles/vectorLabelCandidates.js +18 -11
- package/src/vector-tiles/vectorLabelCells.js +32 -23
- package/src/vector-tiles/vectorLabelIcon.js +38 -30
- package/src/vector-tiles/vectorLabelProperty.js +12 -3
- package/src/vector-tiles/vectorLabelText.js +19 -10
- package/src/vector-tiles/vectorSpriteIcon.js +19 -11
- package/src/vector-tiles/vectorStraightRun.js +23 -14
- package/src/vector-tiles/vectorStyleDependencies.js +22 -15
- package/src/vector-tiles/vectorStyleValue.js +16 -5
- package/src/vector-tiles/vectorStyleZoom.js +12 -6
- package/src/vector-tiles/vectorTileAwaited.js +17 -9
- package/src/vector-tiles/vectorTileOverlaps.js +12 -4
- package/src/vector-tiles/vectorTilePaint.js +18 -10
- package/src/vector-tiles/vectorTileSettings.js +27 -17
- package/src/vector-tiles/vectorTilesIdle.js +11 -3
- package/src/vector-tiles/vectorTolerance.js +11 -4
- package/src/vector-tiles/wrapVectorLabel.js +17 -11
- package/src/vehicles/README.md +27 -0
- package/src/vehicles/bicycleModel.js +7 -1
- package/src/vehicles/boatBenches.js +5 -0
- package/src/vehicles/boatModel.js +32 -32
- package/src/vehicles/buildCarriage.js +9 -1
- package/src/vehicles/busModel.js +10 -2
- package/src/vehicles/carModel.js +34 -33
- package/src/vehicles/metroModel.js +8 -0
- package/src/vehicles/mirrorVehiclePart.js +11 -0
- package/src/vehicles/pedestrianModel.js +7 -1
- package/src/vehicles/tramModel.js +8 -0
- package/src/walk/README.md +30 -0
- package/src/walk/animateWalker.js +5 -4
- package/src/walk/createWalk.js +6 -3
- package/src/walk/initWalk.js +5 -0
- package/src/walk/initializeWalkControl.js +11 -6
- package/src/walk/isWalkBlocked.js +15 -6
- package/src/walk/landWalker.js +35 -31
- package/src/walk/moveWalker.js +35 -22
- package/src/walk/onAddWalkControl.js +40 -31
- package/src/walk/onRemoveWalkControl.js +17 -12
- package/src/walk/onWalkBlur.js +3 -2
- package/src/walk/onWalkKey.js +5 -2
- package/src/walk/onWalkPointer.js +6 -0
- package/src/walk/onWalkTerrain.js +3 -2
- package/src/walk/placeWalker.js +1 -2
- package/src/walk/resolveWalkerPosition.js +33 -28
- package/src/walk/startWalking.js +1 -1
- package/src/walk/stepWalkerHeight.js +18 -11
- package/src/walk/stopWalking.js +1 -0
- package/src/walk/toggleWalking.js +3 -2
- package/src/walk/updateWalkerFrame.js +29 -19
- package/src/walk/updateWalkerView.js +31 -22
- package/src/weakmaps/README.md +33 -0
- package/src/weakmaps/addedByLayer.js +5 -0
- package/src/weakmaps/archiveHeaderByLayer.js +5 -0
- package/src/weakmaps/areasByLayer.js +5 -0
- package/src/weakmaps/boundsMethods.js +5 -0
- package/src/weakmaps/bridgeMeshByLayer.js +5 -0
- package/src/weakmaps/bridgesByLayer.js +5 -0
- package/src/weakmaps/cameraAnimationByMap.js +5 -0
- package/src/weakmaps/cameraBearingByMap.js +5 -0
- package/src/weakmaps/cameraByLayer.js +5 -0
- package/src/weakmaps/cameraDraggableByMap.js +5 -0
- package/src/weakmaps/cameraFields.js +5 -0
- package/src/weakmaps/cameraFrameByMap.js +5 -0
- package/src/weakmaps/cameraHandlersByMap.js +6 -1
- package/src/weakmaps/cameraMaps.js +5 -0
- package/src/weakmaps/cameraPitchByMap.js +5 -0
- package/src/weakmaps/cameraReadyByMap.js +5 -0
- package/src/weakmaps/cameraTouchStateByMap.js +5 -0
- package/src/weakmaps/cameraViewByMap.js +5 -0
- package/src/weakmaps/cameraZIndexOffsetByLayer.js +5 -0
- package/src/weakmaps/closestMethods.js +5 -0
- package/src/weakmaps/colliders.js +5 -0
- package/src/weakmaps/containerByLayer.js +5 -0
- package/src/weakmaps/controlByLayer.js +5 -0
- package/src/weakmaps/countStatusByLayer.js +5 -0
- package/src/weakmaps/cursorByLayer.js +5 -0
- package/src/weakmaps/demByLayer.js +5 -0
- package/src/weakmaps/directoriesByLayer.js +5 -0
- package/src/weakmaps/dragByHandler.js +5 -0
- package/src/weakmaps/dragStates.js +5 -0
- package/src/weakmaps/etagByLayer.js +5 -0
- package/src/weakmaps/eventMapByLayer.js +5 -0
- package/src/weakmaps/eventsByLayer.js +5 -0
- package/src/weakmaps/fadeFrameByLayer.js +5 -0
- package/src/weakmaps/fadeVersionByLayer.js +5 -0
- package/src/weakmaps/frameByLayer.js +5 -0
- package/src/weakmaps/geojsonByLayer.js +5 -0
- package/src/weakmaps/geometryWorkersByMap.js +6 -1
- package/src/weakmaps/gridInitializers.js +5 -0
- package/src/weakmaps/groupByLayer.js +5 -0
- package/src/weakmaps/headerByLayer.js +5 -0
- package/src/weakmaps/highlightedFeatureByLayer.js +5 -0
- package/src/weakmaps/hoveredFeatureByLayer.js +5 -0
- package/src/weakmaps/imageStates.js +5 -0
- package/src/weakmaps/inflightByLayer.js +5 -0
- package/src/weakmaps/kindByLayer.js +5 -0
- package/src/weakmaps/layersByLayer.js +5 -0
- package/src/weakmaps/loadingTilesByLayer.js +5 -0
- package/src/weakmaps/locationByLayer.js +5 -0
- package/src/weakmaps/modelByLayer.js +5 -0
- package/src/weakmaps/modelUrlByLayer.js +5 -0
- package/src/weakmaps/nativeEventMaps.js +5 -0
- package/src/weakmaps/nativeGPUBackByMap.js +5 -0
- package/src/weakmaps/nativeGPUByLayer.js +5 -0
- package/src/weakmaps/nativeGPUOrderByMap.js +5 -0
- package/src/weakmaps/nativeProgramsByRenderer.js +6 -1
- package/src/weakmaps/nativeRenderByLayer.js +5 -0
- package/src/weakmaps/pathProjectionByMap.js +6 -1
- package/src/weakmaps/pitchSkyByMap.js +5 -0
- package/src/weakmaps/pointerEventsByLayer.js +5 -0
- package/src/weakmaps/pruneAfterByLayer.js +5 -0
- package/src/weakmaps/pruneVersionByLayer.js +5 -0
- package/src/weakmaps/pruneWantedByLayer.js +5 -0
- package/src/weakmaps/queuedByLayer.js +5 -0
- package/src/weakmaps/rasterGeometryByLayer.js +5 -0
- package/src/weakmaps/rasterProgramByLayer.js +5 -0
- package/src/weakmaps/rasterTilesByLayer.js +5 -0
- package/src/weakmaps/rasterVersionByLayer.js +5 -0
- package/src/weakmaps/raycasterByLayer.js +5 -0
- package/src/weakmaps/readyByLayer.js +5 -0
- package/src/weakmaps/rendererByLayer.js +5 -0
- package/src/weakmaps/rendererDevices.js +5 -0
- package/src/weakmaps/rendererReadyByLayer.js +5 -0
- package/src/weakmaps/renderers.js +5 -0
- package/src/weakmaps/roofRasterByLayer.js +5 -0
- package/src/weakmaps/roofRastersByLayer.js +5 -0
- package/src/weakmaps/rootByLayer.js +5 -0
- package/src/weakmaps/rotateControlByMap.js +5 -0
- package/src/weakmaps/sceneByLayer.js +5 -0
- package/src/weakmaps/sceneFields.js +5 -0
- package/src/weakmaps/sceneLayers.js +5 -0
- package/src/weakmaps/sceneOriginByLayer.js +5 -0
- package/src/weakmaps/shadowMeshesByLayer.js +5 -0
- package/src/weakmaps/sharedByLayer.js +5 -0
- package/src/weakmaps/sizeByLayer.js +5 -0
- package/src/weakmaps/state3dByLayer.js +5 -0
- package/src/weakmaps/streamTerrainByLayer.js +6 -1
- package/src/weakmaps/streamTerrainByMap.js +6 -1
- package/src/weakmaps/sunByMap.js +6 -1
- package/src/weakmaps/sunlightByControl.js +5 -0
- package/src/weakmaps/sunlightByMap.js +5 -0
- package/src/weakmaps/terrain3DByLayer.js +5 -0
- package/src/weakmaps/terrain3DByMap.js +5 -0
- package/src/weakmaps/terrainArchiveByLayer.js +5 -0
- package/src/weakmaps/terrainBaseYByLayer.js +5 -0
- package/src/weakmaps/terrainBoundsByLayer.js +5 -0
- package/src/weakmaps/terrainControllerByLayer.js +5 -0
- package/src/weakmaps/terrainGridsByLayer.js +5 -0
- package/src/weakmaps/terrainLoadingByLayer.js +5 -0
- package/src/weakmaps/terrainOriginElevationByLayer.js +5 -0
- package/src/weakmaps/terrainPromiseByLayer.js +5 -0
- package/src/weakmaps/terrainReadyByLayer.js +5 -0
- package/src/weakmaps/terrainRequestByLayer.js +5 -0
- package/src/weakmaps/terrainSourceByLayer.js +5 -0
- package/src/weakmaps/terrainTilesByLayer.js +5 -0
- package/src/weakmaps/terrainZoomByLayer.js +5 -0
- package/src/weakmaps/tileZoomByLayer.js +5 -0
- package/src/weakmaps/timeControlByMap.js +5 -0
- package/src/weakmaps/tooltipByLayer.js +5 -0
- package/src/weakmaps/touchByContainer.js +5 -0
- package/src/weakmaps/touchPitchByMap.js +5 -0
- package/src/weakmaps/touchRotateByMap.js +5 -0
- package/src/weakmaps/trafficByLayer.js +5 -0
- package/src/weakmaps/typeByLayer.js +5 -0
- package/src/weakmaps/urlByLayer.js +5 -0
- package/src/weakmaps/vectorTileOptionsByLayer.js +6 -1
- package/src/weakmaps/vectorWorkerByLayer.js +6 -1
- package/src/weakmaps/visibleMeshesByLayer.js +5 -0
- package/src/weakmaps/walkByMap.js +6 -1
- package/src/weakmaps/walkerByLayer.js +5 -0
- package/src/weakmaps/wantedRasterTilesByLayer.js +5 -0
- package/src/weakmaps/workerMapByLayer.js +6 -1
- package/src/weakmaps/zoomLevelByLayer.js +5 -0
- package/src/weakmaps/zoomTransitionsByLayer.js +5 -0
- package/src/weakmaps/zoomViewByLayer.js +5 -0
- package/src/workers/README.md +33 -0
- package/src/workers/acquireGeometryWorker.js +39 -29
- package/src/workers/buildAreaInWorker.js +24 -16
- package/src/workers/closeGeometryWorkers.js +16 -11
- package/src/workers/cogWorker.js +27 -20
- package/src/workers/createGeometryWorker.js +30 -20
- package/src/workers/geometryWorker.js +34 -29
- package/src/workers/getCogInWorker.js +18 -7
- package/src/workers/modelWorker.js +17 -10
- package/src/workers/openCogInWorker.js +22 -14
- package/src/workers/runSourceWorker.js +44 -32
- package/src/workers/settleGeometryWorker.js +16 -10
- package/src/workers/startGeometryWorker.js +23 -16
- package/src/workers/vectorTileWorker.js +15 -10
- package/src/collision/setTrafficNormal.js +0 -9
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
import { readTileJSON } from './readTileJSON.js';
|
|
2
|
-
import { readVectorStyle } from './readVectorStyle.js';
|
|
3
|
-
import { validateVectorTileZooms } from './validateVectorTileZooms.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { readTileJSON } from './readTileJSON.js';
|
|
2
|
+
import { readVectorStyle } from './readVectorStyle.js';
|
|
3
|
+
import { validateVectorTileZooms } from './validateVectorTileZooms.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolve and validate vector tile source options, metadata and style.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} options Vector tile source options.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<Object>} Resolved settings.
|
|
11
|
+
*
|
|
12
|
+
* @throws {TypeError} If source options are absent or not an object.
|
|
13
|
+
* @throws {Error} If the XYZ tile URL template is invalid.
|
|
14
|
+
*/
|
|
15
|
+
export async function vectorTileSettings(options) {
|
|
16
|
+
if (!options || typeof options !== 'object') throw /* alloc */ new TypeError('Vector tiles require source options');
|
|
17
|
+
if (options.tileJSON) options = await readTileJSON(options);
|
|
18
|
+
let { url, style, minNativeZoom = 0, maxNativeZoom = 14, maxZoom = 19 } = options;
|
|
19
|
+
let key;
|
|
20
|
+
if (typeof url === 'string') url = url.replaceAll(/%7B([zxy])%7D/gi, '{$1}');
|
|
21
|
+
for (key of /* alloc */ ['{z}', '{x}', '{y}']) {
|
|
22
|
+
if (typeof url !== 'string' || !url.includes(key)) throw /* alloc */ new Error('Vector tiles require an XYZ URL template');
|
|
23
|
+
}
|
|
24
|
+
validateVectorTileZooms(minNativeZoom, maxNativeZoom, maxZoom);
|
|
25
|
+
style = await readVectorStyle(style);
|
|
26
|
+
return /* alloc */ { ...options, url, style, minNativeZoom, maxNativeZoom, maxZoom };
|
|
27
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Check that the vector tile session is current and the map has settled.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} layer Vector tile layer.
|
|
5
|
+
* @param {Object} session Session identity.
|
|
6
|
+
*
|
|
7
|
+
* @returns {boolean} Whether the session is idle.
|
|
8
|
+
*/
|
|
9
|
+
export function vectorTilesIdle(layer, session) {
|
|
10
|
+
return layer.session === session && performance.now() - (layer.changedAt || 0) >= 180;
|
|
11
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Compute a simplification tolerance of about 0.7 screen pixels in tile units.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} job Vector tile preparation job.
|
|
5
|
+
* @param {Object} layer Decoded source layer.
|
|
6
|
+
*
|
|
7
|
+
* @returns {number} Tolerance in tile units.
|
|
8
|
+
*/
|
|
9
|
+
export function vectorTolerance(job, layer) {
|
|
10
|
+
return layer.extent / 256 / 2 ** Math.max(-1, job.mapZoom - job.coords.z) * 0.7;
|
|
11
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Greedily wrap label words at 10 ems, estimating glyph width at 0.52 em.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} text Label text.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Array<string>} Wrapped lines.
|
|
7
|
+
*/
|
|
8
|
+
export function wrapVectorLabel(text) {
|
|
9
|
+
const limit = Math.floor(10 / 0.52), lines = /* alloc */ [];
|
|
10
|
+
let line = '', word;
|
|
11
|
+
for (word of text.split(' ')) {
|
|
12
|
+
if (line && Array.from(`${line} ${word}`).length > limit) { lines.push(line); line = word; }
|
|
13
|
+
else line = line ? `${line} ${word}` : word;
|
|
14
|
+
}
|
|
15
|
+
lines.push(line);
|
|
16
|
+
return lines;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Vehicle models
|
|
2
|
+
|
|
3
|
+
[Source guide](../README.md) | [Project README](../../README.md)
|
|
4
|
+
|
|
5
|
+
Creates procedural vehicle and pedestrian parts for traffic. Walking uses
|
|
6
|
+
shared pedestrian body parts rather than the traffic model itself.
|
|
7
|
+
|
|
8
|
+
## Shapes versus movement
|
|
9
|
+
|
|
10
|
+
```mermaid
|
|
11
|
+
flowchart LR
|
|
12
|
+
Shared["Shared pedestrian body parts"] --> Shapes["Vehicle / pedestrian models"]
|
|
13
|
+
Shared --> WalkerParts["Walker limbs"]
|
|
14
|
+
Shapes --> TrafficBuild["Build traffic geometry"]
|
|
15
|
+
WalkerParts --> WalkBuild["Build walker geometry"]
|
|
16
|
+
TrafficBuild --> Traffic["Traffic: lanes + GPU poses"]
|
|
17
|
+
WalkBuild --> Walk["Walk: pedestrian animation"]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
These are shapes, not animated layers. Shared-part changes affect both
|
|
21
|
+
consumers; changes here do not alter traffic routing or walker movement.
|
|
22
|
+
|
|
23
|
+
- [carModel.js](./carModel.js): construct car parts.
|
|
24
|
+
- [pedestrianModel.js](./pedestrianModel.js): construct pedestrian parts.
|
|
25
|
+
- [bicycleModel.js](./bicycleModel.js): construct bicycle parts.
|
|
26
|
+
|
|
27
|
+
Related: [traffic](../traffic/README.md), [walk](../walk/README.md), [geometry](../geometry/README.md).
|
|
@@ -2,9 +2,15 @@ import { paints } from '../globals/paints.js';
|
|
|
2
2
|
import { dark } from '../globals/dark.js';
|
|
3
3
|
import { skin } from '../globals/skin.js';
|
|
4
4
|
import { trousers } from '../globals/trousers.js';
|
|
5
|
-
|
|
6
5
|
import { box } from '../geometry/box.js';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Build the geometry parts for a bicycle and rider.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} index Index selecting a paint color.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Array} Extrusion parts for the model.
|
|
13
|
+
*/
|
|
8
14
|
export function bicycleModel(index) {
|
|
9
15
|
const paint = paints[index % paints.length];
|
|
10
16
|
return /* alloc */ [
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { hull } from '../globals/hull.js';
|
|
2
2
|
import { white } from '../globals/white.js';
|
|
3
3
|
import { glass } from '../globals/glass.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export function boatModel() {
|
|
14
|
-
return /* alloc */ [
|
|
15
|
-
/* alloc */ [
|
|
16
|
-
hull, 0, 0.8, /* alloc */ [0.1, 0.16, 0.26]],
|
|
17
|
-
/* alloc */ [hull, 0.8, 1.4, white],
|
|
18
|
-
/* alloc */ [box(-5, 5, -18, 26), 1.4, 3.7, glass, box(-4.6, 4.6, -17.4, 25.6)],
|
|
19
|
-
...mirror(4.64, 4.74, -17, 25, 3.25, 3.45, /* alloc */ [1.6, 1.25, 0.8]),
|
|
20
|
-
/* alloc */ [box(-4.8, 4.8, -17.8, 25.8), 3.7, 3.9, white],
|
|
21
|
-
...boatBenches(),
|
|
22
|
-
...mirror(4.65, 4.8, -13.6, 25.8, 3.9, 4.8, white),
|
|
23
|
-
/* alloc */ [box(-4.8, 4.8, 25.65, 25.8), 3.9, 4.8, white],
|
|
24
|
-
/* alloc */ [box(-2.2, 2.2, -17.6, -14), 3.9, 4.7, white],
|
|
25
|
-
/* alloc */ [box(-2.2, 2.2, -17.6, -14), 4.7, 5.5, glass],
|
|
26
|
-
/* alloc */ [box(-2.5, 2.5, -18, -13.6), 5.5, 5.7, white],
|
|
27
|
-
/* alloc */ [
|
|
28
|
-
box(-2.45, -2.2, -16.2, -15.8), 5, 5.3, /* alloc */ [2, 0.15, 0.1]],
|
|
29
|
-
/* alloc */ [
|
|
30
|
-
box(2.2, 2.45, -16.2, -15.8), 5, 5.3, /* alloc */ [0.1, 2, 0.4]],
|
|
31
|
-
/* alloc */ [box(-0.1, 0.1, -15.9, -15.7), 5.7, 6.6, white],
|
|
32
|
-
/* alloc */ [
|
|
33
|
-
box(-0.15, 0.15, -15.95, -15.65), 6.6, 6.8, /* alloc */ [2, 2, 1.9]],
|
|
34
|
-
];
|
|
35
|
-
}
|
|
4
|
+
import { box } from '../geometry/box.js';
|
|
5
|
+
import { mirror } from './mirrorVehiclePart.js';
|
|
6
|
+
import { boatBenches } from './boatBenches.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Build the geometry parts for a panoramic river cruiser, about 60 by 11 metres.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Array} Extrusion parts for the hull, deck and fittings.
|
|
12
|
+
*/
|
|
13
|
+
export function boatModel() {
|
|
14
|
+
return /* alloc */ [
|
|
15
|
+
/* alloc */ [
|
|
16
|
+
hull, 0, 0.8, /* alloc */ [0.1, 0.16, 0.26]],
|
|
17
|
+
/* alloc */ [hull, 0.8, 1.4, white],
|
|
18
|
+
/* alloc */ [box(-5, 5, -18, 26), 1.4, 3.7, glass, box(-4.6, 4.6, -17.4, 25.6)],
|
|
19
|
+
...mirror(4.64, 4.74, -17, 25, 3.25, 3.45, /* alloc */ [1.6, 1.25, 0.8]),
|
|
20
|
+
/* alloc */ [box(-4.8, 4.8, -17.8, 25.8), 3.7, 3.9, white],
|
|
21
|
+
...boatBenches(),
|
|
22
|
+
...mirror(4.65, 4.8, -13.6, 25.8, 3.9, 4.8, white),
|
|
23
|
+
/* alloc */ [box(-4.8, 4.8, 25.65, 25.8), 3.9, 4.8, white],
|
|
24
|
+
/* alloc */ [box(-2.2, 2.2, -17.6, -14), 3.9, 4.7, white],
|
|
25
|
+
/* alloc */ [box(-2.2, 2.2, -17.6, -14), 4.7, 5.5, glass],
|
|
26
|
+
/* alloc */ [box(-2.5, 2.5, -18, -13.6), 5.5, 5.7, white],
|
|
27
|
+
/* alloc */ [
|
|
28
|
+
box(-2.45, -2.2, -16.2, -15.8), 5, 5.3, /* alloc */ [2, 0.15, 0.1]],
|
|
29
|
+
/* alloc */ [
|
|
30
|
+
box(2.2, 2.45, -16.2, -15.8), 5, 5.3, /* alloc */ [0.1, 2, 0.4]],
|
|
31
|
+
/* alloc */ [box(-0.1, 0.1, -15.9, -15.7), 5.7, 6.6, white],
|
|
32
|
+
/* alloc */ [
|
|
33
|
+
box(-0.15, 0.15, -15.95, -15.65), 6.6, 6.8, /* alloc */ [2, 2, 1.9]],
|
|
34
|
+
];
|
|
35
|
+
}
|
|
@@ -3,9 +3,17 @@ import { white } from '../globals/white.js';
|
|
|
3
3
|
import { tyre } from '../globals/tyre.js';
|
|
4
4
|
import { headlight } from '../globals/headlight.js';
|
|
5
5
|
import { taillight } from '../globals/taillight.js';
|
|
6
|
-
|
|
7
6
|
import { box } from '../geometry/box.js';
|
|
8
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Build a carriage with body, windows, wheels and lights.
|
|
10
|
+
*
|
|
11
|
+
* @param {number} center Carriage center along the longitudinal axis.
|
|
12
|
+
* @param {number} length Carriage length.
|
|
13
|
+
* @param {number[]} color Body color.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Array} Carriage extrusion parts.
|
|
16
|
+
*/
|
|
9
17
|
export function carriage(center, length, color) {
|
|
10
18
|
const front = center - length / 2, rear = center + length / 2;
|
|
11
19
|
return /* alloc */ [
|
package/src/vehicles/busModel.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { routeColor } from '../traffic/routeColor.js';
|
|
2
2
|
import { carriage } from './buildCarriage.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Build a single bus carriage colored from its route properties.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} index Vehicle index, unused by this model.
|
|
8
|
+
* @param {Object} properties Route properties used to choose the color.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Array} Bus extrusion parts.
|
|
11
|
+
*/
|
|
12
|
+
export function busModel(index, properties) {
|
|
13
|
+
return carriage(0, 12, routeColor(properties));
|
|
6
14
|
}
|
package/src/vehicles/carModel.js
CHANGED
|
@@ -3,36 +3,37 @@ import { tyre } from '../globals/tyre.js';
|
|
|
3
3
|
import { glass } from '../globals/glass.js';
|
|
4
4
|
import { headlight } from '../globals/headlight.js';
|
|
5
5
|
import { taillight } from '../globals/taillight.js';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...mirror(0.7, 0.92, 1.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* alloc */ [-0.
|
|
24
|
-
/* alloc */ [0.72, -2.25],
|
|
25
|
-
/* alloc */ [0.
|
|
26
|
-
/* alloc */ [0.9,
|
|
27
|
-
/* alloc */ [0.
|
|
28
|
-
/* alloc */ [
|
|
29
|
-
/* alloc */ [-0.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/* alloc */ [box(-0.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
import { box } from '../geometry/box.js';
|
|
7
|
+
import { mirror } from './mirrorVehiclePart.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Build the geometry parts for a car.
|
|
11
|
+
*
|
|
12
|
+
* @param {number} i Index selecting a paint color.
|
|
13
|
+
*
|
|
14
|
+
* @returns {Array} Car body, wheels, windows and light parts.
|
|
15
|
+
*/
|
|
16
|
+
export function carModel(i) {
|
|
17
|
+
const paint = paints[i % paints.length];
|
|
18
|
+
return /* alloc */ [
|
|
19
|
+
...mirror(0.7, 0.92, -1.68, -1.02, 0, 0.64, tyre),
|
|
20
|
+
...mirror(0.7, 0.92, 1.02, 1.68, 0, 0.64, tyre),
|
|
21
|
+
/* alloc */ [
|
|
22
|
+
/* alloc */ [
|
|
23
|
+
/* alloc */ [-0.9, -1.95],
|
|
24
|
+
/* alloc */ [-0.72, -2.25],
|
|
25
|
+
/* alloc */ [0.72, -2.25],
|
|
26
|
+
/* alloc */ [0.9, -1.95],
|
|
27
|
+
/* alloc */ [0.9, 2.05],
|
|
28
|
+
/* alloc */ [0.76, 2.25],
|
|
29
|
+
/* alloc */ [-0.76, 2.25],
|
|
30
|
+
/* alloc */ [-0.9, 2.05],
|
|
31
|
+
],
|
|
32
|
+
0.28, 0.82, paint],
|
|
33
|
+
// Greenhouse: the windscreen leans back, the rear window less.
|
|
34
|
+
/* alloc */ [box(-0.84, 0.84, -0.75, 1.6), 0.82, 1.38, glass, box(-0.7, 0.7, -0.05, 1.3)],
|
|
35
|
+
/* alloc */ [box(-0.71, 0.71, -0.06, 1.31), 1.38, 1.46, paint],
|
|
36
|
+
...mirror(0.38, 0.8, -2.3, -2.16, 0.56, 0.76, headlight),
|
|
37
|
+
/* alloc */ [box(-0.78, 0.78, 2.16, 2.3), 0.6, 0.76, taillight],
|
|
38
|
+
];
|
|
39
|
+
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { routeColor } from '../traffic/routeColor.js';
|
|
2
2
|
import { carriage } from './buildCarriage.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Build a five-car metro colored from its route properties.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} index Vehicle index, unused by this model.
|
|
8
|
+
* @param {Object} properties Route properties used to choose the color.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Array} Metro extrusion parts.
|
|
11
|
+
*/
|
|
4
12
|
export function metroModel(index, properties) {
|
|
5
13
|
const color = routeColor(properties), parts = /* alloc */ [];
|
|
6
14
|
let car;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { box } from "../geometry/box.js";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Create a pair of extrusion parts mirrored across the vehicle's longitudinal axis.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} x0 Inner lateral bound.
|
|
7
|
+
* @param {number} x1 Outer lateral bound.
|
|
8
|
+
* @param {number} z0 First longitudinal bound.
|
|
9
|
+
* @param {number} z1 Second longitudinal bound.
|
|
10
|
+
* @param {...*} rest Remaining extrusion-part fields.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Array} The two mirrored parts.
|
|
13
|
+
*/
|
|
3
14
|
export function mirror(x0, x1, z0, z1, ...rest) {
|
|
4
15
|
return /* alloc */ [
|
|
5
16
|
/* alloc */ [box(x0, x1, z0, z1), ...rest],
|
|
@@ -2,9 +2,15 @@ import { parts } from '../globals/parts.js';
|
|
|
2
2
|
import { paints } from '../globals/paints.js';
|
|
3
3
|
import { trousers } from '../globals/trousers.js';
|
|
4
4
|
import { skin } from '../globals/skin.js';
|
|
5
|
-
|
|
6
5
|
import { box } from '../geometry/box.js';
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Build a pedestrian from the shared body and additional limb parts.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} index Index selecting a clothing color.
|
|
11
|
+
*
|
|
12
|
+
* @returns {Array} Pedestrian extrusion parts.
|
|
13
|
+
*/
|
|
8
14
|
export function pedestrianModel(index) {
|
|
9
15
|
const model = parts.body.slice();
|
|
10
16
|
model[1] = /* alloc */ [model[1][0], model[1][1], model[1][2], paints[index % paints.length]];
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { routeColor } from '../traffic/routeColor.js';
|
|
2
2
|
import { carriage } from './buildCarriage.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Build a five-car tram colored from its route properties.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} index Vehicle index, unused by this model.
|
|
8
|
+
* @param {Object} properties Route properties used to choose the color.
|
|
9
|
+
*
|
|
10
|
+
* @returns {Array} Tram extrusion parts.
|
|
11
|
+
*/
|
|
4
12
|
export function tramModel(index, properties) {
|
|
5
13
|
const color = routeColor(properties), parts = /* alloc */ [];
|
|
6
14
|
let car;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Walk mode
|
|
2
|
+
|
|
3
|
+
[Source guide](../README.md) | [Project README](../../README.md)
|
|
4
|
+
|
|
5
|
+
Provides a third-person walking control, including input, walker animation,
|
|
6
|
+
terrain following, camera updates and movement collision checks.
|
|
7
|
+
|
|
8
|
+
## Enter, move, leave
|
|
9
|
+
|
|
10
|
+
```mermaid
|
|
11
|
+
flowchart LR
|
|
12
|
+
Start["Enter: save map state + install listeners"] --> Input["Input + frame time"]
|
|
13
|
+
Input --> Movement["Turn / move / ascend / fall"]
|
|
14
|
+
Movement --> Collision["Check obstacles + slide"]
|
|
15
|
+
Collision --> Landing["Land on terrain or geometry"]
|
|
16
|
+
Landing --> View["Update walker + camera"]
|
|
17
|
+
View --> Input
|
|
18
|
+
Start --> Stop["Leave: remove listeners + meshes; restore map"]
|
|
19
|
+
Collision --> Enclosed["If enclosed: search nearby clear position"]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Movement checks current obstacles but does not make traffic avoid the walker.
|
|
23
|
+
Pair any new walk-mode state or listener with
|
|
24
|
+
[stopWalking.js](./stopWalking.js).
|
|
25
|
+
|
|
26
|
+
- [initWalk.js](./initWalk.js): install the walk control.
|
|
27
|
+
- [moveWalker.js](./moveWalker.js): move and slide along obstacles.
|
|
28
|
+
- [resolveWalkerPosition.js](./resolveWalkerPosition.js): find a clear nearby position when enclosed.
|
|
29
|
+
|
|
30
|
+
Related: [collision](../collision/README.md), [camera](../camera/README.md), [vehicles](../vehicles/README.md).
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { rendererByLayer } from '../weakmaps/rendererByLayer.js';
|
|
2
2
|
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
3
|
-
|
|
4
3
|
import { limbs } from '../globals/limbs.js';
|
|
5
4
|
import { parts } from '../globals/parts.js';
|
|
6
5
|
import { moves } from '../globals/moves.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
6
|
import * as createMesh from '../rendering/createMesh.js';
|
|
10
7
|
import { build } from '../geometry/buildGeometryParts.js';
|
|
11
|
-
|
|
12
8
|
import { local } from '../projections/walkerLocalPosition.js';
|
|
13
9
|
import { stepWalkerHeight } from './stepWalkerHeight.js';
|
|
14
10
|
import { resolveWalkerPosition } from './resolveWalkerPosition.js';
|
|
15
11
|
import { updateWalkerFrame } from './updateWalkerFrame.js';
|
|
16
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Advance one walk frame, checking clearance periodically and applying input, height and camera updates.
|
|
15
|
+
*
|
|
16
|
+
* @param {number} now Animation-frame timestamp in milliseconds.
|
|
17
|
+
*/
|
|
17
18
|
export function step(now) {
|
|
18
19
|
const layer = this.layer;
|
|
19
20
|
this.frame = requestAnimationFrame(this.step);
|
package/src/walk/createWalk.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { typeByLayer } from '../weakmaps/typeByLayer.js';
|
|
2
2
|
import { walkerByLayer } from '../weakmaps/walkerByLayer.js';
|
|
3
|
-
|
|
4
3
|
import { L } from '../globals/L.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
import { init3D } from '../scene/init3D.js';
|
|
8
5
|
import { onBlur } from './onWalkBlur.js';
|
|
9
6
|
import { onKey } from './onWalkKey.js';
|
|
@@ -14,6 +11,12 @@ import { step } from './animateWalker.js';
|
|
|
14
11
|
import { stop } from './stopWalking.js';
|
|
15
12
|
import { toggle } from './toggleWalking.js';
|
|
16
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Create the walk layer, control UI and bound event handlers for a control.
|
|
16
|
+
*
|
|
17
|
+
* @param {L.Control} control Control receiving the walk state.
|
|
18
|
+
* @param {Object} options Walking speed, camera distance and layer options.
|
|
19
|
+
*/
|
|
17
20
|
export function createWalk(control, {
|
|
18
21
|
speed,
|
|
19
22
|
distance,
|
package/src/walk/initWalk.js
CHANGED
|
@@ -16,6 +16,11 @@ class WalkControl extends extendLeafletClass(L.Control) {
|
|
|
16
16
|
static initHooks = true;
|
|
17
17
|
static defaultOptions = { position: 'bottomright', speed: 70, distance: 20 };
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Initialize the control and its hooks explicitly when using Leaflet 2.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} options Walk control options.
|
|
23
|
+
*/
|
|
19
24
|
constructor(options) {
|
|
20
25
|
super(options);
|
|
21
26
|
if (L.version.startsWith('2.')) {
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { L } from '../globals/L.js';
|
|
2
|
-
import { createWalk } from './createWalk.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
2
|
+
import { createWalk } from './createWalk.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Apply Leaflet control options and create the walk control's state and UI.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} options Walk control options.
|
|
8
|
+
*/
|
|
9
|
+
export function initialize(options) {
|
|
10
|
+
L.Util.setOptions(this, options);
|
|
11
|
+
createWalk(this, this.options);
|
|
12
|
+
}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { hit } from '../picking/hit.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
import { hit } from '../picking/hit.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cast a horizontal movement ray with walker clearance and return the nearest obstacle normal.
|
|
5
|
+
*
|
|
6
|
+
* @param {number} east Eastward movement in metres.
|
|
7
|
+
* @param {number} north Northward movement in metres.
|
|
8
|
+
* @param {number[]} feet Walker's world-space feet position.
|
|
9
|
+
*
|
|
10
|
+
* @returns {number[]|null|false} Horizontal obstacle normal, or a falsy value when clear.
|
|
11
|
+
*/
|
|
12
|
+
export function blocked(east, north, feet) {
|
|
13
|
+
const length = Math.hypot(east, north);
|
|
14
|
+
return length > 1e-6 && hit(this.layer, feet[0], feet[1], feet[2], east / length, -north / length, length + 0.3, this.hitData);
|
|
15
|
+
}
|
package/src/walk/landWalker.js
CHANGED
|
@@ -4,35 +4,39 @@ import { raycasterByLayer } from '../weakmaps/raycasterByLayer.js';
|
|
|
4
4
|
import { rootByLayer } from '../weakmaps/rootByLayer.js';
|
|
5
5
|
import { sceneByLayer } from '../weakmaps/sceneByLayer.js';
|
|
6
6
|
import { sharedByLayer } from '../weakmaps/sharedByLayer.js';
|
|
7
|
+
import { intersectMeshes } from '../collision/intersectMeshes.js';
|
|
8
|
+
import { traverse } from '../scene/traverse.js';
|
|
9
|
+
import { updateWorldMatrix } from '../transforms/updateWorldMatrix.js';
|
|
10
|
+
import { collectVisibleMesh } from '../picking/collectVisibleMesh.js';
|
|
11
|
+
import { shouldSkipOther } from '../picking/shouldSkipOther.js';
|
|
12
|
+
import { local } from '../projections/walkerLocalPosition.js';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ray.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
ray.meshes.length = 0;
|
|
38
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* Land a descending walker on the first visible surface crossed since its previous height.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} previousY Previous world-space feet height.
|
|
18
|
+
*/
|
|
19
|
+
export function land(previousY) {
|
|
20
|
+
const ray = raycasterByLayer.get(this.layer)
|
|
21
|
+
const feet = local.call(this, this.local), root = rootByLayer.get(this.layer);
|
|
22
|
+
const x = root.position[0] + feet[0] * root.scale[0];
|
|
23
|
+
const y = root.position[1] + feet[1] * root.scale[1];
|
|
24
|
+
const z = root.position[2] + feet[2] * root.scale[2];
|
|
25
|
+
if (y > previousY || this.verticalSpeed > 0) return;
|
|
26
|
+
updateWorldMatrix(sceneByLayer.get(this.layer));
|
|
27
|
+
ray.origin[0] = x; ray.origin[1] = previousY + 0.01; ray.origin[2] = z;
|
|
28
|
+
ray.direction[0] = 0; ray.direction[1] = -1; ray.direction[2] = 0;
|
|
29
|
+
ray.meshes.length = 0;
|
|
30
|
+
let layer, hit;
|
|
31
|
+
for (layer of layersByLayer.get(sharedByLayer.get(this.layer))) {
|
|
32
|
+
if (shouldSkipOther(layer, this.layer) || kindByLayer.get(layer) === 'raster' || layer.options.nightLight) continue;
|
|
33
|
+
traverse(rootByLayer.get(layer), collectVisibleMesh, ray.meshes);
|
|
34
|
+
}
|
|
35
|
+
for (hit of intersectMeshes(ray, ray.meshes)) {
|
|
36
|
+
if (hit.point[1] < y - 0.001) break;
|
|
37
|
+
this.state.height += (hit.point[1] - y) / root.scale[1];
|
|
38
|
+
this.verticalSpeed = 0;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
ray.meshes.length = 0;
|
|
42
|
+
}
|