@bloopjs/toodle 0.0.100
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/Toodle.d.ts +304 -0
- package/dist/Toodle.d.ts.map +1 -0
- package/dist/colors/mod.d.ts +872 -0
- package/dist/colors/mod.d.ts.map +1 -0
- package/dist/coreTypes/Color.d.ts +7 -0
- package/dist/coreTypes/Color.d.ts.map +1 -0
- package/dist/coreTypes/Point.d.ts +8 -0
- package/dist/coreTypes/Point.d.ts.map +1 -0
- package/dist/coreTypes/Size.d.ts +5 -0
- package/dist/coreTypes/Size.d.ts.map +1 -0
- package/dist/coreTypes/Transform.d.ts +16 -0
- package/dist/coreTypes/Transform.d.ts.map +1 -0
- package/dist/coreTypes/Vec2.d.ts +8 -0
- package/dist/coreTypes/Vec2.d.ts.map +1 -0
- package/dist/coreTypes/mod.d.ts +6 -0
- package/dist/coreTypes/mod.d.ts.map +1 -0
- package/dist/docs/snippets/add-remove-children.d.ts +1 -0
- package/dist/docs/snippets/basic-quad.d.ts +1 -0
- package/dist/docs/snippets/filter-linear.d.ts +1 -0
- package/dist/docs/snippets/filter-nearest.d.ts +1 -0
- package/dist/docs/snippets/flipxy.d.ts +1 -0
- package/dist/docs/snippets/hello-text.d.ts +1 -0
- package/dist/docs/snippets/jumbo-textures.d.ts +1 -0
- package/dist/docs/snippets/layer.d.ts +1 -0
- package/dist/docs/snippets/layout-edges.d.ts +1 -0
- package/dist/docs/snippets/layout-screen-and-world-space.d.ts +1 -0
- package/dist/docs/snippets/postprocess.d.ts +1 -0
- package/dist/docs/snippets/quad-size-scale.d.ts +1 -0
- package/dist/docs/snippets/quickstart.d.ts +1 -0
- package/dist/docs/snippets/repeat-texture-loading.d.ts +1 -0
- package/dist/docs/snippets/screen-shaders.d.ts +1 -0
- package/dist/docs/snippets/shader-color-flash.d.ts +1 -0
- package/dist/docs/snippets/shader-default.d.ts +1 -0
- package/dist/docs/snippets/shader-fill.d.ts +1 -0
- package/dist/docs/snippets/shapes-line.d.ts +1 -0
- package/dist/docs/snippets/sprite-region.d.ts +1 -0
- package/dist/docs/snippets/text-alignment.d.ts +1 -0
- package/dist/docs/snippets/text-shrink-to-fit.d.ts +1 -0
- package/dist/docs/snippets/text-word-wrap.d.ts +1 -0
- package/dist/docs/snippets/texture-bundles-prebaked.d.ts +1 -0
- package/dist/docs/snippets/texture-bundles.d.ts +1 -0
- package/dist/docs/snippets/transforms.d.ts +1 -0
- package/dist/docs/snippets/transparent-cropping.d.ts +1 -0
- package/dist/examples/0-hello.d.ts +1 -0
- package/dist/examples/1-hello.d.ts +1 -0
- package/dist/examples/1-hello.d.ts.map +1 -0
- package/dist/examples/1-quad.d.ts +1 -0
- package/dist/examples/10-resize.d.ts +1 -0
- package/dist/examples/10-resize.d.ts.map +1 -0
- package/dist/examples/11-bundle-test.d.ts +1 -0
- package/dist/examples/11-bundle-test.d.ts.map +1 -0
- package/dist/examples/12-transparent-pixel-cropping.d.ts +1 -0
- package/dist/examples/12-transparent-pixel-cropping.d.ts.map +1 -0
- package/dist/examples/13-crop.d.ts +1 -0
- package/dist/examples/13-crop.d.ts.map +1 -0
- package/dist/examples/14-bundle-bench.d.ts +1 -0
- package/dist/examples/14-bundle-bench.d.ts.map +1 -0
- package/dist/examples/15-text-layer.d.ts +1 -0
- package/dist/examples/15-text-layer.d.ts.map +1 -0
- package/dist/examples/16-jumbo-texture.d.ts +1 -0
- package/dist/examples/16-jumbo-textures.d.ts +1 -0
- package/dist/examples/16-screen-shader.d.ts +1 -0
- package/dist/examples/16-screen-shader.d.ts.map +1 -0
- package/dist/examples/17-lighting.d.ts +1 -0
- package/dist/examples/17-lighting.d.ts.map +1 -0
- package/dist/examples/17-translations.d.ts +1 -0
- package/dist/examples/18-blur.d.ts +1 -0
- package/dist/examples/19-postprocess.d.ts +1 -0
- package/dist/examples/19-screenshader.d.ts +1 -0
- package/dist/examples/2-shapes.d.ts +1 -0
- package/dist/examples/2-shapes.d.ts.map +1 -0
- package/dist/examples/3-shader.d.ts +1 -0
- package/dist/examples/3-shader.d.ts.map +1 -0
- package/dist/examples/4-shader-bench.d.ts +1 -0
- package/dist/examples/4-shader-bench.d.ts.map +1 -0
- package/dist/examples/5-z.d.ts +1 -0
- package/dist/examples/5-z.d.ts.map +1 -0
- package/dist/examples/6-atlas.d.ts +1 -0
- package/dist/examples/6-atlas.d.ts.map +1 -0
- package/dist/examples/7-text.d.ts +1 -0
- package/dist/examples/7-text.d.ts.map +1 -0
- package/dist/examples/8-text-bench.d.ts +1 -0
- package/dist/examples/8-text-bench.d.ts.map +1 -0
- package/dist/examples/9-alignment.d.ts +1 -0
- package/dist/examples/9-alignment.d.ts.map +1 -0
- package/dist/examples/main.d.ts +1 -0
- package/dist/examples/main.d.ts.map +1 -0
- package/dist/examples/util.d.ts +82 -0
- package/dist/examples/util.d.ts.map +1 -0
- package/dist/limits.d.ts +23 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/math/angle.d.ts +13 -0
- package/dist/math/angle.d.ts.map +1 -0
- package/dist/math/matrix.d.ts +26 -0
- package/dist/math/matrix.d.ts.map +1 -0
- package/dist/math/mod.d.ts +3 -0
- package/dist/math/mod.d.ts.map +1 -0
- package/dist/mod.d.ts +17 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +19665 -0
- package/dist/mod.js.map +41 -0
- package/dist/postprocess.d.ts +10 -0
- package/dist/postprocess.d.ts.map +1 -0
- package/dist/scene/Batcher.d.ts +20 -0
- package/dist/scene/Batcher.d.ts.map +1 -0
- package/dist/scene/Camera.d.ts +16 -0
- package/dist/scene/Camera.d.ts.map +1 -0
- package/dist/scene/JumboQuadNode.d.ts +29 -0
- package/dist/scene/JumboQuadNode.d.ts.map +1 -0
- package/dist/scene/QuadNode.d.ts +159 -0
- package/dist/scene/QuadNode.d.ts.map +1 -0
- package/dist/scene/RenderComponent.d.ts +11 -0
- package/dist/scene/RenderComponent.d.ts.map +1 -0
- package/dist/scene/SceneNode.d.ts +300 -0
- package/dist/scene/SceneNode.d.ts.map +1 -0
- package/dist/scene/mod.d.ts +5 -0
- package/dist/scene/mod.d.ts.map +1 -0
- package/dist/screen/mod.d.ts +2 -0
- package/dist/screen/mod.d.ts.map +1 -0
- package/dist/screen/resolution.d.ts +5 -0
- package/dist/screen/resolution.d.ts.map +1 -0
- package/dist/shaders/EngineUniform.d.ts +9 -0
- package/dist/shaders/EngineUniform.d.ts.map +1 -0
- package/dist/shaders/IShader.d.ts +15 -0
- package/dist/shaders/IShader.d.ts.map +1 -0
- package/dist/shaders/QuadShader.d.ts +18 -0
- package/dist/shaders/QuadShader.d.ts.map +1 -0
- package/dist/shaders/ShaderDescriptor.d.ts +7 -0
- package/dist/shaders/ShaderDescriptor.d.ts.map +1 -0
- package/dist/shaders/mod.d.ts +6 -0
- package/dist/shaders/mod.d.ts.map +1 -0
- package/dist/shaders/parser.d.ts +8 -0
- package/dist/shaders/parser.d.ts.map +1 -0
- package/dist/shaders/postprocess/blur.d.ts +3 -0
- package/dist/shaders/postprocess/blur.d.ts.map +1 -0
- package/dist/shaders/postprocess/mod.d.ts +17 -0
- package/dist/shaders/postprocess/mod.d.ts.map +1 -0
- package/dist/shaders/samplers.d.ts +3 -0
- package/dist/shaders/samplers.d.ts.map +1 -0
- package/dist/shaders/wgsl/example.wgsl.d.ts +3 -0
- package/dist/shaders/wgsl/example.wgsl.d.ts.map +1 -0
- package/dist/shaders/wgsl/hello.wgsl.d.ts +3 -0
- package/dist/shaders/wgsl/hello.wgsl.d.ts.map +1 -0
- package/dist/shaders/wgsl/helloInstanced.wgsl.d.ts +3 -0
- package/dist/shaders/wgsl/helloInstanced.wgsl.d.ts.map +1 -0
- package/dist/shaders/wgsl/quad.wgsl.d.ts +3 -0
- package/dist/shaders/wgsl/quad.wgsl.d.ts.map +1 -0
- package/dist/src/Toodle.d.ts +303 -0
- package/dist/src/Toodle.d.ts.map +1 -0
- package/dist/src/colors/mod.d.ts +871 -0
- package/dist/src/coreTypes/Color.d.ts +6 -0
- package/dist/src/coreTypes/Color.d.ts.map +1 -0
- package/dist/src/coreTypes/Point.d.ts +7 -0
- package/dist/src/coreTypes/Point.d.ts.map +1 -0
- package/dist/src/coreTypes/Size.d.ts +4 -0
- package/dist/src/coreTypes/Size.d.ts.map +1 -0
- package/dist/src/coreTypes/Transform.d.ts +15 -0
- package/dist/src/coreTypes/Transform.d.ts.map +1 -0
- package/dist/src/coreTypes/Vec2.d.ts +7 -0
- package/dist/src/coreTypes/Vec2.d.ts.map +1 -0
- package/dist/src/coreTypes/mod.d.ts +5 -0
- package/dist/src/coreTypes/mod.d.ts.map +1 -0
- package/dist/src/limits.d.ts +22 -0
- package/dist/src/limits.d.ts.map +1 -0
- package/dist/src/math/angle.d.ts +12 -0
- package/dist/src/math/angle.d.ts.map +1 -0
- package/dist/src/math/matrix.d.ts +25 -0
- package/dist/src/math/matrix.d.ts.map +1 -0
- package/dist/src/math/mod.d.ts +2 -0
- package/dist/src/math/mod.d.ts.map +1 -0
- package/dist/src/mod.d.ts +16 -0
- package/dist/src/mod.d.ts.map +1 -0
- package/dist/src/postprocess.d.ts +10 -0
- package/dist/src/postprocess.d.ts.map +1 -0
- package/dist/src/scene/Batcher.d.ts +19 -0
- package/dist/src/scene/Batcher.d.ts.map +1 -0
- package/dist/src/scene/Camera.d.ts +15 -0
- package/dist/src/scene/Camera.d.ts.map +1 -0
- package/dist/src/scene/JumboQuadNode.d.ts +28 -0
- package/dist/src/scene/QuadNode.d.ts +158 -0
- package/dist/src/scene/QuadNode.d.ts.map +1 -0
- package/dist/src/scene/RenderComponent.d.ts +10 -0
- package/dist/src/scene/RenderComponent.d.ts.map +1 -0
- package/dist/src/scene/SceneNode.d.ts +299 -0
- package/dist/src/scene/SceneNode.d.ts.map +1 -0
- package/dist/src/scene/mod.d.ts +4 -0
- package/dist/src/scene/mod.d.ts.map +1 -0
- package/dist/src/screen/mod.d.ts +1 -0
- package/dist/src/screen/mod.d.ts.map +1 -0
- package/dist/src/screen/resolution.d.ts +4 -0
- package/dist/src/screen/resolution.d.ts.map +1 -0
- package/dist/src/shaders/EngineUniform.d.ts +8 -0
- package/dist/src/shaders/EngineUniform.d.ts.map +1 -0
- package/dist/src/shaders/IShader.d.ts +14 -0
- package/dist/src/shaders/IShader.d.ts.map +1 -0
- package/dist/src/shaders/QuadShader.d.ts +17 -0
- package/dist/src/shaders/QuadShader.d.ts.map +1 -0
- package/dist/src/shaders/ShaderDescriptor.d.ts +6 -0
- package/dist/src/shaders/ShaderDescriptor.d.ts.map +1 -0
- package/dist/src/shaders/mod.d.ts +5 -0
- package/dist/src/shaders/mod.d.ts.map +1 -0
- package/dist/src/shaders/parser.d.ts +7 -0
- package/dist/src/shaders/parser.d.ts.map +1 -0
- package/dist/src/shaders/postprocess/blur.d.ts +2 -0
- package/dist/src/shaders/postprocess/mod.d.ts +16 -0
- package/dist/src/shaders/postprocess/postprocess.d.ts +8 -0
- package/dist/src/shaders/postprocess/util.d.ts +2 -0
- package/dist/src/shaders/samplers.d.ts +2 -0
- package/dist/src/shaders/samplers.d.ts.map +1 -0
- package/dist/src/shaders/wgsl/example.wgsl.d.ts +2 -0
- package/dist/src/shaders/wgsl/example.wgsl.d.ts.map +1 -0
- package/dist/src/shaders/wgsl/hello.wgsl.d.ts +2 -0
- package/dist/src/shaders/wgsl/hello.wgsl.d.ts.map +1 -0
- package/dist/src/shaders/wgsl/helloInstanced.wgsl.d.ts +2 -0
- package/dist/src/shaders/wgsl/helloInstanced.wgsl.d.ts.map +1 -0
- package/dist/src/shaders/wgsl/quad.wgsl.d.ts +2 -0
- package/dist/src/shaders/wgsl/quad.wgsl.d.ts.map +1 -0
- package/dist/src/text/FontPipeline.d.ts +13 -0
- package/dist/src/text/FontPipeline.d.ts.map +1 -0
- package/dist/src/text/MsdfFont.d.ts +81 -0
- package/dist/src/text/MsdfFont.d.ts.map +1 -0
- package/dist/src/text/TextFormatting.d.ts +18 -0
- package/dist/src/text/TextFormatting.d.ts.map +1 -0
- package/dist/src/text/TextNode.d.ts +18 -0
- package/dist/src/text/TextNode.d.ts.map +1 -0
- package/dist/src/text/TextShader.d.ts +14 -0
- package/dist/src/text/TextShader.d.ts.map +1 -0
- package/dist/src/text/mod.d.ts +3 -0
- package/dist/src/text/mod.d.ts.map +1 -0
- package/dist/src/text/shaping.d.ts +38 -0
- package/dist/src/text/shaping.d.ts.map +1 -0
- package/dist/src/text/text.wgsl.d.ts +2 -0
- package/dist/src/text/text.wgsl.d.ts.map +1 -0
- package/dist/src/textures/AssetManager.d.ts +181 -0
- package/dist/src/textures/AssetManager.d.ts.map +1 -0
- package/dist/src/textures/NewTextureComputeShader.d.ts +28 -0
- package/dist/src/textures/TextureComputeShader.d.ts +20 -0
- package/dist/src/textures/TextureComputeShader.d.ts.map +1 -0
- package/dist/src/textures/crop.wgsl.d.ts +2 -0
- package/dist/src/textures/mod.d.ts +1 -0
- package/dist/src/textures/mod.d.ts.map +1 -0
- package/dist/src/textures/pixel-scraping.wgsl.d.ts +2 -0
- package/dist/src/textures/pixel-scraping.wgsl.d.ts.map +1 -0
- package/dist/src/textures/texture-processing.wgsl.d.ts +2 -0
- package/dist/src/textures/types.d.ts +176 -0
- package/dist/src/textures/types.d.ts.map +1 -0
- package/dist/src/textures/util.d.ts +7 -0
- package/dist/src/textures/util.d.ts.map +1 -0
- package/dist/src/utils/assert.d.ts +1 -0
- package/dist/src/utils/assert.d.ts.map +1 -0
- package/dist/src/utils/boilerplate.d.ts +10 -0
- package/dist/src/utils/boilerplate.d.ts.map +1 -0
- package/dist/src/utils/error.d.ts +7 -0
- package/dist/src/utils/error.d.ts.map +1 -0
- package/dist/src/utils/mod.d.ts +2 -0
- package/dist/src/utils/mod.d.ts.map +1 -0
- package/dist/src/utils/pool.d.ts +22 -0
- package/dist/src/utils/pool.d.ts.map +1 -0
- package/dist/test/math/matrix.test.d.ts +1 -0
- package/dist/test/scene/Batcher.test.d.ts +1 -0
- package/dist/test/scene/SceneNode.test.d.ts +1 -0
- package/dist/test/shader/parser.test.d.ts +1 -0
- package/dist/text/FontPipeline.d.ts +14 -0
- package/dist/text/FontPipeline.d.ts.map +1 -0
- package/dist/text/MsdfFont.d.ts +82 -0
- package/dist/text/MsdfFont.d.ts.map +1 -0
- package/dist/text/TextFormatting.d.ts +19 -0
- package/dist/text/TextFormatting.d.ts.map +1 -0
- package/dist/text/TextNode.d.ts +19 -0
- package/dist/text/TextNode.d.ts.map +1 -0
- package/dist/text/TextShader.d.ts +15 -0
- package/dist/text/TextShader.d.ts.map +1 -0
- package/dist/text/mod.d.ts +4 -0
- package/dist/text/mod.d.ts.map +1 -0
- package/dist/text/shaping.d.ts +39 -0
- package/dist/text/shaping.d.ts.map +1 -0
- package/dist/text/text.wgsl.d.ts +3 -0
- package/dist/text/text.wgsl.d.ts.map +1 -0
- package/dist/textures/AssetManager.d.ts +182 -0
- package/dist/textures/AssetManager.d.ts.map +1 -0
- package/dist/textures/TextureComputeShader.d.ts +21 -0
- package/dist/textures/TextureComputeShader.d.ts.map +1 -0
- package/dist/textures/mod.d.ts +2 -0
- package/dist/textures/mod.d.ts.map +1 -0
- package/dist/textures/pixel-scraping.wgsl.d.ts +3 -0
- package/dist/textures/pixel-scraping.wgsl.d.ts.map +1 -0
- package/dist/textures/types.d.ts +177 -0
- package/dist/textures/types.d.ts.map +1 -0
- package/dist/textures/util.d.ts +8 -0
- package/dist/textures/util.d.ts.map +1 -0
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.d.ts.map +1 -0
- package/dist/utils/boilerplate.d.ts +11 -0
- package/dist/utils/boilerplate.d.ts.map +1 -0
- package/dist/utils/error.d.ts +8 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/mod.d.ts +3 -0
- package/dist/utils/mod.d.ts.map +1 -0
- package/dist/utils/pool.d.ts +23 -0
- package/dist/utils/pool.d.ts.map +1 -0
- package/package.json +47 -0
- package/src/Toodle.ts +853 -0
- package/src/colors/mod.ts +151 -0
- package/src/coreTypes/Color.ts +1 -0
- package/src/coreTypes/Point.ts +7 -0
- package/src/coreTypes/Size.ts +4 -0
- package/src/coreTypes/Transform.ts +16 -0
- package/src/coreTypes/Vec2.ts +7 -0
- package/src/coreTypes/mod.ts +5 -0
- package/src/globals.d.ts +4 -0
- package/src/limits.ts +23 -0
- package/src/math/angle.ts +17 -0
- package/src/math/matrix.ts +99 -0
- package/src/math/mod.ts +2 -0
- package/src/mod.ts +22 -0
- package/src/scene/Batcher.ts +61 -0
- package/src/scene/Camera.ts +69 -0
- package/src/scene/JumboQuadNode.ts +219 -0
- package/src/scene/QuadNode.ts +403 -0
- package/src/scene/RenderComponent.ts +12 -0
- package/src/scene/SceneNode.ts +668 -0
- package/src/scene/mod.ts +4 -0
- package/src/screen/mod.ts +1 -0
- package/src/screen/resolution.ts +1 -0
- package/src/shaders/EngineUniform.ts +11 -0
- package/src/shaders/IShader.ts +20 -0
- package/src/shaders/QuadShader.ts +288 -0
- package/src/shaders/ShaderDescriptor.ts +6 -0
- package/src/shaders/mod.ts +5 -0
- package/src/shaders/parser.ts +221 -0
- package/src/shaders/postprocess/blur.ts +245 -0
- package/src/shaders/postprocess/mod.ts +71 -0
- package/src/shaders/samplers.ts +13 -0
- package/src/shaders/wgsl/example.wgsl.ts +24 -0
- package/src/shaders/wgsl/hello.wgsl.ts +62 -0
- package/src/shaders/wgsl/helloInstanced.wgsl.ts +46 -0
- package/src/shaders/wgsl/quad.wgsl.ts +140 -0
- package/src/text/FontPipeline.ts +212 -0
- package/src/text/MsdfFont.ts +190 -0
- package/src/text/TextFormatting.ts +28 -0
- package/src/text/TextNode.ts +82 -0
- package/src/text/TextShader.ts +223 -0
- package/src/text/mod.ts +8 -0
- package/src/text/shaping.ts +280 -0
- package/src/text/text.wgsl.ts +149 -0
- package/src/textures/AssetManager.ts +746 -0
- package/src/textures/TextureComputeShader.ts +434 -0
- package/src/textures/mod.ts +1 -0
- package/src/textures/pixel-scraping.wgsl.ts +131 -0
- package/src/textures/types.ts +182 -0
- package/src/textures/util.ts +352 -0
- package/src/utils/assert.ts +5 -0
- package/src/utils/boilerplate.ts +110 -0
- package/src/utils/error.ts +14 -0
- package/src/utils/mod.ts +2 -0
- package/src/utils/pool.ts +42 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { Point } from "../coreTypes/Point";
|
|
2
|
+
import type { Size } from "../coreTypes/Size";
|
|
3
|
+
import type { Transform } from "../coreTypes/Transform";
|
|
4
|
+
import type { Vec2 } from "../coreTypes/Vec2";
|
|
5
|
+
import type { RenderComponent } from "./RenderComponent";
|
|
6
|
+
/**
|
|
7
|
+
* A node in the scene graph.
|
|
8
|
+
*
|
|
9
|
+
* This is a base class and is fairly low level. You will probably want to interact with
|
|
10
|
+
* the wrapper classes {@link Toodle['Node']} or {@link Toodle['Quad']} instead.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SceneNode {
|
|
13
|
+
#private;
|
|
14
|
+
static nextId: number;
|
|
15
|
+
id: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
constructor(opts?: NodeOptions);
|
|
18
|
+
/**
|
|
19
|
+
* Add a child node and return the child node with this node set as its parent.
|
|
20
|
+
*/
|
|
21
|
+
add<T extends SceneNode>(kid: T, index?: number): T;
|
|
22
|
+
/**
|
|
23
|
+
* Returns an array of the node's immediate kids.
|
|
24
|
+
*
|
|
25
|
+
* Note that these will be returned with a `SceneNode` type, but can be narrowed if you know the type of them,
|
|
26
|
+
* for eg:
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* for (const kid of node.kids) {
|
|
30
|
+
* if (kid instanceof Scene.QuadNode) {
|
|
31
|
+
* console.log(kid.color)
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* if (kid instanceof Text.TextNode) {
|
|
35
|
+
* console.log(kid.text)
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
get kids(): SceneNode[];
|
|
41
|
+
/**
|
|
42
|
+
* The children of the node. Alias for {@link SceneNode.kids}.
|
|
43
|
+
*/
|
|
44
|
+
get children(): SceneNode[];
|
|
45
|
+
/**
|
|
46
|
+
* Returns a reference to the node's transform.
|
|
47
|
+
*
|
|
48
|
+
* Do not edit this transform directly as it won't invalidate cache's correctly.
|
|
49
|
+
* Instead, use convenience properties {@link SceneNode.position}, {@link SceneNode.scale}, and {@link SceneNode.rotation}.
|
|
50
|
+
*/
|
|
51
|
+
get transform(): Transform;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the key of the node as set when the node was created.
|
|
54
|
+
*
|
|
55
|
+
* This key can be used to reference the node from an external lookup system.
|
|
56
|
+
*/
|
|
57
|
+
get key(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the parent node. See https://toodle.gg/f849595b3ed13fc956fc1459a5cb5f0228f9d259/examples/transforms.html
|
|
60
|
+
*/
|
|
61
|
+
get parent(): SceneNode | null;
|
|
62
|
+
set position(value: Point);
|
|
63
|
+
/**
|
|
64
|
+
* Position of the node in local space. For world space, use {@link SceneNode.bounds}.
|
|
65
|
+
*/
|
|
66
|
+
get position(): Point;
|
|
67
|
+
set x(value: number);
|
|
68
|
+
/**
|
|
69
|
+
* The local x coordinate of the node.
|
|
70
|
+
*/
|
|
71
|
+
get x(): number;
|
|
72
|
+
set y(value: number);
|
|
73
|
+
/**
|
|
74
|
+
* The local y coordinate of the node.
|
|
75
|
+
*/
|
|
76
|
+
get y(): number;
|
|
77
|
+
set rotation(value: number);
|
|
78
|
+
/**
|
|
79
|
+
* The rotation of the node in degrees.
|
|
80
|
+
* For radians, see {@link SceneNode.rotationRadians}.
|
|
81
|
+
*/
|
|
82
|
+
get rotation(): number;
|
|
83
|
+
/**
|
|
84
|
+
* The rotation of the node in radians.
|
|
85
|
+
* For degrees, see {@link SceneNode.rotation}.
|
|
86
|
+
*/
|
|
87
|
+
get rotationRadians(): number;
|
|
88
|
+
set rotationRadians(value: number);
|
|
89
|
+
/**
|
|
90
|
+
* The scale of the node. See https://toodle.gg/f849595b3ed13fc956fc1459a5cb5f0228f9d259/examples/quad-size-scale.html
|
|
91
|
+
*/
|
|
92
|
+
get scale(): Vec2;
|
|
93
|
+
set scale(value: Vec2 | number);
|
|
94
|
+
set idealSize(value: Size | null);
|
|
95
|
+
/**
|
|
96
|
+
* The size of the node. See https://toodle.gg/f849595b3ed13fc956fc1459a5cb5f0228f9d259/examples/quad-size-scale.html
|
|
97
|
+
*/
|
|
98
|
+
get size(): Size | null;
|
|
99
|
+
/**
|
|
100
|
+
* The aspect ratio of the node.
|
|
101
|
+
* If the node has no defined size, the aspect ratio will be 1.
|
|
102
|
+
*/
|
|
103
|
+
get aspectRatio(): number;
|
|
104
|
+
/**
|
|
105
|
+
* isActive is a boolean that determines if the node is active.
|
|
106
|
+
* If a node is not active, it will not be drawn.
|
|
107
|
+
* If any of a node's ancestors are not active, the node will not be active.
|
|
108
|
+
*/
|
|
109
|
+
get isActive(): boolean;
|
|
110
|
+
set isActive(value: boolean);
|
|
111
|
+
/**
|
|
112
|
+
* Nodes are batched for drawing based on their layer. Each layer will submit a separate draw call.
|
|
113
|
+
* Nodes with the same layer will be drawn in the order they are drawn with toodle.Draw
|
|
114
|
+
* Nodes with a higher layer will be drawn on top of nodes with a lower layer.
|
|
115
|
+
*/
|
|
116
|
+
get layer(): number;
|
|
117
|
+
/**
|
|
118
|
+
* Returns true if the node has an explicit layer set.
|
|
119
|
+
*
|
|
120
|
+
* If the node does not have an explicit layer but one of its ancestors does,
|
|
121
|
+
* its layer will be inherited from its parent.
|
|
122
|
+
*/
|
|
123
|
+
get hasExplicitLayer(): boolean;
|
|
124
|
+
set layer(value: number);
|
|
125
|
+
get renderComponent(): RenderComponent | null;
|
|
126
|
+
/**
|
|
127
|
+
* This is the model matrix of the node. See https://webgpufundamentals.org/webgpu/lessons/webgpu-matrix-math.html for more information.
|
|
128
|
+
*
|
|
129
|
+
* Do not edit this matrix directly as it is derived from the node's transform and will be overwritten.
|
|
130
|
+
*/
|
|
131
|
+
get matrix(): Float32Array;
|
|
132
|
+
/**
|
|
133
|
+
* Get the bounds of the node in world space
|
|
134
|
+
*/
|
|
135
|
+
get bounds(): Bounds;
|
|
136
|
+
/**
|
|
137
|
+
* Set the bounds of the node in world space.
|
|
138
|
+
*/
|
|
139
|
+
setBounds(bounds: Partial<Bounds>): this;
|
|
140
|
+
/**
|
|
141
|
+
* Set the left edge of the node in world space.
|
|
142
|
+
*/
|
|
143
|
+
set left(value: number);
|
|
144
|
+
/**
|
|
145
|
+
* Set the bottom edge of the node in world space.
|
|
146
|
+
*/
|
|
147
|
+
set bottom(value: number);
|
|
148
|
+
/**
|
|
149
|
+
* Set the top edge of the node in world space.
|
|
150
|
+
*/
|
|
151
|
+
set top(value: number);
|
|
152
|
+
/**
|
|
153
|
+
* Set the right edge of the node in world space.
|
|
154
|
+
*/
|
|
155
|
+
set right(value: number);
|
|
156
|
+
/**
|
|
157
|
+
* Set the center x of the node in world space.
|
|
158
|
+
*/
|
|
159
|
+
set centerX(value: number);
|
|
160
|
+
/**
|
|
161
|
+
* Set the center y of the node in world space.
|
|
162
|
+
*/
|
|
163
|
+
set centerY(value: number);
|
|
164
|
+
/**
|
|
165
|
+
* Removes references to this node and all of its children.
|
|
166
|
+
*
|
|
167
|
+
* Call this to remove a node from a parent's tree and before garbage collection to prevent a node from being retained.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
*
|
|
171
|
+
* const parent = toodle.Node();
|
|
172
|
+
* const child = toodle.Quad();
|
|
173
|
+
* const grandchild = toodle.Quad();
|
|
174
|
+
*
|
|
175
|
+
* parent.add(child);
|
|
176
|
+
* child.add(grandchild);
|
|
177
|
+
*
|
|
178
|
+
* // Will delete `child` and `grandchild`
|
|
179
|
+
* child.delete();
|
|
180
|
+
*/
|
|
181
|
+
delete(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Remove any child node from this node. Warns if the child is not found.
|
|
184
|
+
*
|
|
185
|
+
* The node will still exist as an orphaned node and can still be passed to toodle.Draw or added to another parent.
|
|
186
|
+
*
|
|
187
|
+
* Alternatively, calling `node.delete()` on the child will remove it and set it to inactive.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* const parent = toodle.Node();
|
|
191
|
+
* const child = toodle.Quad();
|
|
192
|
+
* const grandchild = toodle.Quad();
|
|
193
|
+
*
|
|
194
|
+
* parent.add(child);
|
|
195
|
+
* child.add(grandchild);
|
|
196
|
+
*
|
|
197
|
+
* parent.remove(child);
|
|
198
|
+
*/
|
|
199
|
+
remove(kid: SceneNode): void;
|
|
200
|
+
/**
|
|
201
|
+
* This marks the node as dirty, invalidating its cache and causing its matrix to be recalculated.
|
|
202
|
+
* This should not be necessary to call directly, but is available for advanced use cases.
|
|
203
|
+
*/
|
|
204
|
+
setDirty(): void;
|
|
205
|
+
/**
|
|
206
|
+
* Parse a node and its descendants from a JSON string.
|
|
207
|
+
* Can be used for deserialization from a file or other source.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
*
|
|
211
|
+
* const node = new Node();
|
|
212
|
+
* const json = JSON.stringify(node);
|
|
213
|
+
* const clonedNode = Node.parse(json);
|
|
214
|
+
*/
|
|
215
|
+
static parse(json: string): SceneNode;
|
|
216
|
+
/**
|
|
217
|
+
* This method usually is not called directly. It will be called automatically by `JSON.stringify`,
|
|
218
|
+
* see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description
|
|
219
|
+
* and {@link SceneNode.parse}.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
*
|
|
223
|
+
* const node = new Node();
|
|
224
|
+
* const json = JSON.stringify(node); // calls toJSON()
|
|
225
|
+
* console.log(json)
|
|
226
|
+
*/
|
|
227
|
+
toJSON(): {
|
|
228
|
+
id: number;
|
|
229
|
+
label: string | undefined;
|
|
230
|
+
transform: Transform;
|
|
231
|
+
layer: number | null;
|
|
232
|
+
isActive: boolean;
|
|
233
|
+
kids: SceneNode[];
|
|
234
|
+
render: RenderComponent | null;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
export type NodeOptions = {
|
|
238
|
+
/** The unique identifier for the node. */
|
|
239
|
+
id?: number;
|
|
240
|
+
/** The label for the node. */
|
|
241
|
+
label?: string;
|
|
242
|
+
/** The layer for the node. */
|
|
243
|
+
layer?: number;
|
|
244
|
+
/** The rotation for the node in degrees. Cannot be used with `rotationRadians`. */
|
|
245
|
+
rotation?: number;
|
|
246
|
+
/** The rotation for the node in radians. Cannot be used with `rotation`. */
|
|
247
|
+
rotationRadians?: number;
|
|
248
|
+
/** The position for the node. */
|
|
249
|
+
position?: Point;
|
|
250
|
+
/** The scale for the node. */
|
|
251
|
+
scale?: Vec2 | number;
|
|
252
|
+
/** The desired size for the node. */
|
|
253
|
+
idealSize?: Size;
|
|
254
|
+
/** The active state for the node. */
|
|
255
|
+
isActive?: boolean;
|
|
256
|
+
/** The kids for the node. */
|
|
257
|
+
kids?: SceneNode[];
|
|
258
|
+
/** The render component for the node. */
|
|
259
|
+
render?: RenderComponent;
|
|
260
|
+
/** Flip the node horizontally. */
|
|
261
|
+
flipX?: boolean;
|
|
262
|
+
/** Flip the node vertically. */
|
|
263
|
+
flipY?: boolean;
|
|
264
|
+
/** A string key for the node - can be used to reference the node from an external lookup system */
|
|
265
|
+
key?: string;
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Bounds represent a bounding box of a rectangle in world space
|
|
269
|
+
*/
|
|
270
|
+
export type Bounds = {
|
|
271
|
+
/**
|
|
272
|
+
* for an axis-aligned rectangle, top is the top edge.
|
|
273
|
+
* for a rotated rectangle, it is the topmost point
|
|
274
|
+
*/
|
|
275
|
+
top: number;
|
|
276
|
+
/**
|
|
277
|
+
* for an axis-aligned rectangle, left is the left edge.
|
|
278
|
+
* for a rotated rectangle, it is the leftmost point
|
|
279
|
+
*/
|
|
280
|
+
left: number;
|
|
281
|
+
/**
|
|
282
|
+
* for an axis-aligned rectangle, right is the right edge.
|
|
283
|
+
* for a rotated rectangle, it is the rightmost point
|
|
284
|
+
*/
|
|
285
|
+
right: number;
|
|
286
|
+
/**
|
|
287
|
+
* for an axis-aligned rectangle, bottom is the bottom edge.
|
|
288
|
+
* for a rotated rectangle, it is the bottommost point
|
|
289
|
+
*/
|
|
290
|
+
bottom: number;
|
|
291
|
+
/**
|
|
292
|
+
* the center x of the node in world space
|
|
293
|
+
*/
|
|
294
|
+
x: number;
|
|
295
|
+
/**
|
|
296
|
+
* the center y of the node in world space
|
|
297
|
+
*/
|
|
298
|
+
y: number;
|
|
299
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SceneNode.d.ts","sourceRoot":"","sources":["../../../src/scene/SceneNode.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/scene/mod.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./resolution";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/screen/mod.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../src/screen/resolution.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineUniform.d.ts","sourceRoot":"","sources":["../../../src/shaders/EngineUniform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,IAAI,CAAC;CAG5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SceneNode } from "../scene/SceneNode";
|
|
2
|
+
import type { EngineUniform } from "./EngineUniform";
|
|
3
|
+
export interface IShader {
|
|
4
|
+
startFrame: (device: GPUDevice, uniform: EngineUniform) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Process a batch of nodes.
|
|
7
|
+
*
|
|
8
|
+
* @param renderPass - The render pass to use.
|
|
9
|
+
* @param nodes - The nodes to process.
|
|
10
|
+
* @returns The number of draw calls made.
|
|
11
|
+
*/
|
|
12
|
+
processBatch: (renderPass: GPURenderPassEncoder, nodes: SceneNode[]) => number;
|
|
13
|
+
endFrame: () => void;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IShader.d.ts","sourceRoot":"","sources":["../../../src/shaders/IShader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAEhE;;;;;;OAMG;IACH,YAAY,EAAE,CACZ,UAAU,EAAE,oBAAoB,EAChC,KAAK,EAAE,SAAS,EAAE,KACf,MAAM,CAAC;IAEZ,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SceneNode } from "../scene/SceneNode";
|
|
2
|
+
import type { AssetManager } from "../textures/AssetManager";
|
|
3
|
+
import type { EngineUniform } from "./EngineUniform";
|
|
4
|
+
import type { IShader } from "./IShader";
|
|
5
|
+
export type QuadShaderOpts = {
|
|
6
|
+
assetManager?: AssetManager;
|
|
7
|
+
blendMode?: GPUBlendState;
|
|
8
|
+
};
|
|
9
|
+
export declare class QuadShader implements IShader {
|
|
10
|
+
#private;
|
|
11
|
+
label: string;
|
|
12
|
+
code: string;
|
|
13
|
+
startFrame(device: GPUDevice, uniform: EngineUniform): void;
|
|
14
|
+
processBatch(renderPass: GPURenderPassEncoder, nodes: SceneNode[]): number;
|
|
15
|
+
endFrame(): void;
|
|
16
|
+
constructor(label: string, assetManager: AssetManager, device: GPUDevice, presentationFormat: GPUTextureFormat, userCode: string, instanceCount: number, blendMode?: GPUBlendState, sampleType?: "linear" | "nearest");
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuadShader.d.ts","sourceRoot":"","sources":["../../../src/shaders/QuadShader.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAQ7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,qBAAa,UAAW,YAAW,OAAO;;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IAWb,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa;IAiBpD,YAAY,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,EAAE;IAiDjE,QAAQ;gBAGN,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,SAAS,EACjB,kBAAkB,EAAE,gBAAgB,EACpC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,aAAa,EACzB,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS;CA0GpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShaderDescriptor.d.ts","sourceRoot":"","sources":["../../../src/shaders/ShaderDescriptor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/shaders/mod.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type StructInfo } from "wgsl_reflect";
|
|
2
|
+
import type { ShaderDescriptor } from "./ShaderDescriptor";
|
|
3
|
+
export declare function codeWithLineNumbers(code: string): string;
|
|
4
|
+
export declare function combineShaderCode(label: string, base: string, mod: string): ShaderDescriptor;
|
|
5
|
+
export declare function struct2BufferLayout(struct: StructInfo, stepMode?: GPUVertexStepMode): GPUVertexBufferLayout;
|
|
6
|
+
export declare function validateFragmentShader(shaderCode: string): void;
|
|
7
|
+
export declare function getGpuFormat(typeName: string): GPUVertexFormat;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/shaders/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,UAK/C;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,GACV,gBAAgB,CA4ClB;AAuED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,UAAU,EAClB,QAAQ,GAAE,iBAA8B,GACvC,qBAAqB,CAkDvB;AAED,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,QAaxD;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAqB9D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type PostProcess = {
|
|
2
|
+
/**
|
|
3
|
+
* A post-processor modifies the current render before it is presented to the screen.
|
|
4
|
+
*
|
|
5
|
+
* @param encoder - a GPUCommandEncoder used to create render passes
|
|
6
|
+
* @param pingpong - a pair of GPUTextures used for ping-pong rendering
|
|
7
|
+
* @param screen - the final screen GPUTexture to render to
|
|
8
|
+
*/
|
|
9
|
+
process(queue: GPUQueue, encoder: GPUCommandEncoder, pingpong: [GPUTexture, GPUTexture], screen: GPUTexture): void;
|
|
10
|
+
};
|
|
11
|
+
export declare const PostProcessDefaults: {
|
|
12
|
+
readonly sampler: (device: GPUDevice) => GPUSampler;
|
|
13
|
+
readonly vertexBufferLayout: (device: GPUDevice) => GPUVertexBufferLayout;
|
|
14
|
+
readonly vertexShader: (device: GPUDevice) => GPUShaderModule;
|
|
15
|
+
readonly pipelineDescriptor: (device: GPUDevice) => GPURenderPipelineDescriptor;
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Color } from "../../coreTypes/Color";
|
|
2
|
+
export type ScreenShaderDefinition = {
|
|
3
|
+
pipeline: GPURenderPipeline;
|
|
4
|
+
bindGroups: GPUBindGroup[];
|
|
5
|
+
};
|
|
6
|
+
export declare function postProcess(encoder: GPUCommandEncoder, context: GPUCanvasContext, device: GPUDevice, clearColor: Color, presentationFormat: GPUTextureFormat, pingpong: [GPUTexture, GPUTexture]): void;
|
|
7
|
+
export declare function none(device: GPUDevice, presentationFormat: GPUTextureFormat, pingpong: [GPUTexture, GPUTexture]): ScreenShaderDefinition;
|
|
8
|
+
export declare function crtScanLines(device: GPUDevice, presentationFormat: GPUTextureFormat, pingpong: [GPUTexture, GPUTexture]): ScreenShaderDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"samplers.d.ts","sourceRoot":"","sources":["../../../src/shaders/samplers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,EAAE,oBAK7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,oBAK3B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\nstruct MyStuff {\n red: f32,\n}\n\n@vertex\nfn vert(\n @builtin(vertex_index) VertexIndex: u32,\n @builtin(instance_index) InstanceIndex: u32,\n instance: InstanceData\n) -> VertexOutput {\n var output = default_vertex_shader(VertexIndex, InstanceIndex, instance);\n return output;\n}\n\n@fragment\nfn frag(vertex: VertexOutput) -> @location(0) vec4f {\n let color = default_fragment_shader(vertex);\n color.r = vertex.myStuff_red;\n return color;\n}\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.wgsl.d.ts","sourceRoot":"","sources":["../../../../src/shaders/wgsl/example.wgsl.ts"],"names":[],"mappings":";AAEA,wBAqBE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n\n//\n// SECTION: Struct Definitions\n//\n\nstruct InstanceData {}\n\n\nstruct VertexInput {\n @builtin(vertex_index) vertexIndex: u32,\n @builtin(instance_index) instanceIndex: u32,\n}\n\nstruct VertexOutput {\n @builtin(position) engine_clip_position : vec4<f32>,\n}\n\nstruct FragmentInput {\n @builtin(position) engine_clip_position : vec4<f32>,\n}\n\nstruct FragmentOutput {\n color: vec4<f32>,\n}\n\n//\n// SECTION: Base Entrypoints\n//\n\n@vertex\nfn base_vertex_entrypoint(input: VertexInput) -> VertexOutput {\n return default_vertex_shader(input);\n}\n\n@fragment\nfn base_fragment_entrypoint(vertex: VertexOutput) -> @location(0) vec4<f32> {\n let output = base_fragment_shader(vertex);\n return output.color;\n}\n\n//\n// SECTION: Base Shaders\n//\n\nconst pos = array(vec2f(-1, -1), vec2f(1, -1), vec2f(-1, 1), vec2f(1, 1));\n\nfn base_vertex_shader(input: VertexInput) -> VertexOutput {\n var output : VertexOutput;\n output.engine_clip_position = vec4f(pos[input.vertexIndex], 0.0, 1.0);\n return output;\n}\n\nfn base_fragment_shader(vertex: VertexOutput) -> FragmentOutput {\n var output : FragmentOutput;\n output.color = vec4f(1.0, 0.0, 1.0, 1.0);\n return output;\n}\n\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hello.wgsl.d.ts","sourceRoot":"","sources":["../../../../src/shaders/wgsl/hello.wgsl.ts"],"names":[],"mappings":";AAEA,wBA2DE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\n// const pos = array(vec2f(-0.5, -0.5), vec2f(0.5, -0.5), vec2f(-0.5, 0.5), vec2f(0.5, 0.5));\nconst pos = array(vec2f(-0.5, 0.5), vec2f(-0.5, -0.5), vec2f(0.5, 0.5), vec2f(0.5, -0.5));\n\nstruct InstanceData {\n @location(0) model0: vec4<f32>,\n @location(1) model1: vec4<f32>,\n @location(2) model2: vec4<f32>,\n @location(3) color: vec4<f32>,\n}\nstruct VertexOutput {\n @builtin(position) engine_clip_position : vec4<f32>,\n @location(0) @interpolate(flat) color: vec4<f32>,\n}\n\nstruct EngineUniform {\n viewProjection: mat3x3<f32>,\n};\n\n@group(0) @binding(0) var<uniform> engineUniform: EngineUniform;\n\n\n// this is the vertex shader\n@vertex\nfn vs(\n @builtin(vertex_index) VertexIndex : u32,\n @builtin(instance_index) InstanceIndex: u32, // Instance ID for each instance\n instanceData: InstanceData,\n) -> VertexOutput {\n var output : VertexOutput;\n let modelMatrix = mat3x3(instanceData.model0.xyz, instanceData.model1.xyz, instanceData.model2.xyz);\n let worldPosition = engineUniform.viewProjection * modelMatrix * vec3f(pos[VertexIndex], 1.0);\n\n output.engine_clip_position = vec4f(worldPosition, 1.0);\n output.color = instanceData.color;\n return output;\n}\n\n// this is the fragment shader\n@fragment\nfn fs(vertex: VertexOutput) -> @location(0) vec4<f32> {\n return vertex.color;\n}\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helloInstanced.wgsl.d.ts","sourceRoot":"","sources":["../../../../src/shaders/wgsl/helloInstanced.wgsl.ts"],"names":[],"mappings":";AAEA,wBA2CE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "\nstruct InstanceData {\n // location 0-2 are the model matrix for this instanced quad\n @location(0) model0: vec4<f32>,\n @location(1) model1: vec4<f32>,\n @location(2) model2: vec4<f32>,\n // location 3 is the tint - the color will be multiplied by the texture color to determine the pixel color\n @location(3) engine_tint: vec4<f32>,\n // location 4 are the uv offset and scale used to sample the texture atlas. these are in normalized texel coordinates.\n @location(4) uvOffsetAndScale: vec4<f32>,\n // location 5 is the crop offset from center and scale. These are ratios applied to the unit quad.\n @location(5) cropOffsetAndScale: vec4<f32>,\n // location 6 is the atlas index\n @location(6) atlasIndex: u32,\n // @INSTANCE_DATA SNIPPET\n}\n\nstruct VertexInput {\n @builtin(vertex_index) VertexIndex: u32,\n @builtin(instance_index) InstanceIndex: u32,\n instance: InstanceData\n}\n\nstruct VertexOutput {\n @builtin(position) engine_clip_position : vec4<f32>,\n // uv coordinates are stored as two vec2s:\n // [0,1] = atlas uv coords\n // [2,3] = uv scale\n @location(0) engine_uv: vec4<f32>,\n @location(1) @interpolate(flat) engine_tint: vec4<f32>,\n @location(2) @interpolate(flat) engine_atlasIndex: u32,\n // @VERTEX_OUTPUT SNIPPET\n}\n\nstruct EngineUniform {\n viewProjection: mat3x3<f32>,\n resolution: vec2f,\n};\n\n// we can't divide by 2 in the projection matrix because\n// it will affect the positioning as well as the geometry scale\n// so we need to divide by 2 for the initial position scale.\n// for eg a 10x10 quad in the top left of a 100x100 logical canvas with a 200x200 natural size\n// will be passed in as\n// position=[-45, 45]\n// scale=[10,10]\n// so the top left corner will be: (-0.5 * 10 - 45) * 2 / 100 = -1\n// if the top left vertex was -1, it would be: (-1 * 10 - 45) * 2 / 100 = -1.1\nconst enginePosLookup = array(vec2f(-0.5, 0.5), vec2f(-0.5, -0.5), vec2f(0.5, 0.5), vec2f(0.5, -0.5));\nconst engineUvLookup = array(vec2f(0, 0), vec2f(0, 1), vec2f(1, 0), vec2f(1, 1));\n\n@group(0) @binding(0) var<uniform> engineUniform: EngineUniform;\n@group(0) @binding(1) var linearSampler: sampler;\n@group(0) @binding(2) var nearestSampler: sampler;\n\n@group(1) @binding(0) var textureArray: texture_2d_array<f32>;\n\n@vertex\nfn engine_vs(\n @builtin(vertex_index) VertexIndex: u32,\n @builtin(instance_index) InstanceIndex: u32,\n instance: InstanceData\n) -> VertexOutput {\n var output = default_vertex_shader(VertexIndex, InstanceIndex,instance);\n return output;\n}\n\n@fragment\nfn engine_fs(vertex: VertexOutput) -> @location(0) vec4<f32> {\n return default_fragment_shader(vertex, nearestSampler);\n}\n\nfn default_vertex_shader(\n VertexIndex: u32,\n InstanceIndex: u32,\n instance: InstanceData\n) -> VertexOutput {\n var output : VertexOutput;\n output.engine_tint = instance.engine_tint;\n\n // reconstruct the model matrix from the instance data\n // bc we can't pass a mat3x3 as instance data\n let modelMatrix = mat3x3(instance.model0.xyz, instance.model1.xyz, instance.model2.xyz);\n\n // transform the vertex position\n let localPosition = enginePosLookup[VertexIndex];\n let cropOffset = instance.cropOffsetAndScale.xy;\n let cropScale = instance.cropOffsetAndScale.zw;\n let croppedPosition = localPosition * cropScale + cropOffset;\n let worldPosition = modelMatrix * vec3f(croppedPosition, 1.0);\n let clipPosition = engineUniform.viewProjection * worldPosition;\n output.engine_clip_position = vec4f(clipPosition, 1.0);\n\n // set the uv coordinates in the texture atlas.\n let original_uv = engineUvLookup[VertexIndex];\n // uvOffsetAndScale is a vec4 with the following values:\n // [0,1] = uv offset\n // [2,3] = uv scale\n let atlas_uv = original_uv * instance.uvOffsetAndScale.zw * cropScale + instance.uvOffsetAndScale.xy;\n // we also pack the original uv coordinates in the w and z components\n // since these can be useful in the fragment shader\n output.engine_uv = vec4f(atlas_uv, original_uv);\n output.engine_atlasIndex = u32(instance.atlasIndex);\n // @PASSTHROUGH_SNIPPET\n\n return output;\n}\n\nfn default_fragment_shader(vertex: VertexOutput, samp: sampler) -> vec4<f32> {\n let atlas_uv = vertex.engine_uv.xy;\n let original_uv = vertex.engine_uv.zw;\n\n // Force both samplers to be referenced without assignment\n // This prevents WGSLReflect from optimizing them away\n var nope: bool = false;\n if (nope) {\n _ = linearSampler;\n _ = nearestSampler;\n }\n\n let color = textureSample(textureArray, samp, atlas_uv, vertex.engine_atlasIndex);\n\n if (vertex.engine_atlasIndex == 1000u) {\n // rectangle - return a solid color\n return vec4f(1,1,1,1) * vertex.engine_tint;\n } else if (vertex.engine_atlasIndex == 1001u) {\n // circle:\n // edge width is 4 logical pixels\n let edgeWidth = 4. / max(engineUniform.resolution.x, engineUniform.resolution.y);\n // distance from center of the quad ranging from [0,1]\n let centerDistance = 2 * distance(vec2f(0.5, 0.5), original_uv);\n // alpha is 1 before edgeWidth and 0 after edgeWidth\n let alpha = 1. - smoothstep(1. - edgeWidth, 1. + edgeWidth, centerDistance);\n return vec4f(vertex.engine_tint.rgb, alpha * vertex.engine_tint.a);\n } else {\n // texture:\n return color * vertex.engine_tint;\n }\n}\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quad.wgsl.d.ts","sourceRoot":"","sources":["../../../../src/shaders/wgsl/quad.wgsl.ts"],"names":[],"mappings":";AAAA,wBA2IE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MsdfFont } from "./MsdfFont";
|
|
2
|
+
/**
|
|
3
|
+
* A webgpu pipeline for rendering blocks of text with a given font.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FontPipeline {
|
|
6
|
+
pipeline: GPURenderPipeline;
|
|
7
|
+
font: MsdfFont;
|
|
8
|
+
fontBindGroup: GPUBindGroup;
|
|
9
|
+
maxCharCount: number;
|
|
10
|
+
constructor(pipeline: GPURenderPipeline, font: MsdfFont, fontBindGroup: GPUBindGroup, maxCharCount: number);
|
|
11
|
+
static create(device: GPUDevice, font: MsdfFont, colorFormat: GPUTextureFormat, maxCharCount: number): Promise<FontPipeline>;
|
|
12
|
+
}
|
|
13
|
+
export declare function pipelinePromise(device: GPUDevice, colorFormat: GPUTextureFormat, label: string): Promise<GPURenderPipeline>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FontPipeline.d.ts","sourceRoot":"","sources":["../../../src/text/FontPipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C;;GAEG;AACH,qBAAa,YAAY;IAEd,QAAQ,EAAE,iBAAiB;IAC3B,IAAI,EAAE,QAAQ;IACd,aAAa,EAAE,YAAY;IAC3B,YAAY,EAAE,MAAM;gBAHpB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,QAAQ,EACd,aAAa,EAAE,YAAY,EAC3B,YAAY,EAAE,MAAM;WAGhB,MAAM,CACjB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,gBAAgB,EAC7B,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,CAAC;CAuEzB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,gBAAgB,EAC7B,KAAK,EAAE,MAAM,8BA4Cd"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type KerningMap = Map<number, Map<number, number>>;
|
|
2
|
+
export interface MsdfChar {
|
|
3
|
+
id: number;
|
|
4
|
+
index: number;
|
|
5
|
+
char: string;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
xoffset: number;
|
|
9
|
+
yoffset: number;
|
|
10
|
+
xadvance: number;
|
|
11
|
+
chnl: number;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
page: number;
|
|
15
|
+
charIndex: number;
|
|
16
|
+
}
|
|
17
|
+
export declare class MsdfFont {
|
|
18
|
+
#private;
|
|
19
|
+
id: string;
|
|
20
|
+
json: MsdfFontJson;
|
|
21
|
+
imageBitmap: ImageBitmap;
|
|
22
|
+
/** the name of the font */
|
|
23
|
+
name: string;
|
|
24
|
+
/** the set of available characters in the font texture */
|
|
25
|
+
charset: string[];
|
|
26
|
+
charCount: number;
|
|
27
|
+
lineHeight: number;
|
|
28
|
+
/** a binary buffer of character data for loading into the gpu */
|
|
29
|
+
charBuffer: Float32Array;
|
|
30
|
+
constructor(id: string, json: MsdfFontJson, imageBitmap: ImageBitmap);
|
|
31
|
+
getChar(charCode: number): MsdfChar;
|
|
32
|
+
getXAdvance(charCode: number, nextCharCode?: number): number;
|
|
33
|
+
static create(id: string, fontJsonUrl: URL): Promise<MsdfFont>;
|
|
34
|
+
set fallbackCharacter(character: string);
|
|
35
|
+
}
|
|
36
|
+
type MsdfFontJson = {
|
|
37
|
+
pages: string[];
|
|
38
|
+
chars: MsdfChar[];
|
|
39
|
+
info: {
|
|
40
|
+
face: string;
|
|
41
|
+
size: string;
|
|
42
|
+
bold: number;
|
|
43
|
+
italic: number;
|
|
44
|
+
charset: string[];
|
|
45
|
+
unicode: number;
|
|
46
|
+
stretchH: number;
|
|
47
|
+
smooth: number;
|
|
48
|
+
aa: number;
|
|
49
|
+
padding: number[];
|
|
50
|
+
spacing: number[];
|
|
51
|
+
};
|
|
52
|
+
common: {
|
|
53
|
+
lineHeight: number;
|
|
54
|
+
base: number;
|
|
55
|
+
scaleW: number;
|
|
56
|
+
scaleH: number;
|
|
57
|
+
pages: number;
|
|
58
|
+
packed: number;
|
|
59
|
+
alphaChnl: number;
|
|
60
|
+
redChnl: number;
|
|
61
|
+
greenChnl: number;
|
|
62
|
+
blueChnl: number;
|
|
63
|
+
};
|
|
64
|
+
distanceField: {
|
|
65
|
+
fieldType: string;
|
|
66
|
+
distanceRange: number;
|
|
67
|
+
};
|
|
68
|
+
kernings: Kerning[];
|
|
69
|
+
};
|
|
70
|
+
type Kerning = {
|
|
71
|
+
first: number;
|
|
72
|
+
second: number;
|
|
73
|
+
amount: number;
|
|
74
|
+
};
|
|
75
|
+
export declare enum WhitespaceKeyCodes {
|
|
76
|
+
HorizontalTab = 9,
|
|
77
|
+
Newline = 10,
|
|
78
|
+
CarriageReturn = 13,
|
|
79
|
+
Space = 32
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MsdfFont.d.ts","sourceRoot":"","sources":["../../../src/text/MsdfFont.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1D,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,QAAQ;;IAgBV,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,WAAW;IAjBjC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IAEnB,iEAAiE;IACjE,UAAU,EAAE,YAAY,CAAC;gBAOhB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,WAAW;IA0CjC,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ;IAiBnC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,MAAM;WAW3C,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;IAuBpE,IAAI,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAWtC;CACF;AAED,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,aAAa,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,oBAAY,kBAAkB;IAC5B,aAAa,IAAI;IACjB,OAAO,KAAK;IACZ,cAAc,KAAK;IACnB,KAAK,KAAK;CACX"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Color } from "../coreTypes/Color";
|
|
2
|
+
export interface TextFormatting {
|
|
3
|
+
align?: "left" | "right" | "center";
|
|
4
|
+
fontSize?: number;
|
|
5
|
+
color?: Color;
|
|
6
|
+
wordWrap?: WordWrapOptions;
|
|
7
|
+
shrinkToFit?: ShrinkToFitOptions;
|
|
8
|
+
}
|
|
9
|
+
export type WordWrapOptions = {
|
|
10
|
+
emWidth: number;
|
|
11
|
+
breakOn?: "word" | "character";
|
|
12
|
+
};
|
|
13
|
+
export type ShrinkToFitOptions = {
|
|
14
|
+
minFontSize: number;
|
|
15
|
+
maxFontSize?: number;
|
|
16
|
+
maxLines?: number;
|
|
17
|
+
padding?: number;
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFormatting.d.ts","sourceRoot":"","sources":["../../../src/text/TextFormatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,cAAc;IAE7B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAEpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,KAAK,CAAC,EAAE,KAAK,CAAC;IAGd,QAAQ,CAAC,EAAE,eAAe,CAAC;IAG3B,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|