@codexo/exojs 0.12.0 → 0.13.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/dist/esm/core/BuildInfo.js +2 -2
  3. package/dist/esm/extensions/Extension.d.ts +39 -7
  4. package/dist/esm/extensions/Extension.d.ts.map +1 -1
  5. package/dist/esm/extensions/ExtensionRegistry.d.ts.map +1 -1
  6. package/dist/esm/extensions/ExtensionRegistry.js.map +1 -1
  7. package/dist/esm/extensions/snapshot.d.ts +12 -2
  8. package/dist/esm/extensions/snapshot.d.ts.map +1 -1
  9. package/dist/esm/extensions/snapshot.js +43 -14
  10. package/dist/esm/extensions/snapshot.js.map +1 -1
  11. package/dist/esm/index.js +8 -0
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/rendering/Drawable.d.ts +23 -0
  14. package/dist/esm/rendering/Drawable.d.ts.map +1 -1
  15. package/dist/esm/rendering/Drawable.js +34 -0
  16. package/dist/esm/rendering/Drawable.js.map +1 -1
  17. package/dist/esm/rendering/coreRendererBindings.d.ts.map +1 -1
  18. package/dist/esm/rendering/coreRendererBindings.js +22 -0
  19. package/dist/esm/rendering/coreRendererBindings.js.map +1 -1
  20. package/dist/esm/rendering/index.d.ts +13 -0
  21. package/dist/esm/rendering/index.d.ts.map +1 -1
  22. package/dist/esm/rendering/pixelSnap.d.ts +219 -0
  23. package/dist/esm/rendering/pixelSnap.d.ts.map +1 -0
  24. package/dist/esm/rendering/pixelSnap.js +186 -0
  25. package/dist/esm/rendering/pixelSnap.js.map +1 -0
  26. package/dist/esm/rendering/plan/RenderPlanPlayer.d.ts.map +1 -1
  27. package/dist/esm/rendering/plan/RenderPlanPlayer.js +21 -1
  28. package/dist/esm/rendering/plan/RenderPlanPlayer.js.map +1 -1
  29. package/dist/esm/rendering/sprite/NineSliceSprite.d.ts +69 -0
  30. package/dist/esm/rendering/sprite/NineSliceSprite.d.ts.map +1 -0
  31. package/dist/esm/rendering/sprite/NineSliceSprite.js +207 -0
  32. package/dist/esm/rendering/sprite/NineSliceSprite.js.map +1 -0
  33. package/dist/esm/rendering/sprite/RepeatingSprite.d.ts +120 -0
  34. package/dist/esm/rendering/sprite/RepeatingSprite.d.ts.map +1 -0
  35. package/dist/esm/rendering/sprite/RepeatingSprite.js +279 -0
  36. package/dist/esm/rendering/sprite/RepeatingSprite.js.map +1 -0
  37. package/dist/esm/rendering/sprite/Sprite.d.ts +13 -0
  38. package/dist/esm/rendering/sprite/Sprite.d.ts.map +1 -1
  39. package/dist/esm/rendering/sprite/Sprite.js +23 -0
  40. package/dist/esm/rendering/sprite/Sprite.js.map +1 -1
  41. package/dist/esm/rendering/sprite/nineSlice.d.ts +53 -0
  42. package/dist/esm/rendering/sprite/nineSlice.d.ts.map +1 -0
  43. package/dist/esm/rendering/sprite/nineSlice.js +340 -0
  44. package/dist/esm/rendering/sprite/nineSlice.js.map +1 -0
  45. package/dist/esm/rendering/sprite/repeatingSpritePlan.d.ts +57 -0
  46. package/dist/esm/rendering/sprite/repeatingSpritePlan.d.ts.map +1 -0
  47. package/dist/esm/rendering/sprite/repeatingSpritePlan.js +156 -0
  48. package/dist/esm/rendering/sprite/repeatingSpritePlan.js.map +1 -0
  49. package/dist/esm/rendering/texture/TextureRegion.d.ts +100 -0
  50. package/dist/esm/rendering/texture/TextureRegion.d.ts.map +1 -0
  51. package/dist/esm/rendering/texture/TextureRegion.js +144 -0
  52. package/dist/esm/rendering/texture/TextureRegion.js.map +1 -0
  53. package/dist/esm/rendering/texture/repeat.d.ts +96 -0
  54. package/dist/esm/rendering/texture/repeat.d.ts.map +1 -0
  55. package/dist/esm/rendering/texture/repeat.js +158 -0
  56. package/dist/esm/rendering/texture/repeat.js.map +1 -0
  57. package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts +20 -0
  58. package/dist/esm/rendering/webgl2/WebGl2Backend.d.ts.map +1 -1
  59. package/dist/esm/rendering/webgl2/WebGl2Backend.js +31 -2
  60. package/dist/esm/rendering/webgl2/WebGl2Backend.js.map +1 -1
  61. package/dist/esm/rendering/webgl2/WebGl2NineSliceSpriteRenderer.d.ts +32 -0
  62. package/dist/esm/rendering/webgl2/WebGl2NineSliceSpriteRenderer.d.ts.map +1 -0
  63. package/dist/esm/rendering/webgl2/WebGl2NineSliceSpriteRenderer.js +308 -0
  64. package/dist/esm/rendering/webgl2/WebGl2NineSliceSpriteRenderer.js.map +1 -0
  65. package/dist/esm/rendering/webgl2/WebGl2RepeatingSpriteRenderer.d.ts +49 -0
  66. package/dist/esm/rendering/webgl2/WebGl2RepeatingSpriteRenderer.d.ts.map +1 -0
  67. package/dist/esm/rendering/webgl2/WebGl2RepeatingSpriteRenderer.js +535 -0
  68. package/dist/esm/rendering/webgl2/WebGl2RepeatingSpriteRenderer.js.map +1 -0
  69. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.d.ts +9 -0
  70. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.d.ts.map +1 -1
  71. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.js +22 -2
  72. package/dist/esm/rendering/webgl2/WebGl2SpriteRenderer.js.map +1 -1
  73. package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts +21 -1
  74. package/dist/esm/rendering/webgpu/WebGpuBackend.d.ts.map +1 -1
  75. package/dist/esm/rendering/webgpu/WebGpuBackend.js +29 -2
  76. package/dist/esm/rendering/webgpu/WebGpuBackend.js.map +1 -1
  77. package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.d.ts +36 -0
  78. package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.d.ts.map +1 -0
  79. package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.js +358 -0
  80. package/dist/esm/rendering/webgpu/WebGpuNineSliceSpriteRenderer.js.map +1 -0
  81. package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.d.ts +52 -0
  82. package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.d.ts.map +1 -0
  83. package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.js +556 -0
  84. package/dist/esm/rendering/webgpu/WebGpuRepeatingSpriteRenderer.js.map +1 -0
  85. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts +9 -0
  86. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.d.ts.map +1 -1
  87. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js +22 -2
  88. package/dist/esm/rendering/webgpu/WebGpuSpriteRenderer.js.map +1 -1
  89. package/dist/esm/rendering/webgpu/WebGpuTransformStorage.d.ts +3 -2
  90. package/dist/esm/rendering/webgpu/WebGpuTransformStorage.d.ts.map +1 -1
  91. package/dist/esm/rendering/webgpu/WebGpuTransformStorage.js +4 -4
  92. package/dist/esm/rendering/webgpu/WebGpuTransformStorage.js.map +1 -1
  93. package/dist/esm/rendering.d.ts +1 -0
  94. package/dist/esm/rendering.d.ts.map +1 -1
  95. package/dist/esm/resources/Loader.d.ts +36 -8
  96. package/dist/esm/resources/Loader.d.ts.map +1 -1
  97. package/dist/esm/resources/Loader.js +30 -11
  98. package/dist/esm/resources/Loader.js.map +1 -1
  99. package/dist/exo.esm.js +3449 -59
  100. package/dist/exo.esm.js.map +1 -1
  101. package/package.json +10 -3
