@motionscript/core 0.1.0-alpha.8 → 0.1.0-alpha.9
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 +6 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -49
- package/README.md +91 -91
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/effects/index.js.map +1 -1
- package/dist/attributes/audio/effects/registry.js.map +1 -1
- package/dist/attributes/audio/effects/union.js.map +1 -1
- package/dist/attributes/audio/ramp.js.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +4 -4
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.js.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
- package/dist/browser/chunks/{chunk-GKM6UZJR.js → chunk-7DB6BI27.js} +2 -2
- package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
- package/dist/browser/chunks/{chunk-AOT33LMS.js → chunk-IX53IFBD.js} +2 -2
- package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
- package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
- package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/experimental.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.js.map +1 -1
- package/dist/components/builtins/geometry/composite.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/providers/providers.js.map +1 -1
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +9 -9
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.js.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/clip-of.js.map +1 -1
- package/dist/components/factory/commands-for.js.map +1 -1
- package/dist/components/factory/component-audio.js.map +1 -1
- package/dist/components/factory/component2d.js.map +1 -1
- package/dist/components/factory/component3d.js.map +1 -1
- package/dist/components/factory/factory.js.map +1 -1
- package/dist/components/factory/timeline.js.map +1 -1
- package/dist/components/factory/type-def.js.map +1 -1
- package/dist/components/factory/types.js.map +1 -1
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/modules/aim.js.map +1 -1
- package/dist/components/modules/corners.js.map +1 -1
- package/dist/components/modules/flow.js.map +1 -1
- package/dist/components/modules/material.js.map +1 -1
- package/dist/components/modules/paint.js.map +1 -1
- package/dist/components/modules/shapes.js.map +1 -1
- package/dist/components/modules/text-layout.js.map +1 -1
- package/dist/components/modules/text-style.d.ts +1 -1
- package/dist/components/modules/text-style.js.map +1 -1
- package/dist/components/modules/three-entries.js.map +1 -1
- package/dist/components/modules/view3d.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.js.map +1 -1
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.js.map +1 -1
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/index.js.map +1 -1
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/components/trees/index.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/missing-node.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.js.map +1 -1
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.js.map +1 -1
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.js.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/render-issue.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.js.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.js.map +1 -1
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +0 -113
- package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/chain.js +0 -104
- package/dist/attributes/audio/filters/chain.js.map +0 -1
- package/dist/attributes/audio/filters/curve.d.ts +0 -152
- package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
- package/dist/attributes/audio/filters/curve.js +0 -250
- package/dist/attributes/audio/filters/curve.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
- package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.js +0 -11
- package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
- package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.js +0 -6
- package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.js +0 -10
- package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js +0 -10
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
- package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.js +0 -6
- package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js +0 -10
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
- package/dist/attributes/audio/filters/index.d.ts +0 -22
- package/dist/attributes/audio/filters/index.d.ts.map +0 -1
- package/dist/attributes/audio/filters/index.js +0 -8
- package/dist/attributes/audio/filters/index.js.map +0 -1
- package/dist/attributes/audio/filters/registry.d.ts +0 -36
- package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
- package/dist/attributes/audio/filters/registry.js +0 -82
- package/dist/attributes/audio/filters/registry.js.map +0 -1
- package/dist/attributes/audio/filters/union.d.ts +0 -18
- package/dist/attributes/audio/filters/union.d.ts.map +0 -1
- package/dist/attributes/audio/filters/union.js +0 -28
- package/dist/attributes/audio/filters/union.js.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
- package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.js +0 -0
- package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
- package/dist/browser/chunks/chunk-AOT33LMS.js.map +0 -7
- package/dist/browser/chunks/chunk-GKM6UZJR.js.map +0 -7
- package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
- package/dist/component/api.d.ts +0 -508
- package/dist/component/api.d.ts.map +0 -1
- package/dist/component/api.js +0 -4
- package/dist/component/api.js.map +0 -1
- package/dist/component/builtins/audio.d.ts +0 -26
- package/dist/component/builtins/audio.d.ts.map +0 -1
- package/dist/component/builtins/audio.js +0 -41
- package/dist/component/builtins/audio.js.map +0 -1
- package/dist/component/builtins/canvas3d.d.ts +0 -98
- package/dist/component/builtins/canvas3d.d.ts.map +0 -1
- package/dist/component/builtins/canvas3d.js +0 -21
- package/dist/component/builtins/canvas3d.js.map +0 -1
- package/dist/component/builtins/composite.d.ts +0 -56
- package/dist/component/builtins/composite.d.ts.map +0 -1
- package/dist/component/builtins/composite.js +0 -25
- package/dist/component/builtins/composite.js.map +0 -1
- package/dist/component/builtins/geometry.d.ts +0 -505
- package/dist/component/builtins/geometry.d.ts.map +0 -1
- package/dist/component/builtins/geometry.js +0 -107
- package/dist/component/builtins/geometry.js.map +0 -1
- package/dist/component/builtins/layout.d.ts +0 -88
- package/dist/component/builtins/layout.d.ts.map +0 -1
- package/dist/component/builtins/layout.js +0 -84
- package/dist/component/builtins/layout.js.map +0 -1
- package/dist/component/builtins/media.d.ts +0 -95
- package/dist/component/builtins/media.d.ts.map +0 -1
- package/dist/component/builtins/media.js +0 -149
- package/dist/component/builtins/media.js.map +0 -1
- package/dist/component/builtins/providers.d.ts +0 -23
- package/dist/component/builtins/providers.d.ts.map +0 -1
- package/dist/component/builtins/providers.js +0 -30
- package/dist/component/builtins/providers.js.map +0 -1
- package/dist/component/builtins/text.d.ts +0 -193
- package/dist/component/builtins/text.d.ts.map +0 -1
- package/dist/component/builtins/text.js +0 -113
- package/dist/component/builtins/text.js.map +0 -1
- package/dist/component/builtins/three.d.ts +0 -1085
- package/dist/component/builtins/three.d.ts.map +0 -1
- package/dist/component/builtins/three.js +0 -265
- package/dist/component/builtins/three.js.map +0 -1
- package/dist/component/clip-of.d.ts +0 -5
- package/dist/component/clip-of.d.ts.map +0 -1
- package/dist/component/clip-of.js +0 -33
- package/dist/component/clip-of.js.map +0 -1
- package/dist/component/commands-for.d.ts +0 -19
- package/dist/component/commands-for.d.ts.map +0 -1
- package/dist/component/commands-for.js +0 -5
- package/dist/component/commands-for.js.map +0 -1
- package/dist/component/component-audio.d.ts +0 -9
- package/dist/component/component-audio.d.ts.map +0 -1
- package/dist/component/component-audio.js +0 -18
- package/dist/component/component-audio.js.map +0 -1
- package/dist/component/component2d.d.ts +0 -9
- package/dist/component/component2d.d.ts.map +0 -1
- package/dist/component/component2d.js +0 -239
- package/dist/component/component2d.js.map +0 -1
- package/dist/component/component3d.d.ts +0 -9
- package/dist/component/component3d.d.ts.map +0 -1
- package/dist/component/component3d.js +0 -99
- package/dist/component/component3d.js.map +0 -1
- package/dist/component/factory.d.ts +0 -63
- package/dist/component/factory.d.ts.map +0 -1
- package/dist/component/factory.js +0 -313
- package/dist/component/factory.js.map +0 -1
- package/dist/component/modules/aim.d.ts +0 -30
- package/dist/component/modules/aim.d.ts.map +0 -1
- package/dist/component/modules/aim.js +0 -39
- package/dist/component/modules/aim.js.map +0 -1
- package/dist/component/modules/corners.d.ts +0 -13
- package/dist/component/modules/corners.d.ts.map +0 -1
- package/dist/component/modules/corners.js +0 -12
- package/dist/component/modules/corners.js.map +0 -1
- package/dist/component/modules/flow.d.ts +0 -26
- package/dist/component/modules/flow.d.ts.map +0 -1
- package/dist/component/modules/flow.js +0 -55
- package/dist/component/modules/flow.js.map +0 -1
- package/dist/component/modules/material.d.ts +0 -40
- package/dist/component/modules/material.d.ts.map +0 -1
- package/dist/component/modules/material.js +0 -75
- package/dist/component/modules/material.js.map +0 -1
- package/dist/component/modules/paint.d.ts +0 -71
- package/dist/component/modules/paint.d.ts.map +0 -1
- package/dist/component/modules/paint.js +0 -106
- package/dist/component/modules/paint.js.map +0 -1
- package/dist/component/modules/shapes.d.ts +0 -31
- package/dist/component/modules/shapes.d.ts.map +0 -1
- package/dist/component/modules/shapes.js +0 -43
- package/dist/component/modules/shapes.js.map +0 -1
- package/dist/component/modules/text-layout.d.ts +0 -26
- package/dist/component/modules/text-layout.d.ts.map +0 -1
- package/dist/component/modules/text-layout.js +0 -57
- package/dist/component/modules/text-layout.js.map +0 -1
- package/dist/component/modules/text-style.d.ts +0 -48
- package/dist/component/modules/text-style.d.ts.map +0 -1
- package/dist/component/modules/text-style.js +0 -63
- package/dist/component/modules/text-style.js.map +0 -1
- package/dist/component/modules/three-entries.d.ts +0 -23
- package/dist/component/modules/three-entries.d.ts.map +0 -1
- package/dist/component/modules/three-entries.js +0 -41
- package/dist/component/modules/three-entries.js.map +0 -1
- package/dist/component/modules/view3d.d.ts +0 -55
- package/dist/component/modules/view3d.d.ts.map +0 -1
- package/dist/component/modules/view3d.js +0 -160
- package/dist/component/modules/view3d.js.map +0 -1
- package/dist/component/timeline.d.ts +0 -22
- package/dist/component/timeline.d.ts.map +0 -1
- package/dist/component/timeline.js +0 -128
- package/dist/component/timeline.js.map +0 -1
- package/dist/component/type-def.d.ts +0 -26
- package/dist/component/type-def.d.ts.map +0 -1
- package/dist/component/type-def.js +0 -16
- package/dist/component/type-def.js.map +0 -1
- package/dist/component/types.d.ts +0 -91
- package/dist/component/types.d.ts.map +0 -1
- package/dist/component/types.js +0 -88
- package/dist/component/types.js.map +0 -1
- package/dist/component/views.d.ts +0 -121
- package/dist/component/views.d.ts.map +0 -1
- package/dist/component/views.js +0 -413
- package/dist/component/views.js.map +0 -1
- package/dist/document/withdraw.d.ts +0 -28
- package/dist/document/withdraw.d.ts.map +0 -1
- package/dist/document/withdraw.js +0 -61
- package/dist/document/withdraw.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
- package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-dev-runtime.js +0 -3
- package/dist/jsx/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx/jsx-runtime.d.ts +0 -27
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -26
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
- package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
- package/dist/nodes/2d/node-lifecycle.js +0 -264
- package/dist/nodes/2d/node-lifecycle.js.map +0 -1
- package/dist/nodes/2d/node-motion.d.ts +0 -56
- package/dist/nodes/2d/node-motion.d.ts.map +0 -1
- package/dist/nodes/2d/node-motion.js +0 -86
- package/dist/nodes/2d/node-motion.js.map +0 -1
- package/dist/nodes/2d/node-render.d.ts +0 -44
- package/dist/nodes/2d/node-render.d.ts.map +0 -1
- package/dist/nodes/2d/node-render.js +0 -80
- package/dist/nodes/2d/node-render.js.map +0 -1
- package/dist/nodes/2d/node-space.d.ts +0 -63
- package/dist/nodes/2d/node-space.d.ts.map +0 -1
- package/dist/nodes/2d/node-space.js +0 -131
- package/dist/nodes/2d/node-space.js.map +0 -1
- package/dist/nodes/2d/node-transform.d.ts +0 -55
- package/dist/nodes/2d/node-transform.d.ts.map +0 -1
- package/dist/nodes/2d/node-transform.js +0 -73
- package/dist/nodes/2d/node-transform.js.map +0 -1
- package/dist/nodes/2d/node2d.d.ts +0 -1111
- package/dist/nodes/2d/node2d.d.ts.map +0 -1
- package/dist/nodes/2d/node2d.js +0 -1665
- package/dist/nodes/2d/node2d.js.map +0 -1
- package/dist/nodes/2d/paint-node.d.ts +0 -142
- package/dist/nodes/2d/paint-node.d.ts.map +0 -1
- package/dist/nodes/2d/paint-node.js +0 -232
- package/dist/nodes/2d/paint-node.js.map +0 -1
- package/dist/nodes/audio/audio-bus.d.ts +0 -28
- package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
- package/dist/nodes/audio/audio-bus.js +0 -33
- package/dist/nodes/audio/audio-bus.js.map +0 -1
- package/dist/nodes/audio/index.d.ts +0 -4
- package/dist/nodes/audio/index.d.ts.map +0 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +0 -1
- package/dist/nodes/audio/node-audio.d.ts +0 -107
- package/dist/nodes/audio/node-audio.d.ts.map +0 -1
- package/dist/nodes/audio/node-audio.js +0 -179
- package/dist/nodes/audio/node-audio.js.map +0 -1
- package/dist/nodes/audio/sound-node.d.ts +0 -41
- package/dist/nodes/audio/sound-node.d.ts.map +0 -1
- package/dist/nodes/audio/sound-node.js +0 -71
- package/dist/nodes/audio/sound-node.js.map +0 -1
- package/dist/nodes/geometry/boolean-node.d.ts +0 -28
- package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
- package/dist/nodes/geometry/boolean-node.js +0 -81
- package/dist/nodes/geometry/boolean-node.js.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
- package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.js +0 -181
- package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
- package/dist/nodes/geometry/box-path-node.d.ts +0 -89
- package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/box-path-node.js +0 -116
- package/dist/nodes/geometry/box-path-node.js.map +0 -1
- package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
- package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
- package/dist/nodes/geometry/ellipse-node.js +0 -45
- package/dist/nodes/geometry/ellipse-node.js.map +0 -1
- package/dist/nodes/geometry/group-bounds.d.ts +0 -56
- package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
- package/dist/nodes/geometry/group-bounds.js +0 -87
- package/dist/nodes/geometry/group-bounds.js.map +0 -1
- package/dist/nodes/geometry/mask-node.d.ts +0 -33
- package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
- package/dist/nodes/geometry/mask-node.js +0 -66
- package/dist/nodes/geometry/mask-node.js.map +0 -1
- package/dist/nodes/geometry/path-node.d.ts +0 -26
- package/dist/nodes/geometry/path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/path-node.js +0 -58
- package/dist/nodes/geometry/path-node.js.map +0 -1
- package/dist/nodes/geometry/polygon-node.d.ts +0 -26
- package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygon-node.js +0 -47
- package/dist/nodes/geometry/polygon-node.js.map +0 -1
- package/dist/nodes/geometry/polygram-node.d.ts +0 -33
- package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygram-node.js +0 -52
- package/dist/nodes/geometry/polygram-node.js.map +0 -1
- package/dist/nodes/geometry/rect-node.d.ts +0 -38
- package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
- package/dist/nodes/geometry/rect-node.js +0 -56
- package/dist/nodes/geometry/rect-node.js.map +0 -1
- package/dist/nodes/geometry/shape-node.d.ts +0 -71
- package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-node.js +0 -140
- package/dist/nodes/geometry/shape-node.js.map +0 -1
- package/dist/nodes/geometry/shape-outline.d.ts +0 -93
- package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-outline.js +0 -470
- package/dist/nodes/geometry/shape-outline.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -53
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -35
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/layout/camera-node.d.ts +0 -80
- package/dist/nodes/layout/camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/camera-node.js +0 -153
- package/dist/nodes/layout/camera-node.js.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
- package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.js +0 -118
- package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
- package/dist/nodes/layout/rotated-box.d.ts +0 -20
- package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
- package/dist/nodes/layout/rotated-box.js +0 -76
- package/dist/nodes/layout/rotated-box.js.map +0 -1
- package/dist/nodes/media/video-node.d.ts +0 -229
- package/dist/nodes/media/video-node.d.ts.map +0 -1
- package/dist/nodes/media/video-node.js +0 -350
- package/dist/nodes/media/video-node.js.map +0 -1
- package/dist/nodes/node/declare-paints.d.ts +0 -19
- package/dist/nodes/node/declare-paints.d.ts.map +0 -1
- package/dist/nodes/node/declare-paints.js +0 -27
- package/dist/nodes/node/declare-paints.js.map +0 -1
- package/dist/nodes/node/node-editor-state.d.ts +0 -53
- package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
- package/dist/nodes/node/node-editor-state.js +0 -23
- package/dist/nodes/node/node-editor-state.js.map +0 -1
- package/dist/nodes/node/node-reactive.d.ts +0 -89
- package/dist/nodes/node/node-reactive.d.ts.map +0 -1
- package/dist/nodes/node/node-reactive.js +0 -135
- package/dist/nodes/node/node-reactive.js.map +0 -1
- package/dist/nodes/node/node-time.d.ts +0 -39
- package/dist/nodes/node/node-time.d.ts.map +0 -1
- package/dist/nodes/node/node-time.js +0 -14
- package/dist/nodes/node/node-time.js.map +0 -1
- package/dist/nodes/node/node-walk.d.ts +0 -46
- package/dist/nodes/node/node-walk.d.ts.map +0 -1
- package/dist/nodes/node/node-walk.js +0 -74
- package/dist/nodes/node/node-walk.js.map +0 -1
- package/dist/nodes/node/node.d.ts +0 -445
- package/dist/nodes/node/node.d.ts.map +0 -1
- package/dist/nodes/node/node.js +0 -745
- package/dist/nodes/node/node.js.map +0 -1
- package/dist/nodes/node/text-defaults.d.ts +0 -32
- package/dist/nodes/node/text-defaults.d.ts.map +0 -1
- package/dist/nodes/node/text-defaults.js +0 -37
- package/dist/nodes/node/text-defaults.js.map +0 -1
- package/dist/nodes/root/canvas2d-node.d.ts +0 -163
- package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/root/canvas2d-node.js +0 -264
- package/dist/nodes/root/canvas2d-node.js.map +0 -1
- package/dist/nodes/root/provider-node.d.ts +0 -47
- package/dist/nodes/root/provider-node.d.ts.map +0 -1
- package/dist/nodes/root/provider-node.js +0 -63
- package/dist/nodes/root/provider-node.js.map +0 -1
- package/dist/nodes/root/theme-provider-node.d.ts +0 -29
- package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/root/theme-provider-node.js +0 -43
- package/dist/nodes/root/theme-provider-node.js.map +0 -1
- package/dist/nodes/text/default-text-style-node.d.ts +0 -103
- package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
- package/dist/nodes/text/default-text-style-node.js +0 -146
- package/dist/nodes/text/default-text-style-node.js.map +0 -1
- package/dist/nodes/text/number-format.d.ts +0 -66
- package/dist/nodes/text/number-format.d.ts.map +0 -1
- package/dist/nodes/text/number-format.js +0 -227
- package/dist/nodes/text/number-format.js.map +0 -1
- package/dist/nodes/text/number-node.d.ts +0 -94
- package/dist/nodes/text/number-node.d.ts.map +0 -1
- package/dist/nodes/text/number-node.js +0 -86
- package/dist/nodes/text/number-node.js.map +0 -1
- package/dist/nodes/text/number-pattern.d.ts +0 -51
- package/dist/nodes/text/number-pattern.d.ts.map +0 -1
- package/dist/nodes/text/number-pattern.js +0 -77
- package/dist/nodes/text/number-pattern.js.map +0 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -68
- package/dist/nodes/text/richtext-node.d.ts.map +0 -1
- package/dist/nodes/text/richtext-node.js +0 -78
- package/dist/nodes/text/richtext-node.js.map +0 -1
- package/dist/nodes/text/text-base.d.ts +0 -118
- package/dist/nodes/text/text-base.d.ts.map +0 -1
- package/dist/nodes/text/text-base.js +0 -153
- package/dist/nodes/text/text-base.js.map +0 -1
- package/dist/nodes/text/text-layout.d.ts +0 -87
- package/dist/nodes/text/text-layout.d.ts.map +0 -1
- package/dist/nodes/text/text-layout.js +0 -368
- package/dist/nodes/text/text-layout.js.map +0 -1
- package/dist/nodes/text/text-node.d.ts +0 -84
- package/dist/nodes/text/text-node.d.ts.map +0 -1
- package/dist/nodes/text/text-node.js +0 -188
- package/dist/nodes/text/text-node.js.map +0 -1
- package/dist/nodes/text/text-selection.d.ts +0 -125
- package/dist/nodes/text/text-selection.d.ts.map +0 -1
- package/dist/nodes/text/text-selection.js +0 -209
- package/dist/nodes/text/text-selection.js.map +0 -1
- package/dist/nodes/three/camera-nodes.d.ts +0 -109
- package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
- package/dist/nodes/three/camera-nodes.js +0 -112
- package/dist/nodes/three/camera-nodes.js.map +0 -1
- package/dist/nodes/three/canvas3d-node.d.ts +0 -295
- package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
- package/dist/nodes/three/canvas3d-node.js +0 -486
- package/dist/nodes/three/canvas3d-node.js.map +0 -1
- package/dist/nodes/three/drawable-nodes.d.ts +0 -173
- package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
- package/dist/nodes/three/drawable-nodes.js +0 -284
- package/dist/nodes/three/drawable-nodes.js.map +0 -1
- package/dist/nodes/three/environment-nodes.d.ts +0 -106
- package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
- package/dist/nodes/three/environment-nodes.js +0 -134
- package/dist/nodes/three/environment-nodes.js.map +0 -1
- package/dist/nodes/three/geometry-nodes.d.ts +0 -197
- package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
- package/dist/nodes/three/geometry-nodes.js +0 -322
- package/dist/nodes/three/geometry-nodes.js.map +0 -1
- package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
- package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
- package/dist/nodes/three/grid-geometry3d.js +0 -114
- package/dist/nodes/three/grid-geometry3d.js.map +0 -1
- package/dist/nodes/three/group3d.d.ts +0 -23
- package/dist/nodes/three/group3d.d.ts.map +0 -1
- package/dist/nodes/three/group3d.js +0 -21
- package/dist/nodes/three/group3d.js.map +0 -1
- package/dist/nodes/three/light-nodes.d.ts +0 -120
- package/dist/nodes/three/light-nodes.d.ts.map +0 -1
- package/dist/nodes/three/light-nodes.js +0 -173
- package/dist/nodes/three/light-nodes.js.map +0 -1
- package/dist/nodes/three/mesh3d.d.ts +0 -117
- package/dist/nodes/three/mesh3d.d.ts.map +0 -1
- package/dist/nodes/three/mesh3d.js +0 -147
- package/dist/nodes/three/mesh3d.js.map +0 -1
- package/dist/nodes/three/node3d.d.ts +0 -230
- package/dist/nodes/three/node3d.d.ts.map +0 -1
- package/dist/nodes/three/node3d.js +0 -337
- package/dist/nodes/three/node3d.js.map +0 -1
- package/dist/render/descriptors/latex.d.ts +0 -6
- package/dist/render/descriptors/latex.d.ts.map +0 -1
- package/dist/render/descriptors/latex.js +0 -2
- package/dist/render/descriptors/latex.js.map +0 -1
- package/dist/tween/seekable.d.ts +0 -81
- package/dist/tween/seekable.d.ts.map +0 -1
- package/dist/tween/seekable.js +0 -137
- package/dist/tween/seekable.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene3d.js","sourceRoot":"","sources":["../../src/render3d/scene3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EACH,gBAAgB,GAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAChC,IAAI,GAAgB,EAAE,CAAC;IACvB,OAAO,GAAwB,IAAI,CAAC;IACpC,IAAI,GAAqB,IAAI,CAAC;IAC9B,YAAY,GAA6B,IAAI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AAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAClD,CAAC;QACN,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DRAWABLE_KINDS, Graphics3D, type Graphics3DOp } from \"./graphics3d\";\r\nimport { RenderContext3D, type Node3DRenderState } from \"./render-context3d\";\r\nimport type { CameraData3D, OrthographicCameraData3D, PerspectiveCameraData3D } from \"./camera\";\r\nimport type { LightData3D } from \"./light\";\r\nimport {\r\n resolveShadows3D,\r\n type EnvironmentData3D, type FogData3D, type PostEffect3D,\r\n type ShadowSettings3D, type Shadows3D, type ToneSettings3D,\r\n} from \"./scene-settings\";\r\nimport { warnInert3D } from \"./inert\";\r\nimport type { Shadow3D, Transform3D } from \"./transform\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\n\r\n/** Options accepted by every `Camera3D` node and by {@link Scene3D.perspective}. */\r\ntype ParamsOf<T extends { type: string }> = Omit<T, \"type\">;\r\n\r\n/**\r\n * One recorded operation in a {@link Scene3D}.\r\n *\r\n * A superset of {@link Graphics3DOp}: everything a node draws, plus the four\r\n * things that describe the scene around it — the `push`/`pop` nesting the node\r\n * tree produces, the lights in it, and where it is viewed from.\r\n */\r\nexport type Scene3DOp =\r\n | { kind: \"push\"; transform?: Transform3D }\r\n | { kind: \"pop\" }\r\n | { kind: \"light\"; light: LightData3D; transform?: Transform3D }\r\n | { kind: \"camera\"; camera: CameraData3D }\r\n | Graphics3DOp;\r\n\r\n/**\r\n * A recorded 3D scene — and the {@link RenderContext3D} that records it.\r\n *\r\n * One value plays both parts, exactly as `Graphics2D` is both the builder and the\r\n * thing handed to a backend. A `Node3D` tree draws into it, and the result is a\r\n * flat op list plus a handful of scene-wide settings that a renderer replays.\r\n *\r\n * Almost always produced for you: a `Canvas3D` opens one per frame, walks its\r\n * `Node3D` children through it and paints the result through its own path. The\r\n * builder surface below is the escape hatch — it is what lets a scene be shaded\r\n * through *any* 2D shape rather than only a rect:\r\n *\r\n * const scene = new Scene3D()\r\n * .perspective({ orbit: 30, elevation: 20, distance: 6 })\r\n * .light({ type: \"ambient\", intensity: 0.4 })\r\n * .draw(new Graphics3D().box({ width: 2, fill: \"tomato\" }));\r\n *\r\n * Text({ text: \"DEPTH\", fontSize: 320, fill: scene })\r\n *\r\n * A bare `Scene3D` coerces to a `canvas3D` fill the way a bare CSS string coerces\r\n * to a solid one, so `fill={scene}` and `fill={[\"#0b0d12\", scene]}` both work.\r\n */\r\nexport class Scene3D extends RenderContext3D {\r\n private _ops: Scene3DOp[] = [];\r\n private _camera: CameraData3D | null = null;\r\n private _fog: FogData3D | null = null;\r\n private _environment: EnvironmentData3D | null = null;\r\n private _shadows: ShadowSettings3D | null = null;\r\n private _tone: ToneSettings3D | null = null;\r\n private _post: PostEffect3D[] = [];\r\n /** Open `push` count, so {@link assertBalanced} can report a leak. */\r\n private _depth = 0;\r\n /**\r\n * The `shadow` of each open node scope, innermost last (`undefined` for a\r\n * scope that states none). What a drawable that states none of its own takes.\r\n */\r\n private _shadowScopes: (Shadow3D | undefined)[] = [];\r\n\r\n // ─── Node scopes ─────────────────────────────────────────────────────────\r\n\r\n override begin(state: Node3DRenderState): void {\r\n // The node's id rides on the transform's `key`, which is the renderer's\r\n // identity slot — so a group is cached against the node that opened it\r\n // rather than against its index among its siblings.\r\n this._ops.push({ kind: \"push\", transform: { ...state.transform, key: state.id } });\r\n this._shadowScopes.push(state.transform?.shadow);\r\n this._depth++;\r\n }\r\n\r\n override end(): void {\r\n this._ops.push({ kind: \"pop\" });\r\n this._shadowScopes.pop();\r\n this._depth--;\r\n }\r\n\r\n // ─── Drawables ───────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Splice what a node draws into the scene at the current scope.\r\n *\r\n * The ops are copied rather than referenced: a `Graphics3D` is rebuilt every\r\n * frame, so there is nothing to share, and a flat list is what the renderer\r\n * walks.\r\n *\r\n * A drawable that states no `shadow` of its own takes the one of the node\r\n * scope it is drawn in. That is what carries a node's `shadow` to its mesh: the\r\n * node's scope becomes a group, and a renderer reads casting and receiving off\r\n * the mesh, never off a group, so the scope's value would otherwise never be\r\n * seen. A `shadow` on the op itself wins.\r\n */\r\n override draw(graphics: Graphics3D): this {\r\n const ops = graphics.ops();\r\n const scope = this._shadowScopes[this._shadowScopes.length - 1];\r\n for (let i = 0; i < ops.length; i++) {\r\n const op = ops[i];\r\n if (scope === undefined || op.transform?.shadow !== undefined) {\r\n this._ops.push(op);\r\n } else {\r\n this._ops.push({ ...op, transform: { ...op.transform, shadow: scope } });\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n // ─── Lights ──────────────────────────────────────────────────────────────\r\n\r\n override light(light: LightData3D, transform?: Transform3D): this {\r\n this._ops.push({ kind: \"light\", light, transform });\r\n return this;\r\n }\r\n\r\n // ─── Camera ──────────────────────────────────────────────────────────────\r\n\r\n override camera(camera: CameraData3D): this {\r\n this._camera = camera;\r\n this._ops.push({ kind: \"camera\", camera });\r\n return this;\r\n }\r\n\r\n /** Set a perspective camera. The usual choice. */\r\n perspective(options?: ParamsOf<PerspectiveCameraData3D>): this {\r\n return this.camera({ type: \"perspective\", ...options } as PerspectiveCameraData3D);\r\n }\r\n\r\n /** Set an orthographic camera — parallel projection, for isometric looks. */\r\n orthographic(options?: ParamsOf<OrthographicCameraData3D>): this {\r\n return this.camera({ type: \"orthographic\", ...options } as OrthographicCameraData3D);\r\n }\r\n\r\n // ─── Scene settings ──────────────────────────────────────────────────────\r\n //\r\n // Fields rather than ops: a scene has exactly one fog and one environment.\r\n // Recording them positionally would imply an ordering that doesn't exist.\r\n // Last writer wins.\r\n\r\n override fog(fog: FogData3D | Color | null): this {\r\n if (fog === null) {\r\n this._fog = null;\r\n } else if (typeof fog === \"object\" && !Array.isArray(fog)) {\r\n this._fog = fog as FogData3D;\r\n } else {\r\n this._fog = { color: fog as Color };\r\n }\r\n return this;\r\n }\r\n\r\n override environment(environment: EnvironmentData3D | null): this {\r\n if (environment) {\r\n if (environment.src !== undefined || (environment.faces?.length ?? 0) > 0) {\r\n warnInert3D(\r\n \"environment-src\",\r\n \"An environment's `src` and `faces` (HDR, EXR, cubemap) are recorded, and no backend loads them. Only `preset: \\\"studio\\\"` is rendered: \"\r\n + \"without a preset the scene gets no image-based light and its `background` is not drawn.\",\r\n );\r\n }\r\n if (environment.params && Object.keys(environment.params).length > 0) {\r\n warnInert3D(\r\n \"environment-params\",\r\n \"`params` on an environment is not applied: nothing assigns it onto the generated environment.\",\r\n );\r\n }\r\n }\r\n this._environment = environment;\r\n return this;\r\n }\r\n\r\n override shadows(settings?: Shadows3D): this {\r\n this._shadows = resolveShadows3D(settings ?? true);\r\n return this;\r\n }\r\n\r\n override tone(settings: ToneSettings3D): this {\r\n this._tone = settings;\r\n return this;\r\n }\r\n\r\n override post(effects: PostEffect3D | readonly PostEffect3D[]): this {\r\n const added = Array.isArray(effects) ? (effects as PostEffect3D[]) : [effects as PostEffect3D];\r\n if (added.length > 0) {\r\n warnInert3D(\r\n \"post\",\r\n `Post-processing (${added.map((effect) => `\"${effect.type}\"`).join(\", \")}) is recorded, and no backend applies a pass: the scene renders exactly as it would without \\`post\\`. `\r\n + \"Use the Canvas3D's 2D `effects` over the composited result instead.\",\r\n );\r\n }\r\n this._post.push(...added);\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Replayed by the renderer. */\r\n ops(): readonly Scene3DOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** The camera, or `null` to let the renderer supply a default framing. */\r\n cameraDescriptor(): CameraData3D | null {\r\n return this._camera;\r\n }\r\n fogDescriptor(): FogData3D | null {\r\n return this._fog;\r\n }\r\n environmentDescriptor(): EnvironmentData3D | null {\r\n return this._environment;\r\n }\r\n shadowSettings(): ShadowSettings3D | null {\r\n return this._shadows;\r\n }\r\n toneSettings(): ToneSettings3D | null {\r\n return this._tone;\r\n }\r\n postEffects(): readonly PostEffect3D[] {\r\n return this._post;\r\n }\r\n\r\n /**\r\n * True when nothing would be drawn — no mesh, light or other drawable. The\r\n * node skips the whole 3D pass (and the WebGL context entirely) in that case.\r\n */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => DRAWABLE_KINDS.has(op.kind));\r\n }\r\n\r\n /**\r\n * Throw if `push` and `pop` are unbalanced. Called once by the consumer before\r\n * replay, so a mismatched scope fails loudly rather than silently reparenting\r\n * everything after it.\r\n *\r\n * A `Node3D` tree cannot get this wrong — `begin`/`end` are bracketed by the\r\n * walk — so in practice this catches a hand-built scene.\r\n */\r\n assertBalanced(): void {\r\n if (this._depth !== 0) {\r\n const verb = this._depth > 0 ? \"unclosed begin()\" : \"extra end()\";\r\n throw new Error(\r\n `Scene3D has ${Math.abs(this._depth)} ${verb}.`,\r\n );\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"scene3d.js","sourceRoot":"","sources":["../../src/render3d/scene3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EACH,gBAAgB,GAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAChC,IAAI,GAAgB,EAAE,CAAC;IACvB,OAAO,GAAwB,IAAI,CAAC;IACpC,IAAI,GAAqB,IAAI,CAAC;IAC9B,YAAY,GAA6B,IAAI,CAAC;IAC9C,QAAQ,GAA4B,IAAI,CAAC;IACzC,KAAK,GAA0B,IAAI,CAAC;IACpC,KAAK,GAAmB,EAAE,CAAC;IACnC,sEAAsE;IAC9D,MAAM,GAAG,CAAC,CAAC;IACnB;;;OAGG;IACK,aAAa,GAA6B,EAAE,CAAC;IAErD,4EAA4E;IAEnE,KAAK,CAAC,KAAwB;QACnC,wEAAwE;QACxE,uEAAuE;QACvE,oDAAo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G,KAAK,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,4DAA4D;IAC5D,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,gBAAgB;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IACD,aAAa;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IACD,qBAAqB;QACjB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD,cAAc;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IACD,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IACD,WAAW;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;OAOG;IACH,cAAc;QACV,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC;YAClE,MAAM,IAAI,KAAK,CACX,eAAe,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAClD,CAAC;QACN,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DRAWABLE_KINDS, Graphics3D, type Graphics3DOp } from \"./graphics3d\";\nimport { RenderContext3D, type Node3DRenderState } from \"./render-context3d\";\nimport type { CameraData3D, OrthographicCameraData3D, PerspectiveCameraData3D } from \"./camera\";\nimport type { LightData3D } from \"./light\";\nimport {\n resolveShadows3D,\n type EnvironmentData3D, type FogData3D, type PostEffect3D,\n type ShadowSettings3D, type Shadows3D, type ToneSettings3D,\n} from \"./scene-settings\";\nimport { warnInert3D } from \"./inert\";\nimport type { Shadow3D, Transform3D } from \"./transform\";\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\n\n/** Options accepted by every `Camera3D` node and by {@link Scene3D.perspective}. */\ntype ParamsOf<T extends { type: string }> = Omit<T, \"type\">;\n\n/**\n * One recorded operation in a {@link Scene3D}.\n *\n * A superset of {@link Graphics3DOp}: everything a node draws, plus the four\n * things that describe the scene around it — the `push`/`pop` nesting the node\n * tree produces, the lights in it, and where it is viewed from.\n */\nexport type Scene3DOp =\n | { kind: \"push\"; transform?: Transform3D }\n | { kind: \"pop\" }\n | { kind: \"light\"; light: LightData3D; transform?: Transform3D }\n | { kind: \"camera\"; camera: CameraData3D }\n | Graphics3DOp;\n\n/**\n * A recorded 3D scene — and the {@link RenderContext3D} that records it.\n *\n * One value plays both parts, exactly as `Graphics2D` is both the builder and the\n * thing handed to a backend. A `Node3D` tree draws into it, and the result is a\n * flat op list plus a handful of scene-wide settings that a renderer replays.\n *\n * Almost always produced for you: a `Canvas3D` opens one per frame, walks its\n * `Node3D` children through it and paints the result through its own path. The\n * builder surface below is the escape hatch — it is what lets a scene be shaded\n * through *any* 2D shape rather than only a rect:\n *\n * const scene = new Scene3D()\n * .perspective({ orbit: 30, elevation: 20, distance: 6 })\n * .light({ type: \"ambient\", intensity: 0.4 })\n * .draw(new Graphics3D().box({ width: 2, fill: \"tomato\" }));\n *\n * Text({ text: \"DEPTH\", fontSize: 320, fill: scene })\n *\n * A bare `Scene3D` coerces to a `canvas3D` fill the way a bare CSS string coerces\n * to a solid one, so `fill={scene}` and `fill={[\"#0b0d12\", scene]}` both work.\n */\nexport class Scene3D extends RenderContext3D {\n private _ops: Scene3DOp[] = [];\n private _camera: CameraData3D | null = null;\n private _fog: FogData3D | null = null;\n private _environment: EnvironmentData3D | null = null;\n private _shadows: ShadowSettings3D | null = null;\n private _tone: ToneSettings3D | null = null;\n private _post: PostEffect3D[] = [];\n /** Open `push` count, so {@link assertBalanced} can report a leak. */\n private _depth = 0;\n /**\n * The `shadow` of each open node scope, innermost last (`undefined` for a\n * scope that states none). What a drawable that states none of its own takes.\n */\n private _shadowScopes: (Shadow3D | undefined)[] = [];\n\n // ─── Node scopes ─────────────────────────────────────────────────────────\n\n override begin(state: Node3DRenderState): void {\n // The node's id rides on the transform's `key`, which is the renderer's\n // identity slot — so a group is cached against the node that opened it\n // rather than against its index among its siblings.\n this._ops.push({ kind: \"push\", transform: { ...state.transform, key: state.id } });\n this._shadowScopes.push(state.transform?.shadow);\n this._depth++;\n }\n\n override end(): void {\n this._ops.push({ kind: \"pop\" });\n this._shadowScopes.pop();\n this._depth--;\n }\n\n // ─── Drawables ───────────────────────────────────────────────────────────\n\n /**\n * Splice what a node draws into the scene at the current scope.\n *\n * The ops are copied rather than referenced: a `Graphics3D` is rebuilt every\n * frame, so there is nothing to share, and a flat list is what the renderer\n * walks.\n *\n * A drawable that states no `shadow` of its own takes the one of the node\n * scope it is drawn in. That is what carries a node's `shadow` to its mesh: the\n * node's scope becomes a group, and a renderer reads casting and receiving off\n * the mesh, never off a group, so the scope's value would otherwise never be\n * seen. A `shadow` on the op itself wins.\n */\n override draw(graphics: Graphics3D): this {\n const ops = graphics.ops();\n const scope = this._shadowScopes[this._shadowScopes.length - 1];\n for (let i = 0; i < ops.length; i++) {\n const op = ops[i];\n if (scope === undefined || op.transform?.shadow !== undefined) {\n this._ops.push(op);\n } else {\n this._ops.push({ ...op, transform: { ...op.transform, shadow: scope } });\n }\n }\n return this;\n }\n\n // ─── Lights ──────────────────────────────────────────────────────────────\n\n override light(light: LightData3D, transform?: Transform3D): this {\n this._ops.push({ kind: \"light\", light, transform });\n return this;\n }\n\n // ─── Camera ──────────────────────────────────────────────────────────────\n\n override camera(camera: CameraData3D): this {\n this._camera = camera;\n this._ops.push({ kind: \"camera\", camera });\n return this;\n }\n\n /** Set a perspective camera. The usual choice. */\n perspective(options?: ParamsOf<PerspectiveCameraData3D>): this {\n return this.camera({ type: \"perspective\", ...options } as PerspectiveCameraData3D);\n }\n\n /** Set an orthographic camera — parallel projection, for isometric looks. */\n orthographic(options?: ParamsOf<OrthographicCameraData3D>): this {\n return this.camera({ type: \"orthographic\", ...options } as OrthographicCameraData3D);\n }\n\n // ─── Scene settings ──────────────────────────────────────────────────────\n //\n // Fields rather than ops: a scene has exactly one fog and one environment.\n // Recording them positionally would imply an ordering that doesn't exist.\n // Last writer wins.\n\n override fog(fog: FogData3D | Color | null): this {\n if (fog === null) {\n this._fog = null;\n } else if (typeof fog === \"object\" && !Array.isArray(fog)) {\n this._fog = fog as FogData3D;\n } else {\n this._fog = { color: fog as Color };\n }\n return this;\n }\n\n override environment(environment: EnvironmentData3D | null): this {\n if (environment) {\n if (environment.src !== undefined || (environment.faces?.length ?? 0) > 0) {\n warnInert3D(\n \"environment-src\",\n \"An environment's `src` and `faces` (HDR, EXR, cubemap) are recorded, and no backend loads them. Only `preset: \\\"studio\\\"` is rendered: \"\n + \"without a preset the scene gets no image-based light and its `background` is not drawn.\",\n );\n }\n if (environment.params && Object.keys(environment.params).length > 0) {\n warnInert3D(\n \"environment-params\",\n \"`params` on an environment is not applied: nothing assigns it onto the generated environment.\",\n );\n }\n }\n this._environment = environment;\n return this;\n }\n\n override shadows(settings?: Shadows3D): this {\n this._shadows = resolveShadows3D(settings ?? true);\n return this;\n }\n\n override tone(settings: ToneSettings3D): this {\n this._tone = settings;\n return this;\n }\n\n override post(effects: PostEffect3D | readonly PostEffect3D[]): this {\n const added = Array.isArray(effects) ? (effects as PostEffect3D[]) : [effects as PostEffect3D];\n if (added.length > 0) {\n warnInert3D(\n \"post\",\n `Post-processing (${added.map((effect) => `\"${effect.type}\"`).join(\", \")}) is recorded, and no backend applies a pass: the scene renders exactly as it would without \\`post\\`. `\n + \"Use the Canvas3D's 2D `effects` over the composited result instead.\",\n );\n }\n this._post.push(...added);\n return this;\n }\n\n // ─── Consumption ─────────────────────────────────────────────────────────\n\n /** The recorded ops, in order. Replayed by the renderer. */\n ops(): readonly Scene3DOp[] {\n return this._ops;\n }\n\n /** The camera, or `null` to let the renderer supply a default framing. */\n cameraDescriptor(): CameraData3D | null {\n return this._camera;\n }\n fogDescriptor(): FogData3D | null {\n return this._fog;\n }\n environmentDescriptor(): EnvironmentData3D | null {\n return this._environment;\n }\n shadowSettings(): ShadowSettings3D | null {\n return this._shadows;\n }\n toneSettings(): ToneSettings3D | null {\n return this._tone;\n }\n postEffects(): readonly PostEffect3D[] {\n return this._post;\n }\n\n /**\n * True when nothing would be drawn — no mesh, light or other drawable. The\n * node skips the whole 3D pass (and the WebGL context entirely) in that case.\n */\n isEmpty(): boolean {\n return !this._ops.some((op) => DRAWABLE_KINDS.has(op.kind));\n }\n\n /**\n * Throw if `push` and `pop` are unbalanced. Called once by the consumer before\n * replay, so a mismatched scope fails loudly rather than silently reparenting\n * everything after it.\n *\n * A `Node3D` tree cannot get this wrong — `begin`/`end` are bracketed by the\n * walk — so in practice this catches a hand-built scene.\n */\n assertBalanced(): void {\n if (this._depth !== 0) {\n const verb = this._depth > 0 ? \"unclosed begin()\" : \"extra end()\";\n throw new Error(\n `Scene3D has ${Math.abs(this._depth)} ${verb}.`,\n );\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.js","sourceRoot":"","sources":["../../src/render3d/segments.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CACtB,KAA6B,EAC7B,QAA2B;IAE3B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"segments.js","sourceRoot":"","sources":["../../src/render3d/segments.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CACtB,KAA6B,EAC7B,QAA2B;IAE3B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IAC/B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * Subdivision counts, as one name.\n *\n * three spells this ten different ways — `widthSegments`, `heightSegments`,\n * `depthSegments`, `radialSegments`, `tubularSegments`, `thetaSegments`,\n * `phiSegments`, `capSegments`, `curveSegments`, `detail` — and which one a given\n * shape wants is a thing an author has to look up every time. Every geometry here\n * takes one {@link Segments3D} instead, and the per-axis meaning is documented on\n * the shape rather than encoded in a name.\n *\n * A scalar applies to every axis, which is what you want when you are just\n * turning the resolution up. A tuple is per-axis, in the order the shape's own\n * docs give.\n */\nexport type Segments3D =\n | number\n | readonly [number]\n | readonly [number, number]\n | readonly [number, number, number];\n\n/**\n * Resolve a {@link Segments3D} against a shape's per-axis defaults.\n *\n * A scalar broadcasts, a tuple fills what it names and leaves the rest at the\n * default, and `undefined` is entirely defaults — so an unset `segments` never\n * pins a shape to a resolution invented at a call site.\n *\n * Values are floored and clamped to at least 1, because a fractional or zero\n * subdivision count reaches three as a degenerate geometry rather than as an\n * error.\n */\nexport function segmentsOf(\n value: Segments3D | undefined,\n defaults: readonly number[],\n): number[] {\n if (value === undefined) return defaults.map(clampSegment);\n if (typeof value === \"number\") return defaults.map(() => clampSegment(value));\n return defaults.map((fallback, index) => clampSegment(value[index] ?? fallback));\n}\n\nfunction clampSegment(value: number): number {\n return Math.max(1, Math.floor(value));\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/render3d/texture.ts"],"names":[],"mappings":"AAkKA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAuB;IACxD,OAAO,OAAQ,MAAqB,CAAC,GAAG,KAAK,UAAU;QACnD,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAoB,EAAE;QACtD,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAgB,EAAE,CAAC;AACnD,CAAC;AAQD,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC;AAC5D,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,OAAkB;IACjD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,IAAI,OAAO,CAAC;AAC9D,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,OAAkB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAChD,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,OAAO,CAAC,GAAG,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,0DAA0D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type { Vector2 } from \"@/attributes/layout/vector2\";\r\n// Type-only, like `Color` above: `render3d` is pure data and never reaches into\r\n// the render or node layers at runtime. See SurfaceSource3D.\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\n\r\n/** How sampling behaves outside the 0–1 UV range. */\r\nexport type TextureWrap3D = \"clamp\" | \"repeat\" | \"mirror\";\r\n\r\n/** How texels are blended when the texture is scaled. */\r\nexport type TextureFilter3D = \"nearest\" | \"linear\";\r\n\r\n/**\r\n * Which colour space the texture's data is in.\r\n *\r\n * `\"srgb\"` for anything representing a *colour* an eye would see (albedo/`map`,\r\n * `emissiveMap`), so the renderer linearizes it before lighting maths.\r\n * `\"linear\"` for *data* maps whose channels are numbers rather than colours\r\n * (`normalMap`, `roughnessMap`, `metalnessMap`, `aoMap`, `displacementMap`) —\r\n * linearizing those would corrupt them. Each map slot defaults correctly, so\r\n * this only needs setting for unusual pipelines.\r\n */\r\nexport type TextureColorSpace3D = \"srgb\" | \"linear\";\r\n\r\n/** Sampler state shared by every texture source. */\r\nexport interface TextureOptions3D {\r\n wrapS?: TextureWrap3D;\r\n wrapT?: TextureWrap3D;\r\n /** UV scale. `[2, 2]` tiles twice on each axis (needs a `repeat` wrap). */\r\n repeat?: Vector2 | readonly [number, number];\r\n offset?: Vector2 | readonly [number, number];\r\n /** UV rotation in **degrees**, about {@link center}. */\r\n rotation?: number;\r\n center?: Vector2 | readonly [number, number];\r\n magFilter?: TextureFilter3D;\r\n minFilter?: TextureFilter3D;\r\n /** Sharpness at grazing angles. Clamped to the GPU's maximum. */\r\n anisotropy?: number;\r\n flipY?: boolean;\r\n colorSpace?: TextureColorSpace3D;\r\n}\r\n\r\n/**\r\n * A texture loaded from the project's asset manifest.\r\n *\r\n * `src` is discovered by the asset-tracking render pass and requested through\r\n * core's ordinary image pipeline — the very same path a 2D image fill uses — so\r\n * the pixels are decoded and resident *before* the frame that needs them draws.\r\n */\r\nexport interface ImageTexture3D extends TextureOptions3D {\r\n src: string;\r\n}\r\n\r\n/**\r\n * A texture built from raw RGBA8888 bytes — the escape hatch for procedurally\r\n * generated pixels (gradient ramps, noise, LUTs, data encoded as colour).\r\n */\r\nexport interface DataTexture3D extends TextureOptions3D {\r\n data: ArrayLike<number>;\r\n width: number;\r\n height: number;\r\n /**\r\n * Bump to force a re-upload after mutating `data` in place. Mutation is\r\n * invisible to identity comparison, so without this the renderer cannot\r\n * tell the bytes changed. See {@link BufferGeometry3D.revision}.\r\n */\r\n revision?: number;\r\n}\r\n\r\n/**\r\n * A texture whose pixels are Motion Script's own 2D output, rasterized offscreen\r\n * — the way to put a chart, a readout or a whole laid-out UI onto 3D geometry.\r\n *\r\n * `source` is a value, not a name and not a mounted node: either a built\r\n * {@link Graphics2D} command list, or a `Node2D` subtree. Both are supplied directly,\r\n * so there is no matching indirection and nothing has to live in a particular\r\n * place in the scene tree.\r\n *\r\n * g3.plane({ map: Tex.surface(scopeGraphics, 1024, 640) })\r\n * g3.plane({ map: Tex.surface(statsSubtree, 1024, 640) })\r\n *\r\n * A `Node2D` source is *adopted for binding* by whatever paints the scene — it gets\r\n * that node's asset catalog, inherited context and clock, which is what makes a\r\n * webfont shape and an `<Image>` load. It is never laid out or painted by the\r\n * scene tree; it is measured against `width`×`height` and drawn into the buffer.\r\n *\r\n * **Hoist the source.** Building it fresh inside the scene builder allocates a new\r\n * subtree every frame — re-binding, re-laying-out, defeating the texture cache and\r\n * leaking. Declare it once and pass the same instance.\r\n *\r\n * That hoisting rule is also what removed this descriptor's old `key`: a hoisted\r\n * source *is* a stable identity, so the renderer keys the GPU texture off the\r\n * source object itself (in a `WeakMap`) rather than off its ordinal in the scene\r\n * walk. A conditionally-emitted surface therefore needs nothing written by hand,\r\n * and a source that goes out of scope becomes collectable instead of orphaning\r\n * its texture — which the ordinal scheme could not do.\r\n */\r\nexport interface SurfaceTexture3D extends TextureOptions3D {\r\n /** A built `Graphics2D`, or a `Node2D` subtree. Typed structurally — see below. */\r\n source: SurfaceSource3D;\r\n /** Buffer width in pixels. This *is* the texture's resolution. */\r\n width: number;\r\n /** Buffer height in pixels. */\r\n height: number;\r\n /**\r\n * Declare the source's pixels unchanging, so the buffer is rasterized once\r\n * and reused rather than redrawn every frame.\r\n *\r\n * Set by `resolveFill3D` for a fill chain, whose layers describe the same\r\n * image on every frame; an author's own source is live by default, which is\r\n * what makes an animated `Graphics2D` or a prop-driven subtree work with no\r\n * bookkeeping. Needs {@link identity} to be cacheable.\r\n *\r\n * @internal\r\n */\r\n static?: boolean;\r\n /**\r\n * Cache identity for a synthesized source.\r\n *\r\n * An author's source is identified by the source object itself (see the note\r\n * above), which is exactly right for something hoisted. A source built *for*\r\n * a fill is a fresh object every frame and has no such identity, so the value\r\n * it was derived from supplies one.\r\n *\r\n * @internal\r\n */\r\n identity?: string;\r\n /**\r\n * Ceiling on the buffer's device-pixel ratio. Default 1, i.e. the buffer is\r\n * exactly `width` × `height`.\r\n *\r\n * Unlike a 2D node — which wants to match the display — a surface is sampled by\r\n * a 3D material at whatever size the geometry occupies on screen, so the honest\r\n * control is `width`/`height`. Raise this only when a surface is viewed close\r\n * up and reads soft.\r\n */\r\n maxPixelRatio?: number;\r\n}\r\n\r\n/**\r\n * What a {@link SurfaceTexture3D} can be painted from: a built {@link Graphics2D}\r\n * command list, or a {@link Node2D} subtree.\r\n *\r\n * Both imports are **type-only**, exactly as `Color` is — `render3d` describes\r\n * scenes as data and never reaches into the render or node layers at runtime, and\r\n * a value import of `Node2D` here would close a real module cycle. Consumers narrow\r\n * with {@link resolveSurfaceSource}.\r\n */\r\nexport type SurfaceSource3D = Graphics2D | Node;\r\n\r\n// Declared against the dimension-agnostic base because that is what a built\r\n// node is typed as, so `Tex.surface(new Rect({ … }), …)` type-checks without a\r\n// cast. It has to be a 2D subtree in fact — the renderer lays it out and draws it\r\n// into a 2D buffer — and `resolveSurfaceSource` narrows to that; handing it a\r\n// `Node3D` fails at render time rather than here.\r\n\r\n/** A {@link SurfaceSource3D} narrowed to the arm its renderer should take. */\r\nexport type ResolvedSurfaceSource =\r\n | { kind: \"graphics\"; graphics: Graphics2D }\r\n | { kind: \"node\"; node: Node2D };\r\n\r\n/**\r\n * Narrow a surface source to the arm that knows how to draw it: a `Graphics2D` is\r\n * replayed into a render context, a `Node2D` is laid out against the buffer and\r\n * rendered.\r\n *\r\n * Structural rather than `instanceof`, because that would need value imports of\r\n * both classes and close the cycle the type-only imports above avoid. `Graphics2D`\r\n * is a command recorder and exposes `ops()`; a `Node2D` has no such method. The\r\n * union makes any *other* value a type error, so this only has to separate two\r\n * known shapes rather than validate an unknown one.\r\n */\r\nexport function resolveSurfaceSource(source: SurfaceSource3D): ResolvedSurfaceSource {\r\n return typeof (source as Graphics2D).ops === \"function\"\r\n ? { kind: \"graphics\", graphics: source as Graphics2D }\r\n : { kind: \"node\", node: source as Node2D };\r\n}\r\n\r\n/**\r\n * A texture reference. A bare string is sugar for `{ src }`, so the common case\r\n * is `map: \"/wood.png\"`.\r\n */\r\nexport type Texture3D = string | ImageTexture3D | DataTexture3D | SurfaceTexture3D;\r\n\r\n/** True for the raw-bytes form (vs. an asset-backed {@link ImageTexture3D}). */\r\nexport function isDataTexture3D(texture: Texture3D): texture is DataTexture3D {\r\n return typeof texture !== \"string\" && \"data\" in texture;\r\n}\r\n\r\n/** True for the {@link SurfaceTexture3D} form — pixels are rasterized from 2D. */\r\nexport function isSurfaceTexture3D(texture: Texture3D): texture is SurfaceTexture3D {\r\n return typeof texture !== \"string\" && \"source\" in texture;\r\n}\r\n\r\n/** Normalize the string shorthand to an {@link ImageTexture3D}. */\r\nexport function resolveTexture3D(texture: Texture3D): ImageTexture3D | DataTexture3D | SurfaceTexture3D {\r\n return typeof texture === \"string\" ? { src: texture } : texture;\r\n}\r\n\r\n/**\r\n * The asset `src` a texture reads from, or `null` when it has none (a data or\r\n * surface texture). Used by the asset-tracking pass to enumerate what a 3D scene\r\n * needs loaded — a `null` here means \"nothing to request\", not \"not a texture\".\r\n */\r\nexport function texture3DSource(texture: Texture3D): string | null {\r\n if (typeof texture === \"string\") return texture;\r\n if (isDataTexture3D(texture) || isSurfaceTexture3D(texture)) return null;\r\n return texture.src;\r\n}\r\n\r\n/**\r\n * True for a string that names an asset rather than a colour.\r\n *\r\n * Leading `/` or `.` is a path by construction; otherwise the extension decides.\r\n * A colour never matches either, and a bare name like `\"wood\"` is a colour —\r\n * which is right, since an asset reference without a path or extension is not\r\n * something the manifest could resolve either.\r\n */\r\nexport function looksLikeAssetPath(value: string): boolean {\r\n return value.startsWith(\"/\")\r\n || value.startsWith(\".\")\r\n || /\\.(png|jpe?g|webp|avif|svg|ktx2?|hdr|exr|mp4|webm|mov)$/i.test(value);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/render3d/texture.ts"],"names":[],"mappings":"AAkKA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAuB;IACxD,OAAO,OAAQ,MAAqB,CAAC,GAAG,KAAK,UAAU;QACnD,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAoB,EAAE;QACtD,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAgB,EAAE,CAAC;AACnD,CAAC;AAQD,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC;AAC5D,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,OAAkB;IACjD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,IAAI,OAAO,CAAC;AAC9D,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,OAAkB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAChD,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,OAAO,CAAC,GAAG,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,0DAA0D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type { Vector2 } from \"@/attributes/layout/vector2\";\n// Type-only, like `Color` above: `render3d` is pure data and never reaches into\n// the render or node layers at runtime. See SurfaceSource3D.\nimport type { Graphics2D } from \"@/render/graphics2d\";\nimport type { Node } from \"@/components/trees/node/node\";\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\n\n/** How sampling behaves outside the 0–1 UV range. */\nexport type TextureWrap3D = \"clamp\" | \"repeat\" | \"mirror\";\n\n/** How texels are blended when the texture is scaled. */\nexport type TextureFilter3D = \"nearest\" | \"linear\";\n\n/**\n * Which colour space the texture's data is in.\n *\n * `\"srgb\"` for anything representing a *colour* an eye would see (albedo/`map`,\n * `emissiveMap`), so the renderer linearizes it before lighting maths.\n * `\"linear\"` for *data* maps whose channels are numbers rather than colours\n * (`normalMap`, `roughnessMap`, `metalnessMap`, `aoMap`, `displacementMap`) —\n * linearizing those would corrupt them. Each map slot defaults correctly, so\n * this only needs setting for unusual pipelines.\n */\nexport type TextureColorSpace3D = \"srgb\" | \"linear\";\n\n/** Sampler state shared by every texture source. */\nexport interface TextureOptions3D {\n wrapS?: TextureWrap3D;\n wrapT?: TextureWrap3D;\n /** UV scale. `[2, 2]` tiles twice on each axis (needs a `repeat` wrap). */\n repeat?: Vector2 | readonly [number, number];\n offset?: Vector2 | readonly [number, number];\n /** UV rotation in **degrees**, about {@link center}. */\n rotation?: number;\n center?: Vector2 | readonly [number, number];\n magFilter?: TextureFilter3D;\n minFilter?: TextureFilter3D;\n /** Sharpness at grazing angles. Clamped to the GPU's maximum. */\n anisotropy?: number;\n flipY?: boolean;\n colorSpace?: TextureColorSpace3D;\n}\n\n/**\n * A texture loaded from the project's asset manifest.\n *\n * `src` is discovered by the asset-tracking render pass and requested through\n * core's ordinary image pipeline — the very same path a 2D image fill uses — so\n * the pixels are decoded and resident *before* the frame that needs them draws.\n */\nexport interface ImageTexture3D extends TextureOptions3D {\n src: string;\n}\n\n/**\n * A texture built from raw RGBA8888 bytes — the escape hatch for procedurally\n * generated pixels (gradient ramps, noise, LUTs, data encoded as colour).\n */\nexport interface DataTexture3D extends TextureOptions3D {\n data: ArrayLike<number>;\n width: number;\n height: number;\n /**\n * Bump to force a re-upload after mutating `data` in place. Mutation is\n * invisible to identity comparison, so without this the renderer cannot\n * tell the bytes changed. See {@link BufferGeometry3D.revision}.\n */\n revision?: number;\n}\n\n/**\n * A texture whose pixels are Motion Script's own 2D output, rasterized offscreen\n * — the way to put a chart, a readout or a whole laid-out UI onto 3D geometry.\n *\n * `source` is a value, not a name and not a mounted node: either a built\n * {@link Graphics2D} command list, or a `Node2D` subtree. Both are supplied directly,\n * so there is no matching indirection and nothing has to live in a particular\n * place in the scene tree.\n *\n * g3.plane({ map: Tex.surface(scopeGraphics, 1024, 640) })\n * g3.plane({ map: Tex.surface(statsSubtree, 1024, 640) })\n *\n * A `Node2D` source is *adopted for binding* by whatever paints the scene — it gets\n * that node's asset catalog, inherited context and clock, which is what makes a\n * webfont shape and an `<Image>` load. It is never laid out or painted by the\n * scene tree; it is measured against `width`×`height` and drawn into the buffer.\n *\n * **Hoist the source.** Building it fresh inside the scene builder allocates a new\n * subtree every frame — re-binding, re-laying-out, defeating the texture cache and\n * leaking. Declare it once and pass the same instance.\n *\n * That hoisting rule is also what removed this descriptor's old `key`: a hoisted\n * source *is* a stable identity, so the renderer keys the GPU texture off the\n * source object itself (in a `WeakMap`) rather than off its ordinal in the scene\n * walk. A conditionally-emitted surface therefore needs nothing written by hand,\n * and a source that goes out of scope becomes collectable instead of orphaning\n * its texture — which the ordinal scheme could not do.\n */\nexport interface SurfaceTexture3D extends TextureOptions3D {\n /** A built `Graphics2D`, or a `Node2D` subtree. Typed structurally — see below. */\n source: SurfaceSource3D;\n /** Buffer width in pixels. This *is* the texture's resolution. */\n width: number;\n /** Buffer height in pixels. */\n height: number;\n /**\n * Declare the source's pixels unchanging, so the buffer is rasterized once\n * and reused rather than redrawn every frame.\n *\n * Set by `resolveFill3D` for a fill chain, whose layers describe the same\n * image on every frame; an author's own source is live by default, which is\n * what makes an animated `Graphics2D` or a prop-driven subtree work with no\n * bookkeeping. Needs {@link identity} to be cacheable.\n *\n * @internal\n */\n static?: boolean;\n /**\n * Cache identity for a synthesized source.\n *\n * An author's source is identified by the source object itself (see the note\n * above), which is exactly right for something hoisted. A source built *for*\n * a fill is a fresh object every frame and has no such identity, so the value\n * it was derived from supplies one.\n *\n * @internal\n */\n identity?: string;\n /**\n * Ceiling on the buffer's device-pixel ratio. Default 1, i.e. the buffer is\n * exactly `width` × `height`.\n *\n * Unlike a 2D node — which wants to match the display — a surface is sampled by\n * a 3D material at whatever size the geometry occupies on screen, so the honest\n * control is `width`/`height`. Raise this only when a surface is viewed close\n * up and reads soft.\n */\n maxPixelRatio?: number;\n}\n\n/**\n * What a {@link SurfaceTexture3D} can be painted from: a built {@link Graphics2D}\n * command list, or a {@link Node2D} subtree.\n *\n * Both imports are **type-only**, exactly as `Color` is — `render3d` describes\n * scenes as data and never reaches into the render or node layers at runtime, and\n * a value import of `Node2D` here would close a real module cycle. Consumers narrow\n * with {@link resolveSurfaceSource}.\n */\nexport type SurfaceSource3D = Graphics2D | Node;\n\n// Declared against the dimension-agnostic base because that is what a built\n// node is typed as, so `Tex.surface(new Rect({ … }), …)` type-checks without a\n// cast. It has to be a 2D subtree in fact — the renderer lays it out and draws it\n// into a 2D buffer — and `resolveSurfaceSource` narrows to that; handing it a\n// `Node3D` fails at render time rather than here.\n\n/** A {@link SurfaceSource3D} narrowed to the arm its renderer should take. */\nexport type ResolvedSurfaceSource =\n | { kind: \"graphics\"; graphics: Graphics2D }\n | { kind: \"node\"; node: Node2D };\n\n/**\n * Narrow a surface source to the arm that knows how to draw it: a `Graphics2D` is\n * replayed into a render context, a `Node2D` is laid out against the buffer and\n * rendered.\n *\n * Structural rather than `instanceof`, because that would need value imports of\n * both classes and close the cycle the type-only imports above avoid. `Graphics2D`\n * is a command recorder and exposes `ops()`; a `Node2D` has no such method. The\n * union makes any *other* value a type error, so this only has to separate two\n * known shapes rather than validate an unknown one.\n */\nexport function resolveSurfaceSource(source: SurfaceSource3D): ResolvedSurfaceSource {\n return typeof (source as Graphics2D).ops === \"function\"\n ? { kind: \"graphics\", graphics: source as Graphics2D }\n : { kind: \"node\", node: source as Node2D };\n}\n\n/**\n * A texture reference. A bare string is sugar for `{ src }`, so the common case\n * is `map: \"/wood.png\"`.\n */\nexport type Texture3D = string | ImageTexture3D | DataTexture3D | SurfaceTexture3D;\n\n/** True for the raw-bytes form (vs. an asset-backed {@link ImageTexture3D}). */\nexport function isDataTexture3D(texture: Texture3D): texture is DataTexture3D {\n return typeof texture !== \"string\" && \"data\" in texture;\n}\n\n/** True for the {@link SurfaceTexture3D} form — pixels are rasterized from 2D. */\nexport function isSurfaceTexture3D(texture: Texture3D): texture is SurfaceTexture3D {\n return typeof texture !== \"string\" && \"source\" in texture;\n}\n\n/** Normalize the string shorthand to an {@link ImageTexture3D}. */\nexport function resolveTexture3D(texture: Texture3D): ImageTexture3D | DataTexture3D | SurfaceTexture3D {\n return typeof texture === \"string\" ? { src: texture } : texture;\n}\n\n/**\n * The asset `src` a texture reads from, or `null` when it has none (a data or\n * surface texture). Used by the asset-tracking pass to enumerate what a 3D scene\n * needs loaded — a `null` here means \"nothing to request\", not \"not a texture\".\n */\nexport function texture3DSource(texture: Texture3D): string | null {\n if (typeof texture === \"string\") return texture;\n if (isDataTexture3D(texture) || isSurfaceTexture3D(texture)) return null;\n return texture.src;\n}\n\n/**\n * True for a string that names an asset rather than a colour.\n *\n * Leading `/` or `.` is a path by construction; otherwise the extension decides.\n * A colour never matches either, and a bare name like `\"wood\"` is a colour —\n * which is right, since an asset reference without a path or extension is not\n * something the manifest could resolve either.\n */\nexport function looksLikeAssetPath(value: string): boolean {\n return value.startsWith(\"/\")\n || value.startsWith(\".\")\n || /\\.(png|jpe?g|webp|avif|svg|ktx2?|hdr|exr|mp4|webm|mov)$/i.test(value);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/render3d/tracking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;G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AE,OAAO,KAAK,CAAC;IACzC,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Asset discovery for 3D scenes.\n *\n * Walks a {@link Graphics3D}'s or {@link Scene3D}'s descriptors for the resources it references and\n * declares them into an {@link AssetScope}, so the ordinary asset timeline →\n * `AssetManager.loadAt` chain has them decoded and resident *before* the frame\n * that needs them renders. That is what lets the 3D draw stay synchronous.\n *\n * This runs off the very same descriptors the real render consumes — the node\n * builds its `Graphics3D` through one method that both paths call — so what gets\n * loaded cannot drift from what gets drawn.\n */\n\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { LoaderFn } from \"@/assets/record\";\nimport type { Graphics3D } from \"./graphics3d\";\nimport { Scene3D } from \"./scene3d\";\nimport type { Geometry3D } from \"./geometry\";\nimport type { EnvironmentData3D } from \"./scene-settings\";\nimport { isSurfaceTexture3D, resolveSurfaceSource, texture3DSource } from \"./texture\";\nimport {\n canvas3DResourceKey, canvas3DResourceLoader,\n type Canvas3DResourceKind, type Canvas3DResourceLoader,\n} from \"./resources\";\nimport { forEachTexture3D } from \"./walk\";\n\n/**\n * Declare every asset a 3D scene or drawable list needs: textures as images, models\n * and environment panoramas through the backend's loader, and each `Tex.surface`\n * node source as a subtree of the declaring node.\n *\n * A `Graphics2D` surface source declares nothing.\n */\nexport function declare3DResources(g3: Graphics3D | Scene3D, assets: AssetScope): void {\n forEachTexture3D(g3, (value) => {\n if (isSurfaceTexture3D(value)) {\n const source = resolveSurfaceSource(value.source);\n if (source.kind === \"node\") assets.subtree(source.node);\n return;\n }\n const src = texture3DSource(value);\n if (src !== null) assets.image(src);\n });\n\n const geometry = (value: Geometry3D | undefined): void => {\n if (value === undefined) return;\n if (value.type === \"modelGeometry\") {\n declareLoader(\"gltf\", value.src, assets);\n } else if (value.type === \"edges\" || value.type === \"wireframe\") {\n geometry(value.source);\n }\n };\n\n for (const op of g3.ops()) {\n switch (op.kind) {\n case \"mesh\":\n case \"points\":\n case \"line\":\n case \"instances\":\n geometry(op.geometry);\n break;\n case \"model\":\n declareLoader(\"gltf\", op.src, assets);\n break;\n }\n }\n\n if (g3 instanceof Scene3D) declareEnvironment(g3.environmentDescriptor(), assets);\n}\n\n/** An environment's panoramas. A `preset` is generated and needs nothing. */\nexport function declareEnvironment(\n environment: Pick<EnvironmentData3D, \"src\" | \"faces\"> | null,\n assets: AssetScope,\n): void {\n if (environment === null) return;\n if (environment.src !== undefined) declareLoader(hdrKind(environment.src), environment.src, assets);\n for (const face of environment.faces ?? []) declareLoader(hdrKind(face), face, assets);\n}\n\n// Stable per backend loader and key, so declaring a resource again hands the scope\n// the same function rather than tripping its conflicting-loader check.\nconst resourceLoads = new WeakMap<Canvas3DResourceLoader, Map<string, LoaderFn>>();\n\nfunction declareLoader(kind: Canvas3DResourceKind, src: string, assets: AssetScope): void {\n const load = canvas3DResourceLoader();\n if (!load) return;\n const key = canvas3DResourceKey(kind, src);\n let byKey = resourceLoads.get(load);\n if (!byKey) resourceLoads.set(load, (byKey = new Map()));\n let fn = byKey.get(key);\n if (!fn) byKey.set(key, (fn = () => load(kind, src)));\n assets.loader(key, fn);\n}\n\nfunction hdrKind(src: string): Canvas3DResourceKind {\n const lower = src.toLowerCase();\n if (lower.endsWith(\".exr\")) return \"exr\";\n return \"hdr\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/render3d/transform.ts"],"names":[],"mappings":"AA8CA,iCAAiC;AACjC,MAAM,UAAU,WAAW,CAAC,IAA0B;IAClD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,KAAK,MAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AACvD,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,cAAc,CAAC,IAA0B;IACrD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,IAA0B;IAC7D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { Euler3, Quaternion, Vector3Input } from \"./vector3\";\
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/render3d/transform.ts"],"names":[],"mappings":"AA8CA,iCAAiC;AACjC,MAAM,UAAU,WAAW,CAAC,IAA0B;IAClD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,KAAK,MAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AACvD,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,cAAc,CAAC,IAA0B;IACrD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACrD,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,IAA0B;IAC7D,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { Euler3, Quaternion, Vector3Input } from \"./vector3\";\n\n/**\n * Tuning for the shadow a *light* casts.\n *\n * Two knobs where three has seven: `mapSize`, `near`, `far`, `bias` and\n * `normalBias` are all derived by the renderer. `bias` in particular existed only\n * to fight shadow acne, its right value is a function of the scene's scale, and\n * `-0.0005` is not a number any author should be asked to discover.\n * {@link params} is applied straight onto the light's own `shadow` object for the\n * rare scene that needs to override one.\n */\nexport interface ShadowOptions3D {\n /** 0 hard-edged → 1 very soft. Default 0.5. */\n softness?: number;\n /**\n * Half-extent of a directional light's orthographic shadow frustum, in world\n * units. Sized to the scene's own bounds when omitted — too large and the\n * shadow is blocky, too small and it clips.\n */\n extent?: number;\n /** Escape hatch, assigned onto the renderer's shadow object. */\n params?: Record<string, unknown>;\n}\n\n/**\n * A node's relationship to shadows.\n *\n * One control rather than the two booleans three has, because for an *object*\n * \"casts\" and \"receives\" are almost never wanted apart, and defaulting both to\n * `false` (as three does) means a scene with shadows enabled and a light casting\n * them still renders nothing until every mesh is tagged. Here the default is\n * `true` and the viewport's own `shadows` switch is what decides — so turning\n * shadows on turns shadows on.\n *\n * For a *light* the same prop says whether it casts a shadow map, and the object\n * form carries that map's tuning. One name, because it is one question — \"what\n * does this node do about shadows\" — asked of two kinds of node.\n *\n * Note that every light casting by default is a real cost once shadows are on: a\n * point light needs a six-face cube map. Turn the fill lights off with\n * `shadow={false}` and leave the key light casting, which is what a lighting\n * setup does anyway.\n */\nexport type Shadow3D = boolean | \"cast\" | \"receive\" | ShadowOptions3D;\n\n/** True when this mode casts. */\nexport function shadowCasts(mode: Shadow3D | undefined): boolean {\n if (mode === undefined || mode === true) return true;\n if (mode === false) return false;\n return mode === \"cast\" || typeof mode === \"object\";\n}\n\n/** True when this mode receives. */\nexport function shadowReceives(mode: Shadow3D | undefined): boolean {\n if (mode === undefined || mode === true) return true;\n if (mode === false) return false;\n return mode === \"receive\" || typeof mode === \"object\";\n}\n\n/** A light's shadow tuning, or `null` when it casts none. */\nexport function resolveShadowOptions3D(mode: Shadow3D | undefined): ShadowOptions3D | null {\n if (!shadowCasts(mode)) return null;\n return typeof mode === \"object\" ? mode : {};\n}\n\n/**\n * Placement of a single 3D object. Every field is optional; an omitted field\n * means identity, so `{}` is a valid no-op transform.\n *\n * Rotation is in **degrees** — the engine's 2D `rotation` is degrees, so 3D\n * matches and authors never write `Math.PI`. The renderer converts.\n *\n * There is no `key` here. Reconciler identity is derived: a node stamps its own\n * id on the scope it opens, and a drawable is keyed by that id plus a content\n * signature, so a builder that emits ops conditionally reuses the right cache\n * entry without anything being written by hand. See the reconciler.\n */\nexport interface Transform3D {\n /** Position in the parent's local space. Default origin. */\n position?: Vector3Input;\n /**\n * Euler rotation in **degrees**, applied in `order` (default `\"XYZ\"`).\n * Ignored when {@link quaternion} is set.\n */\n rotation?: Vector3Input | Euler3;\n /**\n * Rotation as a unit quaternion. Wins over {@link rotation} — use it (with\n * `slerpQuaternion`) for tumbles where Euler interpolation would gimbal.\n */\n quaternion?: Quaternion;\n /** Per-axis scale; a scalar scales uniformly. Default 1. */\n scale?: Vector3Input;\n /**\n * World-space point to orient toward, applied after {@link position}.\n * Wins over both {@link rotation} and {@link quaternion}.\n */\n lookAt?: Vector3Input;\n /** Hide without removing (keeps the cached object alive). Default true. */\n visible?: boolean;\n /** Shadow participation. Default `true` — see {@link Shadow3D}. */\n shadow?: Shadow3D;\n /** Draw-order override, for tuning transparent sorting. */\n renderOrder?: number;\n /**\n * Node identity, stamped by the scene recorder rather than by an author.\n *\n * `Scene3D.begin` writes the recording node's id here so the renderer caches\n * a group against the node that opened it. Nothing an author writes goes in\n * this field.\n *\n * @internal\n */\n key?: string;\n}\n\n/** Which faces of a surface are rasterized. */\nexport type Faces3D = \"front\" | \"back\" | \"both\";\n\n/** How a drawn colour combines with what is already in the framebuffer. */\nexport type Blend3D = \"normal\" | \"additive\" | \"subt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\n * A 3D point or offset. The 3D counterpart to core's {@link Vector2}\r\n * (`attributes/layout/vector2.ts`), kept structurally identical so the same\r\n * plain-object idiom works in both dimensions.\r\n */\r\nexport interface Vector3 {\r\n x: number;\r\n y: number;\r\n z: number;\r\n}\r\n\r\n/**\r\n * Loose forms accepted anywhere a {@link Vector3} is expected:\r\n *\r\n * - an object — `{ x: 1, y: 2, z: 3 }`\r\n * - a 3-tuple — `[1, 2, 3]`\r\n * - a scalar, broadcast to all three axes — `0` means the origin, `2` means\r\n * `{ x: 2, y: 2, z: 2 }` (handy for uniform scale and `lookAt: 0`)\r\n */\r\nexport type Vector3Input = Vector3 | readonly [number, number, number] | number;\r\n\r\nconst ZERO: Vector3 = { x: 0, y: 0, z: 0 };\r\n\r\n/** Normalize any {@link Vector3Input} to a concrete {@link Vector3}. */\r\nexport function resolveVector3(input: Vector3Input | undefined): Vector3 {\r\n if (input === undefined) return { ...ZERO };\r\n if (typeof input === \"number\") return { x: input, y: input, z: input };\r\n if (Array.isArray(input)) return { x: input[0] ?? 0, y: input[1] ?? 0, z: input[2] ?? 0 };\r\n const v = input as Vector3;\r\n return { x: v.x ?? 0, y: v.y ?? 0, z: v.z ?? 0 };\r\n}\r\n\r\n/**\r\n * Component-wise lerp between two positions. `t=0` returns `from`, `t=1`\r\n * returns `to`.\r\n *\r\n * Pass this as a prop's `tween` so 3D vectors actually animate:\r\n * `property({ default: …, tween: lerpVector3 })` — or a `Types.vector3` entry,\r\n * which carries it already. Without one `to()` **leaves the prop alone**, having\r\n * nothing to interpolate two vectors with.\r\n */\r\nexport function lerpVector3(from: Vector3, to: Vector3, t: number): Vector3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n };\r\n}\r\n\r\n/** The `Vector3` attribute's op set — a 3D position or scale. */\r\nexport const vector3Ops: AttributeOps<Vector3Input, Vector3> = {\r\n resolve: (value) => resolveVector3(value),\r\n lerp: lerpVector3,\r\n};\r\n\r\n/**\r\n * Map an optional {@link Vector3Input}: an unset prop stays unset (a thunk that\r\n * returns `undefined` included) instead of resolving to the origin, which would\r\n * turn \"no aim\" into \"aim at the origin\".\r\n */\r\nexport function resolveOptionalVector3(input: Vector3Input | undefined): Vector3 | undefined {\r\n return input === undefined ? undefined : resolveVector3(input);\r\n}\r\n\r\n/**\r\n * Lerp for a vector prop that may be unset — a node's `lookAt`, a camera's or\r\n * light's `target`.\r\n *\r\n * With no start value there is nothing to blend from. `unset: \"origin\"` treats it\r\n * as the origin, which is what the renderer uses for `target`; `unset: \"snap\"`\r\n * holds it unset and swaps at the end, which is the only honest reading for\r\n * `lookAt` (an unset `lookAt` is \"do not aim\", not \"aim at the origin\"). A `to`\r\n * that ends unset leaves the start value in place, as every other prop does.\r\n */\r\nexport function lerpOptionalVector3(\r\n from: Vector3 | undefined,\r\n to: Vector3 | undefined,\r\n t: number,\r\n unset: \"origin\" | \"snap\",\r\n): Vector3 | undefined {\r\n if (to === undefined) return from;\r\n if (from !== undefined) return lerpVector3(from, to, t);\r\n if (unset === \"origin\") return lerpVector3(ZERO, to, t);\r\n return t >= 1 ? to : from;\r\n}\r\n\r\n/** The order Euler angles are applied in. Matches three's own naming. */\r\nexport type EulerOrder = \"XYZ\" | \"YXZ\" | \"ZXY\" | \"ZYX\" | \"YZX\" | \"XZY\";\r\n\r\n/**\r\n * An Euler rotation in **degrees**, to match the engine's 2D `rotation`.\r\n * The renderer converts to radians — authors never write `Math.PI`.\r\n */\r\nexport interface Euler3 extends Vector3 {\r\n order?: EulerOrder;\r\n}\r\n\r\n/**\r\n * Component-wise lerp of two Euler rotations, in degrees. `order` is discrete,\r\n * so it snaps at the halfway point rather than blending.\r\n *\r\n * Euler interpolation gimbals near the poles and takes the \"wrong\" path for\r\n * rotations past 180°. For a tumble, hold a {@link Quaternion} prop and use\r\n * {@link slerpQuaternion} instead.\r\n */\r\nexport function lerpEuler3(from: Euler3, to: Euler3, t: number): Euler3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n order: t < 0.5 ? from.order : to.order,\r\n };\r\n}\r\n\r\n/** The `Euler3` attribute's op set — a rotation in degrees, per axis. */\r\nexport const euler3Ops: AttributeOps<Vector3Input | Euler3, Euler3> = {\r\n resolve: (input) => {\r\n const v = resolveVector3(input as Vector3Input);\r\n const order = (input as Euler3)?.order;\r\n return order ? { ...v, order } : v;\r\n },\r\n lerp: lerpEuler3,\r\n};\r\n\r\n/** A rotation as a unit quaternion. */\r\nexport interface Quaternion {\r\n x: number;\r\n y: number;\r\n z: number;\r\n w: number;\r\n}\r\n\r\n/** The identity rotation. */\r\nexport const IDENTITY_QUATERNION: Quaternion = { x: 0, y: 0, z: 0, w: 1 };\r\n\r\n/**\r\n * Shortest-arc spherical linear interpolation — the correct tween for a\r\n * quaternion. A component-wise lerp is *not* correct: it leaves the unit\r\n * hypersphere, so the rotation speed varies and the result needs renormalizing.\r\n *\r\n * Negates `to` when the pair points away from each other (`dot < 0`) so the\r\n * rotation always takes the short way round; falls back to a normalized linear\r\n * blend when the two are nearly parallel and `sin(theta)` would underflow.\r\n */\r\nexport function slerpQuaternion(from: Quaternion, to: Quaternion, t: number): Quaternion {\r\n let { x, y, z, w } = to;\r\n let dot = from.x * x + from.y * y + from.z * z + from.w * w;\r\n\r\n // Both q and -q describe the same rotation; pick the nearer representative.\r\n if (dot < 0) {\r\n x = -x; y = -y; z = -z; w = -w;\r\n dot = -dot;\r\n }\r\n\r\n // Nearly parallel — slerp's sin(theta) denominator underflows, and a linear\r\n // blend is indistinguishable at this angle anyway.\r\n if (dot > 0.9995) {\r\n return normalizeQuaternion({\r\n x: lerpNumber(from.x, x, t),\r\n y: lerpNumber(from.y, y, t),\r\n z: lerpNumber(from.z, z, t),\r\n w: lerpNumber(from.w, w, t),\r\n });\r\n }\r\n\r\n const theta = Math.acos(dot);\r\n const sinTheta = Math.sin(theta);\r\n const a = Math.sin((1 - t) * theta) / sinTheta;\r\n const b = Math.sin(t * theta) / sinTheta;\r\n\r\n return {\r\n x: from.x * a + x * b,\r\n y: from.y * a + y * b,\r\n z: from.z * a + z * b,\r\n w: from.w * a + w * b,\r\n };\r\n}\r\n\r\n/** Scale a quaternion back to unit length. Returns identity for a zero quat. */\r\nexport function normalizeQuaternion(q: Quaternion): Quaternion {\r\n const length = Math.hypot(q.x, q.y, q.z, q.w);\r\n if (length === 0) return { ...IDENTITY_QUATERNION };\r\n return { x: q.x / length, y: q.y / length, z: q.z / length, w: q.w / length };\r\n}\r\n\r\n/** Convert an {@link Euler3} (degrees) to a {@link Quaternion}. */\r\nexport function quaternionFromEuler(euler: Euler3): Quaternion {\r\n const half = Math.PI / 360; // deg → rad, then halved for the half-angle form\r\n const cx = Math.cos(euler.x * half), sx = Math.sin(euler.x * half);\r\n const cy = Math.cos(euler.y * half), sy = Math.sin(euler.y * half);\r\n const cz = Math.cos(euler.z * half), sz = Math.sin(euler.z * half);\r\n\r\n switch (euler.order ?? \"XYZ\") {\r\n case \"YXZ\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"ZXY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"ZYX\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"YZX\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"XZY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"XYZ\":\r\n default:\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n }\r\n}\r\n\r\n/** The `Quaternion` attribute's op set: resolve is the identity, lerp shortest-arc slerps. */\r\nexport const quaternionOps: AttributeOps<Quaternion, Quaternion> = {\r\n resolve: (value) => value,\r\n lerp: slerpQuaternion,\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"vector3.js","sourceRoot":"","sources":["../../src/render3d/vector3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwB1C,MAAM,IAAI,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE3C,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,KAA+B;IAC1D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IACvE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAC1F,MAAM,CAAC,GAA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,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aACjC,CAAC;IACV,CAAC;AACL,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,aAAa,GAAyC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,eAAe;CACxB,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\n\n/**\n * A 3D point or offset. The 3D counterpart to core's {@link Vector2}\n * (`attributes/layout/vector2.ts`), kept structurally identical so the same\n * plain-object idiom works in both dimensions.\n */\nexport interface Vector3 {\n x: number;\n y: number;\n z: number;\n}\n\n/**\n * Loose forms accepted anywhere a {@link Vector3} is expected:\n *\n * - an object — `{ x: 1, y: 2, z: 3 }`\n * - a 3-tuple — `[1, 2, 3]`\n * - a scalar, broadcast to all three axes — `0` means the origin, `2` means\n * `{ x: 2, y: 2, z: 2 }` (handy for uniform scale and `lookAt: 0`)\n */\nexport type Vector3Input = Vector3 | readonly [number, number, number] | number;\n\nconst ZERO: Vector3 = { x: 0, y: 0, z: 0 };\n\n/** Normalize any {@link Vector3Input} to a concrete {@link Vector3}. */\nexport function resolveVector3(input: Vector3Input | undefined): Vector3 {\n if (input === undefined) return { ...ZERO };\n if (typeof input === \"number\") return { x: input, y: input, z: input };\n if (Array.isArray(input)) return { x: input[0] ?? 0, y: input[1] ?? 0, z: input[2] ?? 0 };\n const v = input as Vector3;\n return { x: v.x ?? 0, y: v.y ?? 0, z: v.z ?? 0 };\n}\n\n/**\n * Component-wise lerp between two positions. `t=0` returns `from`, `t=1`\n * returns `to`.\n *\n * Pass this as a prop's `tween` so 3D vectors actually animate:\n * `property({ default: …, tween: lerpVector3 })` — or a `Types.vector3` entry,\n * which carries it already. Without one `to()` **leaves the prop alone**, having\n * nothing to interpolate two vectors with.\n */\nexport function lerpVector3(from: Vector3, to: Vector3, t: number): Vector3 {\n return {\n x: lerpNumber(from.x, to.x, t),\n y: lerpNumber(from.y, to.y, t),\n z: lerpNumber(from.z, to.z, t),\n };\n}\n\n/** The `Vector3` attribute's op set — a 3D position or scale. */\nexport const vector3Ops: AttributeOps<Vector3Input, Vector3> = {\n resolve: (value) => resolveVector3(value),\n lerp: lerpVector3,\n};\n\n/**\n * Map an optional {@link Vector3Input}: an unset prop stays unset (a thunk that\n * returns `undefined` included) instead of resolving to the origin, which would\n * turn \"no aim\" into \"aim at the origin\".\n */\nexport function resolveOptionalVector3(input: Vector3Input | undefined): Vector3 | undefined {\n return input === undefined ? undefined : resolveVector3(input);\n}\n\n/**\n * Lerp for a vector prop that may be unset — a node's `lookAt`, a camera's or\n * light's `target`.\n *\n * With no start value there is nothing to blend from. `unset: \"origin\"` treats it\n * as the origin, which is what the renderer uses for `target`; `unset: \"snap\"`\n * holds it unset and swaps at the end, which is the only honest reading for\n * `lookAt` (an unset `lookAt` is \"do not aim\", not \"aim at the origin\"). A `to`\n * that ends unset leaves the start value in place, as every other prop does.\n */\nexport function lerpOptionalVector3(\n from: Vector3 | undefined,\n to: Vector3 | undefined,\n t: number,\n unset: \"origin\" | \"snap\",\n): Vector3 | undefined {\n if (to === undefined) return from;\n if (from !== undefined) return lerpVector3(from, to, t);\n if (unset === \"origin\") return lerpVector3(ZERO, to, t);\n return t >= 1 ? to : from;\n}\n\n/** The order Euler angles are applied in. Matches three's own naming. */\nexport type EulerOrder = \"XYZ\" | \"YXZ\" | \"ZXY\" | \"ZYX\" | \"YZX\" | \"XZY\";\n\n/**\n * An Euler rotation in **degrees**, to match the engine's 2D `rotation`.\n * The renderer converts to radians — authors never write `Math.PI`.\n */\nexport interface Euler3 extends Vector3 {\n order?: EulerOrder;\n}\n\n/**\n * Component-wise lerp of two Euler rotations, in degrees. `order` is discrete,\n * so it snaps at the halfway point rather than blending.\n *\n * Euler interpolation gimbals near the poles and takes the \"wrong\" path for\n * rotations past 180°. For a tumble, hold a {@link Quaternion} prop and use\n * {@link slerpQuaternion} instead.\n */\nexport function lerpEuler3(from: Euler3, to: Euler3, t: number): Euler3 {\n return {\n x: lerpNumber(from.x, to.x, t),\n y: lerpNumber(from.y, to.y, t),\n z: lerpNumber(from.z, to.z, t),\n order: t < 0.5 ? from.order : to.order,\n };\n}\n\n/** The `Euler3` attribute's op set — a rotation in degrees, per axis. */\nexport const euler3Ops: AttributeOps<Vector3Input | Euler3, Euler3> = {\n resolve: (input) => {\n const v = resolveVector3(input as Vector3Input);\n const order = (input as Euler3)?.order;\n return order ? { ...v, order } : v;\n },\n lerp: lerpEuler3,\n};\n\n/** A rotation as a unit quaternion. */\nexport interface Quaternion {\n x: number;\n y: number;\n z: number;\n w: number;\n}\n\n/** The identity rotation. */\nexport const IDENTITY_QUATERNION: Quaternion = { x: 0, y: 0, z: 0, w: 1 };\n\n/**\n * Shortest-arc spherical linear interpolation — the correct tween for a\n * quaternion. A component-wise lerp is *not* correct: it leaves the unit\n * hypersphere, so the rotation speed varies and the result needs renormalizing.\n *\n * Negates `to` when the pair points away from each other (`dot < 0`) so the\n * rotation always takes the short way round; falls back to a normalized linear\n * blend when the two are nearly parallel and `sin(theta)` would underflow.\n */\nexport function slerpQuaternion(from: Quaternion, to: Quaternion, t: number): Quaternion {\n let { x, y, z, w } = to;\n let dot = from.x * x + from.y * y + from.z * z + from.w * w;\n\n // Both q and -q describe the same rotation; pick the nearer representative.\n if (dot < 0) {\n x = -x; y = -y; z = -z; w = -w;\n dot = -dot;\n }\n\n // Nearly parallel — slerp's sin(theta) denominator underflows, and a linear\n // blend is indistinguishable at this angle anyway.\n if (dot > 0.9995) {\n return normalizeQuaternion({\n x: lerpNumber(from.x, x, t),\n y: lerpNumber(from.y, y, t),\n z: lerpNumber(from.z, z, t),\n w: lerpNumber(from.w, w, t),\n });\n }\n\n const theta = Math.acos(dot);\n const sinTheta = Math.sin(theta);\n const a = Math.sin((1 - t) * theta) / sinTheta;\n const b = Math.sin(t * theta) / sinTheta;\n\n return {\n x: from.x * a + x * b,\n y: from.y * a + y * b,\n z: from.z * a + z * b,\n w: from.w * a + w * b,\n };\n}\n\n/** Scale a quaternion back to unit length. Returns identity for a zero quat. */\nexport function normalizeQuaternion(q: Quaternion): Quaternion {\n const length = Math.hypot(q.x, q.y, q.z, q.w);\n if (length === 0) return { ...IDENTITY_QUATERNION };\n return { x: q.x / length, y: q.y / length, z: q.z / length, w: q.w / length };\n}\n\n/** Convert an {@link Euler3} (degrees) to a {@link Quaternion}. */\nexport function quaternionFromEuler(euler: Euler3): Quaternion {\n const half = Math.PI / 360; // deg → rad, then halved for the half-angle form\n const cx = Math.cos(euler.x * half), sx = Math.sin(euler.x * half);\n const cy = Math.cos(euler.y * half), sy = Math.sin(euler.y * half);\n const cz = Math.cos(euler.z * half), sz = Math.sin(euler.z * half);\n\n switch (euler.order ?? \"XYZ\") {\n case \"YXZ\":\n return {\n x: sx * cy * cz + cx * sy * sz,\n y: cx * sy * cz - sx * cy * sz,\n z: cx * cy * sz - sx * sy * cz,\n w: cx * cy * cz + sx * sy * sz,\n };\n case \"ZXY\":\n return {\n x: sx * cy * cz - cx * sy * sz,\n y: cx * sy * cz + sx * cy * sz,\n z: cx * cy * sz + sx * sy * cz,\n w: cx * cy * cz - sx * sy * sz,\n };\n case \"ZYX\":\n return {\n x: sx * cy * cz - cx * sy * sz,\n y: cx * sy * cz + sx * cy * sz,\n z: cx * cy * sz - sx * sy * cz,\n w: cx * cy * cz + sx * sy * sz,\n };\n case \"YZX\":\n return {\n x: sx * cy * cz + cx * sy * sz,\n y: cx * sy * cz + sx * cy * sz,\n z: cx * cy * sz - sx * sy * cz,\n w: cx * cy * cz - sx * sy * sz,\n };\n case \"XZY\":\n return {\n x: sx * cy * cz - cx * sy * sz,\n y: cx * sy * cz - sx * cy * sz,\n z: cx * cy * sz + sx * sy * cz,\n w: cx * cy * cz + sx * sy * sz,\n };\n case \"XYZ\":\n default:\n return {\n x: sx * cy * cz + cx * sy * sz,\n y: cx * sy * cz - sx * cy * sz,\n z: cx * cy * sz + sx * sy * cz,\n w: cx * cy * cz - sx * sy * sz,\n };\n }\n}\n\n/** The `Quaternion` attribute's op set: resolve is the identity, lerp shortest-arc slerps. */\nexport const quaternionOps: AttributeOps<Quaternion, Quaternion> = {\n resolve: (value) => value,\n lerp: slerpQuaternion,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/render3d/walk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAkB,MAAM,WAAW,CAAC;AAE/D,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAsB;IAC3C,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ;IACpE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa;IACxE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,oBAAoB;IAC7D,uBAAuB,EAAE,iBAAiB,EAAE,cAAc;CAC7D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,OAAO,KAAK,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAwB,EAAE,KAAmC;IAC1F,MAAM,QAAQ,GAAG,CAAC,GAAwC,EAAQ,EAAE;QAChE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AE,CAAC;QACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,MAAM,CAAC;YACZ,KAAK,QAAQ,CAAC;YACd,KAAK,MAAM,CAAC;YACZ,KAAK,WAAW;gBACZ,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;gBACtB,MAAM;YACV,KAAK,QAAQ;gBACT,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;gBACtB,MAAM;YACV,KAAK,OAAO;gBACR,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;oBACd,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,QAAQ;wBAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC9D,CAAC;gBACD,MAAM;YACV,wCAAwC;QAC5C,CAAC;IACL,CAAC;IAED,0EAA0E;IAC1E,2EAA2E;IAC3E,mEAAmE;IACnE,0CAA0C;IAC1C,IAAI,CAAC,CAAC,EAAE,YAAY,OAAO,CAAC;QAAE,OAAO;IAErC,KAAK,MAAM,MAAM,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QACpC,QAAQ,CAAE,MAAiD,CAAC,QAAQ,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC","sourcesContent":["/**\n * Structural walks over a built {@link Graphics3D} or {@link Scene3D}.\n *\n * A `Graphics3D` is a flat op list with a handful of scene-level descriptors\n * hanging off it, and more than one consumer needs to sweep the same surface for\n * the same thing. {@link forEachTexture3D} is that sweep for textures: asset\n * discovery uses it during precomp to decide what to load, and the renderer uses\n * it at paint time to find the surface textures it has to rasterize first.\n *\n * Keeping it here rather than in either caller is what stops the two from\n * drifting — a texture slot added to a material must be seen by *both*, or a map\n * loads and never draws (or draws and never loads).\n */\n\nimport type { Graphics3D } from \"./graphics3d\";\nimport { Scene3D } from \"./scene3d\";\nimport type { Material3D } from \"./material\";\nimport { looksLikeAssetPath, type Texture3D } from \"./texture\";\n\n/** Material fields that hold a {@link Texture3D}. */\nexport const TEXTURE_KEYS: readonly string[] = [\n \"map\", \"alphaMap\", \"aoMap\", \"normalMap\", \"displacementMap\", \"envMap\",\n \"lightMap\", \"emissionMap\", \"roughnessMap\", \"metalnessMap\", \"specularMap\",\n \"gradientMap\", \"matcap\", \"clearcoatMap\", \"clearcoatNormalMap\",\n \"clearcoatRoughnessMap\", \"transmissionMap\", \"thicknessMap\",\n];\n\n/**\n * True for a texture descriptor object (vs. a plain uniform value).\n *\n * Structural, because {@link Texture3D} has no `type` discriminant — each member\n * is branded by the presence of its own payload key.\n */\nexport function isTextureLike(value: unknown): boolean {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return false;\n return \"src\" in value || \"data\" in value || \"source\" in value;\n}\n\n/**\n * Visit every {@link Texture3D} a scene references — material map slots, and\n * shader and post-effect uniforms.\n *\n * Visits duplicates; callers dedupe on whatever key they care about. Does **not**\n * cover model/environment resources, which are not textures and go through the\n * backend's own loader — see `declare3DResources`.\n */\nexport function forEachTexture3D(g3: Graphics3D | Scene3D, visit: (texture: Texture3D) => void): void {\n const uniforms = (bag: Record<string, unknown> | undefined): void => {\n if (!bag) return;\n for (const key in bag) {\n const value = bag[key];\n // A bare string is a texture path only when it looks like one; any\n // other string is a colour uniform and names no asset.\n if ((typeof value === \"string\" && looksLikeAssetPath(value)) || isTextureLike(value)) {\n visit(value as Texture3D);\n }\n }\n };\n\n const material = (value: Material3D | readonly Material3D[] | undefined): void => {\n if (value === undefined) return;\n const list = Array.isArray(value) ? value : [value as Material3D];\n for (const entry of list) {\n const bag = entry as unknown as Record<string, unknown>;\n for (const key of TEXTURE_KEYS) {\n if (bag[key] !== undefined) visit(bag[key] as Texture3D);\n }\n // A shader's uniforms can hold textures too.\n uniforms(bag.uniforms as Record<string, unknown> | undefined);\n }\n };\n\n for (const op of g3.ops()) {\n switch (op.kind) {\n case \"mesh\":\n case \"points\":\n case \"line\":\n case \"instances\":\n material(op.material);\n break;\n case \"sprite\":\n material(op.material);\n break;\n case \"model\":\n if (op.override) {\n for (const key in op.override) material(op.override[key]);\n }\n break;\n // push/pop/light reference no textures.\n }\n }\n\n // Only a whole scene has a post chain; what a single node draws has none.\n // The environment's own panorama is not visited here: it is loaded through\n // the backend's HDR/EXR loader rather than the image pipeline, and\n // `trackEnvironment` is what declares it.\n if (!(g3 instanceof Scene3D)) return;\n\n for (const effect of g3.postEffects()) {\n uniforms((effect as { uniforms?: Record<string, unknown> }).uniforms);\n }\n}\n"]}
|