@swf2es/render 0.0.0-stage → 0.1.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 (143) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +17 -2
  3. package/dist/commands.d.ts +67 -0
  4. package/dist/commands.d.ts.map +1 -0
  5. package/dist/commands.js +93 -0
  6. package/dist/commands.js.map +1 -0
  7. package/dist/filter-plan.d.ts +110 -0
  8. package/dist/filter-plan.d.ts.map +1 -0
  9. package/dist/filter-plan.js +480 -0
  10. package/dist/filter-plan.js.map +1 -0
  11. package/dist/filter-shaders.d.ts +63 -0
  12. package/dist/filter-shaders.d.ts.map +1 -0
  13. package/dist/filter-shaders.js +350 -0
  14. package/dist/filter-shaders.js.map +1 -0
  15. package/dist/filters.d.ts +107 -0
  16. package/dist/filters.d.ts.map +1 -0
  17. package/dist/filters.js +187 -0
  18. package/dist/filters.js.map +1 -0
  19. package/dist/geometry.d.ts +83 -0
  20. package/dist/geometry.d.ts.map +1 -0
  21. package/dist/geometry.js +93 -0
  22. package/dist/geometry.js.map +1 -0
  23. package/dist/index.d.ts +11 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +13 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/keeps.d.ts +17 -0
  28. package/dist/keeps.d.ts.map +1 -0
  29. package/dist/keeps.js +17 -0
  30. package/dist/keeps.js.map +1 -0
  31. package/dist/kernel-shaders.d.ts +74 -0
  32. package/dist/kernel-shaders.d.ts.map +1 -0
  33. package/dist/kernel-shaders.js +323 -0
  34. package/dist/kernel-shaders.js.map +1 -0
  35. package/dist/measure.d.ts +56 -0
  36. package/dist/measure.d.ts.map +1 -0
  37. package/dist/measure.js +287 -0
  38. package/dist/measure.js.map +1 -0
  39. package/dist/plan.d.ts +14 -0
  40. package/dist/plan.d.ts.map +1 -0
  41. package/dist/plan.js +247 -0
  42. package/dist/plan.js.map +1 -0
  43. package/dist/registry.d.ts +49 -0
  44. package/dist/registry.d.ts.map +1 -0
  45. package/dist/registry.js +87 -0
  46. package/dist/registry.js.map +1 -0
  47. package/dist/rows.d.ts +39 -0
  48. package/dist/rows.d.ts.map +1 -0
  49. package/dist/rows.js +60 -0
  50. package/dist/rows.js.map +1 -0
  51. package/dist/scene.d.ts +179 -0
  52. package/dist/scene.d.ts.map +1 -0
  53. package/dist/scene.js +265 -0
  54. package/dist/scene.js.map +1 -0
  55. package/dist/shelves.d.ts +23 -0
  56. package/dist/shelves.d.ts.map +1 -0
  57. package/dist/shelves.js +63 -0
  58. package/dist/shelves.js.map +1 -0
  59. package/dist/textures.d.ts +72 -0
  60. package/dist/textures.d.ts.map +1 -0
  61. package/dist/textures.js +160 -0
  62. package/dist/textures.js.map +1 -0
  63. package/dist/webgl/atlas.d.ts +63 -0
  64. package/dist/webgl/atlas.d.ts.map +1 -0
  65. package/dist/webgl/atlas.js +328 -0
  66. package/dist/webgl/atlas.js.map +1 -0
  67. package/dist/webgl/backend.d.ts +141 -0
  68. package/dist/webgl/backend.d.ts.map +1 -0
  69. package/dist/webgl/backend.js +659 -0
  70. package/dist/webgl/backend.js.map +1 -0
  71. package/dist/webgl/composite.d.ts +101 -0
  72. package/dist/webgl/composite.d.ts.map +1 -0
  73. package/dist/webgl/composite.js +293 -0
  74. package/dist/webgl/composite.js.map +1 -0
  75. package/dist/webgl/draws.d.ts +213 -0
  76. package/dist/webgl/draws.d.ts.map +1 -0
  77. package/dist/webgl/draws.js +714 -0
  78. package/dist/webgl/draws.js.map +1 -0
  79. package/dist/webgl/filters.d.ts +107 -0
  80. package/dist/webgl/filters.d.ts.map +1 -0
  81. package/dist/webgl/filters.js +351 -0
  82. package/dist/webgl/filters.js.map +1 -0
  83. package/dist/webgl/gpu-textures.d.ts +44 -0
  84. package/dist/webgl/gpu-textures.d.ts.map +1 -0
  85. package/dist/webgl/gpu-textures.js +178 -0
  86. package/dist/webgl/gpu-textures.js.map +1 -0
  87. package/dist/webgl/holds.d.ts +97 -0
  88. package/dist/webgl/holds.d.ts.map +1 -0
  89. package/dist/webgl/holds.js +453 -0
  90. package/dist/webgl/holds.js.map +1 -0
  91. package/dist/webgl/index.d.ts +2 -0
  92. package/dist/webgl/index.d.ts.map +1 -0
  93. package/dist/webgl/index.js +4 -0
  94. package/dist/webgl/index.js.map +1 -0
  95. package/dist/webgl/kernels.d.ts +64 -0
  96. package/dist/webgl/kernels.d.ts.map +1 -0
  97. package/dist/webgl/kernels.js +160 -0
  98. package/dist/webgl/kernels.js.map +1 -0
  99. package/dist/webgl/pool.d.ts +71 -0
  100. package/dist/webgl/pool.d.ts.map +1 -0
  101. package/dist/webgl/pool.js +192 -0
  102. package/dist/webgl/pool.js.map +1 -0
  103. package/dist/webgl/programs.d.ts +130 -0
  104. package/dist/webgl/programs.d.ts.map +1 -0
  105. package/dist/webgl/programs.js +582 -0
  106. package/dist/webgl/programs.js.map +1 -0
  107. package/dist/webgl/stage.d.ts +67 -0
  108. package/dist/webgl/stage.d.ts.map +1 -0
  109. package/dist/webgl/stage.js +173 -0
  110. package/dist/webgl/stage.js.map +1 -0
  111. package/dist/webgl/targets.d.ts +172 -0
  112. package/dist/webgl/targets.d.ts.map +1 -0
  113. package/dist/webgl/targets.js +323 -0
  114. package/dist/webgl/targets.js.map +1 -0
  115. package/package.json +35 -3
  116. package/src/commands.ts +98 -0
  117. package/src/filter-plan.ts +755 -0
  118. package/src/filter-shaders.ts +360 -0
  119. package/src/filters.ts +220 -0
  120. package/src/geometry.ts +143 -0
  121. package/src/index.ts +87 -0
  122. package/src/keeps.ts +21 -0
  123. package/src/kernel-shaders.ts +375 -0
  124. package/src/measure.ts +400 -0
  125. package/src/plan.ts +331 -0
  126. package/src/registry.ts +105 -0
  127. package/src/rows.ts +93 -0
  128. package/src/scene.ts +297 -0
  129. package/src/shelves.ts +70 -0
  130. package/src/textures.ts +198 -0
  131. package/src/webgl/atlas.ts +370 -0
  132. package/src/webgl/backend.ts +973 -0
  133. package/src/webgl/composite.ts +372 -0
  134. package/src/webgl/draws.ts +902 -0
  135. package/src/webgl/filters.ts +502 -0
  136. package/src/webgl/gpu-textures.ts +253 -0
  137. package/src/webgl/holds.ts +624 -0
  138. package/src/webgl/index.ts +3 -0
  139. package/src/webgl/kernels.ts +205 -0
  140. package/src/webgl/pool.ts +245 -0
  141. package/src/webgl/programs.ts +620 -0
  142. package/src/webgl/stage.ts +214 -0
  143. package/src/webgl/targets.ts +464 -0