@@ -5,6 +5,7 @@ export type { CameraOptions } from './Camera';
5
5
  export { Camera } from './Camera';
6
6
  export { Container } from './Container';
7
7
  export { Drawable } from './Drawable';
8
+ export type { PixelSnapMode } from './pixelSnap';
8
9
  export type { RenderBackend } from './RenderBackend';
9
10
  export { RenderBackendType } from './RenderBackendType';
10
11
  export type { DrawableConstructor, Renderer } from './Renderer';
@@ -56,6 +57,10 @@ export { ShaderUniform } from '#rendering/shader/ShaderUniform';
56
57
  export { upgradeFragmentShaderToGl300 } from '#rendering/shader/upgradeFragmentShaderToGl300';
57
58
  export type { AnimatedSpriteClipDefinition, AnimatedSpritePlayOptions } from '#rendering/sprite/AnimatedSprite';
58
59
  export { AnimatedSprite } from '#rendering/sprite/AnimatedSprite';
60
+ export type { NineSliceInsets, NineSliceModes, NineSliceOptions } from '#rendering/sprite/nineSlice';
61
+ export { NineSliceSprite } from '#rendering/sprite/NineSliceSprite';
62
+ export { RepeatingSprite } from '#rendering/sprite/RepeatingSprite';
63
+ export type { RepeatingSpriteOptions } from '#rendering/sprite/repeatingSpritePlan';
59
64
  export { Sprite, SpriteFlags } from '#rendering/sprite/Sprite';
60
65
  export type { SpritesheetData, SpritesheetFrame } from '#rendering/sprite/Spritesheet';
61
66
  export { Spritesheet } from '#rendering/sprite/Spritesheet';
