leaflet-city-mapper 0.1.0 → 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 +1 -1
- package/dist/leaflet-city-mapper-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker-src.js.map +1 -1
- package/dist/leaflet-city-mapper-worker.js.map +1 -1
- package/dist/leaflet-city-mapper.js.map +1 -1
- 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/animations/cancelCameraAnimation.js +19 -19
- package/src/animations/mapStopPitchBearingAnimation.js +10 -10
- package/src/animations/scheduleCameraAnimation.js +15 -15
- package/src/animations/scheduleMarkerPan.js +14 -14
- package/src/animations/updateZoomCamera.js +25 -25
- package/src/archives/findDirectoryEntry.js +17 -17
- package/src/archives/findTile.js +45 -45
- package/src/archives/getDirectoryEntries.js +30 -30
- package/src/archives/getTileData.js +26 -26
- package/src/archives/readArchiveRange.js +48 -48
- package/src/astronomy/solarTime.js +21 -21
- package/src/camera/cameraMapReady.js +9 -9
- package/src/camera/cleanupCameraMap.js +13 -13
- package/src/camera/constrainCameraToBounds.js +3 -3
- package/src/camera/createSceneCamera.js +25 -25
- package/src/camera/getBearing.js +10 -10
- package/src/camera/getPitch.js +10 -10
- package/src/camera/mapGetBoundsCenterZoom.js +14 -14
- package/src/camera/mapLimitOffset.js +17 -17
- package/src/camera/mapPanBy.js +14 -14
- package/src/camera/setBearing.js +13 -13
- package/src/camera/setPitch.js +13 -13
- package/src/cog/decodeCogTile.js +37 -37
- package/src/cog/finiteCogValues.js +12 -12
- package/src/cog/getCogAssetEntry.js +26 -26
- package/src/cog/getCogBase.js +22 -22
- package/src/cog/getCogHeader.js +10 -10
- package/src/cog/getCogProfile.js +25 -25
- package/src/cog/getCogTile.js +25 -25
- package/src/cog/getColorTile.js +38 -38
- package/src/cog/getElevationTile.js +29 -29
- package/src/cog/hasCogProjection.js +16 -16
- package/src/cog/initCog.js +13 -13
- package/src/cog/invalidCogFullResponse.js +10 -10
- package/src/cog/openCog.js +40 -40
- package/src/cog/openCogAsset.js +22 -22
- package/src/cog/readCog.js +39 -39
- package/src/cog/readCogBlock.js +19 -19
- package/src/cog/readCogBody.js +30 -30
- package/src/cog/readCogDirectories.js +32 -32
- package/src/cog/readCogDirectory.js +34 -34
- package/src/cog/readCogLevel.js +36 -36
- package/src/cog/readCogTag.js +28 -28
- package/src/cog/validCogDimensions.js +15 -15
- package/src/cog/validCogEncoding.js +18 -18
- package/src/cog/validCogGeoArrays.js +17 -17
- package/src/cog/validCogGrid.js +22 -22
- package/src/cog/validCogTileCoordinates.js +13 -13
- package/src/cog/validateCogContainer.js +17 -17
- package/src/cog/validateCogContentRange.js +18 -18
- package/src/cog/validateCogOffsets.js +19 -19
- package/src/cog/validateCogRange.js +16 -16
- package/src/cog/validateCogResponse.js +26 -26
- package/src/collision/collectIntersections.js +41 -41
- package/src/collision/hiddenLightHit.js +19 -19
- package/src/collision/indexTriangle.js +18 -18
- package/src/collision/insideMesh.js +47 -47
- package/src/collision/insideWalker.js +52 -52
- package/src/collision/intersectMeshes.js +40 -40
- package/src/collision/localRay.js +31 -31
- package/src/collision/mergeHits.js +19 -19
- package/src/collision/rayBounds.js +28 -28
- package/src/collision/readTriangle.js +32 -32
- package/src/collision/trafficCollision.js +23 -23
- package/src/collision/transformTriangle.js +18 -18
- package/src/collision/triangleDistance.js +34 -34
- package/src/collision/vertexCount.js +11 -11
- package/src/collision/worldHit.js +30 -30
- package/src/controls/acceptPitchDrag.js +10 -10
- package/src/controls/acceptRotateDrag.js +9 -9
- package/src/controls/addCameraHandler.js +18 -18
- package/src/controls/adjustCameraDrag.js +13 -13
- package/src/controls/cameraDragContextMenu.js +12 -12
- package/src/controls/cameraDragEnd.js +10 -10
- package/src/controls/cameraDragMove.js +31 -31
- package/src/controls/changeCameraTouch.js +17 -17
- package/src/controls/compassOrientation.js +12 -12
- package/src/controls/compassRemoveHooks.js +2 -2
- package/src/controls/containerResizeRemoveHooks.js +2 -2
- package/src/controls/endCameraTouch.js +18 -18
- package/src/controls/failCompassPermission.js +10 -10
- package/src/controls/finishCameraDrag.js +14 -14
- package/src/controls/finishCompassPermission.js +24 -24
- package/src/controls/isEditableTarget.js +9 -9
- package/src/controls/loadCameraControls.js +18 -18
- package/src/controls/moveCameraTouch.js +34 -34
- package/src/controls/refreshRotateFocus.js +5 -5
- package/src/controls/removeCameraDrag.js +28 -28
- package/src/controls/resizeMap.js +7 -7
- package/src/controls/rotateButtonClick.js +16 -16
- package/src/controls/rotateButtonKeydown.js +20 -20
- package/src/controls/rotateControl.js +12 -12
- package/src/controls/shiftRotateRemoveHooks.js +2 -2
- package/src/controls/shiftRotateWheel.js +15 -15
- package/src/core/cameraMarkerOnDrag.js +16 -16
- package/src/core/constructLayer.js +16 -16
- package/src/core/extendLeafletClass.js +12 -12
- package/src/core/extendTerrainPixelBounds.js +41 -41
- package/src/core/layerAddInitHook.js +12 -12
- package/src/core/layerMergeOptions.js +14 -14
- package/src/core/markerInitInteraction.js +10 -10
- package/src/core/markerSetIcon.js +14 -14
- package/src/core/markerSetRotation.js +19 -19
- package/src/core/projectNativePath.js +30 -30
- package/src/core/redrawPath.js +11 -11
- package/src/core/removeLayer.js +26 -26
- package/src/core/setRotation.js +12 -12
- package/src/core/whenReady.js +14 -14
- package/src/geometry/addBridges.js +36 -36
- package/src/geometry/addGeneratedTriangle.js +10 -10
- package/src/geometry/appendAreaTriangle.js +32 -32
- package/src/geometry/appendNativeTriangle.js +17 -17
- package/src/geometry/appendRouteDash.js +33 -33
- package/src/geometry/appendRouteSegment.js +28 -28
- package/src/geometry/assembleAreaGeometry.js +48 -48
- package/src/geometry/bridgeEdge.js +18 -18
- package/src/geometry/bridgeFaces.js +22 -22
- package/src/geometry/bridgePaths.js +19 -19
- package/src/geometry/bridgePolygon.js +37 -37
- package/src/geometry/bridgeSides.js +18 -18
- package/src/geometry/buildProjectedPoint.js +32 -32
- package/src/geometry/buildProjectedPolygon.js +34 -34
- package/src/geometry/circleAt.js +20 -20
- package/src/geometry/circleGeometry.js +41 -41
- package/src/geometry/createModelGeometry.js +44 -44
- package/src/geometry/crossVector.js +15 -15
- package/src/geometry/dashValues.js +23 -23
- package/src/geometry/dashedSegment.js +33 -33
- package/src/geometry/diskAt.js +18 -18
- package/src/geometry/emitter.js +18 -18
- package/src/geometry/fillNativePolygon.js +28 -28
- package/src/geometry/generateTreeGeometry.js +18 -18
- package/src/geometry/indexBridge.js +36 -36
- package/src/geometry/instanceAreaGeometry.js +37 -37
- package/src/geometry/line.js +28 -28
- package/src/geometry/lineJoin.js +35 -35
- package/src/geometry/markerImageBounds.js +20 -20
- package/src/geometry/meshShadowBounds.js +33 -33
- package/src/geometry/offsetBelowGround.js +10 -10
- package/src/geometry/quad.js +23 -23
- package/src/geometry/restoreGeometry.js +29 -29
- package/src/geometry/roofCoverage.js +33 -33
- package/src/geometry/roofFootprint.js +40 -40
- package/src/geometry/samePoint.js +11 -11
- package/src/geometry/segment.js +32 -32
- package/src/geometry/subtractRoofTile.js +28 -28
- package/src/geometry/terrainBuffers.js +36 -36
- package/src/geometry/terrainTileGeometry.js +28 -28
- package/src/geometry/validateTree.js +19 -19
- package/src/globals/L.js +6 -6
- package/src/globals/cameraFov.js +8 -8
- package/src/globals/cogTags.js +6 -6
- package/src/globals/colorTexture.js +11 -11
- package/src/globals/cosObliquity.js +8 -8
- package/src/globals/degrees.js +6 -6
- package/src/globals/earthCirc.js +6 -6
- package/src/globals/geometryWorkerUrl.js +8 -8
- package/src/globals/halfRadians.js +6 -6
- package/src/globals/lampDirections.js +13 -13
- package/src/globals/layerControlAddItem.js +8 -8
- package/src/globals/leafletLayer.js +8 -8
- package/src/globals/lightScale.js +6 -6
- package/src/globals/mvtTextDecoder.js +6 -6
- package/src/globals/nativeScalableStyleKeys.js +6 -6
- package/src/globals/sinObliquity.js +8 -8
- package/src/globals/tau.js +6 -6
- package/src/globals/vectorStyleNamedColors.js +13 -13
- package/src/globals/vectorTileEvents.js +6 -6
- package/src/globals/workerCogSource.js +6 -6
- package/src/gpu/initializeRendererResources.js +39 -39
- package/src/gpu/initializeSharedRenderer.js +59 -59
- package/src/gpu/mountRenderer.js +25 -25
- package/src/layer-controls/layerControlInputId.js +18 -18
- package/src/layer-controls/layerCountTitle.js +16 -16
- package/src/layer-controls/placeEntryElement.js +29 -29
- package/src/layer-controls/renderLayerCount.js +28 -28
- package/src/lighting/visitLightCells.js +26 -26
- package/src/lighting/writeLightCell.js +14 -14
- package/src/materials/createProgramLayout.js +44 -44
- package/src/materials/createProgramUniforms.js +25 -25
- package/src/materials/modelMaterialFor.js +29 -29
- package/src/materials/prepareMeshCutout.js +21 -21
- package/src/materials/terrainRasterProgram.js +65 -65
- package/src/materials/validateRoofMaterial.js +17 -17
- package/src/models/applyModelTransform.js +18 -18
- package/src/models/buildModelNodes.js +24 -24
- package/src/models/createModelContext.js +24 -24
- package/src/models/loadBuffer.js +16 -16
- package/src/models/loadModelResources.js +22 -22
- package/src/models/normalizeAccessor.js +21 -21
- package/src/models/prepareModel.js +29 -29
- package/src/models/prepareModelGeometry.js +35 -35
- package/src/models/prepareModelPrimitive.js +25 -25
- package/src/models/readAccessorValue.js +16 -16
- package/src/models/readModelAttributes.js +32 -32
- package/src/models/readModelIndices.js +28 -28
- package/src/models/readSparseAccessor.js +31 -31
- package/src/models/releaseModelResources.js +15 -15
- package/src/mvt/addMvtCrossings.js +23 -23
- package/src/mvt/appendMvtBandTriangles.js +42 -42
- package/src/mvt/appendMvtCoordinates.js +20 -20
- package/src/mvt/appendMvtPolygonTriangles.js +29 -29
- package/src/mvt/beginMvtPath.js +19 -19
- package/src/mvt/closeMvtPath.js +16 -16
- package/src/mvt/collectMvtEdges.js +29 -29
- package/src/mvt/createMvtReader.js +14 -14
- package/src/mvt/decodeVectorTile.js +39 -39
- package/src/mvt/expectMvtWire.js +11 -11
- package/src/mvt/finishMvtPath.js +14 -14
- package/src/mvt/finiteMvtCoordinate.js +14 -14
- package/src/mvt/groupMvtPolygons.js +35 -35
- package/src/mvt/isMvtFallbackError.js +13 -13
- package/src/mvt/mergeMvtActiveEdges.js +18 -18
- package/src/mvt/mvtEdgeX.js +12 -12
- package/src/mvt/mvtPathsVertices.js +15 -15
- package/src/mvt/mvtPolygonPaths.js +19 -19
- package/src/mvt/numericMvtValue.js +11 -11
- package/src/mvt/readMvtFeature.js +46 -46
- package/src/mvt/readMvtField.js +17 -17
- package/src/mvt/readMvtGeometry.js +42 -42
- package/src/mvt/readMvtInteger.js +22 -22
- package/src/mvt/readMvtKnownValue.js +30 -30
- package/src/mvt/readMvtLayer.js +40 -40
- package/src/mvt/readMvtMessage.js +18 -18
- package/src/mvt/readMvtNumber.js +18 -18
- package/src/mvt/readMvtNumbers.js +18 -18
- package/src/mvt/readMvtString.js +14 -14
- package/src/mvt/readMvtValue.js +29 -29
- package/src/mvt/skipMvtField.js +22 -22
- package/src/mvt/sortMvtActiveEdges.js +20 -20
- package/src/mvt/sortedMvtLevels.js +29 -29
- package/src/mvt/takeMvtBytes.js +18 -18
- package/src/mvt/tessellateVectorRings.js +26 -26
- package/src/mvt/triangulateVectorRings.js +23 -23
- package/src/native/beforeNativeRender.js +21 -21
- package/src/native/bypassNativeEvent.js +21 -21
- package/src/native/canScaleNativeStyle.js +26 -26
- package/src/native/compareNativeHits.js +10 -10
- package/src/native/createNativeMesh.js +46 -46
- package/src/native/forwardNativeError.js +8 -8
- package/src/native/getGridTerrainTile.js +47 -47
- package/src/native/gridTerrainElevation.js +34 -34
- package/src/native/isCurrentNativeLayer.js +11 -11
- package/src/native/loadGridTerrain.js +36 -36
- package/src/native/nativeEventSource.js +27 -27
- package/src/native/nativeProgram.js +28 -28
- package/src/native/nativeTerrainElevation.js +27 -27
- package/src/native/nativeVectorGeometry.js +30 -30
- package/src/native/orderNativeGridLayer.js +20 -20
- package/src/native/prepareGridTerrainRequests.js +23 -23
- package/src/native/pruneNativeResources.js +25 -25
- package/src/native/readyNativeGPU.js +13 -13
- package/src/native/rejectNativeReady.js +2 -2
- package/src/native/removeNativeEvents.js +20 -20
- package/src/native/resolveNativeReady.js +2 -2
- package/src/native/restoreNativeEvents.js +8 -8
- package/src/native/retainGridTerrain.js +15 -15
- package/src/native/styleNativeMesh.js +20 -20
- package/src/native/syncGridTile.js +28 -28
- package/src/native/syncImageOverlay.js +13 -13
- package/src/native/syncNativeStrokeAnchors.js +18 -18
- package/src/native/syncNativeStrokeZoom.js +34 -34
- package/src/native/syncTerrainGridTile.js +38 -38
- package/src/native/terrainGridMesh.js +47 -47
- package/src/native/updateNativeHover.js +15 -15
- package/src/native/updateNativeStrokeRadius.js +14 -14
- package/src/picking/hitColliderCell.js +29 -29
- package/src/picking/validateCameraInverse.js +15 -15
- package/src/projections/displayContainerPoint.js +32 -32
- package/src/projections/projectBridgePoint.js +17 -17
- package/src/projections/toPoint.js +13 -13
- package/src/projections/transformZoomAnimationPoint.js +8 -8
- package/src/projections/verticalGroundY.js +14 -14
- package/src/raster/rasterTileRange.js +32 -32
- package/src/raster/retainRasterTiles.js +21 -21
- package/src/rendering/collectVisibleMesh.js +48 -48
- package/src/rendering/compareMeshDepth.js +14 -14
- package/src/rendering/drawPipeline.js +44 -44
- package/src/rendering/nativeStrokeExpansion.js +11 -11
- package/src/rendering/prepareFrameBuffer.js +24 -24
- package/src/rendering/prepareMeshUniforms.js +36 -36
- package/src/rendering/revealRoofMesh.js +43 -43
- package/src/scene/addSceneLayer.js +24 -24
- package/src/scene/callLayer.js +34 -34
- package/src/scene/createLayer.js +13 -13
- package/src/scene/getLocation.js +12 -12
- package/src/scene/isNativeLayer.js +19 -19
- package/src/scene/removeSceneLayer.js +22 -22
- package/src/scene/reportLayerError.js +9 -9
- package/src/shaders/materialBaseShader.js +26 -26
- package/src/shaders/materialSurfaceShader.js +60 -60
- package/src/shaders/materialVertexShader.js +89 -89
- package/src/shaders/nativeStrokeShader.js +13 -13
- package/src/shaders/roofVertexShader.js +16 -16
- package/src/shadows/shadowMeshMatches.js +19 -19
- package/src/sources/buildAreaFeatures.js +23 -23
- package/src/sources/extrusionStyle.js +21 -21
- package/src/sources/featureAnchor.js +21 -21
- package/src/sources/groundOffset.js +9 -9
- package/src/sources/initVectorTiles.js +21 -21
- package/src/sources/isVectorTileSource.js +11 -11
- package/src/sources/matchesAreaTile.js +17 -17
- package/src/sources/pendingSourceAreas.js +28 -28
- package/src/sources/prepareAreaGeometryJob.js +34 -34
- package/src/sources/projectAreaPolygons.js +25 -25
- package/src/sources/readyVectorTiles.js +17 -17
- package/src/sunlight/addTimeControlToMap.js +18 -18
- package/src/sunlight/addTimeLayer.js +12 -12
- package/src/sunlight/initializeTimeControl.js +18 -18
- package/src/sunlight/onAddSun.js +37 -37
- package/src/sunlight/onAddTimeControl.js +12 -12
- package/src/sunlight/onRemoveSun.js +10 -10
- package/src/sunlight/removeSun.js +25 -25
- package/src/sunlight/removeTimeControl.js +14 -14
- package/src/sunlight/removeTimeLayer.js +11 -11
- package/src/sunlight/requestSunlightRender.js +12 -12
- package/src/sunlight/styleTimeControl.js +13 -13
- package/src/sunlight/tickSun.js +10 -10
- package/src/sunlight/updateCelestialDisc.js +23 -23
- package/src/sunlight/updateSun.js +44 -44
- package/src/sunlight/useLiveTime.js +11 -11
- package/src/sunlight/useSelectedTime.js +26 -26
- package/src/terrain/applyTerrain.js +30 -30
- package/src/terrain/copyTerrainTile.js +20 -20
- package/src/terrain/loadReadyTerrain.js +6 -6
- package/src/terrain/mapElevationOf.js +19 -19
- package/src/terrain/readBridges.js +13 -13
- package/src/terrain/readyTerrainOf.js +14 -14
- package/src/terrain/sampleTerrainTile.js +16 -16
- package/src/terrain/terrainTileQueue.js +34 -34
- package/src/textures/addImageState.js +13 -13
- package/src/textures/bindMeshTextures.js +57 -57
- package/src/textures/collectRoofTiles.js +23 -23
- package/src/textures/loadModelImage.js +29 -29
- package/src/textures/modelTextureFor.js +47 -47
- package/src/textures/prepareMeshTextures.js +31 -31
- package/src/textures/removeImageState.js +13 -13
- package/src/textures/resizeRoofTexture.js +32 -32
- package/src/textures/restoreMaterialTextures.js +22 -22
- package/src/textures/updateRoofAtlas.js +29 -29
- package/src/textures/uploadMeshTexture.js +32 -32
- package/src/textures/uploadNativeImage.js +26 -26
- package/src/textures/uploadRoofTile.js +29 -29
- package/src/traffic/createTrafficMesh.js +17 -17
- package/src/traffic/disposeTrafficObject.js +19 -19
- package/src/traffic/failTraffic.js +12 -12
- package/src/traffic/failedTrafficLoad.js +10 -10
- package/src/traffic/fetchTrafficLanes.js +21 -21
- package/src/traffic/loadedTrafficLanes.js +21 -21
- package/src/traffic/locateTraffic.js +20 -20
- package/src/traffic/moveTraffic.js +21 -21
- package/src/traffic/readyTraffic.js +10 -10
- package/src/traffic/refreshTrafficTrips.js +42 -42
- package/src/traffic/routeColor.js +13 -13
- package/src/traffic/startTraffic.js +12 -12
- package/src/traffic/trafficNow.js +15 -15
- package/src/traffic/trafficStatusText.js +13 -13
- package/src/traffic/trafficStorage.js +13 -13
- package/src/traffic/updateTraffic.js +13 -13
- package/src/traffic/updateTrafficLights.js +23 -23
- package/src/traffic/updateTrafficPose.js +15 -15
- package/src/traffic/updateTrafficTerrain.js +15 -15
- package/src/traffic/uploadTrafficLanes.js +27 -27
- package/src/transforms/composeLocalTransform.js +23 -23
- package/src/transforms/transformNativePoint.js +19 -19
- package/src/transforms/worldMatrixChanged.js +26 -26
- package/src/triangulation/clipEars.js +32 -32
- package/src/triangulation/connectHole.js +30 -30
- package/src/triangulation/cross.js +12 -12
- package/src/triangulation/equal.js +11 -11
- package/src/triangulation/intersects.js +21 -21
- package/src/triangulation/mergeHoles.js +19 -19
- package/src/triangulation/on.js +13 -13
- package/src/triangulation/polygonRings.js +22 -22
- package/src/triangulation/validateArea.js +19 -19
- package/src/utils/compareDistance.js +11 -11
- package/src/utils/yieldTask.js +12 -12
- package/src/vector-style/appendQuotedStyleCharacter.js +30 -30
- package/src/vector-style/arrayContainsRange.js +18 -18
- package/src/vector-style/evaluateBoolean.js +31 -31
- package/src/vector-style/evaluateCoalesceOrCase.js +34 -34
- package/src/vector-style/evaluateComparison.js +29 -29
- package/src/vector-style/evaluateIExpression.js +21 -21
- package/src/vector-style/evaluateInput.js +16 -16
- package/src/vector-style/evaluateInterpolate.js +36 -36
- package/src/vector-style/evaluateMatch.js +21 -21
- package/src/vector-style/evaluateMath.js +26 -26
- package/src/vector-style/evaluateMembership.js +29 -29
- package/src/vector-style/evaluateNegation.js +26 -26
- package/src/vector-style/evaluatePrimitive.js +21 -21
- package/src/vector-style/evaluateStep.js +20 -20
- package/src/vector-style/evaluateStyle.js +43 -43
- package/src/vector-style/evaluateToExpression.js +27 -27
- package/src/vector-style/fillVectorPaint.js +26 -26
- package/src/vector-style/lineVectorPaint.js +31 -31
- package/src/vector-style/parseFunctionalColor.js +23 -23
- package/src/vector-style/parseHexColor.js +20 -20
- package/src/vector-style/parseVectorStyle.js +20 -20
- package/src/vector-style/readPaintValue.js +17 -17
- package/src/vector-style/removeTrailingCommas.js +19 -19
- package/src/vector-style/scaleDashArray.js +25 -25
- package/src/vector-style/skipStyleComment.js +20 -20
- package/src/vector-style/stripStyleComments.js +28 -28
- package/src/vector-style/styleColor.js +18 -18
- package/src/vector-style/validateVectorLayers.js +18 -18
- package/src/vector-style/vectorPaint.js +17 -17
- package/src/vector-style/visibleStyle.js +16 -16
- package/src/vector-tiles/appendVectorBatch.js +34 -34
- package/src/vector-tiles/attachVectorTileBatch.js +25 -25
- package/src/vector-tiles/attachVectorTileBatches.js +26 -26
- package/src/vector-tiles/compareVectorLabelPriority.js +11 -11
- package/src/vector-tiles/compareVectorTileDistance.js +11 -11
- package/src/vector-tiles/createVectorLabel.js +37 -37
- package/src/vector-tiles/forwardVectorTileError.js +10 -10
- package/src/vector-tiles/loadVectorSprite.js +14 -14
- package/src/vector-tiles/loadVectorTile.js +45 -45
- package/src/vector-tiles/onVectorTileAdd.js +44 -44
- package/src/vector-tiles/onVectorTileMessage.js +15 -15
- package/src/vector-tiles/onVectorTileRemove.js +25 -25
- package/src/vector-tiles/onVectorTileWorkerError.js +16 -16
- package/src/vector-tiles/paintVectorTileBatch.js +18 -18
- package/src/vector-tiles/prepareVectorLabel.js +34 -34
- package/src/vector-tiles/prepareVectorStyleLayer.js +38 -38
- package/src/vector-tiles/prepareVectorTile.js +29 -29
- package/src/vector-tiles/projectVectorPaths.js +25 -25
- package/src/vector-tiles/projectVectorPoint.js +15 -15
- package/src/vector-tiles/projectVectorTriangles.js +28 -28
- package/src/vector-tiles/pruneVectorTiles.js +14 -14
- package/src/vector-tiles/pumpVectorTiles.js +21 -21
- package/src/vector-tiles/readTileJSON.js +27 -27
- package/src/vector-tiles/readVectorStyle.js +28 -28
- package/src/vector-tiles/refreshVectorTiles.js +8 -8
- package/src/vector-tiles/reserveVectorLabelCells.js +14 -14
- package/src/vector-tiles/retireVectorTileGroup.js +20 -20
- package/src/vector-tiles/revokeVectorWorkerUrl.js +14 -14
- package/src/vector-tiles/rotateVectorLabel.js +19 -19
- package/src/vector-tiles/rotateVectorLabels.js +9 -9
- package/src/vector-tiles/simplifyVectorPath.js +29 -29
- package/src/vector-tiles/updateVectorLabelMarker.js +36 -36
- package/src/vector-tiles/updateVectorLabelStyle.js +14 -14
- package/src/vector-tiles/updateVectorTileLabels.js +33 -33
- package/src/vector-tiles/updateVectorTilePaint.js +25 -25
- package/src/vector-tiles/updateVectorTiles.js +32 -32
- package/src/vector-tiles/validateVectorTileZooms.js +15 -15
- package/src/vector-tiles/vectorFeaturePaint.js +25 -25
- package/src/vector-tiles/vectorFeaturePaths.js +26 -26
- package/src/vector-tiles/vectorFeatureZoom.js +18 -18
- package/src/vector-tiles/vectorLabelAnchors.js +31 -31
- package/src/vector-tiles/vectorLabelCandidates.js +18 -18
- package/src/vector-tiles/vectorLabelCells.js +32 -32
- package/src/vector-tiles/vectorLabelIcon.js +38 -38
- package/src/vector-tiles/vectorLabelProperty.js +12 -12
- package/src/vector-tiles/vectorLabelText.js +19 -19
- package/src/vector-tiles/vectorSpriteIcon.js +19 -19
- package/src/vector-tiles/vectorStraightRun.js +23 -23
- package/src/vector-tiles/vectorStyleDependencies.js +22 -22
- package/src/vector-tiles/vectorStyleValue.js +16 -16
- package/src/vector-tiles/vectorStyleZoom.js +12 -12
- package/src/vector-tiles/vectorTileAwaited.js +17 -17
- package/src/vector-tiles/vectorTileOverlaps.js +12 -12
- package/src/vector-tiles/vectorTilePaint.js +18 -18
- package/src/vector-tiles/vectorTileSettings.js +27 -27
- package/src/vector-tiles/vectorTilesIdle.js +11 -11
- package/src/vector-tiles/vectorTolerance.js +11 -11
- package/src/vector-tiles/wrapVectorLabel.js +17 -17
- package/src/vehicles/boatModel.js +35 -35
- package/src/vehicles/busModel.js +13 -13
- package/src/vehicles/carModel.js +39 -39
- package/src/walk/initializeWalkControl.js +12 -12
- package/src/walk/isWalkBlocked.js +15 -15
- package/src/walk/landWalker.js +41 -41
- package/src/walk/moveWalker.js +37 -37
- package/src/walk/onAddWalkControl.js +40 -40
- package/src/walk/onRemoveWalkControl.js +17 -17
- package/src/walk/onWalkBlur.js +3 -3
- package/src/walk/onWalkTerrain.js +3 -3
- package/src/walk/resolveWalkerPosition.js +33 -33
- package/src/walk/stepWalkerHeight.js +18 -18
- package/src/walk/toggleWalking.js +4 -4
- package/src/walk/updateWalkerFrame.js +29 -29
- package/src/walk/updateWalkerView.js +31 -31
- package/src/weakmaps/cameraHandlersByMap.js +6 -6
- package/src/weakmaps/geometryWorkersByMap.js +6 -6
- package/src/weakmaps/nativeProgramsByRenderer.js +6 -6
- package/src/weakmaps/pathProjectionByMap.js +6 -6
- package/src/weakmaps/streamTerrainByLayer.js +6 -6
- package/src/weakmaps/streamTerrainByMap.js +6 -6
- package/src/weakmaps/sunByMap.js +6 -6
- package/src/weakmaps/vectorTileOptionsByLayer.js +6 -6
- package/src/weakmaps/vectorWorkerByLayer.js +6 -6
- package/src/weakmaps/walkByMap.js +6 -6
- package/src/weakmaps/workerMapByLayer.js +6 -6
- package/src/workers/acquireGeometryWorker.js +39 -39
- package/src/workers/buildAreaInWorker.js +24 -24
- package/src/workers/closeGeometryWorkers.js +16 -16
- package/src/workers/cogWorker.js +27 -27
- package/src/workers/createGeometryWorker.js +30 -30
- package/src/workers/geometryWorker.js +34 -34
- package/src/workers/getCogInWorker.js +18 -18
- package/src/workers/modelWorker.js +17 -17
- package/src/workers/openCogInWorker.js +22 -22
- package/src/workers/runSourceWorker.js +44 -44
- package/src/workers/settleGeometryWorker.js +16 -16
- package/src/workers/startGeometryWorker.js +23 -23
- package/src/workers/vectorTileWorker.js +15 -15
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create and initialize a GPU storage buffer with at least 16 bytes.
|
|
3
|
-
*
|
|
4
|
-
* @param {GPUDevice} device Device creating the buffer.
|
|
5
|
-
* @param {TypedArray} data Buffer contents.
|
|
6
|
-
*
|
|
7
|
-
* @returns {GPUBuffer} The initialized storage buffer.
|
|
8
|
-
*/
|
|
9
|
-
export function trafficStorage(device, data) {
|
|
10
|
-
const buffer = device.createBuffer(/* alloc */ { size: Math.max(16, data.byteLength), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
|
|
11
|
-
device.queue.writeBuffer(buffer, 0, data);
|
|
12
|
-
return buffer;
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Create and initialize a GPU storage buffer with at least 16 bytes.
|
|
3
|
+
*
|
|
4
|
+
* @param {GPUDevice} device Device creating the buffer.
|
|
5
|
+
* @param {TypedArray} data Buffer contents.
|
|
6
|
+
*
|
|
7
|
+
* @returns {GPUBuffer} The initialized storage buffer.
|
|
8
|
+
*/
|
|
9
|
+
export function trafficStorage(device, data) {
|
|
10
|
+
const buffer = device.createBuffer(/* alloc */ { size: Math.max(16, data.byteLength), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST });
|
|
11
|
+
device.queue.writeBuffer(buffer, 0, data);
|
|
12
|
+
return buffer;
|
|
13
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { controlByLayer } from '../weakmaps/controlByLayer.js';
|
|
2
|
-
import { loadTraffic } from './loadTraffic.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Reload lanes and tick the simulation when the clock changes or a relevant layer is removed.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} state Traffic layer state.
|
|
8
|
-
* @param {Object} [event] Map event, optionally containing a removed layer.
|
|
9
|
-
*/
|
|
1
|
+
import { controlByLayer } from '../weakmaps/controlByLayer.js';
|
|
2
|
+
import { loadTraffic } from './loadTraffic.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reload lanes and tick the simulation when the clock changes or a relevant layer is removed.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} state Traffic layer state.
|
|
8
|
+
* @param {Object} [event] Map event, optionally containing a removed layer.
|
|
9
|
+
*/
|
|
10
10
|
export function updateTraffic(state, event) {
|
|
11
|
-
if (event?.layer && !controlByLayer.get(event.layer)?.time) return;
|
|
12
|
-
cancelAnimationFrame(state.frame);
|
|
13
|
-
loadTraffic(state);
|
|
14
|
-
state.tick();
|
|
11
|
+
if (event?.layer && !controlByLayer.get(event.layer)?.time) return;
|
|
12
|
+
cancelAnimationFrame(state.frame);
|
|
13
|
+
loadTraffic(state);
|
|
14
|
+
state.tick();
|
|
15
15
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { locateTraffic } from './locateTraffic.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Rebuild the mesh's light snapshot by transforming each vehicle light to its current lane pose.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} state Traffic layer state.
|
|
7
|
-
*/
|
|
8
|
-
export function updateTrafficLights(state) {
|
|
9
|
-
state.litAt = performance.now();
|
|
10
|
-
const lights = /* alloc */ [];
|
|
11
|
-
const target = state.position ||= /* alloc */ {};
|
|
12
|
-
let trip, x, y, z, dx, dz, lx, ly, lz, light;
|
|
13
|
-
for (trip of state.trips) {
|
|
14
|
-
({ x, y, z, dx, dz } = locateTraffic(state, trip, target));
|
|
15
|
-
for (light of state.lights) {
|
|
16
|
-
[lx, ly, lz] = light.position;
|
|
17
|
-
lights.push(/* alloc */ {
|
|
18
|
-
...light, position: /* alloc */ [x - lx * dz - lz * dx, y + ly, z + lx * dx - lz * dz],
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
state.mesh.extras.lights = lights;
|
|
23
|
-
}
|
|
1
|
+
import { locateTraffic } from './locateTraffic.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Rebuild the mesh's light snapshot by transforming each vehicle light to its current lane pose.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} state Traffic layer state.
|
|
7
|
+
*/
|
|
8
|
+
export function updateTrafficLights(state) {
|
|
9
|
+
state.litAt = performance.now();
|
|
10
|
+
const lights = /* alloc */ [];
|
|
11
|
+
const target = state.position ||= /* alloc */ {};
|
|
12
|
+
let trip, x, y, z, dx, dz, lx, ly, lz, light;
|
|
13
|
+
for (trip of state.trips) {
|
|
14
|
+
({ x, y, z, dx, dz } = locateTraffic(state, trip, target));
|
|
15
|
+
for (light of state.lights) {
|
|
16
|
+
[lx, ly, lz] = light.position;
|
|
17
|
+
lights.push(/* alloc */ {
|
|
18
|
+
...light, position: /* alloc */ [x - lx * dz - lz * dx, y + ly, z + lx * dx - lz * dz],
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
state.mesh.extras.lights = lights;
|
|
23
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { moveTraffic } from './moveTraffic.js';
|
|
2
|
-
import { updateTrafficLights } from './updateTrafficLights.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Update GPU vehicle poses and refresh light positions, throttling live light updates.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object} state Traffic layer state.
|
|
8
|
-
* @param {number} ms Simulation timestamp in milliseconds.
|
|
9
|
-
* @param {boolean} live Whether the simulation clock is live.
|
|
10
|
-
*/
|
|
11
|
-
export function updateTrafficPose(state, ms, live) {
|
|
12
|
-
if (!state.mesh) return;
|
|
13
|
-
moveTraffic(state, (ms - state.rebasedAt) / 1000);
|
|
14
|
-
if (state.lights && (!live || !(performance.now() - state.litAt < 100))) updateTrafficLights(state);
|
|
15
|
-
}
|
|
1
|
+
import { moveTraffic } from './moveTraffic.js';
|
|
2
|
+
import { updateTrafficLights } from './updateTrafficLights.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Update GPU vehicle poses and refresh light positions, throttling live light updates.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} state Traffic layer state.
|
|
8
|
+
* @param {number} ms Simulation timestamp in milliseconds.
|
|
9
|
+
* @param {boolean} live Whether the simulation clock is live.
|
|
10
|
+
*/
|
|
11
|
+
export function updateTrafficPose(state, ms, live) {
|
|
12
|
+
if (!state.mesh) return;
|
|
13
|
+
moveTraffic(state, (ms - state.rebasedAt) / 1000);
|
|
14
|
+
if (state.lights && (!live || !(performance.now() - state.litAt < 100))) updateTrafficLights(state);
|
|
15
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { disposeTrafficObject } from './disposeTrafficObject.js';
|
|
2
|
-
import { groundTraffic } from './groundTraffic.js';
|
|
3
|
-
import { trafficBounds } from './trafficBounds.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Reground traffic lanes after a terrain change and invalidate the route mesh and bounds.
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} state Traffic layer state.
|
|
9
|
-
*/
|
|
1
|
+
import { disposeTrafficObject } from './disposeTrafficObject.js';
|
|
2
|
+
import { groundTraffic } from './groundTraffic.js';
|
|
3
|
+
import { trafficBounds } from './trafficBounds.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reground traffic lanes after a terrain change and invalidate the route mesh and bounds.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} state Traffic layer state.
|
|
9
|
+
*/
|
|
10
10
|
export function updateTrafficTerrain(state) {
|
|
11
|
-
if (!state.lanes.length) return;
|
|
12
|
-
groundTraffic(state);
|
|
13
|
-
disposeTrafficObject(state, state.route);
|
|
14
|
-
state.route = null;
|
|
15
|
-
if (state.mesh) trafficBounds(state);
|
|
16
|
-
if (!state.frame) state.tick();
|
|
11
|
+
if (!state.lanes.length) return;
|
|
12
|
+
groundTraffic(state);
|
|
13
|
+
disposeTrafficObject(state, state.route);
|
|
14
|
+
state.route = null;
|
|
15
|
+
if (state.mesh) trafficBounds(state);
|
|
16
|
+
if (!state.frame) state.tick();
|
|
17
17
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { trafficStorage } from './trafficStorage.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Pack lane coordinates, elevations and cumulative distances into the GPU points buffer.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} state Traffic layer state.
|
|
7
|
-
* @param {GPUDevice} device Device used to create the points buffer.
|
|
8
|
-
*/
|
|
9
|
-
export function uploadTrafficLanes(state, device) {
|
|
10
|
-
let lane, i, point, count = 0;
|
|
11
|
-
for (lane of state.lanes) count += lane.points.length;
|
|
12
|
-
const data = /* alloc */ new Float32Array(count * 4);
|
|
13
|
-
let offset = 0;
|
|
14
|
-
for (lane of state.lanes) {
|
|
15
|
-
lane.start = offset / 4;
|
|
16
|
-
for (i = 0; i < lane.points.length; i++) {
|
|
17
|
-
point = lane.points[i];
|
|
18
|
-
data[offset++] = point[0];
|
|
19
|
-
data[offset++] = point[1];
|
|
20
|
-
data[offset++] = point[2];
|
|
21
|
-
data[offset++] = lane.lengths[i];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
state.gpu.points?.destroy();
|
|
25
|
-
state.gpu.points = trafficStorage(device, data);
|
|
26
|
-
state.lanesDirty = false;
|
|
27
|
-
}
|
|
1
|
+
import { trafficStorage } from './trafficStorage.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pack lane coordinates, elevations and cumulative distances into the GPU points buffer.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} state Traffic layer state.
|
|
7
|
+
* @param {GPUDevice} device Device used to create the points buffer.
|
|
8
|
+
*/
|
|
9
|
+
export function uploadTrafficLanes(state, device) {
|
|
10
|
+
let lane, i, point, count = 0;
|
|
11
|
+
for (lane of state.lanes) count += lane.points.length;
|
|
12
|
+
const data = /* alloc */ new Float32Array(count * 4);
|
|
13
|
+
let offset = 0;
|
|
14
|
+
for (lane of state.lanes) {
|
|
15
|
+
lane.start = offset / 4;
|
|
16
|
+
for (i = 0; i < lane.points.length; i++) {
|
|
17
|
+
point = lane.points[i];
|
|
18
|
+
data[offset++] = point[0];
|
|
19
|
+
data[offset++] = point[1];
|
|
20
|
+
data[offset++] = point[2];
|
|
21
|
+
data[offset++] = lane.lengths[i];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
state.gpu.points?.destroy();
|
|
25
|
+
state.gpu.points = trafficStorage(device, data);
|
|
26
|
+
state.lanesDirty = false;
|
|
27
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { degrees } from '../globals/degrees.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Reuse the node's local matrix to compose translation, YXZ rotation and scale.
|
|
5
|
-
*
|
|
6
|
-
* @param {Object} node Scene node with position, rotation and scale.
|
|
7
|
-
*
|
|
8
|
-
* @returns {DOMMatrix} The composed local matrix.
|
|
9
|
-
*/
|
|
10
|
-
export function composeLocalTransform(node) {
|
|
11
|
-
const matrix = node._localTransform ||= /* alloc */ new DOMMatrix();
|
|
12
|
-
matrix.m11 = 1, matrix.m12 = 0, matrix.m13 = 0, matrix.m14 = 0;
|
|
13
|
-
matrix.m21 = 0, matrix.m22 = 1, matrix.m23 = 0, matrix.m24 = 0;
|
|
14
|
-
matrix.m31 = 0, matrix.m32 = 0, matrix.m33 = 1, matrix.m34 = 0;
|
|
15
|
-
matrix.m41 = 0, matrix.m42 = 0, matrix.m43 = 0, matrix.m44 = 1;
|
|
16
|
-
matrix.translateSelf(node.position[0], node.position[1], node.position[2]);
|
|
17
|
-
// Node rotations use YXZ, as did the previous renderer.
|
|
18
|
-
matrix.rotateAxisAngleSelf(0, 1, 0, node.rotation[1] * degrees);
|
|
19
|
-
matrix.rotateAxisAngleSelf(1, 0, 0, node.rotation[0] * degrees);
|
|
20
|
-
matrix.rotateAxisAngleSelf(0, 0, 1, node.rotation[2] * degrees);
|
|
21
|
-
matrix.scaleSelf(node.scale[0], node.scale[1], node.scale[2]);
|
|
22
|
-
return matrix;
|
|
23
|
-
}
|
|
1
|
+
import { degrees } from '../globals/degrees.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reuse the node's local matrix to compose translation, YXZ rotation and scale.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} node Scene node with position, rotation and scale.
|
|
7
|
+
*
|
|
8
|
+
* @returns {DOMMatrix} The composed local matrix.
|
|
9
|
+
*/
|
|
10
|
+
export function composeLocalTransform(node) {
|
|
11
|
+
const matrix = node._localTransform ||= /* alloc */ new DOMMatrix();
|
|
12
|
+
matrix.m11 = 1, matrix.m12 = 0, matrix.m13 = 0, matrix.m14 = 0;
|
|
13
|
+
matrix.m21 = 0, matrix.m22 = 1, matrix.m23 = 0, matrix.m24 = 0;
|
|
14
|
+
matrix.m31 = 0, matrix.m32 = 0, matrix.m33 = 1, matrix.m34 = 0;
|
|
15
|
+
matrix.m41 = 0, matrix.m42 = 0, matrix.m43 = 0, matrix.m44 = 1;
|
|
16
|
+
matrix.translateSelf(node.position[0], node.position[1], node.position[2]);
|
|
17
|
+
// Node rotations use YXZ, as did the previous renderer.
|
|
18
|
+
matrix.rotateAxisAngleSelf(0, 1, 0, node.rotation[1] * degrees);
|
|
19
|
+
matrix.rotateAxisAngleSelf(1, 0, 0, node.rotation[0] * degrees);
|
|
20
|
+
matrix.rotateAxisAngleSelf(0, 0, 1, node.rotation[2] * degrees);
|
|
21
|
+
matrix.scaleSelf(node.scale[0], node.scale[1], node.scale[2]);
|
|
22
|
+
return matrix;
|
|
23
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Multiply a homogeneous point by a DOMMatrix and write its four components into target.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} target Reusable output point.
|
|
5
|
-
* @param {DOMMatrix} matrix Transformation matrix.
|
|
6
|
-
* @param {number} x Input x coordinate.
|
|
7
|
-
* @param {number} y Input y coordinate.
|
|
8
|
-
* @param {number} z Input z coordinate.
|
|
9
|
-
* @param {number} w Input homogeneous coordinate.
|
|
10
|
-
*
|
|
11
|
-
* @returns {Object} The supplied target with x, y, z and w components.
|
|
12
|
-
*/
|
|
13
|
-
export function transformNativePoint(target, matrix, x, y, z, w) {
|
|
14
|
-
target.x = matrix.m11 * x + matrix.m21 * y + matrix.m31 * z + matrix.m41 * w;
|
|
15
|
-
target.y = matrix.m12 * x + matrix.m22 * y + matrix.m32 * z + matrix.m42 * w;
|
|
16
|
-
target.z = matrix.m13 * x + matrix.m23 * y + matrix.m33 * z + matrix.m43 * w;
|
|
17
|
-
target.w = matrix.m14 * x + matrix.m24 * y + matrix.m34 * z + matrix.m44 * w;
|
|
18
|
-
return target;
|
|
19
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Multiply a homogeneous point by a DOMMatrix and write its four components into target.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} target Reusable output point.
|
|
5
|
+
* @param {DOMMatrix} matrix Transformation matrix.
|
|
6
|
+
* @param {number} x Input x coordinate.
|
|
7
|
+
* @param {number} y Input y coordinate.
|
|
8
|
+
* @param {number} z Input z coordinate.
|
|
9
|
+
* @param {number} w Input homogeneous coordinate.
|
|
10
|
+
*
|
|
11
|
+
* @returns {Object} The supplied target with x, y, z and w components.
|
|
12
|
+
*/
|
|
13
|
+
export function transformNativePoint(target, matrix, x, y, z, w) {
|
|
14
|
+
target.x = matrix.m11 * x + matrix.m21 * y + matrix.m31 * z + matrix.m41 * w;
|
|
15
|
+
target.y = matrix.m12 * x + matrix.m22 * y + matrix.m32 * z + matrix.m42 * w;
|
|
16
|
+
target.z = matrix.m13 * x + matrix.m23 * y + matrix.m33 * z + matrix.m43 * w;
|
|
17
|
+
target.w = matrix.m14 * x + matrix.m24 * y + matrix.m34 * z + matrix.m44 * w;
|
|
18
|
+
return target;
|
|
19
|
+
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compare and cache the node's explicit matrix or position, rotation and scale components.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} node Scene node with cached transform state.
|
|
5
|
-
* @param {boolean} changed Whether another change was already detected.
|
|
6
|
-
*
|
|
7
|
-
* @returns {boolean} Whether the transform or another input changed.
|
|
8
|
-
*/
|
|
9
|
-
export function worldMatrixChanged(node, changed) {
|
|
10
|
-
let i, value;
|
|
11
|
-
if (node.matrix) {
|
|
12
|
-
const state = node._matrixState ||= /* alloc */ new Float64Array(16);
|
|
13
|
-
for (i = 0; i < 16; i++) {
|
|
14
|
-
if (state[i] !== node.matrix[i]) changed = true;
|
|
15
|
-
state[i] = node.matrix[i];
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
const state = node._transformState ||= /* alloc */ new Float64Array(9);
|
|
19
|
-
for (i = 0; i < 9; i++) {
|
|
20
|
-
value = i < 3 ? node.position[i] : i < 6 ? node.rotation[i - 3] : node.scale[i - 6];
|
|
21
|
-
if (state[i] !== value) changed = true;
|
|
22
|
-
state[i] = value;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return changed;
|
|
26
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Compare and cache the node's explicit matrix or position, rotation and scale components.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} node Scene node with cached transform state.
|
|
5
|
+
* @param {boolean} changed Whether another change was already detected.
|
|
6
|
+
*
|
|
7
|
+
* @returns {boolean} Whether the transform or another input changed.
|
|
8
|
+
*/
|
|
9
|
+
export function worldMatrixChanged(node, changed) {
|
|
10
|
+
let i, value;
|
|
11
|
+
if (node.matrix) {
|
|
12
|
+
const state = node._matrixState ||= /* alloc */ new Float64Array(16);
|
|
13
|
+
for (i = 0; i < 16; i++) {
|
|
14
|
+
if (state[i] !== node.matrix[i]) changed = true;
|
|
15
|
+
state[i] = node.matrix[i];
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
const state = node._transformState ||= /* alloc */ new Float64Array(9);
|
|
19
|
+
for (i = 0; i < 9; i++) {
|
|
20
|
+
value = i < 3 ? node.position[i] : i < 6 ? node.rotation[i - 3] : node.scale[i - 6];
|
|
21
|
+
if (state[i] !== value) changed = true;
|
|
22
|
+
state[i] = value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return changed;
|
|
26
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { cross } from './cross.js';
|
|
2
|
-
import { containsVertex } from './containsVertex.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Clip convex ears from a polygon in place to produce indexed triangles.
|
|
6
|
-
*
|
|
7
|
-
* @param {Object[]} polygon Counterclockwise vertices carrying original indices.
|
|
8
|
-
*
|
|
9
|
-
* @returns {number[][]} Triangles of original vertex indices.
|
|
10
|
-
*
|
|
11
|
-
* @throws {Error} If no further ear can be clipped.
|
|
12
|
-
*/
|
|
13
|
-
export function clipEars(polygon) {
|
|
14
|
-
const result = /* alloc */ [];
|
|
15
|
-
let clipped, i, a, b, c, p;
|
|
16
|
-
while (polygon.length > 3) {
|
|
17
|
-
clipped = false;
|
|
18
|
-
for (i = 0; i < polygon.length; i++) {
|
|
19
|
-
a = polygon[(i + polygon.length - 1) % polygon.length], b = polygon[i], c = polygon[(i + 1) % polygon.length];
|
|
20
|
-
if (cross(a, b, c) <= 1e-10) continue;
|
|
21
|
-
if (containsVertex(polygon, a, b, c)) continue;
|
|
22
|
-
result.push(/* alloc */ [a.index, b.index, c.index]); polygon.splice(i, 1); clipped = true; break;
|
|
23
|
-
}
|
|
24
|
-
if (!clipped) throw /* alloc */ new Error('Unable to triangulate polygon: invalid or self-intersecting rings');
|
|
25
|
-
}
|
|
26
|
-
if (cross(...polygon) > 1e-10) {
|
|
27
|
-
const triangle = /* alloc */ [];
|
|
28
|
-
for (p of polygon) triangle.push(p.index);
|
|
29
|
-
result.push(triangle);
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
|
-
}
|
|
1
|
+
import { cross } from './cross.js';
|
|
2
|
+
import { containsVertex } from './containsVertex.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Clip convex ears from a polygon in place to produce indexed triangles.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object[]} polygon Counterclockwise vertices carrying original indices.
|
|
8
|
+
*
|
|
9
|
+
* @returns {number[][]} Triangles of original vertex indices.
|
|
10
|
+
*
|
|
11
|
+
* @throws {Error} If no further ear can be clipped.
|
|
12
|
+
*/
|
|
13
|
+
export function clipEars(polygon) {
|
|
14
|
+
const result = /* alloc */ [];
|
|
15
|
+
let clipped, i, a, b, c, p;
|
|
16
|
+
while (polygon.length > 3) {
|
|
17
|
+
clipped = false;
|
|
18
|
+
for (i = 0; i < polygon.length; i++) {
|
|
19
|
+
a = polygon[(i + polygon.length - 1) % polygon.length], b = polygon[i], c = polygon[(i + 1) % polygon.length];
|
|
20
|
+
if (cross(a, b, c) <= 1e-10) continue;
|
|
21
|
+
if (containsVertex(polygon, a, b, c)) continue;
|
|
22
|
+
result.push(/* alloc */ [a.index, b.index, c.index]); polygon.splice(i, 1); clipped = true; break;
|
|
23
|
+
}
|
|
24
|
+
if (!clipped) throw /* alloc */ new Error('Unable to triangulate polygon: invalid or self-intersecting rings');
|
|
25
|
+
}
|
|
26
|
+
if (cross(...polygon) > 1e-10) {
|
|
27
|
+
const triangle = /* alloc */ [];
|
|
28
|
+
for (p of polygon) triangle.push(p.index);
|
|
29
|
+
result.push(triangle);
|
|
30
|
+
}
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { inside } from './inside.js';
|
|
2
|
-
import { insideHole } from './insideHole.js';
|
|
3
|
-
import { crossesBoundary } from './crossesBoundary.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Connect a hole to the polygon using the shortest valid vertex bridge.
|
|
7
|
-
*
|
|
8
|
-
* @param {Object[]} polygon Current polygon vertices.
|
|
9
|
-
* @param {Object[]} hole Hole vertices to connect.
|
|
10
|
-
* @param {Object[][]} rings Outer ring followed by hole rings.
|
|
11
|
-
* @param {Object} mid Reusable midpoint with x and y fields.
|
|
12
|
-
*
|
|
13
|
-
* @returns {Object[]} Polygon vertices including the bridged hole.
|
|
14
|
-
*
|
|
15
|
-
* @throws {Error} If no valid bridge can be found.
|
|
16
|
-
*/
|
|
17
|
-
export function connectHole(polygon, hole, rings, mid) {
|
|
18
|
-
let h2 = -1, p2 = -1, distance = Infinity, h, p, a, b, d;
|
|
19
|
-
for (h = 0; h < hole.length; h++) for (p = 0; p < polygon.length; p++) {
|
|
20
|
-
a = hole[h], b = polygon[p], d = (a.x - b.x) ** 2 + (a.y - b.y) ** 2;
|
|
21
|
-
if (d >= distance) continue;
|
|
22
|
-
mid.x = (a.x + b.x) / 2; mid.y = (a.y + b.y) / 2;
|
|
23
|
-
if (!inside(mid, rings[0]) || insideHole(mid, rings)) continue;
|
|
24
|
-
if (crossesBoundary(a, b, polygon, rings)) continue;
|
|
25
|
-
h2 = h; p2 = p; distance = d;
|
|
26
|
-
}
|
|
27
|
-
if (h2 < 0) throw /* alloc */ new Error('Unable to connect polygon hole');
|
|
28
|
-
return /* alloc */ [...polygon.slice(0, p2 + 1), ...hole.slice(h2), ...hole.slice(0, h2 + 1),
|
|
29
|
-
polygon[p2], ...polygon.slice(p2 + 1)];
|
|
30
|
-
}
|
|
1
|
+
import { inside } from './inside.js';
|
|
2
|
+
import { insideHole } from './insideHole.js';
|
|
3
|
+
import { crossesBoundary } from './crossesBoundary.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Connect a hole to the polygon using the shortest valid vertex bridge.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object[]} polygon Current polygon vertices.
|
|
9
|
+
* @param {Object[]} hole Hole vertices to connect.
|
|
10
|
+
* @param {Object[][]} rings Outer ring followed by hole rings.
|
|
11
|
+
* @param {Object} mid Reusable midpoint with x and y fields.
|
|
12
|
+
*
|
|
13
|
+
* @returns {Object[]} Polygon vertices including the bridged hole.
|
|
14
|
+
*
|
|
15
|
+
* @throws {Error} If no valid bridge can be found.
|
|
16
|
+
*/
|
|
17
|
+
export function connectHole(polygon, hole, rings, mid) {
|
|
18
|
+
let h2 = -1, p2 = -1, distance = Infinity, h, p, a, b, d;
|
|
19
|
+
for (h = 0; h < hole.length; h++) for (p = 0; p < polygon.length; p++) {
|
|
20
|
+
a = hole[h], b = polygon[p], d = (a.x - b.x) ** 2 + (a.y - b.y) ** 2;
|
|
21
|
+
if (d >= distance) continue;
|
|
22
|
+
mid.x = (a.x + b.x) / 2; mid.y = (a.y + b.y) / 2;
|
|
23
|
+
if (!inside(mid, rings[0]) || insideHole(mid, rings)) continue;
|
|
24
|
+
if (crossesBoundary(a, b, polygon, rings)) continue;
|
|
25
|
+
h2 = h; p2 = p; distance = d;
|
|
26
|
+
}
|
|
27
|
+
if (h2 < 0) throw /* alloc */ new Error('Unable to connect polygon hole');
|
|
28
|
+
return /* alloc */ [...polygon.slice(0, p2 + 1), ...hole.slice(h2), ...hole.slice(0, h2 + 1),
|
|
29
|
+
polygon[p2], ...polygon.slice(p2 + 1)];
|
|
30
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compute the signed 2D cross product of the vectors from a to b and c.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} a Origin point with x and y coordinates.
|
|
5
|
-
* @param {Object} b First endpoint.
|
|
6
|
-
* @param {Object} c Second endpoint.
|
|
7
|
-
*
|
|
8
|
-
* @returns {number} Signed cross product.
|
|
9
|
-
*/
|
|
10
|
-
export function cross(a, b, c) {
|
|
11
|
-
return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
|
12
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Compute the signed 2D cross product of the vectors from a to b and c.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} a Origin point with x and y coordinates.
|
|
5
|
+
* @param {Object} b First endpoint.
|
|
6
|
+
* @param {Object} c Second endpoint.
|
|
7
|
+
*
|
|
8
|
+
* @returns {number} Signed cross product.
|
|
9
|
+
*/
|
|
10
|
+
export function cross(a, b, c) {
|
|
11
|
+
return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
|
|
12
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compare two planar points by exact coordinates.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} a First point.
|
|
5
|
-
* @param {Object} b Second point.
|
|
6
|
-
*
|
|
7
|
-
* @returns {boolean} Whether both coordinates match.
|
|
8
|
-
*/
|
|
9
|
-
export function equal(a, b) {
|
|
10
|
-
return a.x === b.x && a.y === b.y;
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Compare two planar points by exact coordinates.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} a First point.
|
|
5
|
+
* @param {Object} b Second point.
|
|
6
|
+
*
|
|
7
|
+
* @returns {boolean} Whether both coordinates match.
|
|
8
|
+
*/
|
|
9
|
+
export function equal(a, b) {
|
|
10
|
+
return a.x === b.x && a.y === b.y;
|
|
11
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { equal } from './equal.js';
|
|
2
|
-
import { cross } from './cross.js';
|
|
3
|
-
import { on } from './on.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Test two segments for intersection, excluding shared endpoints.
|
|
7
|
-
*
|
|
8
|
-
* @param {Object} a First endpoint of the first segment.
|
|
9
|
-
* @param {Object} b Second endpoint of the first segment.
|
|
10
|
-
* @param {Object} c First endpoint of the second segment.
|
|
11
|
-
* @param {Object} d Second endpoint of the second segment.
|
|
12
|
-
*
|
|
13
|
-
* @returns {boolean} Whether the segments intersect.
|
|
14
|
-
*/
|
|
15
|
-
export function intersects(a, b, c, d) {
|
|
16
|
-
if (equal(a, c) || equal(a, d) || equal(b, c) || equal(b, d)) return false;
|
|
17
|
-
const abC = cross(a, b, c), abD = cross(a, b, d), cdA = cross(c, d, a), cdB = cross(c, d, b);
|
|
18
|
-
return abC * abD < 0 && cdA * cdB < 0 ||
|
|
19
|
-
abC === 0 && on(a, b, c) || abD === 0 && on(a, b, d) ||
|
|
20
|
-
cdA === 0 && on(c, d, a) || cdB === 0 && on(c, d, b);
|
|
21
|
-
}
|
|
1
|
+
import { equal } from './equal.js';
|
|
2
|
+
import { cross } from './cross.js';
|
|
3
|
+
import { on } from './on.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test two segments for intersection, excluding shared endpoints.
|
|
7
|
+
*
|
|
8
|
+
* @param {Object} a First endpoint of the first segment.
|
|
9
|
+
* @param {Object} b Second endpoint of the first segment.
|
|
10
|
+
* @param {Object} c First endpoint of the second segment.
|
|
11
|
+
* @param {Object} d Second endpoint of the second segment.
|
|
12
|
+
*
|
|
13
|
+
* @returns {boolean} Whether the segments intersect.
|
|
14
|
+
*/
|
|
15
|
+
export function intersects(a, b, c, d) {
|
|
16
|
+
if (equal(a, c) || equal(a, d) || equal(b, c) || equal(b, d)) return false;
|
|
17
|
+
const abC = cross(a, b, c), abD = cross(a, b, d), cdA = cross(c, d, a), cdB = cross(c, d, b);
|
|
18
|
+
return abC * abD < 0 && cdA * cdB < 0 ||
|
|
19
|
+
abC === 0 && on(a, b, c) || abD === 0 && on(a, b, d) ||
|
|
20
|
+
cdA === 0 && on(c, d, a) || cdB === 0 && on(c, d, b);
|
|
21
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merge two adjacent runs of hole entries by their minimum x coordinate.
|
|
3
|
-
*
|
|
4
|
-
* @param {Object[]} source Sorted runs of hole entries.
|
|
5
|
-
* @param {Object[]} target Array receiving the merged entries.
|
|
6
|
-
* @param {number} start First index of the runs.
|
|
7
|
-
* @param {number} width Maximum length of each run.
|
|
8
|
-
*/
|
|
9
|
-
export function mergeHoles(source, target, start, width) {
|
|
10
|
-
const middle = Math.min(start + width, source.length), end = Math.min(start + width * 2, source.length);
|
|
11
|
-
let left = start, right = middle, output;
|
|
12
|
-
for (output = start; output < end; output++) {
|
|
13
|
-
if (left < middle && (right >= end || source[left].x <= source[right].x)) {
|
|
14
|
-
target[output] = source[left++];
|
|
15
|
-
} else {
|
|
16
|
-
target[output] = source[right++];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Merge two adjacent runs of hole entries by their minimum x coordinate.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object[]} source Sorted runs of hole entries.
|
|
5
|
+
* @param {Object[]} target Array receiving the merged entries.
|
|
6
|
+
* @param {number} start First index of the runs.
|
|
7
|
+
* @param {number} width Maximum length of each run.
|
|
8
|
+
*/
|
|
9
|
+
export function mergeHoles(source, target, start, width) {
|
|
10
|
+
const middle = Math.min(start + width, source.length), end = Math.min(start + width * 2, source.length);
|
|
11
|
+
let left = start, right = middle, output;
|
|
12
|
+
for (output = start; output < end; output++) {
|
|
13
|
+
if (left < middle && (right >= end || source[left].x <= source[right].x)) {
|
|
14
|
+
target[output] = source[left++];
|
|
15
|
+
} else {
|
|
16
|
+
target[output] = source[right++];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|