@@ -0,0 +1,160 @@
1
+ import { IDLE_FRAMES } from "./geometry.js";
2
+ import { Registry } from "./registry.js";
3
+ /**
4
+ * How many frames a texture keeps the bytes it was last set from without
5
+ * being set again, and spare bytes wait for another texture: a texture set
6
+ * every frame, as a BitmapData drawn into every frame is, is converted into
7
+ * the same bytes each time; one that stops changing lets them go a couple
8
+ * of seconds later.
9
+ */
10
+ export const KEEP_FRAMES = 60;
11
+ /** The spare bytes kept at most, the least lately spared let go of first. */
12
+ const SPARE_BYTES = 32 << 20;
13
+ /**
14
+ * Every texture a scene list may name, by id. An owner adds a texture's
15
+ * pixels, and sets them again as they change; the backend uploads what is
16
+ * pending in its next render and lets the pixels go, keeping no hold on
17
+ * them. What goes undrawn for its idle frames, IDLE_FRAMES unless it was
18
+ * given fewer, is let go of, as geometries are.
19
+ *
20
+ * The bytes an owner fills to add or set a texture come from `bytes`, and
21
+ * stay this registry's: filled, they are passed to add or set at once and
22
+ * left be after, as they are lent again, to the same texture to be set again
23
+ * or, once it let them go, to another. A texture set again keeps the bytes it
24
+ * was last set from for KEEP_FRAMES; then, or once uploaded for one only
25
+ * added, or when it is removed, idle or with a lost context, they are spare
26
+ * for as long, for the next texture of their length.
27
+ */
28
+ export class Textures extends Registry {
29
+ data = [];
30
+ /** The bytes each texture was last added or set from, where `bytes` lent them, and the frame. */
31
+ kept = [];
32
+ setAt = [];
33
+ /** Whether each texture was set again since it was added, which keeps its bytes for a while. */
34
+ changing = [];
35
+ /** Bytes no texture keeps, by length, the least lately spared first. */
36
+ spare = new Map();
37
+ spareBytes = 0;
38
+ lent = new WeakSet();
39
+ /** Added or set again since the backend last took them. */
40
+ pending = [];
41
+ /**
42
+ * `length` bytes to fill and add or set a texture from: those texture `id`
43
+ * keeps where they are as long, else spare ones, else new.
44
+ */
45
+ bytes(length, id = -1) {
46
+ const own = id >= 0 && this.holds(id) ? this.kept[id] : null;
47
+ if (own?.length === length) {
48
+ return own;
49
+ }
50
+ const spare = this.spare.get(length)?.pop();
51
+ if (spare) {
52
+ this.spareBytes -= length;
53
+ return spare.bytes;
54
+ }
55
+ const bytes = new Uint8Array(length);
56
+ this.lent.add(bytes);
57
+ return bytes;
58
+ }
59
+ /** A texture of `pixels`, let go of once undrawn for `idle` frames. */
60
+ add(width, height, pixels, idle = IDLE_FRAMES) {
61
+ const handle = this.hold(idle);
62
+ this.data[handle.id] = { width, height, pixels };
63
+ this.keep(handle.id, pixels);
64
+ this.changing[handle.id] = false;
65
+ this.pending.push(handle.id);
66
+ return handle;
67
+ }
68
+ /**
69
+ * `id`'s pixels changed, its size with them perhaps; with `idle`, it is
70
+ * let go of after as many undrawn frames where that is fewer.
71
+ */
72
+ set(id, width, height, pixels, idle) {
73
+ const data = this.data[id];
74
+ if (data) {
75
+ data.width = width;
76
+ data.height = height;
77
+ data.pixels = pixels;
78
+ this.keep(id, pixels);
79
+ this.changing[id] = true;
80
+ this.pending.push(id);
81
+ if (idle !== undefined) {
82
+ this.idleWithin(id, idle);
83
+ }
84
+ }
85
+ }
86
+ get(id) {
87
+ return this.data[id] ?? null;
88
+ }
89
+ /** The bytes held on the CPU: those textures keep, and spare ones. */
90
+ get heldBytes() {
91
+ let held = this.spareBytes;
92
+ for (const bytes of this.kept) {
93
+ held += bytes?.length ?? 0;
94
+ }
95
+ return held;
96
+ }
97
+ /** A frame ends: what went unused too long is let go of, and bytes kept no longer needed spared. */
98
+ endFrame() {
99
+ super.endFrame();
100
+ for (let id = 0; id < this.kept.length; id++) {
101
+ const bytes = this.kept[id];
102
+ const done = !this.changing[id] || this.frame - this.setAt[id] > KEEP_FRAMES;
103
+ // Never while they wait to be uploaded, as they may where the backend drew no frame.
104
+ if (bytes && done && this.data[id]?.pixels !== bytes) {
105
+ this.kept[id] = null;
106
+ this.spareOf(bytes);
107
+ }
108
+ }
109
+ for (const [length, list] of this.spare) {
110
+ while (list.length && this.frame - list[0].at > KEEP_FRAMES) {
111
+ list.shift();
112
+ this.spareBytes -= length;
113
+ }
114
+ }
115
+ }
116
+ dropped(id) {
117
+ this.data[id] = null;
118
+ const bytes = this.kept[id];
119
+ this.kept[id] = null;
120
+ if (bytes) {
121
+ this.spareOf(bytes);
122
+ }
123
+ }
124
+ /** `pixels` kept for `id` where `bytes` lent them; those it kept before spared. */
125
+ keep(id, pixels) {
126
+ const before = this.kept[id];
127
+ const own = pixels instanceof Uint8Array && this.lent.has(pixels) ? pixels : null;
128
+ if (before && before !== own) {
129
+ this.spareOf(before);
130
+ }
131
+ this.kept[id] = own;
132
+ this.setAt[id] = this.frame;
133
+ }
134
+ spareOf(bytes) {
135
+ if (bytes.length > SPARE_BYTES) {
136
+ return;
137
+ }
138
+ let list = this.spare.get(bytes.length);
139
+ if (!list) {
140
+ list = [];
141
+ this.spare.set(bytes.length, list);
142
+ }
143
+ list.push({ bytes, at: this.frame });
144
+ this.spareBytes += bytes.length;
145
+ // Past the cap, the least lately spared go, whatever their length.
146
+ while (this.spareBytes > SPARE_BYTES) {
147
+ let oldest = -1;
148
+ let oldestAt = Number.POSITIVE_INFINITY;
149
+ for (const [length, entries] of this.spare) {
150
+ if (entries.length && entries[0].at < oldestAt) {
151
+ oldestAt = entries[0].at;
152
+ oldest = length;
153
+ }
154
+ }
155
+ this.spare.get(oldest)?.shift();
156
+ this.spareBytes -= oldest;
157
+ }
158
+ }
159
+ }
160
+ //# sourceMappingURL=textures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textures.js","sourceRoot":"","sources":["../src/textures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,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AI,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,MAAM,CAAC;QAChC,mEAAmE;QACnE,OAAO,IAAI,CAAC,UAAU,GAAG,WAAW,EAAE,CAAC;YACrC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;YAChB,IAAI,QAAQ,GAAG,MAAM,CAAC,iBAAiB,CAAC;YACxC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC3C,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;oBAC/C,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACzB,MAAM,GAAG,MAAM,CAAC;gBAClB,CAAC;YACH,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC;QAC5B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,63 @@
1
+ import type { GlState } from "@swf2es/context3d/device";
2
+ import { type Geometries } from "../geometry.js";
3
+ /** Where a geometry lies in the atlas, or the glyph atlas with its text's mode and table. */
4
+ export interface Place {
5
+ vertexStart: number;
6
+ vertices: number;
7
+ indexStart: number;
8
+ indices: number;
9
+ glyphs: {
10
+ mode: Float32Array;
11
+ table: Float32Array;
12
+ } | null;
13
+ /** Its geometry's flat (GeometryData.flat). */
14
+ flat: boolean;
15
+ }
16
+ /**
17
+ * The geometry atlas: every geometry copied once into a vertex and an index
18
+ * buffer, and advanced text's glyph quads into an atlas of their own, where
19
+ * the draws find them by their places. A geometry let go of leaves a hole,
20
+ * and each atlas is packed again from the geometries' own arrays once the
21
+ * holes outweigh what is live.
22
+ */
23
+ export declare class GeometryAtlas {
24
+ private readonly gl;
25
+ private readonly state;
26
+ vertexArray: WebGLVertexArrayObject;
27
+ private vertexBuffer;
28
+ private indexBuffer;
29
+ private vertexCapacity;
30
+ private indexCapacity;
31
+ private vertexTop;
32
+ private indexTop;
33
+ private live;
34
+ private holes;
35
+ places: (Place | null)[];
36
+ glyphArray: WebGLVertexArrayObject;
37
+ private glyphBuffer;
38
+ private glyphIndexBuffer;
39
+ /** The glyph atlas' room and top, of vertices and of indices, and its vertices live and let go of. */
40
+ private readonly glyphs;
41
+ constructor(gl: WebGL2RenderingContext, state: GlState);
42
+ /** The buffers and vertex arrays made, both atlases empty, as the context comes or comes back. */
43
+ setUp(): void;
44
+ /**
45
+ * The geometries removed since the last frame let go of, and those added
46
+ * copied in: at the top while they fit, else into an atlas packed again,
47
+ * grown to twice what is live.
48
+ */
49
+ place(geometries: Geometries): void;
50
+ /** Every live shape's geometry copied into new buffers, with room for twice what is live. */
51
+ repack(geometries: Geometries): void;
52
+ /** Every live text's quads copied into new glyph buffers: none till a text needs them. */
53
+ repackGlyphs(geometries: Geometries): void;
54
+ /** `data` copied in at the top of the atlas, its indices made absolute. */
55
+ private copyIn;
56
+ /** `data`'s vertices interleaved into the atlas from vertex `base`. */
57
+ private copyVertices;
58
+ /** Glyph quads copied in at the top of the glyph atlas, their indices made absolute in it. */
59
+ private copyGlyphs;
60
+ /** The buffers and vertex arrays made on the context, deleted. */
61
+ destroy(): void;
62
+ }
63
+ //# sourceMappingURL=atlas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../src/webgl/atlas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,KAAK,UAAU,EAAmC,MAAM,gBAAgB,CAAC;AA0BlF,6FAA6F;AAC7F,MAAM,WAAW,KAAK;IAC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AAO,CAAC,MAAM;IA8Bd,uEAAuE;IACvE,OAAO,CAAC,YAAY;IAwBpB,8FAA8F;IAC9F,OAAO,CAAC,UAAU;IA2BlB,kEAAkE;IAClE,OAAO,IAAI,IAAI,CAQd;CACF"}
@@ -0,0 +1,328 @@
1
+ import { GLYPH_FLOATS } from "../geometry.js";
2
+ import { COLOR_AT, DEPTH_AT, GLYPH_AT, ORIGIN_AT, POSITION_AT, RUN_AT, TEXEL_AT, TINT_AT, } from "./programs.js";
3
+ /**
4
+ * Bytes a vertex in the atlas: its position's two floats, its texel's two, then its colour's four
5
+ * bytes, or a mesh's depth's float.
6
+ */
7
+ const VERTEX_BYTES = 20;
8
+ /** Bytes a vertex of advanced text's glyph quads, in an atlas of their own. */
9
+ const GLYPH_BYTES = GLYPH_FLOATS * 4;
10
+ /** The fewest glyph vertices the glyph atlas holds once a text needs it. */
11
+ const GLYPHS_LEAST = 1024;
12
+ /** The fewest vertices the atlas holds room for, and its indices thrice that. */
13
+ const LEAST = 1 << 16;
14
+ /** Holes past which, and past the live vertices, the atlas is packed again. */
15
+ const SLACK = 1 << 16;
16
+ /**
17
+ * The geometry atlas: every geometry copied once into a vertex and an index
18
+ * buffer, and advanced text's glyph quads into an atlas of their own, where
19
+ * the draws find them by their places. A geometry let go of leaves a hole,
20
+ * and each atlas is packed again from the geometries' own arrays once the
21
+ * holes outweigh what is live.
22
+ */
23
+ export class GeometryAtlas {
24
+ gl;
25
+ state;
26
+ vertexArray;
27
+ vertexBuffer;
28
+ indexBuffer;
29
+ vertexCapacity = 0;
30
+ indexCapacity = 0;
31
+ vertexTop = 0;
32
+ indexTop = 0;
33
+ live = 0;
34
+ holes = 0;
35
+ places = [];
36
+ glyphArray;
37
+ glyphBuffer;
38
+ glyphIndexBuffer;
39
+ /** The glyph atlas' room and top, of vertices and of indices, and its vertices live and let go of. */
40
+ glyphs = {
41
+ capacity: 0,
42
+ top: 0,
43
+ indexCapacity: 0,
44
+ indexTop: 0,
45
+ live: 0,
46
+ holes: 0,
47
+ };
48
+ constructor(gl, state) {
49
+ this.gl = gl;
50
+ this.state = state;
51
+ }
52
+ /** The buffers and vertex arrays made, both atlases empty, as the context comes or comes back. */
53
+ setUp() {
54
+ const gl = this.gl;
55
+ this.vertexArray = gl.createVertexArray();
56
+ this.vertexBuffer = gl.createBuffer();
57
+ this.indexBuffer = gl.createBuffer();
58
+ this.state.bindVertexArray(this.vertexArray);
59
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
60
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
61
+ gl.enableVertexAttribArray(POSITION_AT);
62
+ gl.vertexAttribPointer(POSITION_AT, 2, gl.FLOAT, false, VERTEX_BYTES, 0);
63
+ gl.enableVertexAttribArray(TEXEL_AT);
64
+ gl.vertexAttribPointer(TEXEL_AT, 2, gl.FLOAT, false, VERTEX_BYTES, 8);
65
+ gl.enableVertexAttribArray(COLOR_AT);
66
+ gl.vertexAttribPointer(COLOR_AT, 4, gl.UNSIGNED_BYTE, true, VERTEX_BYTES, 16);
67
+ // The same bytes as a mesh's depth, which the mesh program reads in place of the colour.
68
+ gl.enableVertexAttribArray(DEPTH_AT);
69
+ gl.vertexAttribPointer(DEPTH_AT, 1, gl.FLOAT, false, VERTEX_BYTES, 16);
70
+ this.glyphArray = gl.createVertexArray();
71
+ this.glyphBuffer = gl.createBuffer();
72
+ this.glyphIndexBuffer = gl.createBuffer();
73
+ this.state.bindVertexArray(this.glyphArray);
74
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);
75
+ gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.glyphIndexBuffer);
76
+ gl.enableVertexAttribArray(POSITION_AT);
77
+ gl.vertexAttribPointer(POSITION_AT, 2, gl.FLOAT, false, GLYPH_BYTES, 0);
78
+ for (const [at, offset] of [
79
+ [ORIGIN_AT, 8],
80
+ [GLYPH_AT, 24],
81
+ [RUN_AT, 40],
82
+ [TINT_AT, 56],
83
+ ]) {
84
+ gl.enableVertexAttribArray(at);
85
+ gl.vertexAttribPointer(at, 4, gl.FLOAT, false, GLYPH_BYTES, offset);
86
+ }
87
+ Object.assign(this.glyphs, {
88
+ capacity: 0,
89
+ top: 0,
90
+ indexCapacity: 0,
91
+ indexTop: 0,
92
+ live: 0,
93
+ holes: 0,
94
+ });
95
+ this.vertexCapacity = 0;
96
+ this.indexCapacity = 0;
97
+ this.places = [];
98
+ }
99
+ /**
100
+ * The geometries removed since the last frame let go of, and those added
101
+ * copied in: at the top while they fit, else into an atlas packed again,
102
+ * grown to twice what is live.
103
+ */
104
+ place(geometries) {
105
+ for (const id of geometries.removed) {
106
+ const place = this.places[id];
107
+ if (place?.glyphs) {
108
+ this.places[id] = null;
109
+ this.glyphs.live -= place.vertices;
110
+ this.glyphs.holes += place.vertices;
111
+ }
112
+ else if (place) {
113
+ this.places[id] = null;
114
+ this.live -= place.vertices;
115
+ this.holes += place.vertices;
116
+ }
117
+ }
118
+ geometries.removed.length = 0;
119
+ // Changed in place: copied again where they lie, else as added.
120
+ for (const id of geometries.updated) {
121
+ const place = this.places[id];
122
+ const data = geometries.get(id);
123
+ if (place && data && !data.glyphs && place.vertices === data.positions.length / 2) {
124
+ this.copyVertices(data, place.vertexStart);
125
+ }
126
+ else if (place && data) {
127
+ this.places[id] = null;
128
+ if (place.glyphs) {
129
+ this.glyphs.live -= place.vertices;
130
+ this.glyphs.holes += place.vertices;
131
+ }
132
+ else {
133
+ this.live -= place.vertices;
134
+ this.holes += place.vertices;
135
+ }
136
+ geometries.added.push(id);
137
+ }
138
+ }
139
+ geometries.updated.length = 0;
140
+ let vertices = 0;
141
+ let indices = 0;
142
+ let glyphVertices = 0;
143
+ let glyphIndices = 0;
144
+ for (const id of geometries.added) {
145
+ const data = geometries.get(id);
146
+ if (data?.glyphs) {
147
+ glyphVertices += data.glyphs.vertices.length / GLYPH_FLOATS;
148
+ glyphIndices += data.indices.length;
149
+ }
150
+ else if (data) {
151
+ vertices += data.positions.length / 2;
152
+ indices += data.indices.length;
153
+ }
154
+ }
155
+ // Each atlas packed again on its own, so that texts' quads made again often never repack
156
+ // the shapes', nor shapes the texts'.
157
+ const g = this.glyphs;
158
+ const shapes = this.vertexTop + vertices > this.vertexCapacity ||
159
+ this.indexTop + indices > this.indexCapacity ||
160
+ (this.holes > SLACK && this.holes > this.live);
161
+ const texts = g.top + glyphVertices > g.capacity ||
162
+ g.indexTop + glyphIndices > g.indexCapacity ||
163
+ (g.holes > GLYPHS_LEAST && g.holes > g.live);
164
+ if (shapes) {
165
+ this.repack(geometries);
166
+ }
167
+ if (texts) {
168
+ this.repackGlyphs(geometries);
169
+ }
170
+ for (const id of geometries.added) {
171
+ const data = geometries.get(id);
172
+ if (data && !(data.glyphs ? texts : shapes)) {
173
+ this.copyIn(id, data);
174
+ }
175
+ }
176
+ geometries.added.length = 0;
177
+ }
178
+ /** Every live shape's geometry copied into new buffers, with room for twice what is live. */
179
+ repack(geometries) {
180
+ const gl = this.gl;
181
+ const ids = geometries.live();
182
+ let vertices = 0;
183
+ let indices = 0;
184
+ for (const id of ids) {
185
+ const data = geometries.get(id);
186
+ if (!data.glyphs) {
187
+ vertices += data.positions.length / 2;
188
+ indices += data.indices.length;
189
+ }
190
+ }
191
+ this.vertexCapacity = Math.max(LEAST, vertices * 2);
192
+ this.indexCapacity = Math.max(LEAST * 3, indices * 2);
193
+ this.state.bindVertexArray(this.vertexArray);
194
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
195
+ gl.bufferData(gl.ARRAY_BUFFER, this.vertexCapacity * VERTEX_BYTES, gl.STATIC_DRAW);
196
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indexCapacity * 4, gl.STATIC_DRAW);
197
+ this.vertexTop = 0;
198
+ this.indexTop = 0;
199
+ this.live = 0;
200
+ this.holes = 0;
201
+ for (const id of ids) {
202
+ const data = geometries.get(id);
203
+ if (!data.glyphs) {
204
+ this.copyIn(id, data);
205
+ }
206
+ }
207
+ }
208
+ /** Every live text's quads copied into new glyph buffers: none till a text needs them. */
209
+ repackGlyphs(geometries) {
210
+ const gl = this.gl;
211
+ const g = this.glyphs;
212
+ const ids = geometries.live();
213
+ let vertices = 0;
214
+ let indices = 0;
215
+ for (const id of ids) {
216
+ const data = geometries.get(id);
217
+ if (data.glyphs) {
218
+ vertices += data.glyphs.vertices.length / GLYPH_FLOATS;
219
+ indices += data.indices.length;
220
+ }
221
+ }
222
+ g.capacity = vertices > 0 ? Math.max(GLYPHS_LEAST, vertices * 2) : 0;
223
+ g.indexCapacity = vertices > 0 ? Math.max(GLYPHS_LEAST * 2, indices * 2) : 0;
224
+ this.state.bindVertexArray(this.glyphArray);
225
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);
226
+ gl.bufferData(gl.ARRAY_BUFFER, g.capacity * GLYPH_BYTES, gl.STATIC_DRAW);
227
+ gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, g.indexCapacity * 4, gl.STATIC_DRAW);
228
+ g.top = 0;
229
+ g.indexTop = 0;
230
+ g.live = 0;
231
+ g.holes = 0;
232
+ for (const id of ids) {
233
+ const data = geometries.get(id);
234
+ if (data.glyphs) {
235
+ this.copyGlyphs(id, data);
236
+ }
237
+ }
238
+ }
239
+ /** `data` copied in at the top of the atlas, its indices made absolute. */
240
+ copyIn(id, data) {
241
+ if (data.glyphs) {
242
+ this.copyGlyphs(id, data);
243
+ return;
244
+ }
245
+ const gl = this.gl;
246
+ const count = data.positions.length / 2;
247
+ const base = this.vertexTop;
248
+ this.copyVertices(data, base);
249
+ const indices = new Uint32Array(data.indices.length);
250
+ for (let i = 0; i < indices.length; i++) {
251
+ indices[i] = data.indices[i] + base;
252
+ }
253
+ this.state.bindVertexArray(this.vertexArray);
254
+ gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, this.indexTop * 4, indices);
255
+ this.places[id] = {
256
+ vertexStart: base,
257
+ vertices: count,
258
+ indexStart: this.indexTop,
259
+ indices: indices.length,
260
+ glyphs: null,
261
+ flat: data.flat === true,
262
+ };
263
+ this.vertexTop += count;
264
+ this.indexTop += indices.length;
265
+ this.live += count;
266
+ }
267
+ /** `data`'s vertices interleaved into the atlas from vertex `base`. */
268
+ copyVertices(data, base) {
269
+ const gl = this.gl;
270
+ const count = data.positions.length / 2;
271
+ const bytes = new ArrayBuffer(count * VERTEX_BYTES);
272
+ const floats = new Float32Array(bytes);
273
+ const words = new Uint32Array(bytes);
274
+ const texels = data.texels;
275
+ const depths = data.depths;
276
+ for (let i = 0; i < count; i++) {
277
+ floats[i * 5] = data.positions[i * 2];
278
+ floats[i * 5 + 1] = data.positions[i * 2 + 1];
279
+ floats[i * 5 + 2] = texels ? texels[i * 2] : 0;
280
+ floats[i * 5 + 3] = texels ? texels[i * 2 + 1] : 0;
281
+ if (depths) {
282
+ floats[i * 5 + 4] = depths[i];
283
+ }
284
+ else {
285
+ words[i * 5 + 4] = data.colors[i];
286
+ }
287
+ }
288
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
289
+ gl.bufferSubData(gl.ARRAY_BUFFER, base * VERTEX_BYTES, floats);
290
+ }
291
+ /** Glyph quads copied in at the top of the glyph atlas, their indices made absolute in it. */
292
+ copyGlyphs(id, data) {
293
+ const gl = this.gl;
294
+ const g = this.glyphs;
295
+ const glyphs = data.glyphs;
296
+ const count = glyphs.vertices.length / GLYPH_FLOATS;
297
+ const indices = new Uint32Array(data.indices.length);
298
+ for (let i = 0; i < indices.length; i++) {
299
+ indices[i] = data.indices[i] + g.top;
300
+ }
301
+ this.state.bindVertexArray(this.glyphArray);
302
+ gl.bindBuffer(gl.ARRAY_BUFFER, this.glyphBuffer);
303
+ gl.bufferSubData(gl.ARRAY_BUFFER, g.top * GLYPH_BYTES, glyphs.vertices);
304
+ gl.bufferSubData(gl.ELEMENT_ARRAY_BUFFER, g.indexTop * 4, indices);
305
+ this.places[id] = {
306
+ vertexStart: g.top,
307
+ vertices: count,
308
+ indexStart: g.indexTop,
309
+ indices: indices.length,
310
+ glyphs: { mode: glyphs.mode, table: glyphs.table },
311
+ flat: false,
312
+ };
313
+ g.top += count;
314
+ g.indexTop += indices.length;
315
+ g.live += count;
316
+ }
317
+ /** The buffers and vertex arrays made on the context, deleted. */
318
+ destroy() {
319
+ const gl = this.gl;
320
+ gl.deleteVertexArray(this.vertexArray);
321
+ gl.deleteBuffer(this.vertexBuffer);
322
+ gl.deleteBuffer(this.indexBuffer);
323
+ gl.deleteVertexArray(this.glyphArray);
324
+ gl.deleteBuffer(this.glyphBuffer);
325
+ gl.deleteBuffer(this.glyphIndexBuffer);
326
+ }
327
+ }
328
+ //# sourceMappingURL=atlas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atlas.js","sourceRoot":"","sources":["../../src/webgl/atlas.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,WAAW,EACX,MAAM,EACN,QAAQ,EACR,OAAO,GACR,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,+EAA+E;AAC/E,MAAM,WAAW,GAAG,YAAY,GAAG,CAAC,CAAC;AACrC,4EAA4E;AAC5E,MAAM,YAAY,GAAG,IAAI,CAAC;AAC1B,iFAAiF;AACjF,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;AACtB,+EAA+E;AAC/E,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC;AAatB;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IACP,EAAE,CAAyB;IAC3B,KAAK,CAAU;IAChC,WAAW,CAA0B;IAC7B,YAAY,CAAe;IAC3B,WAAW,CAAe;IAC1B,cAAc,GAAG,CAAC,CAAC;IACnB,aAAa,GAAG,CAAC,CAAC;IAClB,SAAS,GAAG,CAAC,CAAC;IACd,QAAQ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