@@ -78,16 +83,22 @@ export type { GlyphInfo, GlyphKey, GlyphPlacement, GlyphProvider, TextAlignment,
78
83
  export type { DataTextureBuffer, DataTextureDirtyRegion, DataTextureFormat, DataTextureOptions } from '#rendering/texture/DataTexture';
79
84
  export { DataTexture } from '#rendering/texture/DataTexture';
80
85
  export { RenderTexture } from '#rendering/texture/RenderTexture';
86
+ export type { RepeatFit, RepeatMode, RepeatPlan, RepeatSegment } from '#rendering/texture/repeat';
87
+ export { planRepeat } from '#rendering/texture/repeat';
81
88
  export type { SamplerOptions } from '#rendering/texture/Sampler';
82
89
  export { Sampler } from '#rendering/texture/Sampler';
83
90
  export { Texture } from '#rendering/texture/Texture';
91
+ export type { TextureRegionInsets, TextureRegionOptions } from '#rendering/texture/TextureRegion';
92
+ export { TextureRegion } from '#rendering/texture/TextureRegion';
84
93
  export { Video } from '#rendering/video/Video';
85
94
  export { AbstractWebGl2BatchedRenderer } from '#rendering/webgl2/AbstractWebGl2BatchedRenderer';
86
95
  export { AbstractWebGl2Renderer } from '#rendering/webgl2/AbstractWebGl2Renderer';
87
96
  export { WebGl2Backend } from '#rendering/webgl2/WebGl2Backend';
88
97
  export { WebGl2MeshRenderer } from '#rendering/webgl2/WebGl2MeshRenderer';
98
+ export { WebGl2NineSliceSpriteRenderer } from '#rendering/webgl2/WebGl2NineSliceSpriteRenderer';
89
99
  export type { WebGl2RenderBufferRuntime } from '#rendering/webgl2/WebGl2RenderBuffer';
90
100
  export { WebGl2RenderBuffer } from '#rendering/webgl2/WebGl2RenderBuffer';
101
+ export { WebGl2RepeatingSpriteRenderer } from '#rendering/webgl2/WebGl2RepeatingSpriteRenderer';
91
102
  export { WebGl2ShaderBlock } from '#rendering/webgl2/WebGl2ShaderBlock';
92
103
  export { webGl2PrimitiveArrayConstructors, webGl2PrimitiveByteSizeMapping, webGl2PrimitiveTypeNames } from '#rendering/webgl2/WebGl2ShaderMappings';
93
104
  export { createWebGl2ShaderProgram } from '#rendering/webgl2/WebGl2ShaderProgram';
@@ -101,6 +112,8 @@ export { WebGpuComputePipeline, WebGpuStorageBuffer } from '#rendering/webgpu/co
101
112
  export { WebGpuBackend } from '#rendering/webgpu/WebGpuBackend';
102
113
  export { getWebGpuBlendState } from '#rendering/webgpu/WebGpuBlendState';
103
114
  export { WebGpuMeshRenderer } from '#rendering/webgpu/WebGpuMeshRenderer';
115
+ export { WebGpuNineSliceSpriteRenderer } from '#rendering/webgpu/WebGpuNineSliceSpriteRenderer';
116
+ export { WebGpuRepeatingSpriteRenderer } from '#rendering/webgpu/WebGpuRepeatingSpriteRenderer';
104
117
  export { WebGpuSpriteRenderer } from '#rendering/webgpu/WebGpuSpriteRenderer';
105
118
  export { WebGpuTextRenderer } from '#rendering/webgpu/WebGpuTextRenderer';
106
119
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rendering/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,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AAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC"}
@@ -0,0 +1,219 @@
1
+ import type { Matrix } from '#math/Matrix';
2
+ import type { Rectangle } from '#math/Rectangle';
3
+ import type { Drawable } from './Drawable';
4
+ import type { View } from './View';
5
+ /**
6
+ * Render-only pixel snapping.
7
+ *
8
+ * ## Coordinate spaces
9
+ *
10
+ * A drawable travels through these spaces before it lands on the screen:
11
+ *
12
+ * ```
13
+ * local space quad / boundary coordinates relative to the node origin
14
+ * │ × node world matrix (a, b, c, d, x, y) — logical, NEVER mutated here
15
+ * ▼
16
+ * world space the scene's logical coordinate system
17
+ * │ × View.getTransform() — the camera (center, zoom, rotation)
18
+ * ▼
19
+ * clip space OpenGL/WebGPU normalised device coordinates, [-1, 1]
20
+ * │ × viewport (fraction) × target device pixels
21
+ * ▼
22
+ * device space actual pixels of the active render target
23
+ * (root canvas = css × pixelRatio; RenderTexture = its own size)
24
+ * ```
25
+ *
26
+ * Pixel snapping aligns rendered geometry to **device pixels** — not to integer
27
+ * world units. One world unit only equals one device pixel when the view scale
28
+ * and pixel ratio are both `1`; under zoom or a high-DPR backbuffer the device
29
+ * grid is finer or coarser, so we always project into device space, round there,
30
+ * and project back. The full world↔device mapping is provided by the existing,
31
+ * tested {@link View.worldToScreen} / {@link View.screenToWorld} helpers — we
32
+ * pass the **active render target's device-pixel dimensions** so the result is
33
+ * device-correct for both the main canvas and offscreen render targets, and
34
+ * correct under viewport rectangles (split-screen).
35
+ *
36
+ * ## Render-only contract
37
+ *
38
+ * Snapping happens on the CPU during render-data preparation and affects only
39
+ * the values handed to the GPU for that frame. It never mutates logical
40
+ * position, world/local matrices used for queries, collision data, tween or
41
+ * physics state, or {@link SceneNode.getBounds} results. {@link snapWorldTranslationInto}
42
+ * writes into a caller-owned scratch matrix; the node's cached global transform
43
+ * is left untouched.
44
+ *
45
+ * ## Modes
46
+ *
47
+ * - `position` — snap the node's rendered origin (the world translation) only.
48
+ * Touches the matrix translation `(x, y)` exclusively, leaving the linear part
49
+ * `(a, b, c, d)` intact, so it is safe under any transform (rotation, skew,
50
+ * non-uniform scale) — the origin is a single point with a well-defined device
51
+ * position.
52
+ * - `geometry` — additionally snap shared geometry boundaries (NineSlice edges,
53
+ * repeat-segment boundaries, the sprite quad). Each unique boundary is snapped
54
+ * by the **same** pure function {@link snapLocalBoundary}, so adjacent quads
55
+ * that share a boundary value snap to the same result — seams cannot open.
56
+ * Guaranteed only for **axis-aligned** transforms; rotation / skew (in the
57
+ * node or the view) downgrade it to `position` (see
58
+ * {@link resolveEffectivePixelSnapMode}).
59
+ *
60
+ * ## Rounding policy
61
+ *
62
+ * Nearest device pixel via `Math.round` (ties toward +∞). One deterministic
63
+ * policy used everywhere, so CPU debug values, WebGL2 and WebGPU all agree.
64
+ *
65
+ * @module
66
+ */
67
+ /**
68
+ * Render-only pixel-snapping policy for a {@link Drawable}.
69
+ *
70
+ * - `'none'` — no snapping; rendered transform and geometry use existing behaviour.
71
+ * - `'position'` — snap the rendered origin to the nearest device pixel. Logical
72
+ * `x`/`y`, matrices, bounds and collision are unchanged.
73
+ * - `'geometry'` — snap a single coherent shared-boundary plan (origin + boundaries)
74
+ * so neighbouring quads stay seam-free. Falls back to `'position'` automatically
75
+ * when the transform is not axis-aligned (rotation / skew).
76
+ *
77
+ * Snapping targets device pixels (× view scale × pixel ratio), not integer world
78
+ * units, and never alters logical state.
79
+ *
80
+ * @default 'none'
81
+ * @stable
82
+ */
83
+ export type PixelSnapMode = 'none' | 'position' | 'geometry';
84
+ /**
85
+ * Runtime guard for the {@link PixelSnapMode} union. Used by the public setter to
86
+ * reject JavaScript-invalid values atomically.
87
+ * @internal
88
+ */
89
+ export declare function isPixelSnapMode(value: unknown): value is PixelSnapMode;
90
+ /**
91
+ * Axis-aligned device-pixel mapping for one drawable in the active pass. Built
92
+ * from the node world matrix, the pass {@link View}, and the active render
93
+ * target's device-pixel dimensions. Distances/positions are in device pixels;
94
+ * `worldX`/`worldY` are back in world space.
95
+ * @internal
96
+ */
97
+ export interface PixelSnapContext {
98
+ /** Device-pixel position of the node's local origin, before snapping. */
99
+ readonly originX: number;
100
+ readonly originY: number;
101
+ /** Device-pixel position of the local origin after snapping to the nearest pixel. */
102
+ readonly snappedOriginX: number;
103
+ readonly snappedOriginY: number;
104
+ /** World translation that places the local origin exactly on the snapped device pixel. */
105
+ readonly worldX: number;
106
+ readonly worldY: number;
107
+ /** Signed device pixels per local unit along X / Y (node scale × view scale × DPR). */
108
+ readonly scaleX: number;
109
+ readonly scaleY: number;
110
+ /** `true` when local axes map cleanly to device axes (no rotation/skew in node or view). */
111
+ readonly axisAligned: boolean;
112
+ }
113
+ /**
114
+ * Build the device-pixel snap context for `world` (a node's global transform)
115
+ * under `view`, targeting a surface of `targetPxWidth` × `targetPxHeight` device
116
+ * pixels. Pure — does not mutate `world` or `view`. Falls back to a no-op context
117
+ * (snapped origin = original origin) when the target size or projection is
118
+ * degenerate, so callers can always use the result safely.
119
+ * @internal
120
+ */
121
+ export declare function buildPixelSnapContext(world: Matrix, view: View, targetPxWidth: number, targetPxHeight: number): PixelSnapContext;
122
+ /**
123
+ * Copy `world` into `out`, replacing only the translation with the snapped world
124
+ * origin from `ctx`. The linear part `(a, b, c, d)` and homogeneous row are
125
+ * preserved, so rotation / scale / skew are untouched — position snapping is safe
126
+ * under any transform. The source `world` matrix is never mutated.
127
+ * @internal
128
+ */
129
+ export declare function snapWorldTranslationInto(out: Matrix, world: Matrix, ctx: PixelSnapContext): Matrix;
130
+ /**
131
+ * Snap a single local boundary coordinate to the device-pixel grid along an axis
132
+ * whose local→device scale is `scale`. Returns the local value whose device
133
+ * position (relative to the already-snapped origin) lands on an integer device
134
+ * pixel: `round(L · scale) / scale`.
135
+ *
136
+ * The function is pure, so two boundaries with the same input value snap to the
137
+ * same output — shared boundaries stay shared and seams cannot open. It is also
138
+ * monotonic non-decreasing in `L` for any non-zero `scale` (including negative
139
+ * scale from a flip), so boundary order is preserved and snapped spans never go
140
+ * negative. Degenerate scales (`|scale| < epsilon`) and non-finite inputs return
141
+ * the value unchanged.
142
+ * @internal
143
+ */
144
+ export declare function snapLocalBoundary(localValue: number, scale: number): number;
145
+ /** A local-space quad with UVs — the content-cache shape shared by NineSlice / RepeatingSprite. @internal */
146
+ export interface BoundaryQuad {
147
+ readonly x0: number;
148
+ readonly y0: number;
149
+ readonly x1: number;
150
+ readonly y1: number;
151
+ readonly u0: number;
152
+ readonly v0: number;
153
+ readonly u1: number;
154
+ readonly v1: number;
155
+ }
156
+ /** Mutable quad produced by {@link snapQuadsInto}; consumed by the batched sprite renderers. @internal */
157
+ export interface RenderQuad {
158
+ x0: number;
159
+ y0: number;
160
+ x1: number;
161
+ y1: number;
162
+ u0: number;
163
+ v0: number;
164
+ u1: number;
165
+ v1: number;
166
+ }
167
+ /**
168
+ * Snap every quad's local X/Y boundaries to the device grid using the per-axis
169
+ * scale in `ctx`, writing the result into the reusable `out` buffer (grown /
170
+ * truncated to match `source`, never reallocated per frame once warm). UVs are
171
+ * copied verbatim — sampling is unchanged. Because {@link snapLocalBoundary} is
172
+ * pure, quads sharing a boundary value stay seam-free without any explicit
173
+ * de-duplication.
174
+ * @internal
175
+ */
176
+ export declare function snapQuadsInto(source: readonly BoundaryQuad[], ctx: PixelSnapContext, out: RenderQuad[]): RenderQuad[];
177
+ /**
178
+ * Resolve the world transform to upload for `drawable` at the transform-buffer
179
+ * write seam. Returns the drawable's live global transform unchanged when its
180
+ * mode is `'none'` (zero overhead), otherwise a snapped copy written into the
181
+ * caller-owned `scratch` matrix — the logical global transform is never mutated.
182
+ *
183
+ * Both backends call this at their single transform-write boundary, so position
184
+ * snapping (and tilemap chunk/layer origin snapping) is applied once, backend-
185
+ * neutrally, to every drawable. `view` and the target device-pixel dimensions
186
+ * come from the active pass.
187
+ * @internal
188
+ */
189
+ export declare function resolveUploadTransform(drawable: Drawable, view: View, targetPxWidth: number, targetPxHeight: number, scratch: Matrix): Matrix;
190
+ /**
191
+ * Snap a single local-space bounds rectangle (e.g. a sprite quad) to the device
192
+ * grid using the per-axis scale in `ctx`, writing the result into `out`. Each of
193
+ * the four edges is snapped by {@link snapLocalBoundary}, so combined with the
194
+ * device-snapped origin every corner lands on a whole device pixel. `out` may be
195
+ * the same instance across frames (no allocation). UV/texture mapping is the
196
+ * caller's concern and is unaffected.
197
+ * @internal
198
+ */
199
+ export declare function snapBoundsInto(base: Rectangle, ctx: PixelSnapContext, out: Rectangle): Rectangle;
200
+ /** Reason a requested `geometry` snap was downgraded. @internal */
201
+ export type PixelSnapDowngradeReason = 'non-axis-aligned' | null;
202
+ /**
203
+ * Resolve the effective snap mode from the requested mode and whether the
204
+ * combined node+view transform is axis-aligned. `geometry` downgrades to
205
+ * `position` when the transform is not axis-aligned (rotation or skew, in the
206
+ * node itself or any ancestor or the view); `none` and `position` pass through
207
+ * unchanged. Pure and stateless — never stores an effective mode, so it always
208
+ * reflects the current world transform.
209
+ * @internal
210
+ */
211
+ export declare function resolveEffectivePixelSnapMode(requested: PixelSnapMode, axisAligned: boolean): PixelSnapMode;
212
+ /**
213
+ * Diagnostic companion to {@link resolveEffectivePixelSnapMode}: returns why a
214
+ * `geometry` request was downgraded, or `null` when no downgrade occurred. Not a
215
+ * stable public API — exposed for tests and dev warnings only.
216
+ * @internal
217
+ */
218
+ export declare function getPixelSnapDowngradeReason(requested: PixelSnapMode, axisAligned: boolean): PixelSnapDowngradeReason;
219
+ //# sourceMappingURL=pixelSnap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixelSnap.d.ts","sourceRoot":"","sources":["../../../src/rendering/pixelSnap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAI7D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAKD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,K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CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAU7I;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,GAAG,SAAS,CAOhG;AAED,mEAAmE;AACnE,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,IAAI,CAAC;AAEjE;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,GAAG,aAAa,CAM3G;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,GAAG,wBAAwB,CAMpH"}
@@ -0,0 +1,186 @@
1
+ const pixelSnapModes = new Set(['none', 'position', 'geometry']);
2
+ /**
3
+ * Runtime guard for the {@link PixelSnapMode} union. Used by the public setter to
4
+ * reject JavaScript-invalid values atomically.
5
+ * @internal
6
+ */
7
+ function isPixelSnapMode(value) {
8
+ return typeof value === 'string' && pixelSnapModes.has(value);
9
+ }
10
+ /** Below this magnitude an axis is treated as collapsed / cross-coupled. @internal */
11
+ const epsilon = 1e-6;
12
+ /**
13
+ * Build the device-pixel snap context for `world` (a node's global transform)
14
+ * under `view`, targeting a surface of `targetPxWidth` × `targetPxHeight` device
15
+ * pixels. Pure — does not mutate `world` or `view`. Falls back to a no-op context
16
+ * (snapped origin = original origin) when the target size or projection is
17
+ * degenerate, so callers can always use the result safely.
18
+ * @internal
19
+ */
20
+ function buildPixelSnapContext(world, view, targetPxWidth, targetPxHeight) {
21
+ const ox = world.x;
22
+ const oy = world.y;
23
+ if (!(targetPxWidth > 0) || !(targetPxHeight > 0)) {
24
+ return noopContext(ox, oy);
25
+ }
26
+ // Forward projection only (world → device). The view's inverse is deliberately
27
+ // avoided; instead the origin plus two world-unit axis tips give the exact
28
+ // world→device Jacobian, which we invert ourselves (a 2×2) to map the snapped
29
+ // device origin back to world space. This stays exact for any affine view.
30
+ const origin = view.worldToScreen(ox, oy, targetPxWidth, targetPxHeight);
31
+ if (!Number.isFinite(origin.x) || !Number.isFinite(origin.y)) {
32
+ return noopContext(ox, oy);
33
+ }
34
+ const tipWorldX = view.worldToScreen(ox + 1, oy, targetPxWidth, targetPxHeight);
35
+ const tipWorldY = view.worldToScreen(ox, oy + 1, targetPxWidth, targetPxHeight);
36
+ // Columns of the world→device Jacobian J = [[jxx, jyx], [jxy, jyy]].
37
+ const jxx = tipWorldX.x - origin.x;
38
+ const jxy = tipWorldX.y - origin.y;
39
+ const jyx = tipWorldY.x - origin.x;
40
+ const jyy = tipWorldY.y - origin.y;
41
+ // Local axes in device pixels: apply the node's linear part to the Jacobian —
42
+ // local (1,0)→world (a,c), local (0,1)→world (b,d).
43
+ const scaleX = world.a * jxx + world.c * jyx; // device-x per local-x unit
44
+ const crossXy = world.a * jxy + world.c * jyy; // device-y per local-x unit
45
+ const crossYx = world.b * jxx + world.d * jyx; // device-x per local-y unit
46
+ const scaleY = world.b * jxy + world.d * jyy; // device-y per local-y unit
47
+ const axisAligned = Math.abs(crossXy) < epsilon && Math.abs(crossYx) < epsilon;
48
+ const snappedOriginX = Math.round(origin.x);
49
+ const snappedOriginY = Math.round(origin.y);
50
+ // Map the snapped device origin back to world via J⁻¹ so that, re-projected
51
+ // through the (unchanged) view, the rendered origin lands on the device pixel.
52
+ let worldX = ox;
53
+ let worldY = oy;
54
+ const det = jxx * jyy - jyx * jxy;
55
+ if (Math.abs(det) > epsilon) {
56
+ const ddx = snappedOriginX - origin.x;
57
+ const ddy = snappedOriginY - origin.y;
58
+ worldX = ox + (jyy * ddx - jyx * ddy) / det;
59
+ worldY = oy + (jxx * ddy - jxy * ddx) / det;
60
+ }
61
+ return {
62
+ originX: origin.x,
63
+ originY: origin.y,
64
+ snappedOriginX,
65
+ snappedOriginY,
66
+ worldX,
67
+ worldY,
68
+ scaleX,
69
+ scaleY,
70
+ axisAligned,
71
+ };
72
+ }
73
+ function noopContext(ox, oy) {
74
+ return {
75
+ originX: ox,
76
+ originY: oy,
77
+ snappedOriginX: ox,
78
+ snappedOriginY: oy,
79
+ worldX: ox,
80
+ worldY: oy,
81
+ scaleX: 0,
82
+ scaleY: 0,
83
+ axisAligned: false,
84
+ };
85
+ }
86
+ /**
87
+ * Copy `world` into `out`, replacing only the translation with the snapped world
88
+ * origin from `ctx`. The linear part `(a, b, c, d)` and homogeneous row are
89
+ * preserved, so rotation / scale / skew are untouched — position snapping is safe
90
+ * under any transform. The source `world` matrix is never mutated.
91
+ * @internal
92
+ */
93
+ function snapWorldTranslationInto(out, world, ctx) {
94
+ out.copy(world);
95
+ out.x = ctx.worldX;
96
+ out.y = ctx.worldY;
97
+ return out;
98
+ }
99
+ /**
100
+ * Snap a single local boundary coordinate to the device-pixel grid along an axis
101
+ * whose local→device scale is `scale`. Returns the local value whose device
102
+ * position (relative to the already-snapped origin) lands on an integer device
103
+ * pixel: `round(L · scale) / scale`.
104
+ *
105
+ * The function is pure, so two boundaries with the same input value snap to the
106
+ * same output — shared boundaries stay shared and seams cannot open. It is also
107
+ * monotonic non-decreasing in `L` for any non-zero `scale` (including negative
108
+ * scale from a flip), so boundary order is preserved and snapped spans never go
109
+ * negative. Degenerate scales (`|scale| < epsilon`) and non-finite inputs return
110
+ * the value unchanged.
111
+ * @internal
112
+ */
113
+ function snapLocalBoundary(localValue, scale) {
114
+ if (!Number.isFinite(localValue) || Math.abs(scale) < epsilon) {
115
+ return localValue;
116
+ }
117
+ return Math.round(localValue * scale) / scale;
118
+ }
119
+ /**
120
+ * Snap every quad's local X/Y boundaries to the device grid using the per-axis
121
+ * scale in `ctx`, writing the result into the reusable `out` buffer (grown /
122
+ * truncated to match `source`, never reallocated per frame once warm). UVs are
123
+ * copied verbatim — sampling is unchanged. Because {@link snapLocalBoundary} is
124
+ * pure, quads sharing a boundary value stay seam-free without any explicit
125
+ * de-duplication.
126
+ * @internal
127
+ */
128
+ function snapQuadsInto(source, ctx, out) {
129
+ const { scaleX, scaleY } = ctx;
130
+ out.length = source.length;
131
+ for (let i = 0; i < source.length; i++) {
132
+ const q = source[i];
133
+ let t = out[i];
134
+ if (t === undefined) {
135
+ t = out[i] = { x0: 0, y0: 0, x1: 0, y1: 0, u0: 0, v0: 0, u1: 0, v1: 0 };
136
+ }
137
+ t.x0 = snapLocalBoundary(q.x0, scaleX);
138
+ t.x1 = snapLocalBoundary(q.x1, scaleX);
139
+ t.y0 = snapLocalBoundary(q.y0, scaleY);
140
+ t.y1 = snapLocalBoundary(q.y1, scaleY);
141
+ t.u0 = q.u0;
142
+ t.v0 = q.v0;
143
+ t.u1 = q.u1;
144
+ t.v1 = q.v1;
145
+ }
146
+ return out;
147
+ }
148
+ /**
149
+ * Resolve the world transform to upload for `drawable` at the transform-buffer
150
+ * write seam. Returns the drawable's live global transform unchanged when its
151
+ * mode is `'none'` (zero overhead), otherwise a snapped copy written into the
152
+ * caller-owned `scratch` matrix — the logical global transform is never mutated.
153
+ *
154
+ * Both backends call this at their single transform-write boundary, so position
155
+ * snapping (and tilemap chunk/layer origin snapping) is applied once, backend-
156
+ * neutrally, to every drawable. `view` and the target device-pixel dimensions
157
+ * come from the active pass.
158
+ * @internal
159
+ */
160
+ function resolveUploadTransform(drawable, view, targetPxWidth, targetPxHeight, scratch) {
161
+ const world = drawable.getGlobalTransform();
162
+ if (drawable.pixelSnapMode === 'none') {
163
+ return world;
164
+ }
165
+ const ctx = buildPixelSnapContext(world, view, targetPxWidth, targetPxHeight);
166
+ return snapWorldTranslationInto(scratch, world, ctx);
167
+ }
168
+ /**
169
+ * Snap a single local-space bounds rectangle (e.g. a sprite quad) to the device
170
+ * grid using the per-axis scale in `ctx`, writing the result into `out`. Each of
171
+ * the four edges is snapped by {@link snapLocalBoundary}, so combined with the
172
+ * device-snapped origin every corner lands on a whole device pixel. `out` may be
173
+ * the same instance across frames (no allocation). UV/texture mapping is the
174
+ * caller's concern and is unaffected.
175
+ * @internal
176
+ */
177
+ function snapBoundsInto(base, ctx, out) {
178
+ const left = snapLocalBoundary(base.left, ctx.scaleX);
179
+ const top = snapLocalBoundary(base.top, ctx.scaleY);
180
+ const right = snapLocalBoundary(base.right, ctx.scaleX);
181
+ const bottom = snapLocalBoundary(base.bottom, ctx.scaleY);
182
+ return out.set(left, top, right - left, bottom - top);
183
+ }
184
+
185
+ export { buildPixelSnapContext, isPixelSnapMode, resolveUploadTransform, snapBoundsInto, snapLocalBoundary, snapQuadsInto, snapWorldTranslationInto };
186
+ //# sourceMappingURL=pixelSnap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pixelSnap.js","sources":["../../../../src/rendering/pixelSnap.ts"],"sourcesContent":[null],"names":[],"mappings":"AAuFA,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAS,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE7F;;;;AAIG;AACG,SAAU,eAAe,CAAC,KAAc,EAAA;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC;AAC/D;AAEA;AACA,MAAM,OAAO,GAAG,IAAI;AA0BpB;;;;;;;AAOG;AACG,SAAU,qBAAqB,CAAC,KAAa,EAAE,IAAU,EAAE,aAAqB,EAAE,cAAsB,EAAA;AAC5G,IAAA,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;AAClB,IAAA,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;AAElB,IAAA,IAAI,EAAE,aAAa,GAAG,CAAC,CAAC,IAAI,EAAE,cAAc,GAAG,CAAC,CAAC,EAAE;AACjD,QAAA,OAAO,WAAW,CAAC,EAAE,EAAE,EAAE,CAAC;IAC5B;;;;;AAMA,IAAA,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,EAA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AAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;AACnD,IAAA,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;AACvD,IAAA,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;AAEzD,IAAA,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;AACvD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RenderPlanPlayer.d.ts","sourceRoot":"","sources":["../../../../src/rendering/plan/RenderPlanPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,eAAe,CAAC;AA6B7D,gBAAgB;AAChB,qBAAa,gBAAgB;WACb,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;WA0BpD,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAMzE,OAAO,CAAC,MAAM,CAAC,UAAU;IAYzB,OAAO,CAAC,MAAM,CAAC,UAAU;IAoDzB,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAOrC,OAAO,CAAC,MAAM,CAAC,iCAAiC;IAahD,OAAO,CAAC,MAAM,CAAC,4BAA4B;CAM5C"}
1
+ {"version":3,"file":"RenderPlanPlayer.d.ts","sourceRoot":"","sources":["../../../../src/rendering/plan/RenderPlanPlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAK9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,eAAe,CAAC;AA6B7D,gBAAgB;AAChB,qBAAa,gBAAgB;WACb,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;WA0BpD,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAMzE,OAAO,CAAC,MAAM,CAAC,UAAU;IAYzB,OAAO,CAAC,MAAM,CAAC,UAAU;IA2EzB,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAOrC,OAAO,CAAC,MAAM,CAAC,iCAAiC;IAahD,OAAO,CAAC,MAAM,CAAC,4BAA4B;CAM5C"}
@@ -43,13 +43,33 @@ class RenderPlanPlayer {
43
43
  let groupCursor = 0;
44
44
  let currentGroup = null;
45
45
  let currentInstructionIndex = 0;
46
+ // Phase 1 — populate the CPU transform buffer for all groups in this scope
47
+ // before any renderer draws execute. Without this separation, each
48
+ // per-group upload changes the buffer hash while a renderer holds an
49
+ // in-flight batch; the next flush detects the changed hash and re-uploads
50
+ // the growing buffer, producing O(groups²) GPU transform writes per pass
51
+ // (measured: ~240 KB/frame for 100 NineSlice sprites across 8 textures,
52
+ // ~600 MB/frame for 5000 RepeatingSprites). Writing every group's
53
+ // transforms first ensures the hash is stable by the time the first flush
54
+ // calls bindTransformBufferTexture/getTransformStorageBuffer, so all
55
+ // subsequent flushes within the same scope find an unchanged hash and skip
56
+ // the upload entirely.
57
+ if (hooks._prepareRenderGroupUpload !== undefined) {
58
+ let preInstructionIndex = context.passInstructionIndex;
59
+ for (let gi = 0; gi < groups.length; gi++) {
60
+ const group = groups[gi];
61
+ hooks._prepareRenderGroupUpload(group, this._createRenderGroupPlaybackContext(group.instructions.length, preInstructionIndex, context.passGroupIndex + gi));
62
+ preInstructionIndex += group.instructions.length;
63
+ }
64
+ }
65
+ // Phase 2 — execute draws in document order. Transform writes are already
66
+ // done; _prepareRenderGroupUpload is intentionally not called a second time.
46
67
  for (const entry of scope.entries) {
47
68
  if (entry.kind === RenderEntryKind.Draw) {
48
69
  if (currentGroup === null) {
49
70
  currentGroup = groups[groupCursor];
50
71
  currentInstructionIndex = 0;
51
72
  hooks._beginRenderGroup?.(currentGroup);
52
- hooks._prepareRenderGroupUpload?.(currentGroup, this._createRenderGroupPlaybackContext(currentGroup.instructions.length, context.passInstructionIndex, context.passGroupIndex));
53
73
  context.passGroupIndex++;
54
74
  }
55
75
  // Allocate the per-draw instruction slot only when a backend consumes
@@ -1 +1 @@
1
- {"version":3,"file":"RenderPlanPlayer.js","sources":["../../../../../src/rendering/plan/RenderPlanPlayer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAmCA;MACa,gBAAgB,CAAA;AACpB,IAAA,OAAO,IAAI,CAAC,IAAgB,EAAE,OAAsB,EAAA;QACzD,MAAM,KAAK,GAAG,OAAkD;QAEhE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;AAEtC,QAAA,IAAI;AACF,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;AAC9B,gBAAA,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,CAAC,MAAM,EAAE;AAChE,oBAAA,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;gBACtC;gBAEA,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;AAC9B,oBAAA,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC5B;AAEA,gBAAA,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;AAC5B,oBAAA,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;gBAChC;AAEA,gBAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,CAAC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CAAC,eAAe,GAAG,YAAY,CAAC;oBACrC,YAAY,GAAG,IAAI;oBACnB,uBAAuB,GAAG,CAAC;AAC3B,oBAAA,WAAW,EAAE;gBACf;YACF;iBAAO,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,CAAC,KAAK,EAAE;AAC/C,gBAAA,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;YACvD;iBAAO;gBACL,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,IAAG;oBAC3D,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC;AACtD,gBAAA,CAAC,CAAC;YACJ;QACF;IACF;AAEQ,IAAA,OAAO,sBAAsB,GAAA;QACnC,OAAO;AACL,YAAA,oBAAoB,EAAE,CAAC;AACvB,YAAA,cAAc,EAAE,CAAC;SAClB;IACH;AAEQ,IAAA,OAAO,iCAAiC,CAC9C,qBAA6B,EAC7B,yBAAiC,EACjC,cAAsB,EAAA;QAEtB,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,qBAAqB;YACrB,yBAAyB;AACzB,YAAA,wBAAwB,EAAE,yBAAyB,GAAG,qBAAqB,GAAG,CAAC;YAC/E,cAAc;AACf,SAAA,CAAC;IACJ;AAEQ,IAAA,OAAO,4BAA4B,CAAC,qBAA6B,EAAE,oBAA4B,EAAA;QACrG,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,qBAAqB;YACrB,oBAAoB;AACrB,SAAA,CAAC;IACJ;AACD;;;;"}
@@ -0,0 +1,69 @@
1
+ import type { Rectangle } from '#math/Rectangle';
2
+ import { Drawable } from '#rendering/Drawable';
3
+ import type { Texture } from '#rendering/texture/Texture';
4
+ import { TextureRegion } from '#rendering/texture/TextureRegion';
5
+ import type { View } from '#rendering/View';
6
+ import type { NineSliceInsets, NineSliceModes, NineSliceOptions, NineSliceQuad } from './nineSlice';
7
+ /**
8
+ * A scalable nine-slice (9-patch) sprite.
9
+ * Corners stay pixel-perfect; edges/center fill by stretch, repeat, or mirror-repeat.
10
+ * @stable
11
+ */
12
+ export declare class NineSliceSprite extends Drawable {
13
+ private _region;
14
+ private _slices;
15
+ private _border;
16
+ private _width;
17
+ private _height;
18
+ private _modes;
19
+ private _quads;
20
+ private _geometryDirty;
21
+ private readonly _renderQuads;
22
+ constructor(texture: Texture | TextureRegion, options: NineSliceOptions);
23
+ /** The TextureRegion this nine-slice samples from. */
24
+ get region(): TextureRegion;
25
+ /** Convenience accessor: the texture underlying the region. */
26
+ get texture(): Texture;
27
+ /** The engine-owned, frozen source slice insets. */
28
+ get slices(): Readonly<NineSliceInsets>;
29
+ /** The engine-owned, frozen destination border insets. */
30
+ get border(): Readonly<NineSliceInsets>;
31
+ /** The engine-owned, frozen edge/center fill modes. */
32
+ get modes(): Readonly<NineSliceModes>;
33
+ /** Destination width in local units. */
34
+ get width(): number;
35
+ set width(value: number);
36
+ /** Destination height in local units. */
37
+ get height(): number;
38
+ set height(value: number);
39
+ /** Set destination size. Fails atomically — prior state is preserved on invalid input. */
40
+ setSize(width: number, height: number): this;
41
+ /** Update the SOURCE-space slice insets. Fails atomically. No-ops on equivalent values. */
42
+ setSlices(slices: number | Partial<NineSliceInsets>): this;
43
+ /** Update the DESTINATION border sizes. Fails atomically. No-ops on equivalent values. */
44
+ setBorder(border: number | Partial<NineSliceInsets>): this;
45
+ /** Update the edge/center fill modes. Input is copied, validated, and frozen. No-ops on equivalent values. */
46
+ setModes(modes: NineSliceModes): this;
47
+ getLocalBounds(): Rectangle;
48
+ /**
49
+ * Lazily-built geometry quads. Each quad describes one rendered sub-region
50
+ * in local space with its corresponding UV bounds.
51
+ * @internal
52
+ */
53
+ get quads(): readonly NineSliceQuad[];
54
+ /**
55
+ * Render-time quads for the active pass. In `'geometry'` pixel-snap mode (and
56
+ * only when the combined node+view transform is axis-aligned) the shared
57
+ * boundary plan is snapped to the render target's device-pixel grid via the
58
+ * common {@link snapQuadsInto} helper, so every corner/edge/center quad reuses
59
+ * the exact same snapped boundary value and no seams can open. The content
60
+ * quad cache ({@link quads}) is never rebuilt by snapping — camera movement
61
+ * reuses it — and snapped quads are written into a reused buffer. Returns the
62
+ * unsnapped content quads for `'none'`/`'position'` or under a rotation/skew
63
+ * downgrade.
64
+ * @internal
65
+ */
66
+ getRenderQuads(view: View, targetPxWidth: number, targetPxHeight: number): readonly NineSliceQuad[];
67
+ private _rebuildGeometry;
68
+ }
69
+ //# sourceMappingURL=NineSliceSprite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NineSliceSprite.d.ts","sourceRoot":"","sources":["../../../../src/rendering/sprite/NineSliceSprite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyBpG;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,QAAQ;IAC3C,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAA2B;IAEzC,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;gBAE9B,OAAO,EAAE,OAAO,G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