melonjs 19.9.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -14
- package/build/application/application.d.ts +70 -16
- package/build/application/application.d.ts.map +1 -1
- package/build/application/defaultApplicationSettings.d.ts +2 -2
- package/build/application/resize.d.ts.map +1 -1
- package/build/application/settings.d.ts +150 -53
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +1 -1
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/camera3d.d.ts +13 -11
- package/build/camera/camera3d.d.ts.map +1 -1
- package/build/const.d.ts +55 -26
- package/build/const.d.ts.map +1 -1
- package/build/geometries/box3d.d.ts +156 -0
- package/build/geometries/box3d.d.ts.map +1 -0
- package/build/index.d.ts +33 -23
- package/build/index.d.ts.map +1 -1
- package/build/index.js +21696 -7831
- package/build/index.js.map +4 -4
- package/build/lang/deprecated.d.ts +4 -4
- package/build/lang/deprecated.d.ts.map +1 -1
- package/build/level/gltf/GLTFModel.d.ts +4 -0
- package/build/level/gltf/GLTFModel.d.ts.map +1 -1
- package/build/level/gltf/GLTFScene.d.ts +42 -6
- package/build/level/gltf/GLTFScene.d.ts.map +1 -1
- package/build/level/gltf/srgb.d.ts +20 -0
- package/build/level/gltf/srgb.d.ts.map +1 -0
- package/build/level/level.d.ts +21 -2
- package/build/level/level.d.ts.map +1 -1
- package/build/lighting/light3d.d.ts +61 -13
- package/build/lighting/light3d.d.ts.map +1 -1
- package/build/loader/loader.d.ts +49 -21
- package/build/loader/loader.d.ts.map +1 -1
- package/build/loader/parsers/gltf.d.ts.map +1 -1
- package/build/loader/parsers/mtl.d.ts +18 -0
- package/build/loader/parsers/mtl.d.ts.map +1 -1
- package/build/loader/parsers/obj.d.ts +49 -0
- package/build/loader/parsers/obj.d.ts.map +1 -1
- package/build/loader/parsers/pbr.d.ts +63 -0
- package/build/loader/parsers/pbr.d.ts.map +1 -0
- package/build/loader/parsers/shader.d.ts +32 -24
- package/build/loader/parsers/shader.d.ts.map +1 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +3 -1
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/adapter.d.ts +12 -1
- package/build/physics/adapter.d.ts.map +1 -1
- package/build/physics/broadphase/octree.d.ts +35 -0
- package/build/physics/broadphase/octree.d.ts.map +1 -1
- package/build/physics/builtin/body.d.ts +123 -6
- package/build/physics/builtin/body.d.ts.map +1 -1
- package/build/physics/builtin/builtin-adapter.d.ts.map +1 -1
- package/build/physics/builtin/detector.d.ts +12 -0
- package/build/physics/builtin/detector.d.ts.map +1 -1
- package/build/physics/builtin/raycast.d.ts.map +1 -1
- package/build/physics/builtin/sat3d.d.ts +59 -0
- package/build/physics/builtin/sat3d.d.ts.map +1 -0
- package/build/physics/response.d.ts +32 -0
- package/build/physics/response.d.ts.map +1 -1
- package/build/physics/world.d.ts +1 -0
- package/build/physics/world.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -0
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/entity/entity.d.ts.map +1 -1
- package/build/renderable/frameAnimation.d.ts.map +1 -1
- package/build/renderable/groundshadow.d.ts +92 -0
- package/build/renderable/groundshadow.d.ts.map +1 -0
- package/build/renderable/instanced_mesh.d.ts +286 -0
- package/build/renderable/instanced_mesh.d.ts.map +1 -0
- package/build/renderable/mesh.d.ts +242 -23
- package/build/renderable/mesh.d.ts.map +1 -1
- package/build/renderable/nineslicesprite.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +6 -4
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +3 -1
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/sprite3d.d.ts +17 -6
- package/build/renderable/sprite3d.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/bitmaptextdata.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/state/stage.d.ts.map +1 -1
- package/build/system/device.d.ts +11 -40
- package/build/system/device.d.ts.map +1 -1
- package/build/system/platform.d.ts +0 -16
- package/build/system/platform.d.ts.map +1 -1
- package/build/utils/utils.d.ts +2 -0
- package/build/utils/utils.d.ts.map +1 -1
- package/build/video/canvas/canvas_renderer.d.ts +22 -16
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/{webgl/effects → effects}/blur.d.ts +2 -2
- package/build/video/effects/blur.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/chromaticAberration.d.ts +2 -2
- package/build/video/effects/chromaticAberration.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/colorMatrix.d.ts +3 -3
- package/build/video/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/desaturate.d.ts +1 -1
- package/build/video/effects/desaturate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dissolve.d.ts +2 -2
- package/build/video/effects/dissolve.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/dropShadow.d.ts +2 -2
- package/build/video/effects/dropShadow.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/flash.d.ts +2 -2
- package/build/video/effects/flash.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/glow.d.ts +2 -2
- package/build/video/effects/glow.d.ts.map +1 -0
- package/build/video/effects/glsl_realization.d.ts +18 -0
- package/build/video/effects/glsl_realization.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/hologram.d.ts +2 -2
- package/build/video/effects/hologram.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/invert.d.ts +1 -1
- package/build/video/effects/invert.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/outline.d.ts +2 -2
- package/build/video/effects/outline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/pixelate.d.ts +2 -2
- package/build/video/effects/pixelate.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/radialGradient.d.ts +3 -4
- package/build/video/effects/radialGradient.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/scanline.d.ts +2 -2
- package/build/video/effects/scanline.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/sepia.d.ts +1 -1
- package/build/video/effects/sepia.d.ts.map +1 -0
- package/build/video/{webgl → effects}/shadereffect.d.ts +133 -25
- package/build/video/effects/shadereffect.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/shine.d.ts +2 -2
- package/build/video/effects/shine.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/tintPulse.d.ts +2 -2
- package/build/video/effects/tintPulse.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/vignette.d.ts +2 -2
- package/build/video/effects/vignette.d.ts.map +1 -0
- package/build/video/{webgl/effects → effects}/wave.d.ts +2 -2
- package/build/video/effects/wave.d.ts.map +1 -0
- package/build/video/effects/wgsl/layout.d.ts +28 -0
- package/build/video/effects/wgsl/layout.d.ts.map +1 -0
- package/build/video/effects/wgsl/parse.d.ts +9 -0
- package/build/video/effects/wgsl/parse.d.ts.map +1 -0
- package/build/video/effects/wgsl/scaffold.d.ts +43 -0
- package/build/video/effects/wgsl/scaffold.d.ts.map +1 -0
- package/build/video/effects/wgsl_realization.d.ts +83 -0
- package/build/video/effects/wgsl_realization.d.ts.map +1 -0
- package/build/video/gpu/batcher.d.ts +71 -0
- package/build/video/gpu/batcher.d.ts.map +1 -0
- package/build/video/gpu/instancerecord.d.ts +164 -0
- package/build/video/gpu/instancerecord.d.ts.map +1 -0
- package/build/video/gpu/meshchunk.d.ts +49 -0
- package/build/video/gpu/meshchunk.d.ts.map +1 -0
- package/build/video/gpu/meshvertex.d.ts +54 -0
- package/build/video/gpu/meshvertex.d.ts.map +1 -0
- package/build/video/gpu/primitives.d.ts +60 -0
- package/build/video/gpu/primitives.d.ts.map +1 -0
- package/build/video/gpu/quadcorners.d.ts +11 -0
- package/build/video/gpu/quadcorners.d.ts.map +1 -0
- package/build/video/gpu/textureslots.d.ts +122 -0
- package/build/video/gpu/textureslots.d.ts.map +1 -0
- package/build/video/gpu/texturestore.d.ts +139 -0
- package/build/video/gpu/texturestore.d.ts.map +1 -0
- package/build/video/gpu/topology.d.ts +43 -0
- package/build/video/gpu/topology.d.ts.map +1 -0
- package/build/video/gpu/vertexformat.d.ts +72 -0
- package/build/video/gpu/vertexformat.d.ts.map +1 -0
- package/build/video/gradient.d.ts +14 -5
- package/build/video/gradient.d.ts.map +1 -1
- package/build/video/renderer.d.ts +153 -8
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +7 -6
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +2 -2
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -1
- package/build/video/rendertarget/webglrendertarget.d.ts +38 -2
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/webgpurendertarget.d.ts +83 -0
- package/build/video/rendertarget/webgpurendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/texture/cache.d.ts +20 -2
- package/build/video/texture/cache.d.ts.map +1 -1
- package/build/video/texture/noise_texture2d.d.ts +2 -2
- package/build/video/utils/autodetect.d.ts.map +1 -1
- package/build/video/video.d.ts +1 -55
- package/build/video/video.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +132 -35
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts +14 -0
- package/build/video/webgl/batchers/lit_mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +63 -36
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/material_batcher.d.ts +29 -20
- package/build/video/webgl/batchers/material_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/mesh_batcher.d.ts +308 -14
- package/build/video/webgl/batchers/mesh_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/primitive_batcher.d.ts +2 -2
- package/build/video/webgl/batchers/primitive_batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/quad_batcher.d.ts +0 -2
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +1 -1
- package/build/video/webgl/buffer/instance_buffer.d.ts +54 -0
- package/build/video/webgl/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts +83 -0
- package/build/video/webgl/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgl/buffer/uniformblock.d.ts +81 -0
- package/build/video/webgl/buffer/uniformblock.d.ts.map +1 -0
- package/build/video/webgl/buffer/vertexstate.d.ts +101 -0
- package/build/video/webgl/buffer/vertexstate.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts +101 -8
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +20 -8
- package/build/video/webgl/lighting/constants.d.ts.map +1 -1
- package/build/video/webgl/lighting/pack.d.ts +1 -1
- package/build/video/webgl/lighting/pack3d.d.ts +27 -11
- package/build/video/webgl/lighting/pack3d.d.ts.map +1 -1
- package/build/video/webgl/lighting/std140.d.ts +110 -0
- package/build/video/webgl/lighting/std140.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +7 -3
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -1
- package/build/video/webgl/texture/store.d.ts +52 -0
- package/build/video/webgl/texture/store.d.ts.map +1 -0
- package/build/video/webgl/utils/maxtextures.d.ts +37 -0
- package/build/video/webgl/utils/maxtextures.d.ts.map +1 -0
- package/build/video/webgl/utils/samplercache.d.ts +69 -0
- package/build/video/webgl/utils/samplercache.d.ts.map +1 -0
- package/build/video/webgl/utils/string.d.ts +16 -0
- package/build/video/webgl/utils/string.d.ts.map +1 -1
- package/build/video/webgl/utils/topology.d.ts +24 -0
- package/build/video/webgl/utils/topology.d.ts.map +1 -0
- package/build/video/webgl/utils/vertexformat.d.ts +27 -0
- package/build/video/webgl/utils/vertexformat.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +148 -30
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts +40 -0
- package/build/video/webgpu/batchers/lit_mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts +82 -0
- package/build/video/webgpu/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts +301 -0
- package/build/video/webgpu/batchers/mesh_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts +39 -0
- package/build/video/webgpu/batchers/primitive_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts +143 -0
- package/build/video/webgpu/batchers/quad_batcher.d.ts.map +1 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts +70 -0
- package/build/video/webgpu/batchers/webgpu_batcher.d.ts.map +1 -0
- package/build/video/webgpu/buffer/arena.d.ts +64 -0
- package/build/video/webgpu/buffer/arena.d.ts.map +1 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts +65 -0
- package/build/video/webgpu/buffer/instance_buffer.d.ts.map +1 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts +55 -0
- package/build/video/webgpu/buffer/retained_geometry.d.ts.map +1 -0
- package/build/video/webgpu/buffer/uniformring.d.ts +68 -0
- package/build/video/webgpu/buffer/uniformring.d.ts.map +1 -0
- package/build/video/webgpu/effect_binding.d.ts +17 -0
- package/build/video/webgpu/effect_binding.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts +36 -0
- package/build/video/webgpu/pipeline/bindgroups.d.ts.map +1 -0
- package/build/video/webgpu/pipeline/cache.d.ts +173 -0
- package/build/video/webgpu/pipeline/cache.d.ts.map +1 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts +90 -0
- package/build/video/webgpu/renderers/tmxlayer/orthogonal.d.ts.map +1 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts +60 -0
- package/build/video/webgpu/shaders/mesh-instanced.d.ts.map +1 -0
- package/build/video/webgpu/texture/compressed.d.ts +33 -0
- package/build/video/webgpu/texture/compressed.d.ts.map +1 -0
- package/build/video/webgpu/texture/frametexture.d.ts +65 -0
- package/build/video/webgpu/texture/frametexture.d.ts.map +1 -0
- package/build/video/webgpu/texture/store.d.ts +149 -0
- package/build/video/webgpu/texture/store.d.ts.map +1 -0
- package/build/video/webgpu/webgpu_renderer.d.ts +536 -0
- package/build/video/webgpu/webgpu_renderer.d.ts.map +1 -0
- package/package.json +5 -5
- package/build/video/webgl/effects/blur.d.ts.map +0 -1
- package/build/video/webgl/effects/chromaticAberration.d.ts.map +0 -1
- package/build/video/webgl/effects/colorMatrix.d.ts.map +0 -1
- package/build/video/webgl/effects/desaturate.d.ts.map +0 -1
- package/build/video/webgl/effects/dissolve.d.ts.map +0 -1
- package/build/video/webgl/effects/dropShadow.d.ts.map +0 -1
- package/build/video/webgl/effects/flash.d.ts.map +0 -1
- package/build/video/webgl/effects/glow.d.ts.map +0 -1
- package/build/video/webgl/effects/hologram.d.ts.map +0 -1
- package/build/video/webgl/effects/invert.d.ts.map +0 -1
- package/build/video/webgl/effects/outline.d.ts.map +0 -1
- package/build/video/webgl/effects/pixelate.d.ts.map +0 -1
- package/build/video/webgl/effects/radialGradient.d.ts.map +0 -1
- package/build/video/webgl/effects/scanline.d.ts.map +0 -1
- package/build/video/webgl/effects/sepia.d.ts.map +0 -1
- package/build/video/webgl/effects/shine.d.ts.map +0 -1
- package/build/video/webgl/effects/tintPulse.d.ts.map +0 -1
- package/build/video/webgl/effects/vignette.d.ts.map +0 -1
- package/build/video/webgl/effects/wave.d.ts.map +0 -1
- package/build/video/webgl/shadereffect.d.ts.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-neutral primitive topologies.
|
|
3
|
+
*
|
|
4
|
+
* Names how a stream of vertices is assembled into primitives, in the GPU
|
|
5
|
+
* vocabulary rather than the GL one. Like {@link VertexFormat}, this lets a
|
|
6
|
+
* draw be described without a live rendering context, and lets a backend read
|
|
7
|
+
* the description directly instead of translating enums.
|
|
8
|
+
*
|
|
9
|
+
* This module holds no GL references, so a non-WebGL backend can import it
|
|
10
|
+
* without pulling in the WebGL layer.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* How vertices are assembled into primitives.
|
|
14
|
+
*
|
|
15
|
+
* Five of these are portable across backends. `"line-loop"` and
|
|
16
|
+
* `"triangle-fan"` are **engine extensions** with no modern GPU-API
|
|
17
|
+
* equivalent — they exist because the primitive batcher has always accepted
|
|
18
|
+
* them, and a future backend will have to emulate them (a line loop is a line
|
|
19
|
+
* strip plus a closing segment, which is already how the WebGL path draws it).
|
|
20
|
+
* Prefer {@link PORTABLE_TOPOLOGIES} for anything that must survive a backend
|
|
21
|
+
* change.
|
|
22
|
+
*/
|
|
23
|
+
export type Topology = "point-list" | "line-list" | "line-strip" | "line-loop" | "triangle-list" | "triangle-strip" | "triangle-fan";
|
|
24
|
+
/**
|
|
25
|
+
* The topologies with a direct equivalent in modern GPU APIs.
|
|
26
|
+
*
|
|
27
|
+
* `"line-loop"` and `"triangle-fan"` are deliberately absent — see
|
|
28
|
+
* {@link Topology}.
|
|
29
|
+
*/
|
|
30
|
+
export declare const PORTABLE_TOPOLOGIES: readonly ["point-list", "line-list", "line-strip", "triangle-list", "triangle-strip"];
|
|
31
|
+
/**
|
|
32
|
+
* Whether a value is a supported topology name.
|
|
33
|
+
* @param value - the value to test
|
|
34
|
+
* @returns `true` when `value` names a topology
|
|
35
|
+
*/
|
|
36
|
+
export declare function isTopology(value: unknown): value is Topology;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a topology has a direct equivalent in modern GPU APIs.
|
|
39
|
+
* @param topology - the topology to test
|
|
40
|
+
* @returns `false` for the two engine extensions, which a non-WebGL backend must emulate
|
|
41
|
+
*/
|
|
42
|
+
export declare function isPortableTopology(topology: Topology): boolean;
|
|
43
|
+
//# sourceMappingURL=topology.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/topology.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GACjB,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,cAAc,CAAC;AAElB;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,uFAMQ,CAAC;AAgBzC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend-neutral vertex attribute formats.
|
|
3
|
+
*
|
|
4
|
+
* A vertex format names a component type and a component count in one token:
|
|
5
|
+
* `"float32x3"` is three 32-bit floats, `"unorm8x4"` is four unsigned bytes
|
|
6
|
+
* normalized to `[0, 1]`. That is everything a backend needs to interpret a
|
|
7
|
+
* slice of an interleaved vertex buffer, which is why it replaces the
|
|
8
|
+
* `size` + `type` + `normalized` triple the WebGL API works in.
|
|
9
|
+
*
|
|
10
|
+
* Naming follows the GPU vocabulary rather than the GL one, because the
|
|
11
|
+
* translation only runs one way: `"unorm8x4"` gives you `4` +
|
|
12
|
+
* `UNSIGNED_BYTE` + `normalized`, whereas `UNSIGNED_BYTE` alone cannot tell
|
|
13
|
+
* you the component count or whether it is normalized. Declaring the format
|
|
14
|
+
* also means a layout no longer needs a live rendering context to be written
|
|
15
|
+
* down — the GL enums are only resolved when a backend consumes it.
|
|
16
|
+
*
|
|
17
|
+
* This module holds no GL references at all, so a non-WebGL backend can
|
|
18
|
+
* import it without pulling in the WebGL layer.
|
|
19
|
+
* @see {@link Batcher#addAttribute}
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The scalar component type underlying a {@link VertexFormat}.
|
|
23
|
+
* @ignore
|
|
24
|
+
*/
|
|
25
|
+
export type VertexScalar = "float32" | "uint8" | "sint8" | "unorm8" | "snorm8" | "uint16" | "sint16" | "unorm16" | "snorm16" | "uint32" | "sint32";
|
|
26
|
+
/**
|
|
27
|
+
* A vertex attribute format: component type and count.
|
|
28
|
+
*
|
|
29
|
+
* The set is deliberately narrower than the full GPU vocabulary — see the
|
|
30
|
+
* module notes for what is excluded and why. Layouts that cannot be spelled
|
|
31
|
+
* here (three-component 8- and 16-bit types, for instance) remain expressible
|
|
32
|
+
* with the {@link Batcher#addAttribute} GL-enum form, which is supported
|
|
33
|
+
* indefinitely.
|
|
34
|
+
*/
|
|
35
|
+
export type VertexFormat = "float32" | "float32x2" | "float32x3" | "float32x4" | "uint8" | "uint8x2" | "uint8x4" | "sint8" | "sint8x2" | "sint8x4" | "unorm8" | "unorm8x2" | "unorm8x4" | "snorm8" | "snorm8x2" | "snorm8x4" | "uint16" | "uint16x2" | "uint16x4" | "sint16" | "sint16x2" | "sint16x4" | "unorm16" | "unorm16x2" | "unorm16x4" | "snorm16" | "snorm16x2" | "snorm16x4" | "uint32" | "uint32x2" | "uint32x3" | "uint32x4" | "sint32" | "sint32x2" | "sint32x3" | "sint32x4";
|
|
36
|
+
/**
|
|
37
|
+
* What a {@link VertexFormat} resolves to.
|
|
38
|
+
* @ignore
|
|
39
|
+
*/
|
|
40
|
+
export interface VertexFormatInfo {
|
|
41
|
+
/** number of components (1, 2, 3 or 4) */
|
|
42
|
+
components: 1 | 2 | 3 | 4;
|
|
43
|
+
/** total size of the attribute in bytes */
|
|
44
|
+
bytes: number;
|
|
45
|
+
/** whether integer values are scaled into `[0, 1]` / `[-1, 1]` when read by a shader */
|
|
46
|
+
normalized: boolean;
|
|
47
|
+
/** the underlying scalar type */
|
|
48
|
+
scalar: VertexScalar;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Every supported format, resolved.
|
|
52
|
+
*
|
|
53
|
+
* `bytes` is computed as `components × scalar size`, which is the same
|
|
54
|
+
* arithmetic the GL-enum path has always used — so a layout expressed either
|
|
55
|
+
* way produces an identical stride.
|
|
56
|
+
* @ignore
|
|
57
|
+
*/
|
|
58
|
+
export declare const VERTEX_FORMATS: Record<VertexFormat, VertexFormatInfo>;
|
|
59
|
+
/**
|
|
60
|
+
* Whether a value is a supported vertex format name.
|
|
61
|
+
* @param value - the value to test
|
|
62
|
+
* @returns `true` when `value` names a format in {@link VERTEX_FORMATS}
|
|
63
|
+
*/
|
|
64
|
+
export declare function isVertexFormat(value: unknown): value is VertexFormat;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve a vertex format to its component count, size and normalization.
|
|
67
|
+
* @param format - the format to resolve
|
|
68
|
+
* @returns the resolved description
|
|
69
|
+
* @throws {Error} when `format` is not a supported format name
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveVertexFormat(format: VertexFormat): VertexFormatInfo;
|
|
72
|
+
//# sourceMappingURL=vertexformat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertexformat.d.ts","sourceRoot":"","sources":["../../../src/video/gpu/vertexformat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,MAAM,MAAM,YAAY,GACrB,SAAS,GACT,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAErB,SAAS,GACT,WAAW,GACX,WAAW,GACX,WAAW,GAEX,OAAO,GACP,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,GACT,SAAS,GAET,QAAQ,GACR,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GAEV,QAAQ,GACR,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GAEV,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,WAAW,GACX,WAAW,GAEX,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,GACV,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEd;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,0CAA0C;IAC1C,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,UAAU,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,MAAM,EAAE,YAAY,CAAC;CACrB;AA0DD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,gBAAgB,CA0CjE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CAS1E"}
|
|
@@ -77,17 +77,26 @@ export class Gradient {
|
|
|
77
77
|
*/
|
|
78
78
|
toCanvasGradient(context: CanvasRenderingContext2D): CanvasGradient;
|
|
79
79
|
/**
|
|
80
|
-
* Render the gradient
|
|
81
|
-
* Uses the original gradient coordinates so the
|
|
82
|
-
*
|
|
80
|
+
* Render the gradient into the fixed-resolution shared bake target for
|
|
81
|
+
* the given draw rect. Uses the original gradient coordinates so the
|
|
82
|
+
* result matches Canvas 2D behavior. Rects larger than the bake target
|
|
83
|
+
* are rasterized scaled-down; the destination quad stretches them back,
|
|
84
|
+
* which is visually equivalent (linear stop interpolation × linear
|
|
85
|
+
* texture filtering). The returned `width`/`height` describe the region
|
|
86
|
+
* of the canvas the caller must use as the drawImage SOURCE rect.
|
|
87
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer - the active renderer (used to invalidate the GPU texture)
|
|
83
88
|
* @param {number} x - draw rect x
|
|
84
89
|
* @param {number} y - draw rect y
|
|
85
90
|
* @param {number} width - draw rect width
|
|
86
91
|
* @param {number} height - draw rect height
|
|
87
|
-
* @returns {HTMLCanvasElement|OffscreenCanvas} the
|
|
92
|
+
* @returns {{canvas: HTMLCanvasElement|OffscreenCanvas, width: number, height: number}} the shared gradient canvas + the used source-rect size
|
|
88
93
|
* @ignore
|
|
89
94
|
*/
|
|
90
|
-
toCanvas(renderer: CanvasRenderer | WebGLRenderer, x: number, y: number, width: number, height: number):
|
|
95
|
+
toCanvas(renderer: CanvasRenderer | WebGLRenderer, x: number, y: number, width: number, height: number): {
|
|
96
|
+
canvas: HTMLCanvasElement | OffscreenCanvas;
|
|
97
|
+
width: number;
|
|
98
|
+
height: number;
|
|
99
|
+
};
|
|
91
100
|
/**
|
|
92
101
|
* Get the interpolated color at a given position along the gradient.
|
|
93
102
|
* Useful for procedural effects like trails that need per-segment colors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/video/gradient.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../src/video/gradient.js"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH;IACC;;;OAGG;IACH,kBAHW,QAAQ,GAAC,QAAQ,UACjB,MAAM,EAAE,EAqDlB;IAlDA;;;OAGG;IACH,cAAc;IACd,YAA2B;IAE3B,0BAAgB;IAEhB;;;;OAIG;IACH,QAHU,MAAM,EAAE,CAGE;IAEpB;;;;OAIG;IACH,YAHU,KAAK,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,CAG5B;IAEpB;;;;OAIG;IACH,iBAHU,cAAc,GAAC,SAAS,CAGF;IAEhC;;;;OAIG;IACH,eAHU,kBAAkB,GAAC,SAAS,CAGR;IAE9B;;;;OAIG;IACH,QAHU,OAAO,CAGC;IAElB;;;;OAIG;IACH,cAHU;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAC,EAAE,GAAC,IAAI,CAGvB;IAGzB;;;;;;;;;OASG;IACH,qBARW,MAAM,SACN,KAAK,GAAC,MAAM,GACV,QAAQ,CA0BpB;IAED;;;;;OAKG;IACH,0BAJW,wBAAwB,GACtB,cAAc,CAiC1B;IAED;;;;;;;;;;;;;;;OAeG;IACH,mBARW,cAAc,GAAC,aAAa,KAC5B,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ;QAAC,MAAM,EAAE,iBAAiB,GAAC,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAwFtF;IAED;;;;;;;;;;;OAWG;IACH,qBATW,MAAM,OACN,KAAK,GACH,KAAK,CA+CjB;IAED;;;OAGG;IACH,0BAWC;IAED;;OAEG;IACH,gBAOC;CACD;+BA1V8B,sCAAsC;2BAF7C,kBAAkB"}
|
|
@@ -104,11 +104,75 @@ declare class Renderer {
|
|
|
104
104
|
*/
|
|
105
105
|
path2D: Path2D;
|
|
106
106
|
/**
|
|
107
|
-
* The renderer
|
|
108
|
-
*
|
|
107
|
+
* The renderer backend identity — the built-in renderers report
|
|
108
|
+
* `"CANVAS"`, `"WebGL2"` and `"WebGPU"`. Use it for identity
|
|
109
|
+
* checks (code coupled to one backend's machinery); prefer the
|
|
110
|
+
* capability flags (`shaderLanguage`, `supportsDepthBuffer`,
|
|
111
|
+
* `supportsRetainedMesh`, `supportsShaderTileLayers`) when the
|
|
112
|
+
* requirement is a capability rather than a specific backend.
|
|
113
|
+
* (override this property with a specific value when implementing
|
|
114
|
+
* a custom renderer)
|
|
109
115
|
* @type {string}
|
|
110
116
|
*/
|
|
111
117
|
type: string;
|
|
118
|
+
/**
|
|
119
|
+
* The {@link Application} this renderer belongs to, set by
|
|
120
|
+
* `Application.init()` — engine code holding a renderer reference
|
|
121
|
+
* must use this rather than the global game instance.
|
|
122
|
+
* @type {Application|undefined}
|
|
123
|
+
*/
|
|
124
|
+
parentApplication: Application | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Whether this renderer backend can draw TMX tile layers through a
|
|
127
|
+
* GPU shader path (see the `gpuTilemap` application setting).
|
|
128
|
+
* `false` here on the base/Canvas renderer; GPU backends flip it.
|
|
129
|
+
* A capability flag rather than a version/class check so future
|
|
130
|
+
* backends advertise support without consumers growing type checks.
|
|
131
|
+
* @type {boolean}
|
|
132
|
+
* @default false
|
|
133
|
+
*/
|
|
134
|
+
supportsShaderTileLayers: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether this renderer backend can keep mesh geometry resident on the
|
|
137
|
+
* GPU, letting a mesh supply a model matrix instead of vertices it has
|
|
138
|
+
* already positioned itself. `false` here on the base/Canvas renderer.
|
|
139
|
+
* @type {boolean}
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
supportsRetainedMesh: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Whether this renderer backend can draw one geometry many times in a
|
|
145
|
+
* single call from per-instance data — what {@link InstancedMesh}
|
|
146
|
+
* needs. `false` here on the base/Canvas renderer, which falls back to
|
|
147
|
+
* drawing each instance individually.
|
|
148
|
+
* @type {boolean}
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
supportsInstancing: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* The source language this backend accepts for user-supplied shaders,
|
|
154
|
+
* or `null` when it has no programmable pipeline at all (the Canvas
|
|
155
|
+
* backend). `"glsl"` on the WebGL backend, `"wgsl"` on the WebGPU
|
|
156
|
+
* backend.
|
|
157
|
+
*
|
|
158
|
+
* Consumers that need a *specific* language — `ShaderEffect` and the
|
|
159
|
+
* loader's `{vertex, fragment}` shader assets both hand GLSL source
|
|
160
|
+
* straight to the driver — must compare against the language rather
|
|
161
|
+
* than test for a GPU backend, or they would accept a backend that
|
|
162
|
+
* cannot read what they are about to give it.
|
|
163
|
+
* @type {"glsl"|"wgsl"|null}
|
|
164
|
+
* @default null
|
|
165
|
+
*/
|
|
166
|
+
shaderLanguage: "glsl" | "wgsl" | null;
|
|
167
|
+
/**
|
|
168
|
+
* Whether this backend has a depth buffer, and with it the 3D
|
|
169
|
+
* projection and mesh paths a depth-sorted scene needs (`Camera3d`
|
|
170
|
+
* and any camera declaring `defaultSortOn = "depth"`). `false` here
|
|
171
|
+
* on the base/Canvas renderer.
|
|
172
|
+
* @type {boolean}
|
|
173
|
+
* @default false
|
|
174
|
+
*/
|
|
175
|
+
supportsDepthBuffer: boolean;
|
|
112
176
|
/**
|
|
113
177
|
* The background color used to clear the main framebuffer.
|
|
114
178
|
* Note: alpha value will be set based on the transparent property of the renderer settings.
|
|
@@ -168,8 +232,8 @@ declare class Renderer {
|
|
|
168
232
|
get currentBlendMode(): string;
|
|
169
233
|
set currentDepth(value: number);
|
|
170
234
|
/**
|
|
171
|
-
* Current per-renderable depth value. GPU batchers (WebGL
|
|
172
|
-
* WebGPU
|
|
235
|
+
* Current per-renderable depth value. The GPU batchers (WebGL and
|
|
236
|
+
* WebGPU) push it into the vertex stream as the `z`
|
|
173
237
|
* component of each vertex — a no-op under the default orthographic
|
|
174
238
|
* projection, used by perspective (Camera3d) to
|
|
175
239
|
* scale and parallax sprites by distance. Mirrors `renderable.depth`,
|
|
@@ -190,6 +254,16 @@ declare class Renderer {
|
|
|
190
254
|
* @returns {number} width of the system Canvas
|
|
191
255
|
*/
|
|
192
256
|
get width(): number;
|
|
257
|
+
/**
|
|
258
|
+
* Acquire whatever the backend cannot acquire synchronously — awaited by
|
|
259
|
+
* {@link Application#init} right after the renderer is constructed, and
|
|
260
|
+
* the reason `Application#init` is asynchronous at all. The Canvas and
|
|
261
|
+
* WebGL backends have their context by the end of the constructor and
|
|
262
|
+
* resolve immediately (this default); the WebGPU backend performs its
|
|
263
|
+
* adapter/device negotiation here.
|
|
264
|
+
* @returns {Promise<void>} resolves once the renderer is ready to draw
|
|
265
|
+
*/
|
|
266
|
+
init(): Promise<void>;
|
|
193
267
|
/**
|
|
194
268
|
* prepare the framebuffer for drawing a new frame
|
|
195
269
|
*/
|
|
@@ -198,16 +272,61 @@ declare class Renderer {
|
|
|
198
272
|
* render the main framebuffer on screen
|
|
199
273
|
*/
|
|
200
274
|
flush(): void;
|
|
275
|
+
/**
|
|
276
|
+
* Hold one ground shadow ({@link Mesh#castGroundShadow}) back until the end
|
|
277
|
+
* of the mesh pass (#1515).
|
|
278
|
+
*
|
|
279
|
+
* A blob shadow deliberately writes no depth, so that two overlapping at
|
|
280
|
+
* one ground height blend instead of fighting. The price of that choice is
|
|
281
|
+
* that it leaves nothing in the depth buffer to defend itself with: any
|
|
282
|
+
* opaque mesh drawn afterwards simply paints over it. The ground plane is
|
|
283
|
+
* exactly that mesh whenever it sorts after the props standing on it — the
|
|
284
|
+
* common case, because a large plane's single sort key says nothing useful
|
|
285
|
+
* about where it sits relative to what stands on it.
|
|
286
|
+
*
|
|
287
|
+
* So shadows are collected here and drawn once the opaque meshes are down.
|
|
288
|
+
* Depth *testing* stays on throughout, so a shadow is still correctly
|
|
289
|
+
* hidden behind geometry genuinely in front of it: deferring changes only
|
|
290
|
+
* who paints over whom among draws that write no depth.
|
|
291
|
+
* @param {object} quad - the shared shadow quad
|
|
292
|
+
* @param {Matrix3d} modelMatrix - where the blob sits (copied, not retained)
|
|
293
|
+
* @param {number} tint - packed ARGB tint for the draw
|
|
294
|
+
* @param {object} [instanced] - the `InstancedMesh` whose instance buffer
|
|
295
|
+
* supplies one blob per instance, for the instanced tier
|
|
296
|
+
* @ignore
|
|
297
|
+
*/
|
|
298
|
+
queueGroundShadow(quad: object, modelMatrix: Matrix3d, tint: number, instanced?: object): void;
|
|
299
|
+
_shadowCount: any;
|
|
300
|
+
/**
|
|
301
|
+
* Draw every ground shadow queued since the last drain, then empty the
|
|
302
|
+
* queue (#1515). Called when the renderer leaves mesh mode, and once more
|
|
303
|
+
* at end of frame for a scene made only of meshes, which never switches
|
|
304
|
+
* away from mesh mode on its own.
|
|
305
|
+
*
|
|
306
|
+
* Inert on a backend that never queues — the Canvas renderer has no depth
|
|
307
|
+
* buffer and so no ground shadows at all.
|
|
308
|
+
*/
|
|
309
|
+
flushGroundShadows(): void;
|
|
310
|
+
_shadowFlushing: boolean | undefined;
|
|
201
311
|
/**
|
|
202
312
|
* Draw a textured triangle mesh.
|
|
203
313
|
* The mesh object must provide: `vertices` (Float32Array, x/y/z triplets),
|
|
204
314
|
* `uvs` (Float32Array, u/v pairs), `indices` (Uint16Array, triangle indices),
|
|
205
315
|
* `texture` (TextureAtlas), `vertexCount` (number), and optionally
|
|
206
316
|
* `cullBackFaces` (boolean, default true).
|
|
207
|
-
*
|
|
317
|
+
*
|
|
318
|
+
* On the GPU backends (WebGL and WebGPU — hardware depth testing),
|
|
319
|
+
* passing a `modelMatrix` selects the **retained** path: the mesh's
|
|
320
|
+
* model-space geometry stays resident on the GPU and the matrix
|
|
321
|
+
* places it, so redrawing never re-uploads vertices (see
|
|
322
|
+
* {@link Renderer#supportsRetainedMesh}). Without a matrix the
|
|
323
|
+
* vertices are taken as already CPU-projected (the 2D-camera path —
|
|
324
|
+
* the only path the Canvas renderer supports, using painter's
|
|
325
|
+
* algorithm). `Mesh.draw` selects the right form automatically.
|
|
208
326
|
* @param {Mesh} mesh - a Mesh renderable or compatible object
|
|
327
|
+
* @param {Matrix3d} [modelMatrix] - the mesh's placement, for the retained path (GPU backends)
|
|
209
328
|
*/
|
|
210
|
-
drawMesh(mesh: Mesh): void;
|
|
329
|
+
drawMesh(mesh: Mesh, modelMatrix?: Matrix3d): void;
|
|
211
330
|
/**
|
|
212
331
|
* Reset context state
|
|
213
332
|
*/
|
|
@@ -223,11 +342,23 @@ declare class Renderer {
|
|
|
223
342
|
* @returns {HTMLCanvasElement}
|
|
224
343
|
*/
|
|
225
344
|
getCanvas(): HTMLCanvasElement;
|
|
345
|
+
/**
|
|
346
|
+
* Create and return a new Canvas element, sized as requested.
|
|
347
|
+
*
|
|
348
|
+
* The instance form of {@link Renderer.createCanvas}. `app.renderer` is
|
|
349
|
+
* the renderer entry point, and a static is not reachable through an
|
|
350
|
+
* instance — so this is what user code actually calls.
|
|
351
|
+
* @param {number} width - width in pixels
|
|
352
|
+
* @param {number} height - height in pixels
|
|
353
|
+
* @param {boolean} [returnOffscreenCanvas=false] - return an OffscreenCanvas where supported
|
|
354
|
+
* @returns {HTMLCanvasElement|OffscreenCanvas} the new canvas
|
|
355
|
+
*/
|
|
356
|
+
createCanvas(width: number, height: number, returnOffscreenCanvas?: boolean): HTMLCanvasElement | OffscreenCanvas;
|
|
226
357
|
/**
|
|
227
358
|
* return a reference to the current render target corresponding Context
|
|
228
|
-
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
359
|
+
* @returns {CanvasRenderingContext2D|WebGLRenderingContext|GPUCanvasContext}
|
|
229
360
|
*/
|
|
230
|
-
getContext(): CanvasRenderingContext2D | WebGLRenderingContext;
|
|
361
|
+
getContext(): CanvasRenderingContext2D | WebGLRenderingContext | GPUCanvasContext;
|
|
231
362
|
/**
|
|
232
363
|
* return the list of supported compressed texture formats.
|
|
233
364
|
* The base implementation returns null for all formats (no GPU
|
|
@@ -496,6 +627,20 @@ declare class Renderer {
|
|
|
496
627
|
* @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas or offscreencanvas (if supported) element representing the tinted image
|
|
497
628
|
*/
|
|
498
629
|
tint(src: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas, color: Color | string, mode?: string): HTMLCanvasElement | OffscreenCanvas;
|
|
630
|
+
/**
|
|
631
|
+
* Clip the region anything drawn afterwards is confined to.
|
|
632
|
+
* Implemented by subclasses.
|
|
633
|
+
* @param {number} x - x position of the clipping rectangle
|
|
634
|
+
* @param {number} y - y position of the clipping rectangle
|
|
635
|
+
* @param {number} width - width of the clipping rectangle
|
|
636
|
+
* @param {number} height - height of the clipping rectangle
|
|
637
|
+
*/
|
|
638
|
+
clipRect(x: number, y: number, width: number, height: number): void;
|
|
639
|
+
/**
|
|
640
|
+
* Reset the current transform back to the identity matrix.
|
|
641
|
+
* Implemented by subclasses.
|
|
642
|
+
*/
|
|
643
|
+
resetTransform(): void;
|
|
499
644
|
/**
|
|
500
645
|
* Push the current transform / alpha / clip state onto an internal
|
|
501
646
|
* stack. Pair with {@link Renderer#restore}. Implemented by subclasses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AAUA;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IA2dC;;;;;;;;;;;;OAYG;IACH,2BANW,MAAM,UACN,MAAM,0BACN,OAAO,GAEL,iBAAiB,GAAC,eAAe,CAI7C;IAED;;;;;;;;;;;;OAYG;IACH,wBAFa,iBAAiB,GAAC,eAAe,CAgB7C;IAtgBD;;OAEG;IACH,sBAFW,mBAAmB,EA4N7B;IAzNA;;;;OAIG;IACH,cAFU,kBAAkB,CAS3B;IAED;;;;OAIG;IACH,iBAFU,MAAM,CAEO;IAEvB;;;;OAIG;IACH,oBAFU,MAAM,CAE6C;IAE7D;;;;OAIG;IACH,YAHU,QAAQ,CAGsD;IAExE;;;;OAIG;IACH,gBAFU,OAAO,CAES;IAE1B;;;;OAIG;IACH,aAFU,MAAM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B;IAED;;;;;;;OAOG;IACH,cANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;OAQG;IACH,qBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;OAOG;IACH,iBANW,MAAM,YACN,MAAM,gBAOhB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IAEH,yBAfG;QAAiC,MAAM;QAIwC,MAAM;eAAlE,MAAM;eAAK,MAAM;mBAAS,MAAM;oBAAU,MAAM;;KAMnE,GAAU,SAAS,CAOrB;CACD;;;;;+BAr2C8B,sCAAsC;yBAL5C,qBAAqB;kCAQb,sCAAsC;mBAXpD,2BAA2B;sBACxB,oBAAoB;wBAMlB,kBAAkB;yBALjB,qBAAqB;0BAavB,8BAA8B;yBAT5B,eAAe;4BAcf,wBAAwB;+BAJrB,8BAA8B;6BAChC,0BAA0B;0BAC7B,yBAAyB;6BACtB,4BAA4B;0CAEf,wBAAwB"}
|
|
@@ -11,8 +11,7 @@ declare class CanvasRenderTarget extends RenderTarget {
|
|
|
11
11
|
* @param {number} width - the desired width of the canvas
|
|
12
12
|
* @param {number} height - the desired height of the canvas
|
|
13
13
|
* @param {object} attributes - The attributes to create both the canvas and context
|
|
14
|
-
* @param {string} [attributes.context="2d"] - the context type to be created ("2d", "webgl")
|
|
15
|
-
* @param {boolean} [attributes.preferWebGL1=false] - set to true for force using WebGL1 instead of WebGL2 (if supported)
|
|
14
|
+
* @param {string} [attributes.context="2d"] - the context type to be created ("2d", "webgl" — a "webgl" request creates a WebGL 2 context — or "webgpu")
|
|
16
15
|
* @param {boolean} [attributes.transparent=false] - specify if the canvas contains an alpha channel
|
|
17
16
|
* @param {boolean} [attributes.offscreenCanvas=false] - will create an offscreenCanvas if true instead of a standard canvas
|
|
18
17
|
* @param {boolean} [attributes.willReadFrequently=false] - Indicates whether or not a lot of read-back operations are planned
|
|
@@ -20,7 +19,6 @@ declare class CanvasRenderTarget extends RenderTarget {
|
|
|
20
19
|
*/
|
|
21
20
|
constructor(width: number, height: number, attributes?: {
|
|
22
21
|
context?: string | undefined;
|
|
23
|
-
preferWebGL1?: boolean | undefined;
|
|
24
22
|
transparent?: boolean | undefined;
|
|
25
23
|
offscreenCanvas?: boolean | undefined;
|
|
26
24
|
willReadFrequently?: boolean | undefined;
|
|
@@ -36,11 +34,9 @@ declare class CanvasRenderTarget extends RenderTarget {
|
|
|
36
34
|
stencil: boolean;
|
|
37
35
|
blendMode: string;
|
|
38
36
|
failIfMajorPerformanceCaveat: boolean;
|
|
39
|
-
preferWebGL1: boolean;
|
|
40
37
|
powerPreference: string;
|
|
41
38
|
} & {
|
|
42
39
|
context?: string | undefined;
|
|
43
|
-
preferWebGL1?: boolean | undefined;
|
|
44
40
|
transparent?: boolean | undefined;
|
|
45
41
|
offscreenCanvas?: boolean | undefined;
|
|
46
42
|
willReadFrequently?: boolean | undefined;
|
|
@@ -48,7 +44,12 @@ declare class CanvasRenderTarget extends RenderTarget {
|
|
|
48
44
|
};
|
|
49
45
|
canvas: any;
|
|
50
46
|
context: any;
|
|
51
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The WebGL version of the created context.
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @deprecated since 20.0.0 — the WebGL renderer is WebGL 2 only, this is always `2`
|
|
51
|
+
*/
|
|
52
|
+
WebGLVersion: number;
|
|
52
53
|
/**
|
|
53
54
|
* @ignore
|
|
54
55
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"canvasrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/canvasrendertarget.js"],"names":[],"mappings":";AA6EA;;;;;;GAMG;AACH;IACC;;;;;;;;;OASG;IACH,mBATW,MAAM,UACN,MAAM,eAEd;QAA4B,OAAO;QACN,WAAW;QACX,eAAe;QACf,kBAAkB;QAClB,SAAS;KACxC,EAoCA;IAhCA;;;;;;;;;;;;;;;;;MAAkE;IASjE,YAA+B;IAUhC,aAA0D;IAGzD;;;;OAIG;IACH,cAHU,MAAM,CAGK;IAOvB;;OAEG;IACH,4CAGC;IAUD;;;OAGG;IACH,sBAFW,OAAO,QAwBjB;IAYD;;;;;;;;OAQG;IACH,gBANW,MAAM,KACN,MAAM,SACN,MAAM,UACN,MAAM,GACJ,SAAS,CAUrB;IAoDD;;;;OAIG;IACH,qBAFW,cAAc,GAAC,aAAa,QAyBtC;IAfC,mBAEC;IAeH;;;;OAIG;IACH,mBAHW,cAAc,GAAC,aAAa,QAyCtC;CA2BD;yBAhWwB,mBAAmB;gCAIb,gCAAgC;+BACjC,8BAA8B"}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export default class RenderTargetPool {
|
|
18
18
|
/**
|
|
19
|
-
* @param {function(number, number): RenderTarget} factory - creates a RenderTarget with the given width and height
|
|
19
|
+
* @param {function(number, number, boolean=): RenderTarget} factory - creates a RenderTarget with the given width and height; the third argument is `true` for CAPTURE slots (scene rasterization — may be multisampled) and `false` for ping-pong intermediates
|
|
20
20
|
*/
|
|
21
|
-
constructor(factory: (arg0: number, arg1: number) => RenderTarget);
|
|
21
|
+
constructor(factory: (arg0: number, arg1: number, arg2: boolean | undefined) => RenderTarget);
|
|
22
22
|
/** @type {function(number, number): RenderTarget} */
|
|
23
23
|
_factory: (arg0: number, arg1: number) => RenderTarget;
|
|
24
24
|
/** @type {RenderTarget[]} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render_target_pool.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/render_target_pool.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH;IACC;;OAEG;IACH,qBAFW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"render_target_pool.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/render_target_pool.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;GAYG;AACH;IACC;;OAEG;IACH,qBAFW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,EAAE,IAAQ,EAAR,OAAO,YAAC,KAAG,YAAY,EAc1D;IAXA,qDAAqD;IACrD,UADW,CAAS,IAAM,EAAN,MAAM,EAAE,IAAM,EAAN,MAAM,KAAG,YAAY,CAC1B;IACvB,6BAA6B;IAC7B,OADW,YAAY,EAAE,CACV;IACf;;;;;OAKG;IACH,YAFU,MAAM,EAAE,CAEE;IAGrB;;;OAGG;IACH,kBAFa,MAAM,CAMlB;IAED;;;;;;OAMG;IACH,WALW,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CAaxB;IAED;;;;;;;;OAQG;IACH,gBANW,OAAO,eACP,MAAM,SACN,MAAM,UACN,MAAM,GACJ,YAAY,CAuBxB;IAED;;;OAGG;IACH,oBAFa,YAAY,GAAC,SAAS,CAQlC;IAED;;;OAGG;IACH,qBAFa,YAAY,GAAC,SAAS,CAQlC;IAED;;;;OAIG;IACH,OAFa,YAAY,GAAC,IAAI,CAS7B;IAED;;;;OAIG;IACH,iBAHW,MAAM,UACN,MAAM,QAQhB;IAED;;OAEG;IACH,gBAQC;CACD;8BA/J4B,mBAAmB"}
|
|
@@ -11,11 +11,41 @@ export default class WebGLRenderTarget extends RenderTarget {
|
|
|
11
11
|
* @param {number} width - initial width in pixels
|
|
12
12
|
* @param {number} height - initial height in pixels
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @param {WebGLRenderingContext|WebGL2RenderingContext} gl - the WebGL context
|
|
16
|
+
* @param {number} width - initial width in pixels
|
|
17
|
+
* @param {number} height - initial height in pixels
|
|
18
|
+
* @param {object} [options] - target options
|
|
19
|
+
* @param {number} [options.samples=0] - MSAA sample count for the scene
|
|
20
|
+
* rasterization. When > 0 the target keeps a multisampled render FBO
|
|
21
|
+
* (color + depth-stencil renderbuffers) that draws rasterize into, and
|
|
22
|
+
* resolves it into the sampleable texture via `blitFramebuffer` on
|
|
23
|
+
* {@link WebGLRenderTarget#resolve} (called automatically by `unbind`).
|
|
24
|
+
*/
|
|
25
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, width: number, height: number, options?: {
|
|
26
|
+
samples?: number | undefined;
|
|
27
|
+
});
|
|
15
28
|
gl: WebGLRenderingContext | WebGL2RenderingContext;
|
|
29
|
+
/**
|
|
30
|
+
* MSAA sample count of the render half (0 = single-sampled)
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
samples: number;
|
|
34
|
+
_needsResolve: boolean;
|
|
16
35
|
framebuffer: WebGLFramebuffer;
|
|
17
|
-
texture: WebGLTexture;
|
|
18
36
|
depthStencilBuffer: WebGLRenderbuffer;
|
|
37
|
+
renderFramebuffer: WebGLFramebuffer | null;
|
|
38
|
+
colorRenderbuffer: WebGLRenderbuffer | null;
|
|
39
|
+
/**
|
|
40
|
+
* (Re)create the sampleable color texture with immutable storage
|
|
41
|
+
* (`texStorage2D` — the driver skips completeness validation and the
|
|
42
|
+
* layout is explicit) and attach it to the resolve framebuffer.
|
|
43
|
+
* Immutable storage can never be respecified, so a resize replaces the
|
|
44
|
+
* texture object. Caller manages ACTIVE_TEXTURE save/restore.
|
|
45
|
+
* @ignore
|
|
46
|
+
*/
|
|
47
|
+
_allocateColorTexture(width: any, height: any): void;
|
|
48
|
+
texture: WebGLTexture | null | undefined;
|
|
19
49
|
/**
|
|
20
50
|
* (Re)attach the depth/stencil renderbuffer at the given size and
|
|
21
51
|
* update `_hasStencil` based on the resulting framebuffer status.
|
|
@@ -25,6 +55,12 @@ export default class WebGLRenderTarget extends RenderTarget {
|
|
|
25
55
|
*/
|
|
26
56
|
_applyDepthStencil(width: any, height: any): void;
|
|
27
57
|
_hasStencil: boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Resolve the multisampled render half into the sampleable texture
|
|
60
|
+
* (no-op when single-sampled or already resolved). Leaves no
|
|
61
|
+
* framebuffer bound — callers rebind what they need.
|
|
62
|
+
*/
|
|
63
|
+
resolve(): void;
|
|
28
64
|
}
|
|
29
65
|
import RenderTarget from "./rendertarget.ts";
|
|
30
66
|
//# sourceMappingURL=webglrendertarget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webglrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/webglrendertarget.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webglrendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/webglrendertarget.js"],"names":[],"mappings":"AA2EA;;;;;;GAMG;AACH;IACC;;;;OAIG;IACH;;;;;;;;;;OAUG;IACH,gBAVW,qBAAqB,GAAC,sBAAsB,SAC5C,MAAM,UACN,MAAM,YAEd;QAAyB,OAAO;KAKlC,EAgEA;IA7DA,mDAAY;IAIZ;;;OAGG;IACH,SAFU,MAAM,CAEmB;IAGnC,uBAA0B;IAI1B,8BAAyC;IAWzC,sCAAiD;IAKhD,2CAA+C;IAC/C,4CAAgD;IA+BlD;;;;;;;OAOG;IACH,qDAqBC;IAhBA,yCAAiC;IAkBlC;;;;;;OAMG;IACH,kDAmBC;IAVA,iCAAoC;IA0BrC;;;;OAIG;IACH,gBAqBC;CAuID;yBA9YwB,mBAAmB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebGPU offscreen render target — the WebGPU counterpart of the WebGL
|
|
3
|
+
* FBO-backed {@link WebGLRenderTarget}, used by the post-effect chain
|
|
4
|
+
* through the shared {@link RenderTargetPool}.
|
|
5
|
+
*
|
|
6
|
+
* Owns one color `GPUTexture` (renderable AND sampleable — the whole point
|
|
7
|
+
* of a post-effect target) in the renderer's preferred canvas format, so
|
|
8
|
+
* pipelines keyed on that format serve canvas and offscreen passes alike.
|
|
9
|
+
* The depth-stencil attachment is NOT per-target: every pass shares the
|
|
10
|
+
* renderer's canvas-sized depth-stencil texture (targets in this flow are
|
|
11
|
+
* canvas-sized, only one pass is open at a time — and sharing the stencil
|
|
12
|
+
* means a mask active around a post-effect renderable keeps clipping its
|
|
13
|
+
* offscreen content, which is what masks promise).
|
|
14
|
+
*
|
|
15
|
+
* Under the recording model "binding" a target is a pass break: draws
|
|
16
|
+
* recorded after {@link WebGPURenderer#setRenderTarget} land in a new pass
|
|
17
|
+
* whose color attachment is this texture. Mid-frame resize/destroy retire
|
|
18
|
+
* the texture (a texture referenced by recorded draws must not be
|
|
19
|
+
* destroyed before submit).
|
|
20
|
+
* @augments RenderTarget
|
|
21
|
+
* @category Rendering
|
|
22
|
+
*/
|
|
23
|
+
export default class WebGPURenderTarget extends RenderTarget {
|
|
24
|
+
/**
|
|
25
|
+
* @param {import("../webgpu/webgpu_renderer.js").default} renderer - the owning renderer
|
|
26
|
+
* @param {number} width - width in pixels
|
|
27
|
+
* @param {number} height - height in pixels
|
|
28
|
+
*/
|
|
29
|
+
constructor(renderer: import("../webgpu/webgpu_renderer.js").default, width: number, height: number, options?: {});
|
|
30
|
+
renderer: import("../webgpu/webgpu_renderer.js").default;
|
|
31
|
+
/**
|
|
32
|
+
* MSAA sample count for scene rasterization into this target
|
|
33
|
+
* (1 = single-sampled). When > 1 the target owns a multisampled
|
|
34
|
+
* color texture that passes rasterize into and resolve into
|
|
35
|
+
* `texture` at every pass end — so anything sampling the target
|
|
36
|
+
* always sees resolved pixels.
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
sampleCount: number;
|
|
40
|
+
/** @type {GPUTexture|null} */
|
|
41
|
+
texture: GPUTexture | null;
|
|
42
|
+
/** @type {GPUTextureView|null} */
|
|
43
|
+
colorView: GPUTextureView | null;
|
|
44
|
+
/** the multisampled render half, when sampleCount > 1 @type {GPUTexture|null} */
|
|
45
|
+
msaaTexture: GPUTexture | null;
|
|
46
|
+
/** @type {GPUTextureView|null} */
|
|
47
|
+
msaaView: GPUTextureView | null;
|
|
48
|
+
/**
|
|
49
|
+
* bumped whenever the backing texture is reallocated — cached bind
|
|
50
|
+
* groups referencing the old view key on this
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
generation: number;
|
|
54
|
+
materialBindGroup: GPUBindGroup | null;
|
|
55
|
+
materialBindGroupGeneration: number;
|
|
56
|
+
pendingClear: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The group-1 (material) bind group sampling this target with a linear
|
|
59
|
+
* clamp sampler — what the effect blit binds as its source. Rebuilt
|
|
60
|
+
* lazily when the backing texture was reallocated.
|
|
61
|
+
* @returns {GPUBindGroup} the bind group
|
|
62
|
+
* @ignore
|
|
63
|
+
*/
|
|
64
|
+
getMaterialBindGroup(): GPUBindGroup;
|
|
65
|
+
/**
|
|
66
|
+
* Synchronous readback is impossible under WebGPU — use
|
|
67
|
+
* {@link WebGPURenderTarget#readPixels}.
|
|
68
|
+
* @throws {Error} always
|
|
69
|
+
* @override
|
|
70
|
+
*/
|
|
71
|
+
override getImageData(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Asynchronously read back this target's pixels.
|
|
74
|
+
* @param {number} [x=0] - x of the top-left corner
|
|
75
|
+
* @param {number} [y=0] - y of the top-left corner
|
|
76
|
+
* @param {number} [width=this.width] - width of the area to read
|
|
77
|
+
* @param {number} [height=this.height] - height of the area to read
|
|
78
|
+
* @returns {Promise<ImageData>} the pixel data (RGBA order)
|
|
79
|
+
*/
|
|
80
|
+
readPixels(x?: number, y?: number, width?: number, height?: number): Promise<ImageData>;
|
|
81
|
+
}
|
|
82
|
+
import RenderTarget from "./rendertarget.ts";
|
|
83
|
+
//# sourceMappingURL=webgpurendertarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgpurendertarget.d.ts","sourceRoot":"","sources":["../../../src/video/rendertarget/webgpurendertarget.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACC;;;;OAIG;IACH,sBAJW,OAAO,8BAA8B,EAAE,OAAO,SAC9C,MAAM,UACN,MAAM,gBAsChB;IAlCA,yDAAwB;IAGxB;;;;;;;OAOG;IACH,aAFU,MAAM,CAE2B;IAC3C,8BAA8B;IAC9B,SADW,UAAU,GAAC,IAAI,CACP;IACnB,kCAAkC;IAClC,WADW,cAAc,GAAC,IAAI,CACT;IACrB,iFAAiF;IACjF,aAD8D,UAAU,GAAC,IAAI,CACtD;IACvB,kCAAkC;IAClC,UADW,cAAc,GAAC,IAAI,CACV;IACpB;;;;OAIG;IACH,YAFU,MAAM,CAEG;IAGnB,uCAA6B;IAC7B,oCAAqC;IAErC,sBAAyB;IA+E1B;;;;;;OAMG;IACH,wBAHa,YAAY,CAuBxB;IAED;;;;;OAKG;IACH,8BAIC;IAED;;;;;;;OAOG;IACH,eANW,MAAM,MACN,MAAM,UACN,MAAM,WACN,MAAM,GACJ,OAAO,CAAC,SAAS,CAAC,CAyD9B;CAqBD;yBA3QwB,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../../src/video/texture/atlas.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../../src/video/texture/atlas.js"],"names":[],"mappings":"AAmBA;;;GAGG;AAEH;;;GAGG;AACH;;;;;;;;;;;;;;;;;;;EAoBC;AAED;;;GAGG;AACH,+FAYC;AAED;;;;;;;;;;GAUG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,qBAjCW,MAAM,GAAC,MAAM,EAAE,QACf,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,eAAe,GAAC,MAAM,GAAC,eAAe,EAAE,GAAC,gBAAgB,EAAE,GAAC,iBAAiB,EAAE,GAAC,MAAM,EAAE,YAC3I,OAAO,GAAC,MAAM,EAuOxB;IAj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