@weasel-js/core 1.9.4 → 1.10.0
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/CHANGELOG.md +750 -0
- package/README.md +5 -3
- package/dist/WeaselProvider.js +5 -7
- package/dist/WeaselProvider.js.map +1 -1
- package/dist/affordances/composeAffordanceLayer.js +91 -83
- package/dist/affordances/composeAffordanceLayer.js.map +1 -1
- package/dist/affordances/cornerResize.js +3 -2
- package/dist/affordances/cornerResize.js.map +1 -1
- package/dist/affordances/hitAffordanceRegions.js +54 -100
- package/dist/affordances/hitAffordanceRegions.js.map +1 -1
- package/dist/affordances/pathAnchors.js.map +1 -1
- package/dist/affordances/rotationHandle.js +5 -4
- package/dist/affordances/rotationHandle.js.map +1 -1
- package/dist/animation/behaviors/coast.js +21 -0
- package/dist/animation/behaviors/coast.js.map +1 -0
- package/dist/animation/behaviors/coastByWrite.js +107 -0
- package/dist/animation/behaviors/coastByWrite.js.map +1 -0
- package/dist/animation/behaviors/coastOnTargets.js +94 -0
- package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +48 -136
- package/dist/animation/behaviors/momentum.js.map +1 -1
- package/dist/animation/clipTargets.js +12 -0
- package/dist/animation/clipTargets.js.map +1 -0
- package/dist/animation/index.js +15 -20
- package/dist/animation/poseHelpers.js +112 -33
- package/dist/animation/poseHelpers.js.map +1 -1
- package/dist/animation/poseTarget.js +115 -0
- package/dist/animation/poseTarget.js.map +1 -0
- package/dist/animation/reflow.js +113 -83
- package/dist/animation/reflow.js.map +1 -1
- package/dist/animation/rewind.js +66 -0
- package/dist/animation/rewind.js.map +1 -0
- package/dist/animation/rig/bindRig.js +85 -53
- package/dist/animation/rig/bindRig.js.map +1 -1
- package/dist/animation/rig/rigNode.js +93 -0
- package/dist/animation/rig/rigNode.js.map +1 -0
- package/dist/animation/rig/rigSeat.js +26 -0
- package/dist/animation/rig/rigSeat.js.map +1 -0
- package/dist/animation/rig/skinBinding.js +56 -0
- package/dist/animation/rig/skinBinding.js.map +1 -0
- package/dist/animation/rig/useRig.js +31 -16
- package/dist/animation/rig/useRig.js.map +1 -1
- package/dist/animation/wrappers/animateLifecycle.js +8 -7
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
- package/dist/animation/wrappers/animateOnSetPose.js +31 -31
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
- package/dist/animation/wrappers/instantPose.js.map +1 -1
- package/dist/animation/writtenPoseTarget.js +33 -0
- package/dist/animation/writtenPoseTarget.js.map +1 -0
- package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
- package/dist/barrel/canvas.js +31 -0
- package/dist/barrel/chrome.js +10 -10
- package/dist/barrel/input.js +16 -17
- package/dist/barrel/interactions.js +35 -39
- package/dist/barrel/paint.js +11 -18
- package/dist/barrel/paths.js +12 -19
- package/dist/barrel/renderer.js +14 -20
- package/dist/barrel/routing.js +42 -36
- package/dist/barrel/scene.js +37 -0
- package/dist/barrel/text.js +9 -18
- package/dist/barrel/viewport.js +41 -51
- package/dist/canvas/Canvas.js +281 -475
- package/dist/canvas/Canvas.js.map +1 -1
- package/dist/canvas/CanvasView.js +169 -188
- package/dist/canvas/CanvasView.js.map +1 -1
- package/dist/canvas/CursorCoordsHud.js +22 -23
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/DrawCanvas.js +39 -56
- package/dist/canvas/DrawCanvas.js.map +1 -1
- package/dist/canvas/ModalityHud.js.map +1 -1
- package/dist/canvas/NodeShape.js +28 -29
- package/dist/canvas/NodeShape.js.map +1 -1
- package/dist/canvas/PickHud.js.map +1 -1
- package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
- package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
- package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
- package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
- package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
- package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
- package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +40 -29
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
- package/dist/canvas/SceneCanvas/features.js +73 -43
- package/dist/canvas/SceneCanvas/features.js.map +1 -1
- package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
- package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
- package/dist/canvas/SceneCanvas/props.js +15 -14
- package/dist/canvas/SceneCanvas/props.js.map +1 -1
- package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
- package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
- package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
- package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
- package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
- package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
- package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
- package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
- package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
- package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +39 -37
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
- package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
- package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
- package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +76 -80
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
- package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
- package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
- package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
- package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
- package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +303 -707
- package/dist/canvas/SceneCanvas.js.map +1 -1
- package/dist/canvas/SceneViewCanvas.js +41 -47
- package/dist/canvas/SceneViewCanvas.js.map +1 -1
- package/dist/canvas/adapterDerivedPath.js +26 -0
- package/dist/canvas/adapterDerivedPath.js.map +1 -0
- package/dist/canvas/affordanceAt.js +11 -1
- package/dist/canvas/affordanceAt.js.map +1 -1
- package/dist/canvas/buildSceneLayer.js +81 -61
- package/dist/canvas/buildSceneLayer.js.map +1 -1
- package/dist/canvas/buildSceneTree.js.map +1 -1
- package/dist/canvas/canvasRenderer.js +40 -44
- package/dist/canvas/canvasRenderer.js.map +1 -1
- package/dist/canvas/colorOverrides.js.map +1 -1
- package/dist/canvas/defaultDrawOne.js +12 -12
- package/dist/canvas/defaultDrawOne.js.map +1 -1
- package/dist/canvas/deps/areaSelect.js +4 -4
- package/dist/canvas/deps/areaSelect.js.map +1 -1
- package/dist/canvas/deps/debug.js.map +1 -1
- package/dist/canvas/deps/editAnchors.js +49 -68
- package/dist/canvas/deps/editAnchors.js.map +1 -1
- package/dist/canvas/deps/geometryProjection.js.map +1 -1
- package/dist/canvas/deps/hitTestArea.js +31 -26
- package/dist/canvas/deps/hitTestArea.js.map +1 -1
- package/dist/canvas/deps/insert.js +65 -54
- package/dist/canvas/deps/insert.js.map +1 -1
- package/dist/canvas/deps/lassoSelect.js +5 -5
- package/dist/canvas/deps/lassoSelect.js.map +1 -1
- package/dist/canvas/deps/poseDescriptor.js +1 -1
- package/dist/canvas/deps/poseDescriptor.js.map +1 -1
- package/dist/canvas/deps/resizePolicy.js.map +1 -1
- package/dist/canvas/deps/slice.js +44 -45
- package/dist/canvas/deps/slice.js.map +1 -1
- package/dist/canvas/deps/textEdit.js +8 -8
- package/dist/canvas/deps/textEdit.js.map +1 -1
- package/dist/canvas/deps/view.js.map +1 -1
- package/dist/canvas/derivedPath.js +43 -41
- package/dist/canvas/derivedPath.js.map +1 -1
- package/dist/canvas/drawEnvelope.js +8 -4
- package/dist/canvas/drawEnvelope.js.map +1 -1
- package/dist/canvas/getNodeAtPoint.js +2 -6
- package/dist/canvas/getNodeAtPoint.js.map +1 -1
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/canvas/insertPreviewExtent.js.map +1 -1
- package/dist/canvas/layerOrder.js.map +1 -1
- package/dist/canvas/layerSlots.js +6 -1
- package/dist/canvas/layerSlots.js.map +1 -1
- package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
- package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/imagePainter.js +10 -10
- package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/memo.js.map +1 -1
- package/dist/canvas/nodeShapes/nodePaint.js +34 -23
- package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
- package/dist/canvas/nodeShapes/pathPainter.js +23 -22
- package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/poseBox.js +6 -6
- package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
- package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
- package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
- package/dist/canvas/nodeShapes/shapePainter.js +16 -16
- package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
- package/dist/canvas/nodeShapes/textPainter.js +1 -1
- package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
- package/dist/canvas/overlayRoleStrokes.js.map +1 -1
- package/dist/canvas/paintCull.js +6 -8
- package/dist/canvas/paintCull.js.map +1 -1
- package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
- package/dist/canvas/paintedCursorLayer.js.map +1 -0
- package/dist/canvas/pickWalk.js +52 -50
- package/dist/canvas/pickWalk.js.map +1 -1
- package/dist/canvas/planeClips.js +18 -19
- package/dist/canvas/planeClips.js.map +1 -1
- package/dist/canvas/poseCascade.js +41 -0
- package/dist/canvas/poseCascade.js.map +1 -0
- package/dist/canvas/poseRotation.js +1 -3
- package/dist/canvas/poseRotation.js.map +1 -1
- package/dist/canvas/rasterReadback.js +22 -0
- package/dist/canvas/rasterReadback.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +12 -12
- package/dist/canvas/renderDebugSnapshot.js.map +1 -1
- package/dist/canvas/renderNeeds.js +3 -3
- package/dist/canvas/renderNeeds.js.map +1 -1
- package/dist/canvas/renderSceneToPixels.js +64 -83
- package/dist/canvas/renderSceneToPixels.js.map +1 -1
- package/dist/canvas/sceneAdapter.js +68 -132
- package/dist/canvas/sceneAdapter.js.map +1 -1
- package/dist/canvas/sceneClipboard.js +1 -1
- package/dist/canvas/sceneClipboard.js.map +1 -1
- package/dist/canvas/sceneLayerPaint.js +4 -4
- package/dist/canvas/sceneLayerPaint.js.map +1 -1
- package/dist/canvas/sceneSlotWiring.js +4 -4
- package/dist/canvas/sceneSlotWiring.js.map +1 -1
- package/dist/canvas/sceneViewRender.js +36 -35
- package/dist/canvas/sceneViewRender.js.map +1 -1
- package/dist/canvas/slopsDebugLayer.js +4 -4
- package/dist/canvas/slopsDebugLayer.js.map +1 -1
- package/dist/canvas/surface.module.js +6 -0
- package/dist/canvas/surface.module.js.map +1 -0
- package/dist/canvas/surfaceBox.js +16 -0
- package/dist/canvas/surfaceBox.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +23 -11
- package/dist/canvas/useCanvasRenderer.js.map +1 -1
- package/dist/canvas/useCanvasSurface.js +31 -0
- package/dist/canvas/useCanvasSurface.js.map +1 -0
- package/dist/canvas/useCanvasView.js +46 -37
- package/dist/canvas/useCanvasView.js.map +1 -1
- package/dist/canvas/useFrameLoop.js +11 -12
- package/dist/canvas/useFrameLoop.js.map +1 -1
- package/dist/canvas/useHostAnchor.js +35 -33
- package/dist/canvas/useHostAnchor.js.map +1 -1
- package/dist/canvas/useLateContentRedraw.js +8 -8
- package/dist/canvas/useLateContentRedraw.js.map +1 -1
- package/dist/canvas/useSceneLayerList.js +4 -14
- package/dist/canvas/useSceneLayerList.js.map +1 -1
- package/dist/canvas/useSurfaceInput.js +42 -0
- package/dist/canvas/useSurfaceInput.js.map +1 -0
- package/dist/canvas/useToolCursor.js +29 -0
- package/dist/canvas/useToolCursor.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +46 -85
- package/dist/canvas/useViewHelpers.js.map +1 -1
- package/dist/canvas/viewInputs.js.map +1 -1
- package/dist/canvas/viewRegistry.js +25 -27
- package/dist/canvas/viewRegistry.js.map +1 -1
- package/dist/canvas/watchElementMove.js +43 -0
- package/dist/canvas/watchElementMove.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -1
- package/dist/clipboard.d.ts +7 -14
- package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
- package/dist/clone.d.ts +4 -8
- package/dist/clone.js +0 -2
- package/dist/core/device/targets.js.map +1 -1
- package/dist/core/device/useDeviceProfile.js +13 -13
- package/dist/core/device/useDeviceProfile.js.map +1 -1
- package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
- package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/pathPoseDescriptor.js +88 -0
- package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +61 -14
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/core/geometry/regionHit.js +35 -37
- package/dist/core/geometry/regionHit.js.map +1 -1
- package/dist/core/geometry/targetFrame.js +94 -0
- package/dist/core/geometry/targetFrame.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +4 -5
- package/dist/core/geometry/unionBounds.js.map +1 -1
- package/dist/core/layers/backgroundFill.js +31 -0
- package/dist/core/layers/backgroundFill.js.map +1 -0
- package/dist/{features/groups → core/layers}/children.js +1 -1
- package/dist/core/layers/children.js.map +1 -0
- package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
- package/dist/core/layers/gateLayer.js.map +1 -0
- package/dist/core/layers/layerGroup.js +40 -0
- package/dist/core/layers/layerGroup.js.map +1 -0
- package/dist/core/layers/render.js +50 -76
- package/dist/core/layers/render.js.map +1 -1
- package/dist/core/ops/createHistory.js +9 -9
- package/dist/core/ops/createHistory.js.map +1 -1
- package/dist/core/ops/delete.js.map +1 -1
- package/dist/core/paint/meshKind.js +16 -0
- package/dist/core/paint/meshKind.js.map +1 -0
- package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +103 -92
- package/dist/core/paint/meshKindLazy.js.map +1 -0
- package/dist/core/paint/paintKindEntry.js +8 -0
- package/dist/core/paint/paintKindEntry.js.map +1 -0
- package/dist/core/paint/paintKinds.js +144 -0
- package/dist/core/paint/paintKinds.js.map +1 -0
- package/dist/core/paint/registerMesh.js +7 -0
- package/dist/core/paint/registerMesh.js.map +1 -0
- package/dist/core/scene/NodeProperties.js.map +1 -1
- package/dist/core/scene/NodeRouting.js.map +1 -1
- package/dist/core/scene/arrivalWindow.js +65 -64
- package/dist/core/scene/arrivalWindow.js.map +1 -1
- package/dist/core/scene/boundOps.js +40 -0
- package/dist/core/scene/boundOps.js.map +1 -0
- package/dist/core/scene/composeFrame.js +9 -6
- package/dist/core/scene/composeFrame.js.map +1 -1
- package/dist/{features/groups → core/scene}/composePose.js +18 -18
- package/dist/core/scene/composePose.js.map +1 -0
- package/dist/core/scene/depMemo.js +31 -6
- package/dist/core/scene/depMemo.js.map +1 -1
- package/dist/core/scene/derivedPath.js +19 -20
- package/dist/core/scene/derivedPath.js.map +1 -1
- package/dist/core/scene/editMode.js +26 -0
- package/dist/core/scene/editMode.js.map +1 -0
- package/dist/core/scene/effectivePose.js +38 -39
- package/dist/core/scene/effectivePose.js.map +1 -1
- package/dist/core/scene/fieldEdits.js +98 -0
- package/dist/core/scene/fieldEdits.js.map +1 -0
- package/dist/core/scene/historyFacade.js +116 -70
- package/dist/core/scene/historyFacade.js.map +1 -1
- package/dist/core/scene/historyForm.js +6 -0
- package/dist/core/scene/historyForm.js.map +1 -0
- package/dist/core/scene/kitOps.js +83 -71
- package/dist/core/scene/kitOps.js.map +1 -1
- package/dist/core/scene/kitRegistry.js.map +1 -1
- package/dist/core/scene/layerStack.js +105 -12
- package/dist/core/scene/layerStack.js.map +1 -1
- package/dist/core/scene/layoutPass.js +58 -59
- package/dist/core/scene/layoutPass.js.map +1 -1
- package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
- package/dist/core/scene/nestedHit.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +9 -9
- package/dist/core/scene/nodeFnFields.js.map +1 -1
- package/dist/core/scene/nodeMemo.js.map +1 -1
- package/dist/core/scene/nodeStore.js +72 -71
- package/dist/core/scene/nodeStore.js.map +1 -1
- package/dist/core/scene/notifier.js +37 -0
- package/dist/core/scene/notifier.js.map +1 -0
- package/dist/core/scene/opTable.js +50 -0
- package/dist/core/scene/opTable.js.map +1 -0
- package/dist/core/scene/outerOps.js +66 -0
- package/dist/core/scene/outerOps.js.map +1 -0
- package/dist/core/scene/poseHold.js +39 -0
- package/dist/core/scene/poseHold.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +44 -36
- package/dist/core/scene/poseOverrides.js.map +1 -1
- package/dist/core/scene/poseSnapshot.js.map +1 -1
- package/dist/core/scene/reconcileSpecs.js +3 -2
- package/dist/core/scene/reconcileSpecs.js.map +1 -1
- package/dist/core/scene/recorder.js +86 -0
- package/dist/core/scene/recorder.js.map +1 -0
- package/dist/core/scene/renderOrder.js.map +1 -1
- package/dist/core/scene/scene.js +81 -690
- package/dist/core/scene/scene.js.map +1 -1
- package/dist/core/scene/sceneEdits.js +58 -0
- package/dist/core/scene/sceneEdits.js.map +1 -0
- package/dist/core/scene/sceneMutators.js +49 -0
- package/dist/core/scene/sceneMutators.js.map +1 -0
- package/dist/core/scene/scenePoseAdapter.js +16 -0
- package/dist/core/scene/scenePoseAdapter.js.map +1 -0
- package/dist/core/scene/sceneRecording.js +90 -0
- package/dist/core/scene/sceneRecording.js.map +1 -0
- package/dist/core/scene/sceneSelection.js +28 -0
- package/dist/core/scene/sceneSelection.js.map +1 -0
- package/dist/core/scene/sceneState.js +49 -0
- package/dist/core/scene/sceneState.js.map +1 -0
- package/dist/core/scene/serialization.js +8 -5
- package/dist/core/scene/serialization.js.map +1 -1
- package/dist/core/scene/staleReplay.js +51 -0
- package/dist/core/scene/staleReplay.js.map +1 -0
- package/dist/core/scene/statedFields.js +9 -0
- package/dist/core/scene/statedFields.js.map +1 -0
- package/dist/core/scene/treeEdits.js +127 -0
- package/dist/core/scene/treeEdits.js.map +1 -0
- package/dist/core/scene/treeReads.js +26 -0
- package/dist/core/scene/treeReads.js.map +1 -0
- package/dist/core/scene/types.js.map +1 -1
- package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
- package/dist/core/scene/unionOfChildren.js.map +1 -0
- package/dist/core/scene/unitScopes.js +13 -0
- package/dist/core/scene/unitScopes.js.map +1 -0
- package/dist/core/scene/useScene.js.map +1 -1
- package/dist/core/selection/readOnlySelection.js +32 -0
- package/dist/core/selection/readOnlySelection.js.map +1 -0
- package/dist/core/selection/usePublishSceneSelection.js +26 -0
- package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
- package/dist/core/selection/useSelection.js +34 -25
- package/dist/core/selection/useSelection.js.map +1 -1
- package/dist/core/shapeKinds.js.map +1 -1
- package/dist/core/stylus/stylus.js.map +1 -1
- package/dist/core/stylus/usePointerStylus.js.map +1 -1
- package/dist/core/usePaintKinds.js +1 -1
- package/dist/core/usePaintKinds.js.map +1 -1
- package/dist/core/viewport/clientToWorld.js.map +1 -1
- package/dist/core/viewport/fitViewToBounds.js.map +1 -1
- package/dist/core/viewport/parallax.js.map +1 -1
- package/dist/core/viewport/screenSlop.js +11 -11
- package/dist/core/viewport/screenSlop.js.map +1 -1
- package/dist/core/viewport/useCanvasSize.js.map +1 -1
- package/dist/core/viewport/useDecayLoop.js +8 -8
- package/dist/core/viewport/useDecayLoop.js.map +1 -1
- package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
- package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +102 -43
- package/dist/core/viewport/useViewAnimation.js.map +1 -1
- package/dist/core/viewport/view.js +7 -7
- package/dist/core/viewport/view.js.map +1 -1
- package/dist/core/viewport/wheelHandler.js.map +1 -1
- package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
- package/dist/debug/createDebugOverlayLayer.js +100 -100
- package/dist/debug/createDebugOverlayLayer.js.map +1 -1
- package/dist/debug/createDebugSink.js.map +1 -1
- package/dist/debug/frameStats.js.map +1 -1
- package/dist/debug/useDebugSink.js +52 -0
- package/dist/debug/useDebugSink.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
- package/dist/features/chrome-caps/conditions.js.map +1 -1
- package/dist/features/chrome-caps/defaults.js.map +1 -1
- package/dist/features/chrome-caps/resolve.js.map +1 -1
- package/dist/features/chrome-caps/useChromeCaps.js +54 -0
- package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
- package/dist/features/ingestion/contentHandlers.js +25 -19
- package/dist/features/ingestion/contentHandlers.js.map +1 -1
- package/dist/features/ingestion/imageHandler.js +21 -24
- package/dist/features/ingestion/imageHandler.js.map +1 -1
- package/dist/features/ingestion/openFilePicker.js.map +1 -1
- package/dist/features/ingestion/placement.js +16 -0
- package/dist/features/ingestion/placement.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +5 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -1
- package/dist/features/ingestion/textHandler.js +28 -0
- package/dist/features/ingestion/textHandler.js.map +1 -0
- package/dist/features/ingestion/useCanvasIngestion.js +48 -0
- package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +5 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
- package/dist/features/longPress/longPressFeedback.js.map +1 -1
- package/dist/features/modes/modeLayers.js +7 -7
- package/dist/features/modes/modeLayers.js.map +1 -1
- package/dist/features/paths/editablePath.js +47 -0
- package/dist/features/paths/editablePath.js.map +1 -0
- package/dist/features/paths/index.js +9 -16
- package/dist/features/paths/pathEditState.js +41 -0
- package/dist/features/paths/pathEditState.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
- package/dist/features/paths/pathLayer.js +3 -2
- package/dist/features/paths/pathLayer.js.map +1 -1
- package/dist/features/paths/penPreviewLayer.js +86 -88
- package/dist/features/paths/penPreviewLayer.js.map +1 -1
- package/dist/features/paths/usePathEdit.js +34 -0
- package/dist/features/paths/usePathEdit.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +42 -55
- package/dist/features/poseRun/usePoseRun.js.map +1 -1
- package/dist/features/selection/overlay.js +170 -178
- package/dist/features/selection/overlay.js.map +1 -1
- package/dist/features/text/index.js +6 -0
- package/dist/features/text/textLayer.js +1 -1
- package/dist/features/text/textLayer.js.map +1 -1
- package/dist/features/text/useSceneTextEdit.js +95 -82
- package/dist/features/text/useSceneTextEdit.js.map +1 -1
- package/dist/features/viewports/viewportLayer.js +25 -36
- package/dist/features/viewports/viewportLayer.js.map +1 -1
- package/dist/index.d.ts +4507 -8459
- package/dist/index.js +275 -320
- package/dist/input/keyState.js +14 -14
- package/dist/interactions/actions/actionShortcuts.js.map +1 -1
- package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
- package/dist/interactions/actions/align/action.js.map +1 -0
- package/dist/interactions/actions/align/align.js +23 -23
- package/dist/interactions/actions/align/align.js.map +1 -1
- package/dist/interactions/actions/booleans/action.js +65 -0
- package/dist/interactions/actions/booleans/action.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +69 -78
- package/dist/interactions/actions/booleans/booleans.js.map +1 -1
- package/dist/interactions/actions/booleans/operands.js +40 -0
- package/dist/interactions/actions/booleans/operands.js.map +1 -0
- package/dist/interactions/actions/booleans/pieces.js +45 -0
- package/dist/interactions/actions/booleans/pieces.js.map +1 -0
- package/dist/interactions/actions/booleans/placement.js +24 -0
- package/dist/interactions/actions/booleans/placement.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +11 -9
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
- package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
- package/dist/interactions/actions/clipboard/action.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
- package/dist/interactions/actions/clone/action.js +98 -0
- package/dist/interactions/actions/clone/action.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors.js +52 -0
- package/dist/interactions/actions/clone/behaviors.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
- package/dist/interactions/actions/defaults/anchorEditing.js +41 -43
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
- package/dist/interactions/actions/defaults/delete.js.map +1 -1
- package/dist/interactions/actions/defaults/duplicate.js +19 -19
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
- package/dist/interactions/actions/defaults/group.js +35 -40
- package/dist/interactions/actions/defaults/group.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
- package/dist/interactions/actions/defaults/ingest.js +19 -15
- package/dist/interactions/actions/defaults/ingest.js.map +1 -1
- package/dist/interactions/actions/defaults/insertPathAnchor.js +14 -15
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
- package/dist/interactions/actions/defaults/nudge.js +30 -31
- package/dist/interactions/actions/defaults/nudge.js.map +1 -1
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
- package/dist/interactions/actions/defaults/setFill.js +9 -3
- package/dist/interactions/actions/defaults/setFill.js.map +1 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
- package/dist/interactions/actions/defaults/sliceOps.js +20 -22
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
- package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
- package/dist/interactions/actions/distribute/action.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +11 -11
- package/dist/interactions/actions/distribute/distribute.js.map +1 -1
- package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +19 -21
- package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
- package/dist/interactions/actions/flip/action.js +124 -0
- package/dist/interactions/actions/flip/action.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +1 -1
- package/dist/interactions/actions/flip/helpers.js.map +1 -1
- package/dist/interactions/actions/gestureFrames.js +18 -0
- package/dist/interactions/actions/gestureFrames.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +47 -20
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
- package/dist/interactions/actions/insert/action.js +72 -0
- package/dist/interactions/actions/insert/action.js.map +1 -0
- package/dist/interactions/actions/insert/commit.js +28 -0
- package/dist/interactions/actions/insert/commit.js.map +1 -0
- package/dist/interactions/actions/insert/extras.js +65 -0
- package/dist/interactions/actions/insert/extras.js.map +1 -0
- package/dist/interactions/actions/insert/frame.js +48 -0
- package/dist/interactions/actions/insert/frame.js.map +1 -0
- package/dist/interactions/actions/insert/geometry.js +35 -0
- package/dist/interactions/actions/insert/geometry.js.map +1 -0
- package/dist/interactions/actions/insert/rotateAction.js +21 -0
- package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
- package/dist/interactions/actions/insert/session.js +59 -0
- package/dist/interactions/actions/insert/session.js.map +1 -0
- package/dist/interactions/actions/insert/shape.js +34 -0
- package/dist/interactions/actions/insert/shape.js.map +1 -0
- package/dist/interactions/actions/lasso-select/action.js +143 -0
- package/dist/interactions/actions/lasso-select/action.js.map +1 -0
- package/dist/interactions/actions/move/action.js +87 -0
- package/dist/interactions/actions/move/action.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
- package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
- package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +24 -23
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
- package/dist/interactions/actions/move/capture.js +99 -0
- package/dist/interactions/actions/move/capture.js.map +1 -0
- package/dist/interactions/actions/move/commit/index.js +41 -0
- package/dist/interactions/actions/move/commit/index.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
- package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
- package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
- package/dist/interactions/actions/move/commit/rebase.js +18 -0
- package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
- package/dist/interactions/actions/move/commit/reparent.js +65 -0
- package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
- package/dist/interactions/actions/move/delta.js +51 -0
- package/dist/interactions/actions/move/delta.js.map +1 -0
- package/dist/interactions/actions/move/frame.js +59 -0
- package/dist/interactions/actions/move/frame.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +15 -40
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
- package/dist/interactions/actions/move/landedDescendants.js +8 -8
- package/dist/interactions/actions/move/layout/container.js +94 -0
- package/dist/interactions/actions/move/layout/container.js.map +1 -0
- package/dist/interactions/actions/move/layout/dragged.js +58 -0
- package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
- package/dist/interactions/actions/move/layout/dropPass.js +122 -0
- package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
- package/dist/interactions/actions/move/layout/exits.js +38 -0
- package/dist/interactions/actions/move/layout/exits.js.map +1 -0
- package/dist/interactions/actions/move/layout/glide.js +48 -0
- package/dist/interactions/actions/move/layout/glide.js.map +1 -0
- package/dist/interactions/actions/move/session.js +63 -0
- package/dist/interactions/actions/move/session.js.map +1 -0
- package/dist/interactions/actions/move/translate.js +61 -0
- package/dist/interactions/actions/move/translate.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +17 -64
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
- package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
- package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
- package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
- package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
- package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
- package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
- package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/pointerState.js +12 -0
- package/dist/interactions/actions/pointerState.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +1 -1
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
- package/dist/interactions/actions/poseFrame.js +26 -26
- package/dist/interactions/actions/poseFrame.js.map +1 -1
- package/dist/interactions/actions/resize/action.js +55 -0
- package/dist/interactions/actions/resize/action.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
- package/dist/interactions/actions/resize/boxFrame.js +16 -0
- package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
- package/dist/interactions/actions/resize/capture.js +85 -0
- package/dist/interactions/actions/resize/capture.js.map +1 -0
- package/dist/interactions/actions/resize/commit.js +69 -0
- package/dist/interactions/actions/resize/commit.js.map +1 -0
- package/dist/interactions/actions/resize/frame.js +74 -0
- package/dist/interactions/actions/resize/frame.js.map +1 -0
- package/dist/interactions/actions/resize/pointSnap.js +111 -0
- package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
- package/dist/interactions/actions/resize/ruleBounds.js +9 -0
- package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
- package/dist/interactions/actions/resize/session.js +49 -0
- package/dist/interactions/actions/resize/session.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -1
- package/dist/interactions/actions/resolvePreviews.js.map +1 -1
- package/dist/interactions/actions/rotate/action.js +56 -0
- package/dist/interactions/actions/rotate/action.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
- package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
- package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
- package/dist/interactions/actions/rotate/commit.js +40 -0
- package/dist/interactions/actions/rotate/commit.js.map +1 -0
- package/dist/interactions/actions/rotate/frame.js +65 -0
- package/dist/interactions/actions/rotate/frame.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +12 -12
- package/dist/interactions/actions/rotate/handle.js.map +1 -1
- package/dist/interactions/actions/rotate/session.js +92 -0
- package/dist/interactions/actions/rotate/session.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -1
- package/dist/interactions/actions/useStandardActions.js +77 -72
- package/dist/interactions/actions/useStandardActions.js.map +1 -1
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
- package/dist/interactions/gestures/shared/originProjection.js +1 -1
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
- package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
- package/dist/interactions/gestures/shared/snap.js.map +1 -1
- package/dist/layout/arrivals.js +20 -23
- package/dist/layout/arrivals.js.map +1 -1
- package/dist/math-CYUjoyyU.d.ts +33 -0
- package/dist/math.d.ts +5 -2
- package/dist/math.js +6 -6
- package/dist/mesh.d.ts +4 -268
- package/dist/mesh.js +3 -7
- package/dist/move.d.ts +6 -4
- package/dist/{originProjection-gHnOup4e.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
- package/dist/patterns-builtin.d.ts +1 -118
- package/dist/patterns-builtin.js +2 -3
- package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
- package/dist/renderer.d.ts +1 -92
- package/dist/renderer.js +2 -19
- package/dist/resize.d.ts +11 -22
- package/dist/resize.js +1 -1
- package/dist/style.css +1 -1
- package/dist/test-hook/install.js.map +1 -1
- package/dist/test-hook/useTestHook.js +22 -0
- package/dist/test-hook/useTestHook.js.map +1 -0
- package/dist/test-seams-D0pyV3pR.d.ts +149 -0
- package/dist/test-seams.d.ts +4 -4
- package/dist/test-seams.js +2 -2
- package/dist/tools/builtin/bone/boneActions.js +130 -0
- package/dist/tools/builtin/bone/boneActions.js.map +1 -0
- package/dist/tools/builtin/bone/boneOverlay.js +58 -0
- package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
- package/dist/tools/builtin/bone/placedRig.js +24 -0
- package/dist/tools/builtin/bone/placedRig.js.map +1 -0
- package/dist/tools/builtin/bone/rigEditState.js +21 -0
- package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
- package/dist/tools/builtin/bone/useBoneTool.js +98 -0
- package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
- package/dist/tools/builtin/image/useImageTool.js.map +1 -1
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
- package/dist/tools/builtin/line/useLineTool.js.map +1 -1
- package/dist/tools/builtin/pen/usePenTool.js +161 -163
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
- package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
- package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +4 -4
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
- package/dist/tools/builtin/select/useSelectTool.js +43 -71
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
- package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
- package/dist/tools/builtin/slice/useSliceTool.js +67 -72
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
- package/dist/tools/builtin/star/useStarTool.js.map +1 -1
- package/dist/tools/builtin/text/useTextTool.js +8 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -1
- package/dist/tools/builtin/weight/useWeightTool.js +77 -0
- package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
- package/dist/tools/builtin/weight/weightActions.js +112 -0
- package/dist/tools/builtin/weight/weightActions.js.map +1 -0
- package/dist/tools/builtin/weight/weightOverlay.js +61 -0
- package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
- package/dist/tools/overlayBinding.js.map +1 -1
- package/dist/tools/useKeybindings.js +20 -14
- package/dist/tools/useKeybindings.js.map +1 -1
- package/dist/{types-k-5Oqh-U.d.ts → types-CIKDwlsP.d.ts} +84 -164
- package/dist/util/paint.js +1 -1
- package/dist/util/paint.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +26 -21
- package/dist/animation/colorHelpers.js +0 -135
- package/dist/animation/colorHelpers.js.map +0 -1
- package/dist/animation/colorRegistry.js +0 -37
- package/dist/animation/colorRegistry.js.map +0 -1
- package/dist/animation/engine/axes.js +0 -36
- package/dist/animation/engine/axes.js.map +0 -1
- package/dist/animation/engine/codec.js +0 -170
- package/dist/animation/engine/codec.js.map +0 -1
- package/dist/animation/engine/integrator.js +0 -12
- package/dist/animation/engine/integrator.js.map +0 -1
- package/dist/animation/loop.js +0 -60
- package/dist/animation/loop.js.map +0 -1
- package/dist/animation/observe.js +0 -23
- package/dist/animation/observe.js.map +0 -1
- package/dist/animation/rig/blendPoses.js +0 -43
- package/dist/animation/rig/blendPoses.js.map +0 -1
- package/dist/animation/rig/mirrorPose.js +0 -19
- package/dist/animation/rig/mirrorPose.js.map +0 -1
- package/dist/animation/rig/resolveSkeleton.js +0 -33
- package/dist/animation/rig/resolveSkeleton.js.map +0 -1
- package/dist/animation/rig/solveIk.js +0 -103
- package/dist/animation/rig/solveIk.js.map +0 -1
- package/dist/animation/rig/types.js +0 -12
- package/dist/animation/rig/types.js.map +0 -1
- package/dist/animation/slew.js +0 -27
- package/dist/animation/slew.js.map +0 -1
- package/dist/animation/stagger.js +0 -146
- package/dist/animation/stagger.js.map +0 -1
- package/dist/animation/timeline/booking.js +0 -114
- package/dist/animation/timeline/booking.js.map +0 -1
- package/dist/animation/timeline/createTimeline.js +0 -125
- package/dist/animation/timeline/createTimeline.js.map +0 -1
- package/dist/animation/timeline/sampleTrack.js +0 -79
- package/dist/animation/timeline/sampleTrack.js.map +0 -1
- package/dist/animation/useAnimator.js +0 -388
- package/dist/animation/useAnimator.js.map +0 -1
- package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
- package/dist/builtins-DPcdghtB.d.ts +0 -1223
- package/dist/canvas/MinimapCanvas.js +0 -140
- package/dist/canvas/MinimapCanvas.js.map +0 -1
- package/dist/canvas/deps/poseComposition.js +0 -11
- package/dist/canvas/deps/poseComposition.js.map +0 -1
- package/dist/canvas/minimapMath.js +0 -82
- package/dist/canvas/minimapMath.js.map +0 -1
- package/dist/canvas/toolPreview.js +0 -39
- package/dist/canvas/toolPreview.js.map +0 -1
- package/dist/core/adapters/arrayAdapter.js +0 -94
- package/dist/core/adapters/arrayAdapter.js.map +0 -1
- package/dist/core/adapters/useArrayAdapter.js +0 -13
- package/dist/core/adapters/useArrayAdapter.js.map +0 -1
- package/dist/core/fillInPoseFrame.js +0 -102
- package/dist/core/fillInPoseFrame.js.map +0 -1
- package/dist/core/geometry/poseFrame.js +0 -44
- package/dist/core/geometry/poseFrame.js.map +0 -1
- package/dist/core/geometry/poseRotation.js +0 -58
- package/dist/core/geometry/poseRotation.js.map +0 -1
- package/dist/core/gradient.js +0 -136
- package/dist/core/gradient.js.map +0 -1
- package/dist/core/markerInset.js +0 -24
- package/dist/core/markerInset.js.map +0 -1
- package/dist/core/mixed.js +0 -6
- package/dist/core/mixed.js.map +0 -1
- package/dist/core/paintKinds.js +0 -156
- package/dist/core/paintKinds.js.map +0 -1
- package/dist/core/scene/pickability.js +0 -6
- package/dist/core/scene/pickability.js.map +0 -1
- package/dist/core/strokeMarkerShapes.js +0 -139
- package/dist/core/strokeMarkerShapes.js.map +0 -1
- package/dist/core/strokeMarkers.js +0 -28
- package/dist/core/strokeMarkers.js.map +0 -1
- package/dist/core/viewport/meanScale.js +0 -8
- package/dist/core/viewport/meanScale.js.map +0 -1
- package/dist/core/viewport/pxExtent.js +0 -42
- package/dist/core/viewport/pxExtent.js.map +0 -1
- package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
- package/dist/features/focus/gateLayer.js.map +0 -1
- package/dist/features/focus/useCanvasFocus.js +0 -29
- package/dist/features/focus/useCanvasFocus.js.map +0 -1
- package/dist/features/groups/children.js.map +0 -1
- package/dist/features/groups/composePose.js.map +0 -1
- package/dist/features/groups/nestedHit.js.map +0 -1
- package/dist/features/groups/unionOfChildren.js.map +0 -1
- package/dist/features/images/imageCache.js +0 -104
- package/dist/features/images/imageCache.js.map +0 -1
- package/dist/features/ingestion/index.js +0 -8
- package/dist/features/meshPaint/bake.js +0 -79
- package/dist/features/meshPaint/bake.js.map +0 -1
- package/dist/features/meshPaint/bakeCache.js +0 -59
- package/dist/features/meshPaint/bakeCache.js.map +0 -1
- package/dist/features/meshPaint/handles.js +0 -86
- package/dist/features/meshPaint/handles.js.map +0 -1
- package/dist/features/meshPaint/lazyKind.js.map +0 -1
- package/dist/features/meshPaint/meshPaint.js +0 -239
- package/dist/features/meshPaint/meshPaint.js.map +0 -1
- package/dist/features/meshPaint/meshShader.js +0 -6
- package/dist/features/meshPaint/meshShader.js.map +0 -1
- package/dist/features/meshPaint/register.js +0 -7
- package/dist/features/meshPaint/register.js.map +0 -1
- package/dist/features/meshPaint/surface.js +0 -110
- package/dist/features/meshPaint/surface.js.map +0 -1
- package/dist/features/minimap/actions.js +0 -53
- package/dist/features/minimap/actions.js.map +0 -1
- package/dist/features/minimap/createMinimapContribution.js +0 -96
- package/dist/features/minimap/createMinimapContribution.js.map +0 -1
- package/dist/features/minimap/layers.js +0 -85
- package/dist/features/minimap/layers.js.map +0 -1
- package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
- package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
- package/dist/features/parallax/createParallaxLayer.js +0 -26
- package/dist/features/parallax/createParallaxLayer.js.map +0 -1
- package/dist/features/parallax/createParallaxPlane.js +0 -22
- package/dist/features/parallax/createParallaxPlane.js.map +0 -1
- package/dist/features/paths/anchorEdits.js +0 -167
- package/dist/features/paths/anchorEdits.js.map +0 -1
- package/dist/features/paths/anchors.js +0 -159
- package/dist/features/paths/anchors.js.map +0 -1
- package/dist/features/paths/booleans.js +0 -2
- package/dist/features/paths/markerCommands.js +0 -149
- package/dist/features/paths/markerCommands.js.map +0 -1
- package/dist/features/paths/markerSites.js +0 -59
- package/dist/features/paths/markerSites.js.map +0 -1
- package/dist/features/paths/markers.js +0 -95
- package/dist/features/paths/markers.js.map +0 -1
- package/dist/features/paths/nearestAnchor.js +0 -36
- package/dist/features/paths/nearestAnchor.js.map +0 -1
- package/dist/features/paths/pathInWorld.js +0 -41
- package/dist/features/paths/pathInWorld.js.map +0 -1
- package/dist/features/paths/poseDescriptor.js +0 -39
- package/dist/features/paths/poseDescriptor.js.map +0 -1
- package/dist/features/paths/strokeToPath.js +0 -40
- package/dist/features/paths/strokeToPath.js.map +0 -1
- package/dist/features/paths/tessellate/dash.js +0 -52
- package/dist/features/paths/tessellate/dash.js.map +0 -1
- package/dist/features/paths/tessellate/insets.js +0 -32
- package/dist/features/paths/tessellate/insets.js.map +0 -1
- package/dist/features/paths/tessellate/metric.js +0 -72
- package/dist/features/paths/tessellate/metric.js.map +0 -1
- package/dist/features/paths/tessellate/stroke.js +0 -170
- package/dist/features/paths/tessellate/stroke.js.map +0 -1
- package/dist/features/paths/tessellate/vertexWidths.js +0 -32
- package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
- package/dist/features/patterns/commandPaint.js +0 -18
- package/dist/features/patterns/commandPaint.js.map +0 -1
- package/dist/features/patterns/index.js +0 -11
- package/dist/features/patterns/index.js.map +0 -1
- package/dist/features/patterns/patterns-builtin.js +0 -38
- package/dist/features/patterns/patterns-builtin.js.map +0 -1
- package/dist/features/patterns/rasterizeTile.js +0 -17
- package/dist/features/patterns/rasterizeTile.js.map +0 -1
- package/dist/features/patterns/resolveSpec.js +0 -65
- package/dist/features/patterns/resolveSpec.js.map +0 -1
- package/dist/features/patterns/tileGeometry.js +0 -158
- package/dist/features/patterns/tileGeometry.js.map +0 -1
- package/dist/features/pointer/PointerContext.js +0 -45
- package/dist/features/pointer/PointerContext.js.map +0 -1
- package/dist/features/selection/SelectionContext.js +0 -51
- package/dist/features/selection/SelectionContext.js.map +0 -1
- package/dist/features/simulation/createSimulation.js +0 -61
- package/dist/features/simulation/createSimulation.js.map +0 -1
- package/dist/features/simulation/types.js +0 -6
- package/dist/features/simulation/types.js.map +0 -1
- package/dist/features/simulation/useSimulation.js +0 -74
- package/dist/features/simulation/useSimulation.js.map +0 -1
- package/dist/features/text/domOffsets.js +0 -82
- package/dist/features/text/domOffsets.js.map +0 -1
- package/dist/features/text/domRuns.js +0 -230
- package/dist/features/text/domRuns.js.map +0 -1
- package/dist/features/text/fitTextPose.js +0 -38
- package/dist/features/text/fitTextPose.js.map +0 -1
- package/dist/features/text/hitTest.js +0 -48
- package/dist/features/text/hitTest.js.map +0 -1
- package/dist/features/text/isTextData.js +0 -8
- package/dist/features/text/isTextData.js.map +0 -1
- package/dist/features/text/overlayDirection.js +0 -15
- package/dist/features/text/overlayDirection.js.map +0 -1
- package/dist/features/text/renderLabel.js +0 -14
- package/dist/features/text/renderLabel.js.map +0 -1
- package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
- package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
- package/dist/features/text/runs/flagRange.js +0 -53
- package/dist/features/text/runs/flagRange.js.map +0 -1
- package/dist/features/text/runs/rangeStyle.js +0 -133
- package/dist/features/text/runs/rangeStyle.js.map +0 -1
- package/dist/features/text/textCommand.js +0 -60
- package/dist/features/text/textCommand.js.map +0 -1
- package/dist/features/text/textToPath.js +0 -181
- package/dist/features/text/textToPath.js.map +0 -1
- package/dist/features/text/useTextEdit.js +0 -491
- package/dist/features/text/useTextEdit.js.map +0 -1
- package/dist/features/tiling/createTiledLayer.js +0 -65
- package/dist/features/tiling/createTiledLayer.js.map +0 -1
- package/dist/features/tiling/tiledProject.js +0 -14
- package/dist/features/tiling/tiledProject.js.map +0 -1
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
- package/dist/interactions/actions/defaults/align.js.map +0 -1
- package/dist/interactions/actions/defaults/booleans.js +0 -52
- package/dist/interactions/actions/defaults/booleans.js.map +0 -1
- package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
- package/dist/interactions/actions/defaults/clone.js +0 -91
- package/dist/interactions/actions/defaults/clone.js.map +0 -1
- package/dist/interactions/actions/defaults/createOutlines.js +0 -47
- package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
- package/dist/interactions/actions/defaults/distribute.js.map +0 -1
- package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
- package/dist/interactions/actions/defaults/flip.js +0 -125
- package/dist/interactions/actions/defaults/flip.js.map +0 -1
- package/dist/interactions/actions/defaults/insert.js +0 -287
- package/dist/interactions/actions/defaults/insert.js.map +0 -1
- package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
- package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
- package/dist/interactions/actions/defaults/move.js +0 -778
- package/dist/interactions/actions/defaults/move.js.map +0 -1
- package/dist/interactions/actions/defaults/resize.js +0 -341
- package/dist/interactions/actions/defaults/resize.js.map +0 -1
- package/dist/interactions/actions/defaults/rotate.js +0 -185
- package/dist/interactions/actions/defaults/rotate.js.map +0 -1
- package/dist/interactions/actions/previewOverrides.js +0 -25
- package/dist/interactions/actions/previewOverrides.js.map +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
- package/dist/math-J-ACHyEg.d.ts +0 -159
- package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
- package/dist/renderer/DrawCommand.js +0 -6
- package/dist/renderer/DrawCommand.js.map +0 -1
- package/dist/renderer/WeaselRenderer.js +0 -333
- package/dist/renderer/WeaselRenderer.js.map +0 -1
- package/dist/renderer/batchClip.js +0 -46
- package/dist/renderer/batchClip.js.map +0 -1
- package/dist/renderer/cache/GLImageCache.js +0 -74
- package/dist/renderer/cache/GLImageCache.js.map +0 -1
- package/dist/renderer/cache/GLMeshCache.js +0 -102
- package/dist/renderer/cache/GLMeshCache.js.map +0 -1
- package/dist/renderer/cache/GLTextureCache.js +0 -68
- package/dist/renderer/cache/GLTextureCache.js.map +0 -1
- package/dist/renderer/cache/GradientRampAtlas.js +0 -82
- package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
- package/dist/renderer/cache/cache.js +0 -13
- package/dist/renderer/cache/cache.js.map +0 -1
- package/dist/renderer/cache/markerCommandCache.js +0 -63
- package/dist/renderer/cache/markerCommandCache.js.map +0 -1
- package/dist/renderer/cache/outlineMeshCache.js +0 -15
- package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
- package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
- package/dist/renderer/cache/strokeMeshCache.js +0 -55
- package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
- package/dist/renderer/cullDrawCommands.js +0 -90
- package/dist/renderer/cullDrawCommands.js.map +0 -1
- package/dist/renderer/draw/batch.js +0 -133
- package/dist/renderer/draw/batch.js.map +0 -1
- package/dist/renderer/draw/clip.js +0 -89
- package/dist/renderer/draw/clip.js.map +0 -1
- package/dist/renderer/draw/customShader.js +0 -230
- package/dist/renderer/draw/customShader.js.map +0 -1
- package/dist/renderer/draw/drawTriangles.js +0 -8
- package/dist/renderer/draw/drawTriangles.js.map +0 -1
- package/dist/renderer/draw/effects.js +0 -28
- package/dist/renderer/draw/effects.js.map +0 -1
- package/dist/renderer/draw/flushBatch.js +0 -35
- package/dist/renderer/draw/flushBatch.js.map +0 -1
- package/dist/renderer/draw/gradient.js +0 -90
- package/dist/renderer/draw/gradient.js.map +0 -1
- package/dist/renderer/draw/image.js +0 -38
- package/dist/renderer/draw/image.js.map +0 -1
- package/dist/renderer/draw/mesh.js +0 -16
- package/dist/renderer/draw/mesh.js.map +0 -1
- package/dist/renderer/draw/paintBind.js +0 -70
- package/dist/renderer/draw/paintBind.js.map +0 -1
- package/dist/renderer/draw/pathPaint.js +0 -142
- package/dist/renderer/draw/pathPaint.js.map +0 -1
- package/dist/renderer/draw/scratchPass.js +0 -83
- package/dist/renderer/draw/scratchPass.js.map +0 -1
- package/dist/renderer/draw/stencil.js +0 -28
- package/dist/renderer/draw/stencil.js.map +0 -1
- package/dist/renderer/draw/text.js +0 -167
- package/dist/renderer/draw/text.js.map +0 -1
- package/dist/renderer/draw/uniforms.js +0 -77
- package/dist/renderer/draw/uniforms.js.map +0 -1
- package/dist/renderer/draw.js +0 -79
- package/dist/renderer/draw.js.map +0 -1
- package/dist/renderer/drawBatch.js +0 -198
- package/dist/renderer/drawBatch.js.map +0 -1
- package/dist/renderer/effects/EffectTargets.js +0 -48
- package/dist/renderer/effects/EffectTargets.js.map +0 -1
- package/dist/renderer/effects/builtins.js +0 -31
- package/dist/renderer/effects/builtins.js.map +0 -1
- package/dist/renderer/effects/composite.js +0 -11
- package/dist/renderer/effects/composite.js.map +0 -1
- package/dist/renderer/effects/effectPrelude.js +0 -10
- package/dist/renderer/effects/effectPrelude.js.map +0 -1
- package/dist/renderer/effects/types.js +0 -10
- package/dist/renderer/effects/types.js.map +0 -1
- package/dist/renderer/glyphOutlineMesh.js +0 -67
- package/dist/renderer/glyphOutlineMesh.js.map +0 -1
- package/dist/renderer/index.js +0 -20
- package/dist/renderer/math/color.js +0 -321
- package/dist/renderer/math/color.js.map +0 -1
- package/dist/renderer/math/mat3.js +0 -80
- package/dist/renderer/math/mat3.js.map +0 -1
- package/dist/renderer/math/patternSpace.js +0 -22
- package/dist/renderer/math/patternSpace.js.map +0 -1
- package/dist/renderer/math/viewToMat3.js +0 -19
- package/dist/renderer/math/viewToMat3.js.map +0 -1
- package/dist/renderer/paintResources.js +0 -18
- package/dist/renderer/paintResources.js.map +0 -1
- package/dist/renderer/paintScratch.js +0 -37
- package/dist/renderer/paintScratch.js.map +0 -1
- package/dist/renderer/shaders/ShaderProgram.js +0 -74
- package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
- package/dist/renderer/shaders/batchFill.js +0 -119
- package/dist/renderer/shaders/batchFill.js.map +0 -1
- package/dist/renderer/shaders/customPrelude.js +0 -34
- package/dist/renderer/shaders/customPrelude.js.map +0 -1
- package/dist/renderer/shaders/extractUniformNames.js +0 -184
- package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
- package/dist/renderer/shaders/glyphPaint.js +0 -61
- package/dist/renderer/shaders/glyphPaint.js.map +0 -1
- package/dist/renderer/shaders/gradFill.js +0 -31
- package/dist/renderer/shaders/gradFill.js.map +0 -1
- package/dist/renderer/shaders/pathFill.js +0 -14
- package/dist/renderer/shaders/pathFill.js.map +0 -1
- package/dist/renderer/shaders/patternFill.js +0 -25
- package/dist/renderer/shaders/patternFill.js.map +0 -1
- package/dist/renderer/shaders/registerProgram.js +0 -18
- package/dist/renderer/shaders/registerProgram.js.map +0 -1
- package/dist/renderer/spriteSheet.js +0 -14
- package/dist/renderer/spriteSheet.js.map +0 -1
- package/dist/renderer/state/GroupState.js +0 -77
- package/dist/renderer/state/GroupState.js.map +0 -1
- package/dist/renderer/strokeLengths.js +0 -50
- package/dist/renderer/strokeLengths.js.map +0 -1
- package/dist/renderer/syntheticItalic.js +0 -6
- package/dist/renderer/syntheticItalic.js.map +0 -1
- package/dist/renderer/textures/registerTexture.js +0 -34
- package/dist/renderer/textures/registerTexture.js.map +0 -1
- package/dist/scheduling/useVisibleRaf.js +0 -69
- package/dist/scheduling/useVisibleRaf.js.map +0 -1
- package/dist/test-seams-DM2B87-g.d.ts +0 -356
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","names":["enterGroupClip","pending","ctx","n","clip","enterClip","transform","rect","axisAlignedClipRect","path","depth","pushClip","leaveClip","entry","popClip","syncBatchClip","materializeClips","intersectClipRects","runClipDepth","stack","i","enterUncut","cut","leaveUncut","retryUncut","fn","a","b","flushForOwnDraw","flushBatch","rasterizePathToStencil","gl","handle","fillMeshHandle","setProjAndModel","model","drawTriangles","ancestors","ancestorMask","newDepth","newBit","ref","oldDepth","oldBit"],"sources":["../../../src/renderer/draw/clip.ts"],"sourcesContent":["import type { Path } from '@weasel-js/geom';\nimport type { GlMat3 } from '../math/mat3';\nimport { axisAlignedClipRect, intersectClipRects, type ClipRect } from '../batchClip';\nimport type { DrawContext } from './drawContext';\nimport { drawTriangles } from './drawTriangles';\nimport { fillMeshHandle } from './mesh';\nimport { setProjAndModel } from './uniforms';\nimport { ancestorMask } from './stencil';\nimport { flushBatch } from './flushBatch';\n\n/** `enterClip` for a group command, refusing one past the stencil's budget. */\nexport function enterGroupClip(ctx: DrawContext, clip: Path): void {\n const pending = ctx.clipStack.reduce((n, e) => n + (e.depth === 0 ? 1 : 0), 0);\n if (ctx.clipDepth + pending + 1 > 7) {\n throw new Error(\n 'weasel: clip nesting depth exceeded (max 7). You can\\'t nest more than 7 levels ' +\n 'of clipped containers in a single draw tree. Flatten the hierarchy or compose ' +\n 'poses outside the scene graph.',\n );\n }\n enterClip(ctx, clip);\n}\n\n/**\n * Push a group's clip.\n *\n * A clip only the stencil can express takes its bit now. An axis-aligned rect\n * takes none: staged geometry is cut to it on the CPU (`batchClip.ts`), so\n * content inside it joins the run outside it instead of costing a flush on\n * the way in and another on the way out. It takes a bit only if something that\n * draws for itself turns up inside it — see `flushForOwnDraw`.\n */\nfunction enterClip(ctx: DrawContext, path: Path): void {\n const transform = ctx.state.transform;\n const rect = axisAlignedClipRect(path, transform);\n if (rect === null) {\n // Bits nest in stack order, so any rect clip still without one takes it\n // first.\n materializeClips(ctx);\n const depth = ctx.clipDepth + 1;\n pushClip(ctx, path, depth);\n ctx.clipDepth = depth;\n ctx.clipStack.push({ path, transform, rect: null, depth });\n } else {\n ctx.clipStack.push({ path, transform, rect, depth: 0 });\n }\n syncBatchClip(ctx);\n}\n\nexport function leaveClip(ctx: DrawContext): void {\n const entry = ctx.clipStack.pop()!;\n if (entry.depth > 0) {\n popClip(ctx, entry.path, entry.depth - 1, entry.transform);\n ctx.clipDepth = entry.depth - 1;\n }\n syncBatchClip(ctx);\n}\n\n/** Give every rect clip on the stack its stencil bit, for a draw the CPU cut\n * cannot reach. */\nfunction materializeClips(ctx: DrawContext): void {\n for (const entry of ctx.clipStack) {\n if (entry.depth !== 0) continue;\n const depth = ctx.clipDepth + 1;\n pushClip(ctx, entry.path, depth, entry.transform);\n entry.depth = depth;\n ctx.clipDepth = depth;\n }\n}\n\nfunction syncBatchClip(ctx: DrawContext): void {\n let rect: ClipRect | null = null;\n for (const entry of ctx.clipStack) {\n if (entry.rect) rect = rect ? intersectClipRects(rect, entry.rect) : entry.rect;\n }\n ctx.drawBatch.clip = rect;\n}\n\n/**\n * The clip depth a run is staged and drawn at: the innermost clip only the\n * stencil can express. Rect clips are left out whether or not they hold a bit,\n * because the CPU cut already applies them — which is what lets a run cross\n * them.\n */\nexport function runClipDepth(ctx: DrawContext): number {\n const stack = ctx.clipStack;\n if (stack.length === 0 || ctx.uncut) return ctx.clipDepth;\n for (let i = stack.length - 1; i >= 0; i--) {\n if (stack[i].rect === null) return stack[i].depth;\n }\n // Only rect clips: whatever depth held before the first of them took a bit.\n for (const entry of stack) if (entry.depth > 0) return entry.depth - 1;\n return ctx.clipDepth;\n}\n\n/**\n * Put the rect clips on the stencil and stop cutting, for an item the batch\n * refused to cut — one with a slanted edge across a clip (see\n * `DrawBatch.clipQuad`). Staged again between this and `leaveUncut`, the item\n * sees the full stencil depth and lands in a run of its own under every clip.\n * Returns the cut to hand back.\n *\n * A pair rather than a callback: the staging paths are hot, and a closure\n * over their arguments would cost an allocation on every call, refused or not.\n */\nexport function enterUncut(ctx: DrawContext): ClipRect | null {\n materializeClips(ctx);\n const cut = ctx.drawBatch.clip;\n ctx.drawBatch.clip = null;\n ctx.uncut = true;\n return cut;\n}\n\nexport function leaveUncut(ctx: DrawContext, cut: ClipRect | null): void {\n ctx.drawBatch.clip = cut;\n ctx.uncut = false;\n}\n\n/** `fn(ctx, a, b)` again, uncut — for the stage-and-push helpers, which pass\n * themselves. */\nexport function retryUncut<A, B>(\n ctx: DrawContext, a: A, b: B, fn: (ctx: DrawContext, a: A, b: B) => void,\n): void {\n const cut = enterUncut(ctx);\n fn(ctx, a, b);\n leaveUncut(ctx, cut);\n}\n\n/**\n * Drain the run before a draw that does not go through it, and give that draw\n * the stencil it tests against. Every such draw starts here or behind a\n * `tryStageFill` that returned `false`, which ends the same way.\n */\nexport function flushForOwnDraw(ctx: DrawContext): void {\n flushBatch(ctx);\n if (ctx.clipStack.length > 0) materializeClips(ctx);\n}\n\n/**\n * Rasterize a path into the stencil buffer using the pathFill shader geometry.\n * The caller is responsible for setting stencilFunc / stencilOp / stencilMask\n * and colorMask before calling.\n */\nfunction rasterizePathToStencil(ctx: DrawContext, path: Path, model: GlMat3): void {\n const gl = ctx.gl;\n const handle = fillMeshHandle(ctx, path);\n gl.useProgram(ctx.pathFill.handle);\n gl.bindVertexArray(handle.vao);\n setProjAndModel(ctx, ctx.pathFill, model);\n drawTriangles(ctx, handle.indexCount, ctx.gl.UNSIGNED_INT);\n gl.bindVertexArray(null);\n}\n\n/**\n * Push a clip level. Rasterizes the clip path into the stencil buffer,\n * setting bit `newDepth` where (a) the path's fragment passes AND (b) all\n * ancestor clip bits are already set.\n *\n * Invariant: restores stencilMask(0xFF) on exit so callers (draw functions)\n * can rely on an unnarrowed mask after clip ops complete.\n */\nexport function pushClip(\n ctx: DrawContext, path: Path, newDepth: number, model: GlMat3 = ctx.state.transform,\n): void {\n // First, not last: a run staged outside the clip would otherwise draw under\n // a mask it never had.\n flushBatch(ctx);\n const gl = ctx.gl;\n const ancestors = ancestorMask(newDepth - 1);\n const newBit = 1 << newDepth;\n const ref = ancestors | newBit;\n\n gl.enable(gl.STENCIL_TEST);\n gl.colorMask(false, false, false, false);\n if (fillMeshHandle(ctx, path).requiresStencil) {\n // Fans, one per contour: their union is not the path. Parity goes on\n // bit 0, the clip bit is written where parity is odd, and drawing the\n // fans a third time returns bit 0 to zero.\n gl.stencilMask(0x01);\n gl.stencilFunc(gl.ALWAYS, 0, 0x01);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INVERT);\n rasterizePathToStencil(ctx, path, model);\n gl.stencilMask(newBit);\n gl.stencilFunc(gl.EQUAL, ref | 0x01, ancestors | 0x01);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE);\n rasterizePathToStencil(ctx, path, model);\n gl.stencilMask(0x01);\n gl.stencilFunc(gl.ALWAYS, 0, 0x01);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INVERT);\n rasterizePathToStencil(ctx, path, model);\n } else {\n gl.stencilMask(newBit);\n gl.stencilFunc(gl.EQUAL, ref, ancestors);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.REPLACE);\n rasterizePathToStencil(ctx, path, model);\n }\n\n gl.colorMask(true, true, true, true);\n // Restore full mask so subsequent draw functions don't inherit a narrowed mask.\n gl.stencilMask(0xFF);\n}\n\n/**\n * Pop a clip level. Rasterizes the same path again, clearing bit\n * `oldDepth + 1` where it was set during the matching push.\n *\n * Must re-enable STENCIL_TEST because child draw functions (drawPathFillStencil,\n * drawPathStrokeStenciled) call gl.disable(STENCIL_TEST) at their end. If\n * one of those was the last child before popClip runs, the test would be off\n * and rasterizePathToStencil would write nothing.\n *\n * Invariant: restores stencilMask(0xFF) on exit so callers are not left with\n * a narrowed mask.\n */\nexport function popClip(\n ctx: DrawContext, path: Path, oldDepth: number, model: GlMat3 = ctx.state.transform,\n): void {\n // First, not last: past here the mask is gone, and these pixels belonged\n // inside it. A run staged below this bit does not test it, so it lives on.\n if (ctx.batchState !== undefined && ctx.batchState.clipDepth > oldDepth) flushBatch(ctx);\n const gl = ctx.gl;\n // Re-enable stencil: child draw functions (evenodd/stenciled-stroke) disable\n // it at their end; we must set it before writing the clear pass.\n gl.enable(gl.STENCIL_TEST);\n\n const oldBit = 1 << (oldDepth + 1);\n const ref = ancestorMask(oldDepth) | oldBit;\n\n gl.colorMask(false, false, false, false);\n gl.stencilMask(oldBit);\n gl.stencilFunc(gl.EQUAL, ref, ref);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.ZERO);\n\n rasterizePathToStencil(ctx, path, model);\n\n gl.colorMask(true, true, true, true);\n // Restore full mask so subsequent draw functions don't inherit a narrowed mask.\n gl.stencilMask(0xFF);\n}\n"],"mappings":";;;;;;;AAWA,SAAgBA,EAAe,GAAkB,GAAkB;CACjE,IAAMC,IAAUC,EAAI,UAAU,QAAQ,GAAG,MAAMC,IAAK,IAAE,UAAU,IAAY,CAAC;CAC7E,IAAID,EAAI,YAAYD,IAAU,IAAI,GAChC,MAAU,MACR,6LAGF;CAEF,EAAUC,GAAKE,CAAI;AACrB;AAWA,SAASC,EAAU,GAAkB,GAAkB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KA,CAAG,GACjCV,EAAG,UAAUA,EAAG,MAAMA,EAAG,MAAMA,EAAG,IAAI,GAEtCD,EAAuB5B,GAAKO,GAAM0B,CAAK,GAEvCJ,EAAG,UAAU,IAAM,IAAM,IAAM,EAAI,GAEnCA,EAAG,YAAY,GAAI;AACrB"}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { getTexture as e } from "../textures/registerTexture.js";
|
|
2
|
-
import { mat3 as t } from "../math/mat3.js";
|
|
3
|
-
import { drawTriangles as n } from "./drawTriangles.js";
|
|
4
|
-
import { applyClipTest as r } from "./stencil.js";
|
|
5
|
-
//#region src/renderer/draw/customShader.ts
|
|
6
|
-
var i = /* @__PURE__ */ new Set();
|
|
7
|
-
function a(e, t) {
|
|
8
|
-
let n = `${e}:${t}`;
|
|
9
|
-
i.has(n) || (i.add(n), (typeof process > "u" || process.env.NODE_ENV !== "production") && console.warn(`weasel drawShader: uniform "${t}" not found in program "${e}". Check spelling, ensure it's used in the shader (unused uniforms are optimized away by the driver).`));
|
|
10
|
-
}
|
|
11
|
-
function o(t, n, r, i, a) {
|
|
12
|
-
if (typeof r == "object" && r && !Array.isArray(r) && !(r instanceof Float32Array) && "id" in r && typeof r.id == "string") {
|
|
13
|
-
let o = r, s = e(o.id);
|
|
14
|
-
if (!s) {
|
|
15
|
-
(typeof process > "u" || process.env.NODE_ENV !== "production") && console.warn(`weasel setUniform: TextureHandle "${o.id}" not registered`);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
let c = a.value++;
|
|
19
|
-
t.activeTexture(t.TEXTURE0 + c), i.uploadRegistered(o.id, s.source), i.bind(o.id, c), t.uniform1i(n, c);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (r instanceof Float64Array && (r = Float32Array.from(r)), r instanceof Float32Array) {
|
|
23
|
-
if (r.length === 9) t.uniformMatrix3fv(n, !1, r);
|
|
24
|
-
else if (r.length === 16) t.uniformMatrix4fv(n, !1, r);
|
|
25
|
-
else if (typeof process > "u" || process.env.NODE_ENV !== "production") throw TypeError(`weasel setUniform: Float32Array must be length 9 (mat3) or 16 (mat4), got ${r.length}`);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(r)) {
|
|
29
|
-
let e = r;
|
|
30
|
-
switch (e.length) {
|
|
31
|
-
case 2:
|
|
32
|
-
t.uniform2fv(n, e);
|
|
33
|
-
break;
|
|
34
|
-
case 3:
|
|
35
|
-
t.uniform3fv(n, e);
|
|
36
|
-
break;
|
|
37
|
-
case 4:
|
|
38
|
-
t.uniform4fv(n, e);
|
|
39
|
-
break;
|
|
40
|
-
default: if (typeof process > "u" || process.env.NODE_ENV !== "production") throw TypeError(`weasel setUniform: array length ${e.length} not supported`);
|
|
41
|
-
}
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (typeof r == "number") {
|
|
45
|
-
t.uniform1f(n, r);
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
var s = {
|
|
50
|
-
float: {
|
|
51
|
-
fn: "uniform1fv",
|
|
52
|
-
n: 1
|
|
53
|
-
},
|
|
54
|
-
vec2: {
|
|
55
|
-
fn: "uniform2fv",
|
|
56
|
-
n: 2
|
|
57
|
-
},
|
|
58
|
-
vec3: {
|
|
59
|
-
fn: "uniform3fv",
|
|
60
|
-
n: 3
|
|
61
|
-
},
|
|
62
|
-
vec4: {
|
|
63
|
-
fn: "uniform4fv",
|
|
64
|
-
n: 4
|
|
65
|
-
},
|
|
66
|
-
int: {
|
|
67
|
-
fn: "uniform1iv",
|
|
68
|
-
n: 1
|
|
69
|
-
},
|
|
70
|
-
ivec2: {
|
|
71
|
-
fn: "uniform2iv",
|
|
72
|
-
n: 2
|
|
73
|
-
},
|
|
74
|
-
ivec3: {
|
|
75
|
-
fn: "uniform3iv",
|
|
76
|
-
n: 3
|
|
77
|
-
},
|
|
78
|
-
ivec4: {
|
|
79
|
-
fn: "uniform4iv",
|
|
80
|
-
n: 4
|
|
81
|
-
},
|
|
82
|
-
bool: {
|
|
83
|
-
fn: "uniform1iv",
|
|
84
|
-
n: 1
|
|
85
|
-
},
|
|
86
|
-
bvec2: {
|
|
87
|
-
fn: "uniform2iv",
|
|
88
|
-
n: 2
|
|
89
|
-
},
|
|
90
|
-
bvec3: {
|
|
91
|
-
fn: "uniform3iv",
|
|
92
|
-
n: 3
|
|
93
|
-
},
|
|
94
|
-
bvec4: {
|
|
95
|
-
fn: "uniform4iv",
|
|
96
|
-
n: 4
|
|
97
|
-
},
|
|
98
|
-
uint: {
|
|
99
|
-
fn: "uniform1uiv",
|
|
100
|
-
n: 1
|
|
101
|
-
},
|
|
102
|
-
uvec2: {
|
|
103
|
-
fn: "uniform2uiv",
|
|
104
|
-
n: 2
|
|
105
|
-
},
|
|
106
|
-
uvec3: {
|
|
107
|
-
fn: "uniform3uiv",
|
|
108
|
-
n: 3
|
|
109
|
-
},
|
|
110
|
-
uvec4: {
|
|
111
|
-
fn: "uniform4uiv",
|
|
112
|
-
n: 4
|
|
113
|
-
},
|
|
114
|
-
mat2: {
|
|
115
|
-
fn: "uniformMatrix2fv",
|
|
116
|
-
n: 4,
|
|
117
|
-
matrix: !0
|
|
118
|
-
},
|
|
119
|
-
mat3: {
|
|
120
|
-
fn: "uniformMatrix3fv",
|
|
121
|
-
n: 9,
|
|
122
|
-
matrix: !0
|
|
123
|
-
},
|
|
124
|
-
mat4: {
|
|
125
|
-
fn: "uniformMatrix4fv",
|
|
126
|
-
n: 16,
|
|
127
|
-
matrix: !0
|
|
128
|
-
},
|
|
129
|
-
mat2x2: {
|
|
130
|
-
fn: "uniformMatrix2fv",
|
|
131
|
-
n: 4,
|
|
132
|
-
matrix: !0
|
|
133
|
-
},
|
|
134
|
-
mat3x3: {
|
|
135
|
-
fn: "uniformMatrix3fv",
|
|
136
|
-
n: 9,
|
|
137
|
-
matrix: !0
|
|
138
|
-
},
|
|
139
|
-
mat4x4: {
|
|
140
|
-
fn: "uniformMatrix4fv",
|
|
141
|
-
n: 16,
|
|
142
|
-
matrix: !0
|
|
143
|
-
},
|
|
144
|
-
mat2x3: {
|
|
145
|
-
fn: "uniformMatrix2x3fv",
|
|
146
|
-
n: 6,
|
|
147
|
-
matrix: !0
|
|
148
|
-
},
|
|
149
|
-
mat2x4: {
|
|
150
|
-
fn: "uniformMatrix2x4fv",
|
|
151
|
-
n: 8,
|
|
152
|
-
matrix: !0
|
|
153
|
-
},
|
|
154
|
-
mat3x2: {
|
|
155
|
-
fn: "uniformMatrix3x2fv",
|
|
156
|
-
n: 6,
|
|
157
|
-
matrix: !0
|
|
158
|
-
},
|
|
159
|
-
mat3x4: {
|
|
160
|
-
fn: "uniformMatrix3x4fv",
|
|
161
|
-
n: 12,
|
|
162
|
-
matrix: !0
|
|
163
|
-
},
|
|
164
|
-
mat4x2: {
|
|
165
|
-
fn: "uniformMatrix4x2fv",
|
|
166
|
-
n: 8,
|
|
167
|
-
matrix: !0
|
|
168
|
-
},
|
|
169
|
-
mat4x3: {
|
|
170
|
-
fn: "uniformMatrix4x3fv",
|
|
171
|
-
n: 12,
|
|
172
|
-
matrix: !0
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
function c(e) {
|
|
176
|
-
return Array.isArray(e) || e instanceof Float32Array || e instanceof Int32Array || e instanceof Uint32Array;
|
|
177
|
-
}
|
|
178
|
-
function l(e, t, n, r) {
|
|
179
|
-
let i = typeof process < "u" ? process.env.NODE_ENV !== "production" : !0, a = s[n.type];
|
|
180
|
-
if (!a) {
|
|
181
|
-
i && console.warn(`weasel setUniform: array uniform "${t}" has type ${n.type}, which cannot be written as a whole`);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
if (r.length % a.n !== 0 || r.length > a.n * n.size) {
|
|
185
|
-
if (i) throw TypeError(`weasel setUniform: "${t}" is ${n.type}[${n.size}], so its value must hold a multiple of ${a.n} numbers, at most ${a.n * n.size}; got ${r.length}`);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (r.length === 0) return;
|
|
189
|
-
let o = e[a.fn];
|
|
190
|
-
a.matrix ? o.call(e, n.location, !1, r) : o.call(e, n.location, r);
|
|
191
|
-
}
|
|
192
|
-
function u(e, t, n, r, i, s) {
|
|
193
|
-
for (let [u, d] of Object.entries(r)) {
|
|
194
|
-
let r = t.uniformArray(u);
|
|
195
|
-
if (r && c(d)) {
|
|
196
|
-
l(e, u, r, d);
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
let f = t.uniform(u);
|
|
200
|
-
if (f === void 0) {
|
|
201
|
-
a(n, u);
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
o(e, f, d, i, s);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
function d(e, i) {
|
|
208
|
-
let { gl: a, programRegistry: o, quadVbo: s, quadIbo: c, textureCache: l } = e, d = o.get(i.program.id);
|
|
209
|
-
if (!d) {
|
|
210
|
-
console.warn(`weasel drawShader: program "${i.program.id}" not compiled on this renderer. Call renderer.registerProgram(handle) after the module-level registerProgram().`);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
if (!s || !c) {
|
|
214
|
-
console.warn("weasel drawShader: quad geometry not initialized");
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
a.useProgram(d.handle);
|
|
218
|
-
let f = d.attribute("a_position"), p = d.attribute("a_uv");
|
|
219
|
-
a.bindBuffer(a.ARRAY_BUFFER, s), f !== void 0 && (a.enableVertexAttribArray(f), a.vertexAttribPointer(f, 2, a.FLOAT, !1, 16, 0)), p !== void 0 && (a.enableVertexAttribArray(p), a.vertexAttribPointer(p, 2, a.FLOAT, !1, 16, 8)), a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, c);
|
|
220
|
-
let m = t.screenToClip(e.widthCss, e.heightCss), h = d.uniform("u_proj");
|
|
221
|
-
h !== void 0 && a.uniformMatrix3fv(h, !1, t.toUniform(m));
|
|
222
|
-
let g = d.uniform("u_bounds");
|
|
223
|
-
g !== void 0 && a.uniform4f(g, i.bounds.x, i.bounds.y, i.bounds.w, i.bounds.h);
|
|
224
|
-
let _ = d.uniform("u_view");
|
|
225
|
-
_ !== void 0 && a.uniformMatrix3fv(_, !1, t.toUniform(e.state.transform)), u(a, d, i.program.id, i.uniforms, l, { value: 1 }), r(e), n(e, 6, e.gl.UNSIGNED_SHORT), f !== void 0 && a.disableVertexAttribArray(f), p !== void 0 && a.disableVertexAttribArray(p), a.bindBuffer(a.ARRAY_BUFFER, null), a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, null);
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
export { d as drawShader, o as setUniform, u as setUniforms, a as warnOnceUniform };
|
|
229
|
-
|
|
230
|
-
//# sourceMappingURL=customShader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customShader.js","names":["warnedUniforms","warnOnceUniform","key","programId","name","setUniform","value","handle","entry","getTexture","unit","gl","textureCache","loc","arr","ARRAY_UPLOADS","isArrayValue","setUniformArray","isDev","upload","fn","setUniforms","uniforms","program","nextTexUnit","drawShader","ctx","programRegistry","cmd","quadVbo","quadIbo","aPosLoc","aUvLoc","proj","mat3","uProj","uBounds","uView","applyClipTest","drawTriangles"],"sources":["../../../src/renderer/draw/customShader.ts"],"sourcesContent":["import type { ShaderDrawCommand } from '../DrawCommand';\nimport { getTexture, type TextureHandle } from '../textures/registerTexture';\nimport type { ShaderUniform } from '../shaders/registerProgram';\nimport type { GLTextureCache } from '../cache/GLTextureCache';\nimport type { ShaderProgram, UniformArray } from '../shaders/ShaderProgram';\nimport { mat3 } from '../math/mat3';\nimport type { DrawContext } from './drawContext';\nimport { drawTriangles } from './drawTriangles';\nimport { applyClipTest } from './stencil';\n\nconst warnedUniforms = new Set<string>();\n\nexport function warnOnceUniform(programId: string, name: string): void {\n const key = `${programId}:${name}`;\n if (warnedUniforms.has(key)) return;\n warnedUniforms.add(key);\n const isDev = typeof process !== 'undefined' ? process.env.NODE_ENV !== 'production' : true;\n if (isDev) {\n console.warn(`weasel drawShader: uniform \"${name}\" not found in program \"${programId}\". ` +\n `Check spelling, ensure it's used in the shader (unused uniforms are optimized away by the driver).`);\n }\n}\n\n/**\n * Bind a single ShaderUniform value to a GL uniform location.\n *\n * Type detection order:\n * 1. TextureHandle (object with string `.id`) — bind to next tex unit, set sampler.\n * 2. Float32Array — length 9 → mat3, length 16 → mat4. Other lengths throw in dev.\n * 3. Array — uniform2fv / uniform3fv / uniform4fv based on length.\n * 4. number — uniform1f.\n */\nexport function setUniform(\n gl: WebGL2RenderingContext,\n loc: WebGLUniformLocation,\n value: ShaderUniform,\n textureCache: GLTextureCache,\n nextTexUnit: { value: number },\n): void {\n if (value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Float32Array)\n && 'id' in value && typeof (value as TextureHandle).id === 'string') {\n const handle = value as TextureHandle;\n const entry = getTexture(handle.id);\n if (!entry) {\n const isDev = typeof process !== 'undefined' ? process.env.NODE_ENV !== 'production' : true;\n if (isDev) console.warn(`weasel setUniform: TextureHandle \"${handle.id}\" not registered`);\n return;\n }\n const unit = nextTexUnit.value++;\n // An upload binds and unbinds on the active unit, so it has to be this\n // uniform's own unit and not one an earlier sampler already holds.\n gl.activeTexture(gl.TEXTURE0 + unit);\n textureCache.uploadRegistered(handle.id, entry.source);\n textureCache.bind(handle.id, unit);\n gl.uniform1i(loc, unit);\n return;\n }\n\n // A kit matrix is in doubles; GL wants float32.\n if (value instanceof Float64Array) value = Float32Array.from(value);\n\n if (value instanceof Float32Array) {\n if (value.length === 9) {\n gl.uniformMatrix3fv(loc, false, value);\n } else if (value.length === 16) {\n gl.uniformMatrix4fv(loc, false, value);\n } else {\n const isDev = typeof process !== 'undefined' ? process.env.NODE_ENV !== 'production' : true;\n if (isDev) throw new TypeError(`weasel setUniform: Float32Array must be length 9 (mat3) or 16 (mat4), got ${value.length}`);\n }\n return;\n }\n\n if (Array.isArray(value)) {\n const arr = value as readonly number[];\n switch (arr.length) {\n case 2: gl.uniform2fv(loc, arr as [number, number]); break;\n case 3: gl.uniform3fv(loc, arr as [number, number, number]); break;\n case 4: gl.uniform4fv(loc, arr as [number, number, number, number]); break;\n default: {\n const isDev = typeof process !== 'undefined' ? process.env.NODE_ENV !== 'production' : true;\n if (isDev) throw new TypeError(`weasel setUniform: array length ${arr.length} not supported`);\n }\n }\n return;\n }\n\n if (typeof value === 'number') {\n gl.uniform1f(loc, value);\n return;\n }\n}\n\n/** How an array's element type is uploaded: the `uniform*v` call and the\n * number of components per element. */\nconst ARRAY_UPLOADS: Readonly<Record<string, { fn: string; n: number; matrix?: true }>> = {\n float: { fn: 'uniform1fv', n: 1 }, vec2: { fn: 'uniform2fv', n: 2 },\n vec3: { fn: 'uniform3fv', n: 3 }, vec4: { fn: 'uniform4fv', n: 4 },\n int: { fn: 'uniform1iv', n: 1 }, ivec2: { fn: 'uniform2iv', n: 2 },\n ivec3: { fn: 'uniform3iv', n: 3 }, ivec4: { fn: 'uniform4iv', n: 4 },\n bool: { fn: 'uniform1iv', n: 1 }, bvec2: { fn: 'uniform2iv', n: 2 },\n bvec3: { fn: 'uniform3iv', n: 3 }, bvec4: { fn: 'uniform4iv', n: 4 },\n uint: { fn: 'uniform1uiv', n: 1 }, uvec2: { fn: 'uniform2uiv', n: 2 },\n uvec3: { fn: 'uniform3uiv', n: 3 }, uvec4: { fn: 'uniform4uiv', n: 4 },\n mat2: { fn: 'uniformMatrix2fv', n: 4, matrix: true },\n mat3: { fn: 'uniformMatrix3fv', n: 9, matrix: true },\n mat4: { fn: 'uniformMatrix4fv', n: 16, matrix: true },\n mat2x2: { fn: 'uniformMatrix2fv', n: 4, matrix: true },\n mat3x3: { fn: 'uniformMatrix3fv', n: 9, matrix: true },\n mat4x4: { fn: 'uniformMatrix4fv', n: 16, matrix: true },\n mat2x3: { fn: 'uniformMatrix2x3fv', n: 6, matrix: true },\n mat2x4: { fn: 'uniformMatrix2x4fv', n: 8, matrix: true },\n mat3x2: { fn: 'uniformMatrix3x2fv', n: 6, matrix: true },\n mat3x4: { fn: 'uniformMatrix3x4fv', n: 12, matrix: true },\n mat4x2: { fn: 'uniformMatrix4x2fv', n: 8, matrix: true },\n mat4x3: { fn: 'uniformMatrix4x3fv', n: 12, matrix: true },\n};\n\ntype ArrayValue = readonly number[] | Float32Array | Int32Array | Uint32Array;\n\nfunction isArrayValue(value: ShaderUniform): value is ArrayValue {\n return Array.isArray(value) || value instanceof Float32Array\n || value instanceof Int32Array || value instanceof Uint32Array;\n}\n\n/** Fill an array uniform from slot 0 with one call. Throws in dev on a value\n * that is not a whole number of elements or overruns the declaration. */\nfunction setUniformArray(\n gl: WebGL2RenderingContext,\n name: string,\n arr: UniformArray,\n value: ArrayValue,\n): void {\n const isDev = typeof process !== 'undefined' ? process.env.NODE_ENV !== 'production' : true;\n const upload = ARRAY_UPLOADS[arr.type];\n if (!upload) {\n if (isDev) console.warn(`weasel setUniform: array uniform \"${name}\" has type ${arr.type}, which cannot be written as a whole`);\n return;\n }\n if (value.length % upload.n !== 0 || value.length > upload.n * arr.size) {\n if (isDev) {\n throw new TypeError(\n `weasel setUniform: \"${name}\" is ${arr.type}[${arr.size}], so its value must hold a multiple of ${upload.n} `\n + `numbers, at most ${upload.n * arr.size}; got ${value.length}`,\n );\n }\n return;\n }\n if (value.length === 0) return;\n const fn = (gl as unknown as Record<string, (...args: unknown[]) => void>)[upload.fn];\n if (upload.matrix) fn.call(gl, arr.location, false, value);\n else fn.call(gl, arr.location, value);\n}\n\n/** Write every entry of a command's `uniforms` map. A key naming an array\n * uniform with an array value fills the array; anything else goes to the\n * location of that exact name. */\nexport function setUniforms(\n gl: WebGL2RenderingContext,\n program: ShaderProgram,\n programId: string,\n uniforms: Record<string, ShaderUniform>,\n textureCache: GLTextureCache,\n nextTexUnit: { value: number },\n): void {\n for (const [name, value] of Object.entries(uniforms)) {\n const arr = program.uniformArray(name);\n if (arr && isArrayValue(value)) {\n setUniformArray(gl, name, arr, value);\n continue;\n }\n const loc = program.uniform(name);\n if (loc === undefined) {\n warnOnceUniform(programId, name);\n continue;\n }\n setUniform(gl, loc, value, textureCache, nextTexUnit);\n }\n}\n\nexport function drawShader(ctx: DrawContext, cmd: ShaderDrawCommand): void {\n const { gl, programRegistry, quadVbo, quadIbo, textureCache } = ctx;\n\n const program = programRegistry.get(cmd.program.id);\n if (!program) {\n console.warn(\n `weasel drawShader: program \"${cmd.program.id}\" not compiled on this renderer. ` +\n `Call renderer.registerProgram(handle) after the module-level registerProgram().`,\n );\n return;\n }\n if (!quadVbo || !quadIbo) {\n console.warn('weasel drawShader: quad geometry not initialized');\n return;\n }\n\n gl.useProgram(program.handle);\n\n const aPosLoc = program.attribute('a_position');\n const aUvLoc = program.attribute('a_uv');\n\n gl.bindBuffer(gl.ARRAY_BUFFER, quadVbo);\n if (aPosLoc !== undefined) {\n gl.enableVertexAttribArray(aPosLoc);\n gl.vertexAttribPointer(aPosLoc, 2, gl.FLOAT, false, 16, 0);\n }\n if (aUvLoc !== undefined) {\n gl.enableVertexAttribArray(aUvLoc);\n gl.vertexAttribPointer(aUvLoc, 2, gl.FLOAT, false, 16, 8);\n }\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, quadIbo);\n\n const proj = mat3.screenToClip(ctx.widthCss, ctx.heightCss);\n const uProj = program.uniform('u_proj');\n if (uProj !== undefined) gl.uniformMatrix3fv(uProj, false, mat3.toUniform(proj));\n\n const uBounds = program.uniform('u_bounds');\n if (uBounds !== undefined) {\n gl.uniform4f(uBounds, cmd.bounds.x, cmd.bounds.y, cmd.bounds.w, cmd.bounds.h);\n }\n\n const uView = program.uniform('u_view');\n if (uView !== undefined) gl.uniformMatrix3fv(uView, false, mat3.toUniform(ctx.state.transform));\n\n setUniforms(gl, program, cmd.program.id, cmd.uniforms, textureCache, { value: 1 });\n\n applyClipTest(ctx);\n drawTriangles(ctx, 6, ctx.gl.UNSIGNED_SHORT);\n\n if (aPosLoc !== undefined) gl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,IAAI,CAAC,IAEvDqB,MAAW,KAAA,MACbrB,EAAG,wBAAwBqB,CAAM,GACjCrB,EAAG,oBAAoBqB,GAAQ,GAAGrB,EAAG,OAAO,IAAO,IAAI,CAAC,IAE1DA,EAAG,WAAWA,EAAG,sBAAsBmB,CAAO;CAE9C,IAAMG,IAAOC,EAAK,aAAaR,EAAI,UAAUA,EAAI,SAAS,GACpDS,IAAQZ,EAAQ,QAAQ,QAAQ;CACtC,AAAIY,MAAU,KAAA,KAAWxB,EAAG,iBAAiBwB,GAAO,IAAOD,EAAK,UAAUD,CAAI,CAAC;CAE/E,IAAMG,IAAUb,EAAQ,QAAQ,UAAU;CAC1C,AAAIa,MAAY,KAAA,KACdzB,EAAG,UAAUyB,GAASR,EAAI,OAAO,GAAGA,EAAI,OAAO,GAAGA,EAAI,OAAO,GAAGA,EAAI,OAAO,CAAC;CAG9E,IAAMS,IAAQd,EAAQ,QAAQ,QAAQ;CAWtC,AAVIc,MAAU,KAAA,KAAW1B,EAAG,iBAAiB0B,GAAO,IAAOH,EAAK,UAAUR,EAAI,MAAM,SAAS,CAAC,GAE9FL,EAAYV,GAAIY,GAASK,EAAI,QAAQ,IAAIA,EAAI,UAAUhB,GAAc,EAAE,OAAO,EAAE,CAAC,GAEjF0B,EAAcZ,CAAG,GACjBa,EAAcb,GAAK,GAAGA,EAAI,GAAG,cAAc,GAEvCK,MAAY,KAAA,KAAWpB,EAAG,yBAAyBoB,CAAO,GAC1DC,MAAY,KAAA,KAAWrB,EAAG,yBAAyBqB,CAAM,GAC7DrB,EAAG,WAAWA,EAAG,cAAc,IAAI,GACnCA,EAAG,WAAWA,EAAG,sBAAsB,IAAI;AAC7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drawTriangles.js","names":["drawTriangles","ctx","count","type"],"sources":["../../../src/renderer/draw/drawTriangles.ts"],"sourcesContent":["import type { DrawContext } from './drawContext';\n\n/** Every GL draw the renderer issues goes through here, so the frame's\n * draw-call count cannot miss one. */\nexport function drawTriangles(ctx: DrawContext, count: number, type: number): void {\n ctx.gl.drawElements(ctx.gl.TRIANGLES, count, type, 0);\n if (ctx.stats) ctx.stats.drawCalls++;\n}\n"],"mappings":";AAIA,SAAgBA,EAAc,GAAkB,GAAe,GAAoB;CAEjF,AADAC,EAAI,GAAG,aAAaA,EAAI,GAAG,WAAWC,GAAOC,GAAM,CAAC,GAChDF,EAAI,SAAO,EAAI,MAAM;AAC3B"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { drawTriangles as e } from "./drawTriangles.js";
|
|
2
|
-
import { setUniforms as t } from "./customShader.js";
|
|
3
|
-
import { setColorMatrixUniforms as n } from "./uniforms.js";
|
|
4
|
-
//#region src/renderer/draw/effects.ts
|
|
5
|
-
function r(e, t, n, r) {
|
|
6
|
-
let i = e.gl, a = e.renderTarget ?? null;
|
|
7
|
-
i.bindFramebuffer(i.FRAMEBUFFER, a ? a.fbo : null), a ? i.viewport(0, 0, t, n) : (e.restoreTargetRect?.(), r && i.enable(i.SCISSOR_TEST));
|
|
8
|
-
}
|
|
9
|
-
function i(r, i, a, o, s, c, l, u) {
|
|
10
|
-
let d = r.gl;
|
|
11
|
-
d.useProgram(i.handle);
|
|
12
|
-
let f = i.attribute("a_position"), p = i.attribute("a_uv");
|
|
13
|
-
d.bindBuffer(d.ARRAY_BUFFER, r.quadVbo), d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, r.quadIbo), f !== void 0 && f >= 0 && (d.enableVertexAttribArray(f), d.vertexAttribPointer(f, 2, d.FLOAT, !1, 16, 0)), p !== void 0 && p >= 0 && (d.enableVertexAttribArray(p), d.vertexAttribPointer(p, 2, d.FLOAT, !1, 16, 8)), d.activeTexture(d.TEXTURE0), d.bindTexture(d.TEXTURE_2D, a);
|
|
14
|
-
let m = i.uniform("u_source");
|
|
15
|
-
m !== void 0 && d.uniform1i(m, 0);
|
|
16
|
-
let h = i.uniform("u_resolution");
|
|
17
|
-
h !== void 0 && d.uniform2f(h, o, s);
|
|
18
|
-
let g = i.uniform("u_texel");
|
|
19
|
-
if (g !== void 0 && d.uniform2f(g, 1 / o, 1 / s), l) {
|
|
20
|
-
let e = i.uniform("u_alpha");
|
|
21
|
-
e !== void 0 && d.uniform1f(e, l.alpha), n(r, i, l.colorMatrix);
|
|
22
|
-
}
|
|
23
|
-
c && t(d, i, u ?? "effect", c, r.textureCache, { value: 1 }), e(r, 6, r.gl.UNSIGNED_SHORT), f !== void 0 && f >= 0 && d.disableVertexAttribArray(f), p !== void 0 && p >= 0 && d.disableVertexAttribArray(p), d.bindBuffer(d.ARRAY_BUFFER, null), d.bindBuffer(d.ELEMENT_ARRAY_BUFFER, null);
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { i as drawFullscreenQuad, r as returnToRenderTarget };
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=effects.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effects.js","names":["returnToRenderTarget","gl","ctx","target","width","height","scissorWasOn","drawFullscreenQuad","program","aPos","aUv","texture","source","resolution","texel","composite","alpha","setColorMatrixUniforms","uniforms","setUniforms","programId","drawTriangles"],"sources":["../../../src/renderer/draw/effects.ts"],"sourcesContent":["import type { ShaderUniform } from '../shaders/registerProgram';\nimport type { ShaderProgram } from '../shaders/ShaderProgram';\nimport type { DrawContext } from './drawContext';\nimport { drawTriangles } from './drawTriangles';\nimport { setColorMatrixUniforms } from './uniforms';\nimport { setUniforms } from './customShader';\n\n/** Rebind `ctx.renderTarget` after an offscreen pass: a pooled target takes\n * the whole `width` × `height` buffer, the default framebuffer the renderer's\n * own rect and the scissor it had. */\nexport function returnToRenderTarget(\n ctx: DrawContext, width: number, height: number, scissorWasOn: boolean,\n): void {\n const gl = ctx.gl;\n const target = ctx.renderTarget ?? null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, target ? target.fbo : null);\n if (target) {\n gl.viewport(0, 0, width, height);\n } else {\n ctx.restoreTargetRect?.();\n if (scissorWasOn) gl.enable(gl.SCISSOR_TEST);\n }\n}\n\n/** One pass: the kit quad, `u_source` bound to `texture`, and whatever else\n * the caller supplies. Leaves no attribute arrays or buffers bound. */\nexport function drawFullscreenQuad(\n ctx: DrawContext,\n program: ShaderProgram,\n texture: WebGLTexture,\n width: number,\n height: number,\n uniforms?: Record<string, ShaderUniform>,\n composite?: { alpha: number; colorMatrix: Float32Array },\n programId?: string,\n): void {\n const gl = ctx.gl;\n gl.useProgram(program.handle);\n\n const aPos = program.attribute('a_position');\n const aUv = program.attribute('a_uv');\n gl.bindBuffer(gl.ARRAY_BUFFER, ctx.quadVbo);\n gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, ctx.quadIbo);\n if (aPos !== undefined && aPos >= 0) {\n gl.enableVertexAttribArray(aPos);\n gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n }\n if (aUv !== undefined && aUv >= 0) {\n gl.enableVertexAttribArray(aUv);\n gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n }\n\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n const source = program.uniform('u_source');\n if (source !== undefined) gl.uniform1i(source, 0);\n const resolution = program.uniform('u_resolution');\n if (resolution !== undefined) gl.uniform2f(resolution, width, height);\n const texel = program.uniform('u_texel');\n if (texel !== undefined) gl.uniform2f(texel, 1 / width, 1 / height);\n\n if (composite) {\n const alpha = program.uniform('u_alpha');\n if (alpha !== undefined) gl.uniform1f(alpha, composite.alpha);\n setColorMatrixUniforms(ctx, program, composite.colorMatrix);\n }\n\n // Unit 0 is `u_source`; a consumer texture starts above it.\n if (uniforms) setUniforms(gl, program, programId ?? 'effect', uniforms, ctx.textureCache, { value: 1 });\n\n drawTriangles(ctx, 6, ctx.gl.UNSIGNED_SHORT);\n\n if (aPos !== undefined && aPos >= 0) gl.disableVertexAttribArray(aPos);\n if (aUv !== undefined && aUv >= 0) gl.disable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CAAM;CACpE,IAAMS,IAAQN,EAAQ,QAAQ,SAAS;CAGvC,IAFIM,MAAU,KAAA,KAAWb,EAAG,UAAUa,GAAO,IAAIV,GAAO,IAAIC,CAAM,GAE9DU,GAAW;EACb,IAAMC,IAAQR,EAAQ,QAAQ,SAAS;EAEvC,AADIQ,MAAU,KAAA,KAAWf,EAAG,UAAUe,GAAOD,EAAU,KAAK,GAC5DE,EAAuBf,GAAKM,GAASO,EAAU,WAAW;CAC5D;CAUA,AAPIG,KAAUC,EAAYlB,GAAIO,GAASY,KAAa,UAAUF,GAAUhB,EAAI,cAAc,EAAE,OAAO,EAAE,CAAC,GAEtGmB,EAAcnB,GAAK,GAAGA,EAAI,GAAG,cAAc,GAEvCO,MAAS,KAAA,KAAaA,KAAQ,KAAGR,EAAG,yBAAyBQ,CAAI,GACjEC,MAAQ,KAAA,KAAaA,KAAO,KAAGT,EAAG,yBAAyBS,CAAG,GAClET,EAAG,WAAWA,EAAG,cAAc,IAAI,GACnCA,EAAG,WAAWA,EAAG,sBAAsB,IAAI;AAC7C"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { BATCH_TEXTURE_SLOTS as e } from "../shaders/batchFill.js";
|
|
2
|
-
import { mat3 as t } from "../math/mat3.js";
|
|
3
|
-
import { drawTriangles as n } from "./drawTriangles.js";
|
|
4
|
-
import { applyClipTest as r } from "./stencil.js";
|
|
5
|
-
import { setAlphaUniform as i, setColorMatrixUniforms as a, setColorUniform as o, setProjAndModel as s } from "./uniforms.js";
|
|
6
|
-
//#region src/renderer/draw/flushBatch.ts
|
|
7
|
-
var c = t.identity(), l = new Int32Array(Array.from({ length: e }, (e, t) => t)), u = new Float32Array(2 * e);
|
|
8
|
-
function d(e) {
|
|
9
|
-
let t = e.drawBatch, d = e.batchState;
|
|
10
|
-
if (t.length === 0 || d === void 0) {
|
|
11
|
-
e.batchState = void 0;
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
let f = e.gl, p = e.batchFill;
|
|
15
|
-
f.useProgram(p.handle);
|
|
16
|
-
let m = t.uploadAndBind();
|
|
17
|
-
s(e, p, c), o(e, p, 1, 1, 1, 1), i(e, p, d.alpha), f.uniform1f(p.uniform("u_synthBold"), d.synthBold), a(e, p, d.colorMatrix), f.activeTexture(f.TEXTURE0), f.bindTexture(f.TEXTURE_2D, e.whiteTexture);
|
|
18
|
-
for (let t = 0; t < d.textures.length; t++) {
|
|
19
|
-
let n = d.textures[t];
|
|
20
|
-
if (n.kind === "atlas") {
|
|
21
|
-
e.textureCache.bind(n.id, t + 1), u[2 * (t + 1)] = n.fieldScale[0], u[2 * (t + 1) + 1] = n.fieldScale[1];
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (n.kind === "ramps") {
|
|
25
|
-
e.gradRamps.bind(t + 1);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
e.imageCache.bind(n.image, t + 1), e.imageCache.setMagFilter(n.image, n.sampling === "nearest" ? f.NEAREST : f.LINEAR);
|
|
29
|
-
}
|
|
30
|
-
f.uniform1iv(p.uniform("u_samplers"), l), f.uniform2fv(p.uniform("u_fieldScale"), u), r(e, d.clipDepth), n(e, m, e.gl.UNSIGNED_INT), f.activeTexture(f.TEXTURE0), f.bindVertexArray(null), t.reset(), e.batchState = void 0;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { c as BATCH_MODEL, d as flushBatch };
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=flushBatch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flushBatch.js","names":["BATCH_MODEL","mat3","SAMPLER_UNITS","BATCH_TEXTURE_SLOTS","i","FIELD_SCALES","flushBatch","batch","ctx","staged","gl","prog","indexCount","setProjAndModel","setColorUniform","setAlphaUniform","setColorMatrixUniforms","entry","applyClipTest","drawTriangles"],"sources":["../../../src/renderer/draw/flushBatch.ts"],"sourcesContent":["import { mat3 } from '../math/mat3';\nimport { BATCH_TEXTURE_SLOTS } from '../shaders/batchFill';\nimport type { DrawContext } from './drawContext';\nimport { drawTriangles } from './drawTriangles';\nimport {\n setColorUniform,\n setAlphaUniform,\n setColorMatrixUniforms,\n setProjAndModel,\n} from './uniforms';\nimport { applyClipTest } from './stencil';\n\n/** The rect batch transforms its own corners, so it draws at model identity. */\nexport const BATCH_MODEL = mat3.identity();\n\n/** `u_samplers[i] = i`, uploaded whole per flush. Built once: the mapping from\n * slot to texture unit is the identity and never varies. */\nconst SAMPLER_UNITS = new Int32Array(\n Array.from({ length: BATCH_TEXTURE_SLOTS }, (_, i) => i),\n);\n\n/** `u_fieldScale`, per slot: an atlas slot's `glyphFieldScale`. Slots that are\n * not atlases keep whatever a previous flush wrote, which nothing reads. */\nconst FIELD_SCALES = new Float32Array(2 * BATCH_TEXTURE_SLOTS);\n\n/**\n * Draw the staged run as one `drawElements`, under the state it was staged\n * under. Callers that are about to bind a different program, or paint anything\n * that must land on top of the run, call this first; a group that only changes\n * the color matrix does not, because `pushRect` notices and flushes then, and\n * one that only changes transform or alpha does not break the run at all.\n *\n * Stencil clips are the exception: the stencil is real GL state that the\n * staged values cannot reconstruct, so `pushClip` flushes *before* writing a\n * bit, and `popClip` before clearing one a staged run tests. Rect clips never\n * reach the stencil while only staged geometry is inside them — see\n * `enterClip`.\n *\n * `u_color` stays white: the vertex-color program multiplies it by the\n * per-vertex color, so white makes the result bit-identical to the flat\n * program's `u_color`-only math. `u_model` stays identity for the same reason —\n * the corners arrive already transformed.\n */\nexport function flushBatch(ctx: DrawContext): void {\n const batch = ctx.drawBatch;\n const staged = ctx.batchState;\n if (batch.length === 0 || staged === undefined) {\n // An empty run's state still names a clip depth, and an item refused by\n // the CPU cut is about to be staged again under a different one.\n ctx.batchState = undefined;\n return;\n }\n const gl = ctx.gl;\n const prog = ctx.batchFill;\n gl.useProgram(prog.handle);\n const indexCount = batch.uploadAndBind();\n setProjAndModel(ctx, prog, BATCH_MODEL);\n setColorUniform(ctx, prog, 1, 1, 1, 1);\n setAlphaUniform(ctx, prog, staged.alpha);\n gl.uniform1f(prog.uniform('u_synthBold')!, staged.synthBold);\n setColorMatrixUniforms(ctx, prog, staged.colorMatrix);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, ctx.whiteTexture);\n for (let i = 0; i < staged.textures.length; i++) {\n const entry = staged.textures[i];\n if (entry.kind === 'atlas') {\n ctx.textureCache.bind(entry.id, i + 1);\n FIELD_SCALES[2 * (i + 1)] = entry.fieldScale[0];\n FIELD_SCALES[2 * (i + 1) + 1] = entry.fieldScale[1];\n continue;\n }\n if (entry.kind === 'ramps') {\n ctx.gradRamps.bind(i + 1);\n continue;\n }\n ctx.imageCache.bind(entry.image, i + 1);\n // Per flush, not at upload: the same bitmap can be drawn at both filters in\n // one frame. The cache skips the write when the texture already carries the\n // value, which is most flushes.\n ctx.imageCache.setMagFilter(\n entry.image,\n entry.sampling === 'nearest' ? gl.NEAREST : gl.LINEAR,\n );\n }\n gl.uniform1iv(prog.uniform('u_samplers')!, SAMPLER_UNITS);\n gl.uniform2fv(prog.uniform('u_fieldScale')!, FIELD_SCALES);\n applyClipTest(ctx, staged.clipDepth);\n drawTriangles(ctx, indexCount, ctx.gl.UNSIGNED_INT);\n // Everything else in the renderer binds its texture to unit 0 and some of it\n // does so without an `activeTexture` of its own, so leaving unit 6 selected\n // sends the next such bind to a unit nothing samples.\n gl.activeTexture(gl.TEXTURE0);\n // Not redundant: `drawShader` binds no VAO and points attributes at whatever\n // is current, so a slot left bound here comes back corrupted a ring later.\n gl.bindVertexArray(null);\n batch.reset();\n ctx.batchState = undefined;\n}\n"],"mappings":";;;;;;AAaA,IAAaA,IAAcC,EAAK,SAAS,GAInCC,IAAgB,IAAI,WACxB,MAAM,KAAK,EAAE,QAAQC,EAAoB,IAAI,GAAG,MAAMC,CAAC,CACzD,GAIMC,IAAe,IAAI,aAAa,IAAIF,CAAmB;AAoB7D,SAAgBG,EAAW,GAAwB;CACj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,EAAcX,GAAKI,GAAYJ,EAAI,GAAG,YAAY,GAIlDE,EAAG,cAAcA,EAAG,QAAQ,GAG5BA,EAAG,gBAAgB,IAAI,GACvBH,EAAM,MAAM,GACZ,EAAI,aAAa,KAAA;AACnB"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { PAINT_MODE_CONIC as e, PAINT_MODE_PLAIN as t, PAINT_MODE_RADIAL as n } from "../shaders/batchFill.js";
|
|
2
|
-
import { mat3 as r } from "../math/mat3.js";
|
|
3
|
-
//#region src/renderer/draw/gradient.ts
|
|
4
|
-
function i(r, i, u) {
|
|
5
|
-
if (u) return;
|
|
6
|
-
let d = i.fill ?? "solid";
|
|
7
|
-
if (d === "solid") {
|
|
8
|
-
let e = i;
|
|
9
|
-
return {
|
|
10
|
-
kind: "solid",
|
|
11
|
-
color: e.color,
|
|
12
|
-
opacity: e.opacity
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
if (d !== "linear-gradient" && d !== "radial-gradient" && d !== "conic-gradient") return;
|
|
16
|
-
let f = i, p = o(r, f.units);
|
|
17
|
-
return p ? f.fill === "linear-gradient" ? a(f, t, s(p, f)) : f.fill === "radial-gradient" ? a(f, n, c(p, f)) : a(f, e, l(p, f)) : null;
|
|
18
|
-
}
|
|
19
|
-
function a(e, t, n) {
|
|
20
|
-
return {
|
|
21
|
-
kind: "ramp",
|
|
22
|
-
stops: e.stops,
|
|
23
|
-
space: e.interpolate ?? "rgb",
|
|
24
|
-
opacity: e.opacity,
|
|
25
|
-
mode: t,
|
|
26
|
-
uv: n
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function o(e, t) {
|
|
30
|
-
let n = d(e, t);
|
|
31
|
-
return n && r.multiply(n, e.state.transform);
|
|
32
|
-
}
|
|
33
|
-
function s(e, t) {
|
|
34
|
-
let n = t.to.x - t.from.x, r = t.to.y - t.from.y, i = Math.hypot(n, r) || 1, a = 1 / (i * i);
|
|
35
|
-
return {
|
|
36
|
-
ux: (e[0] * n + e[1] * r) * a,
|
|
37
|
-
uy: (e[3] * n + e[4] * r) * a,
|
|
38
|
-
u0: ((e[6] - t.from.x) * n + (e[7] - t.from.y) * r) * a,
|
|
39
|
-
vx: 0,
|
|
40
|
-
vy: 0,
|
|
41
|
-
v0: 0
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function c(e, t) {
|
|
45
|
-
let n = 1 / Math.max(t.radius, 1e-4);
|
|
46
|
-
return {
|
|
47
|
-
ux: e[0] * n,
|
|
48
|
-
uy: e[3] * n,
|
|
49
|
-
u0: (e[6] - t.center.x) * n,
|
|
50
|
-
vx: e[1] * n,
|
|
51
|
-
vy: e[4] * n,
|
|
52
|
-
v0: (e[7] - t.center.y) * n
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function l(e, t) {
|
|
56
|
-
let n = Math.cos(t.angle), r = Math.sin(t.angle), i = e[6] - t.center.x, a = e[7] - t.center.y;
|
|
57
|
-
return {
|
|
58
|
-
ux: n * e[0] + r * e[1],
|
|
59
|
-
uy: n * e[3] + r * e[4],
|
|
60
|
-
u0: n * i + r * a,
|
|
61
|
-
vx: n * e[1] - r * e[0],
|
|
62
|
-
vy: n * e[4] - r * e[3],
|
|
63
|
-
v0: n * a - r * i
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function u(e, n) {
|
|
67
|
-
return e.mode === t ? {
|
|
68
|
-
uv: {
|
|
69
|
-
...e.uv,
|
|
70
|
-
v0: n
|
|
71
|
-
},
|
|
72
|
-
post: 1
|
|
73
|
-
} : {
|
|
74
|
-
uv: e.uv,
|
|
75
|
-
post: n
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function d(e, t) {
|
|
79
|
-
return t === "local" ? r.invert(e.state.transform) : t === "world" && e.viewMatrix ? r.invert(e.viewMatrix) : r.identity();
|
|
80
|
-
}
|
|
81
|
-
function f(e, t) {
|
|
82
|
-
let n = d(e, t), i = n && r.invert(n);
|
|
83
|
-
if (!i) return null;
|
|
84
|
-
let a = e.deviceWidth && e.widthCss > 0 ? e.deviceWidth / e.widthCss : 1;
|
|
85
|
-
return r.multiply(r.scaled(r.identity(), a, a), i);
|
|
86
|
-
}
|
|
87
|
-
//#endregion
|
|
88
|
-
export { i as batchPaint, d as gradientSpaceInverse, u as rampVertices, f as spaceToDevice };
|
|
89
|
-
|
|
90
|
-
//# sourceMappingURL=gradient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.js","names":["batchPaint","hasVColors","kind","fill","solid","grad","g","gradientMap","ctx","ramp","PAINT_MODE_PLAIN","linearRampUV","PAINT_MODE_RADIAL","radialRampUV","PAINT_MODE_CONIC","conicRampUV","inverse","gradientSpaceInverse","units","mat3","dx","dy","len","k","cos","sin","dx0","dy0","rampVertices","paint","rowV","spaceToDevice","toScreen","ratio"],"sources":["../../../src/renderer/draw/gradient.ts"],"sourcesContent":["import type { ColorSpace, FillStyle, GradientUnits, GradStop } from '@weasel-js/paint';\nimport { mat3, type GlMat3 } from '../math/mat3';\nimport type { GradientUV } from '../drawBatch';\nimport { PAINT_MODE_PLAIN, PAINT_MODE_RADIAL, PAINT_MODE_CONIC } from '../shaders/batchFill';\nimport type { DrawContext } from './drawContext';\n\n/** A paint a run can express, resolved from a `FillStyle` by `batchPaint`. */\nexport type BatchPaint =\n | { kind: 'solid'; color: string; opacity?: number }\n | {\n kind: 'ramp'; stops: GradStop[]; space: ColorSpace; opacity?: number;\n /** `PAINT_MODE_PLAIN` for a linear gradient, whose ramp position a vertex\n * carries outright; `PAINT_MODE_RADIAL` / `PAINT_MODE_CONIC` otherwise. */\n mode: number;\n uv: GradientUV;\n };\n\n/**\n * `fill` as something a run can carry, or `undefined` for a paint no run can\n * express — a pattern, a shader, per-vertex colors — and `null` for a gradient\n * whose space has no inverse under this transform, which draws nothing.\n *\n * **All three gradients qualify, and for the same reason,** which is not that\n * their ramp position is affine in position — only a linear gradient's is. It\n * is that the *coordinate* the ramp position is computed from is affine in all\n * three, so a vertex can carry that and the rasterizer's interpolation across a\n * triangle is exact. A linear gradient's coordinate is the ramp position\n * itself, which is why it needs no paint mode; the other two carry a\n * gradient-space point and the shader takes a `length` or an `atan` of it.\n */\nexport function batchPaint(\n ctx: DrawContext, fill: FillStyle, hasVColors: boolean,\n): BatchPaint | undefined | null {\n if (hasVColors) return undefined;\n const kind = fill.fill ?? 'solid';\n if (kind === 'solid') {\n const solid = fill as { color: string; opacity?: number };\n return { kind: 'solid', color: solid.color, opacity: solid.opacity };\n }\n if (kind !== 'linear-gradient' && kind !== 'radial-gradient' && kind !== 'conic-gradient') {\n return undefined;\n }\n const grad = fill as Extract<FillStyle, { fill: 'linear-gradient' | 'radial-gradient' | 'conic-gradient' }>;\n const g = gradientMap(ctx, grad.units);\n if (!g) return null;\n if (grad.fill === 'linear-gradient') return ramp(grad, PAINT_MODE_PLAIN, linearRampUV(g, grad));\n if (grad.fill === 'radial-gradient') return ramp(grad, PAINT_MODE_RADIAL, radialRampUV(g, grad));\n return ramp(grad, PAINT_MODE_CONIC, conicRampUV(g, grad));\n}\n\nfunction ramp(\n fill: { stops: GradStop[]; interpolate?: ColorSpace; opacity?: number },\n mode: number, uv: GradientUV,\n): BatchPaint {\n return {\n kind: 'ramp', stops: fill.stops, space: fill.interpolate ?? 'rgb',\n opacity: fill.opacity, mode, uv,\n };\n}\n\n/**\n * Geometry-space → gradient-space, as the one matrix a vertex is measured\n * through.\n *\n * `gradientSpaceInverse` maps a screen position back into the gradient's space\n * and the batch's vertices arrive before the model transform, so the two\n * compose. This is the composition `gradFill`'s vertex shader does in two\n * steps, and the pair have to agree: a radial gradient goes through that one\n * and a linear one through this.\n */\nfunction gradientMap(ctx: DrawContext, units: GradientUnits | undefined): GlMat3 | null {\n const inverse = gradientSpaceInverse(ctx, units);\n return inverse && mat3.multiply(inverse, ctx.state.transform);\n}\n\n/**\n * The gradient shader's `dot(p - from, dir) / len` folded into `u`, with `v`\n * left for the atlas row `stageRamps` fills in.\n */\nfunction linearRampUV(\n g: GlMat3, fill: Extract<FillStyle, { fill: 'linear-gradient' }>,\n): GradientUV {\n const dx = fill.to.x - fill.from.x;\n const dy = fill.to.y - fill.from.y;\n const len = Math.hypot(dx, dy) || 1;\n // dir is (dx, dy)/len and the divisor is len, so the pair is 1/len².\n const k = 1 / (len * len);\n return {\n ux: (g[0] * dx + g[1] * dy) * k,\n uy: (g[3] * dx + g[4] * dy) * k,\n u0: ((g[6] - fill.from.x) * dx + (g[7] - fill.from.y) * dy) * k,\n vx: 0, vy: 0, v0: 0,\n };\n}\n\n/** The gradient-space point scaled so its distance from the center *is* the\n * ramp position, which is what makes the shader's half a `length`. */\nfunction radialRampUV(\n g: GlMat3, fill: Extract<FillStyle, { fill: 'radial-gradient' }>,\n): GradientUV {\n // The floor is `gradFill`'s own `max(u_gradRadius, 0.0001)`.\n const k = 1 / Math.max(fill.radius, 1e-4);\n return {\n ux: g[0] * k, uy: g[3] * k, u0: (g[6] - fill.center.x) * k,\n vx: g[1] * k, vy: g[4] * k, v0: (g[7] - fill.center.y) * k,\n };\n}\n\n/**\n * The gradient-space point about the center, turned by `-angle` so the shader's\n * half is an `atan` of it and nothing else.\n *\n * `gradFill` subtracts the angle from the arctangent instead. The two agree\n * because rotating a point turns its arctangent by the same amount, and the\n * `fract` that follows takes care of the wrap either way.\n */\nfunction conicRampUV(\n g: GlMat3, fill: Extract<FillStyle, { fill: 'conic-gradient' }>,\n): GradientUV {\n const cos = Math.cos(fill.angle);\n const sin = Math.sin(fill.angle);\n const dx0 = g[6] - fill.center.x;\n const dy0 = g[7] - fill.center.y;\n return {\n ux: cos * g[0] + sin * g[1],\n uy: cos * g[3] + sin * g[4],\n u0: cos * dx0 + sin * dy0,\n vx: cos * g[1] - sin * g[0],\n vy: cos * g[4] - sin * g[3],\n v0: cos * dy0 - sin * dx0,\n };\n}\n\n/**\n * What a gradient's vertices carry once its row is known.\n *\n * A linear gradient's `a_uv` is (ramp position, row) and its `a_post` is the\n * plain 1, because that is what the plain paint mode already samples. A radial\n * or conic one needs both `a_uv` channels for its coordinate, so its row goes\n * in `a_post` — which no gradient uses for alpha, its opacity riding the vertex\n * color instead.\n */\nexport function rampVertices(\n paint: Extract<BatchPaint, { kind: 'ramp' }>, rowV: number,\n): { uv: GradientUV; post: number } {\n return paint.mode === PAINT_MODE_PLAIN\n ? { uv: { ...paint.uv, v0: rowV }, post: 1 }\n : { uv: paint.uv, post: rowV };\n}\n\n/**\n * Screen→gradient-space matrix for `u_worldInv`, which the vertex shader\n * applies to each fragment's screen position to recover the coordinates the\n * gradient's geometry is expressed in.\n *\n * `'world'` silently degrades to screen space when no view matrix reached\n * the renderer — `render(commands)` without a view is a supported call, and\n * a missing view is not worth a thrown frame. `null` when the space has no\n * inverse; a paint measured in it draws nothing.\n */\nexport function gradientSpaceInverse(ctx: DrawContext, units: GradientUnits | undefined): GlMat3 | null {\n if (units === 'local') return mat3.invert(ctx.state.transform);\n if (units === 'world' && ctx.viewMatrix) return mat3.invert(ctx.viewMatrix);\n return mat3.identity();\n}\n\n/** The paint space `units` names → device pixels: the forward transform\n * `gradientSpaceInverse` undoes, scaled by the target's pixel ratio. */\nexport function spaceToDevice(ctx: DrawContext, units: GradientUnits | undefined): GlMat3 | null {\n const inverse = gradientSpaceInverse(ctx, units);\n const toScreen = inverse && mat3.invert(inverse);\n if (!toScreen) return null;\n const ratio = ctx.deviceWidth && ctx.widthCss > 0 ? ctx.deviceWidth / ctx.widthCss : 1;\n return mat3.multiply(mat3.scaled(mat3.identity(), ratio, ratio), toScreen);\n}\n"],"mappings":";;;AA8BA,SAAgBA,EACd,GAAkB,GAAiB,GACJ;CAC/B,IAAIC,GAAY;CAChB,IAAMC,IAAOC,EAAK,QAAQ;CAC1B,IAAID,MAAS,SAAS;EACpB,IAAME,IAAQD;EACd,OAAO;GAAE,MAAM;GAAS,OAAOC,EAAM;GAAO,SAASA,EAAM;EAAQ;CACrE;CACA,IAAIF,MAAS,qBAAqBA,MAAS,q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IAAIA,EAAI,cAAcA,EAAI,WAAW;CACrF,OAAOW,EAAK,SAASA,EAAK,OAAOA,EAAK,SAAS,GAAGc,GAAOA,CAAK,GAAGD,CAAQ;AAC3E"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { flushBatch as e } from "./flushBatch.js";
|
|
2
|
-
import { enterUncut as t, leaveUncut as n, retryUncut as r } from "./clip.js";
|
|
3
|
-
import { stageImage as i } from "./batch.js";
|
|
4
|
-
import { SPRITE_STRIDE as a } from "../DrawCommand.js";
|
|
5
|
-
//#region src/renderer/draw/image.ts
|
|
6
|
-
function o(e, t) {
|
|
7
|
-
e.imageCache.upload(t.image, t.image);
|
|
8
|
-
let { staged: n, slot: a } = i(e, t.image, t.sampling ?? "linear"), s = t.source, c = 0, l = 0, u = 1, d = 1;
|
|
9
|
-
if (s) {
|
|
10
|
-
let e = t.image.width, n = t.image.height;
|
|
11
|
-
c = s.x / e, u = (s.x + s.w) / e, l = s.y / n, d = (s.y + s.h) / n;
|
|
12
|
-
}
|
|
13
|
-
if (t.flipX) {
|
|
14
|
-
let e = c;
|
|
15
|
-
c = u, u = e;
|
|
16
|
-
}
|
|
17
|
-
if (t.flipY) {
|
|
18
|
-
let e = l;
|
|
19
|
-
l = d, d = e;
|
|
20
|
-
}
|
|
21
|
-
e.drawBatch.pushQuad(t.x, t.y, t.w, t.h, e.state.transform, c, l, u, d, (t.opacity ?? 1) * (n.foldsAlpha ? e.state.alpha : 1), a) || r(e, t, void 0, o);
|
|
22
|
-
}
|
|
23
|
-
function s(r, o) {
|
|
24
|
-
let s = o.sprites, c = Math.floor(s.length / a);
|
|
25
|
-
if (c === 0) return;
|
|
26
|
-
r.imageCache.upload(o.image, o.image);
|
|
27
|
-
let l = o.sampling ?? "linear", { staged: u, slot: d } = i(r, o.image, l), f = r.drawBatch, p = r.state.transform, m = u.foldsAlpha ? r.state.alpha : 1, h = o.image.width, g = o.image.height;
|
|
28
|
-
for (let _ = 0, v = 0; _ < c; _++, v += a) {
|
|
29
|
-
f.wouldOverflow(4) && (e(r), {staged: u, slot: d} = i(r, o.image, l), m = u.foldsAlpha ? r.state.alpha : 1);
|
|
30
|
-
let a = s[v + 4], c = s[v + 5], _ = s[v + 6], y = s[v + 7], b;
|
|
31
|
-
for (; !f.pushQuad(s[v], s[v + 1], s[v + 2], s[v + 3], p, a / h, c / g, (a + _) / h, (c + y) / g, s[v + 8] * m, d);) b = t(r), {staged: u, slot: d} = i(r, o.image, l), m = u.foldsAlpha ? r.state.alpha : 1;
|
|
32
|
-
b !== void 0 && (n(r, b), {staged: u, slot: d} = i(r, o.image, l), m = u.foldsAlpha ? r.state.alpha : 1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { o as drawImage, s as drawSprites };
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=image.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":["drawImage","cmd","stageImage","ctx","src","u0","v0","u1","v1","tw","th","t","staged","slot","retryUncut","drawSprites","data","count","SPRITE_STRIDE","sampling","batch","m","groupAlpha","s","i","flushBatch","sx","sy","sw","sh","cut","enterUncut","leaveUncut"],"sources":["../../../src/renderer/draw/image.ts"],"sourcesContent":["import { type ImageDrawCommand, type SpritesDrawCommand, SPRITE_STRIDE } from '../DrawCommand';\nimport type { ClipRect } from '../batchClip';\nimport type { DrawContext } from './drawContext';\nimport { enterUncut, leaveUncut, retryUncut } from './clip';\nimport { flushBatch } from './flushBatch';\nimport { stageImage } from './batch';\n\n/**\n * Stage one image quad. Nothing reaches the GPU here — `flushBatch` draws the\n * run this joins.\n *\n * The upload has to happen now rather than at flush: a run is keyed on bitmap\n * identity, and `flushBatch` binds a texture it assumes already exists.\n */\nexport function drawImage(ctx: DrawContext, cmd: ImageDrawCommand): void {\n ctx.imageCache.upload(cmd.image, cmd.image);\n const { staged, slot } = stageImage(ctx, cmd.image, cmd.sampling ?? 'linear');\n\n // Sampling window: the whole bitmap unless `source` narrows it, with the\n // flips applied by swapping the ends rather than moving the quad.\n const src = cmd.source;\n let u0 = 0, v0 = 0, u1 = 1, v1 = 1;\n if (src) {\n const tw = cmd.image.width, th = cmd.image.height;\n u0 = src.x / tw; u1 = (src.x + src.w) / tw;\n v0 = src.y / th; v1 = (src.y + src.h) / th;\n }\n if (cmd.flipX) { const t = u0; u0 = u1; u1 = t; }\n if (cmd.flipY) { const t = v0; v0 = v1; v1 = t; }\n\n if (!ctx.drawBatch.pushQuad(\n cmd.x, cmd.y, cmd.w, cmd.h, ctx.state.transform,\n u0, v0, u1, v1,\n // Group alpha rides the vertices only where it rode the solid colors too:\n // with a real color matrix in the run it is `u_alpha`, and folding it here\n // as well would apply it twice.\n (cmd.opacity ?? 1) * (staged.foldsAlpha ? ctx.state.alpha : 1),\n slot,\n )) retryUncut(ctx, cmd, undefined, drawImage);\n}\n\n/**\n * Stage a packed run of sprites. The same staging `drawImage` does, minus a\n * command object per quad — see `SpritesDrawCommand`.\n *\n * The run is opened once and reopened only when the per-flush cap forces a\n * chunk, so the state check that costs a command its own run happens twice in\n * a frame rather than twenty thousand times.\n */\nexport function drawSprites(ctx: DrawContext, cmd: SpritesDrawCommand): void {\n const data = cmd.sprites;\n const count = Math.floor(data.length / SPRITE_STRIDE);\n if (count === 0) return;\n\n ctx.imageCache.upload(cmd.image, cmd.image);\n const sampling = cmd.sampling ?? 'linear';\n let { staged, slot } = stageImage(ctx, cmd.image, sampling);\n\n const batch = ctx.drawBatch;\n const m = ctx.state.transform;\n let groupAlpha = staged.foldsAlpha ? ctx.state.alpha : 1;\n const tw = cmd.image.width;\n const th = cmd.image.height;\n\n for (let s = 0, i = 0; s < count; s++, i += SPRITE_STRIDE) {\n if (batch.wouldOverflow(4)) {\n flushBatch(ctx);\n ({ staged, slot } = stageImage(ctx, cmd.image, sampling));\n groupAlpha = staged.foldsAlpha ? ctx.state.alpha : 1;\n }\n const sx = data[i + 4], sy = data[i + 5], sw = data[i + 6], sh = data[i + 7];\n let cut: ClipRect | null | undefined;\n while (!batch.pushQuad(\n data[i], data[i + 1], data[i + 2], data[i + 3], m,\n sx / tw, sy / th, (sx + sw) / tw, (sy + sh) / th,\n data[i + 8] * groupAlpha, slot,\n )) {\n cut = enterUncut(ctx);\n ({ staged, slot } = stageImage(ctx, cmd.image, sampling));\n groupAlpha = staged.foldsAlpha ? ctx.state.alpha : 1;\n }\n if (cut !== undefined) {\n leaveUncut(ctx, cut);\n ({ staged, slot } = stageImage(ctx, cmd.image, sampling));\n groupAlpha = staged.foldsAlpha ? ctx.state.alpha : 1;\n }\n }\n}\n"],"mappings":";;;;;AAcA,SAAgBA,EAAU,GAAkB,GAA6B;CACvE,EAAI,WAAW,OAAOC,EAAI,OAAOA,EAAI,KAAK;CAC1C,IAAM,EAAE,WAAQ,YAASC,EAAWC,GAAKF,EAAI,OAAOA,EAAI,YAAY,QAAQ,GAItEG,IAAMH,EAAI,QACZI,IAAK,GAAGC,IAAK,GAAGC,IAAK,GAAGC,IAAK;CACjC,IAAIJ,GAAK;EACP,IAAMK,IAAKR,EAAI,MAAM,OAAOS,IAAKT,EAAI,MAAM;EAE1B,AADjB,IAAKG,EAAI,IAAIK,GAAI,KAAML,EAAI,IAAIA,EAAI,KAAKK,GACxC,IAAKL,EAAI,IAAIM,GAAI,KAAMN,EAAI,IAAIA,EAAI,KAAKM;CAC1C;CACA,IAAIT,EAAI,OAAO;EAAE,IAAMU,IAAIN;EAAa,AAAT,IAAKE,GAAI,IAAKI;CAAG;CAChD,IAAIV,EAAI,OAAO;EAAE,IAAMU,IAAIL;EAAa,AAAT,IAAKE,GAAI,IAAKG;CAAG;CAEhD,AAAKR,EAAI,UAAU,SACjBF,EAAI,GAAGA,EAAI,GAAGA,EAAI,GAAGA,EAAI,GAAGE,EAAI,MAAM,WACtCE,GAAIC,GAAIC,GAAIC,IAIXP,EAAI,WAAW,MAAMW,EAAO,aAAaT,EAAI,MAAM,QAAQ,IAC5DU,CACF,KAA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,KAAA,MACVE,EAAW7B,GAAK2B,CAAG,GAClB,uBAAmB5B,EAAWC,GAAKF,EAAI,OAAOkB,CAAQ,GACvD,IAAaP,EAAO,aAAaT,EAAI,MAAM,QAAQ;CAEvD;AACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { getMesh as e } from "../cache/cache.js";
|
|
2
|
-
import { tessellate as t } from "@weasel-js/geom/tessellate";
|
|
3
|
-
//#region src/renderer/draw/mesh.ts
|
|
4
|
-
function n(n, r) {
|
|
5
|
-
return n.flattenTolerance === void 0 ? e(r) : t(r, { flattenTolerance: n.flattenTolerance });
|
|
6
|
-
}
|
|
7
|
-
function r(e, t) {
|
|
8
|
-
return e.flattenTolerance === void 0 ? e.meshCache.handleFor(t) : e.meshCache.uploadTransient(t);
|
|
9
|
-
}
|
|
10
|
-
function i(e, t) {
|
|
11
|
-
return r(e, n(e, t));
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { n as fillMesh, i as fillMeshHandle, r as meshHandle };
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=mesh.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mesh.js","names":["fillMesh","ctx","getMesh","path","tessellate","meshHandle","mesh","fillMeshHandle"],"sources":["../../../src/renderer/draw/mesh.ts"],"sourcesContent":["import type { Path } from '@weasel-js/geom';\nimport type { GLMeshHandle } from '../cache/GLMeshCache';\nimport { getMesh } from '../cache/cache';\nimport { tessellate, type Mesh } from '@weasel-js/geom/tessellate';\nimport type { DrawContext } from './drawContext';\n\n/**\n * Tessellate a fill honoring ctx.flattenTolerance: default route is the\n * persistent Path-identity cache; a custom tolerance tessellates fresh, because\n * the persistent cache's key does not include tolerance.\n */\nexport function fillMesh(ctx: DrawContext, path: Path): Mesh {\n if (ctx.flattenTolerance !== undefined) {\n return tessellate(path, { flattenTolerance: ctx.flattenTolerance });\n }\n return getMesh(path);\n}\n\n/** Upload a mesh for its own draw. A freshly tessellated one rides the\n * transient pool, freed at end of frame. */\nexport function meshHandle(ctx: DrawContext, mesh: Mesh): GLMeshHandle {\n if (ctx.flattenTolerance !== undefined) return ctx.meshCache.uploadTransient(mesh);\n return ctx.meshCache.handleFor(mesh);\n}\n\nexport function fillMeshHandle(ctx: DrawContext, path: Path): GLMeshHandle {\n return meshHandle(ctx, fillMesh(ctx, path));\n}\n"],"mappings":";;;AAWA,SAAgBA,EAAS,GAAkB,GAAkB;CAI3D,OAHIC,EAAI,qBAAqB,KAAA,IAGtBC,EAAQC,CAAI,IAFVC,EAAWD,GAAM,EAAE,kBAAkBF,EAAI,iBAAiB,CAAC;AAGtE;AAIA,SAAgBI,EAAW,GAAkB,GAA0B;CAErE,OADIJ,EAAI,qBAAqB,KAAA,IACtBA,EAAI,UAAU,UAAUK,CAAI,IADYL,EAAI,UAAU,gBAAgBK,CAAI;AAEnF;AAEA,SAAgBC,EAAe,GAAkB,GAA0B;CACzE,OAAOF,EAAWJ,GAAKD,EAASC,GAAKE,CAAI,CAAC;AAC5C"}
|