@swf2es/render 0.1.34 → 0.1.36
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/dist/commands.d.ts +11 -2
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +36 -6
- package/dist/commands.js.map +1 -1
- package/dist/geometry.d.ts +62 -5
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +100 -17
- package/dist/geometry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/measure.d.ts.map +1 -1
- package/dist/measure.js +118 -61
- package/dist/measure.js.map +1 -1
- package/dist/plan.js +4 -4
- package/dist/plan.js.map +1 -1
- package/dist/rows.d.ts +4 -0
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +59 -10
- package/dist/rows.js.map +1 -1
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +37 -5
- package/dist/scene.js.map +1 -1
- package/dist/webgl/atlas.d.ts +89 -16
- package/dist/webgl/atlas.d.ts.map +1 -1
- package/dist/webgl/atlas.js +285 -109
- package/dist/webgl/atlas.js.map +1 -1
- package/dist/webgl/backend.d.ts +5 -3
- package/dist/webgl/backend.d.ts.map +1 -1
- package/dist/webgl/backend.js +9 -9
- package/dist/webgl/backend.js.map +1 -1
- package/dist/webgl/draws.js +1 -1
- package/dist/webgl/draws.js.map +1 -1
- package/package.json +2 -2
- package/src/commands.ts +48 -6
- package/src/geometry.ts +109 -19
- package/src/index.ts +1 -0
- package/src/measure.ts +132 -68
- package/src/plan.ts +4 -4
- package/src/rows.ts +62 -19
- package/src/scene.ts +41 -5
- package/src/webgl/atlas.ts +334 -118
- package/src/webgl/backend.ts +9 -9
- package/src/webgl/draws.ts +1 -1
package/src/scene.ts
CHANGED
|
@@ -145,6 +145,12 @@ export const NO_WHOLE = 0;
|
|
|
145
145
|
export const WHOLE_SMOOTH = 1;
|
|
146
146
|
export const WHOLE_ALIASED = 2;
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Draws of a span from which SceneList.appendDraws copies its columns
|
|
150
|
+
* through views: below it, copying by index costs less than making them.
|
|
151
|
+
*/
|
|
152
|
+
const SPAN_VIEW_DRAWS = 64;
|
|
153
|
+
|
|
148
154
|
/**
|
|
149
155
|
* A frame's drawing in order: each entry a geometry drawn under a row with
|
|
150
156
|
* a blend mode, and the texture it samples (-1 for none) and how. Boundaries
|
|
@@ -226,20 +232,50 @@ export class SceneList {
|
|
|
226
232
|
|
|
227
233
|
const kinds = from.kind;
|
|
228
234
|
const rows = from.row;
|
|
235
|
+
const kind = this.kind;
|
|
229
236
|
const row = this.row;
|
|
237
|
+
if (end - first >= SPAN_VIEW_DRAWS) {
|
|
238
|
+
// A long span's other columns through views, which copy them much faster than by index.
|
|
239
|
+
for (let e = first, to = at; e < end; e++, to++) {
|
|
240
|
+
if (kinds[e] !== DRAW) {
|
|
241
|
+
throw new Error(`entry ${e} of a span is no draw, which a span cannot move`);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
kind[to] = DRAW;
|
|
245
|
+
row[to] = rows[e] + rowShift;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
this.geometry.set(from.geometry.subarray(first, end), at);
|
|
249
|
+
this.blend.set(from.blend.subarray(first, end), at);
|
|
250
|
+
this.texture.set(from.texture.subarray(first, end), at);
|
|
251
|
+
this.sampler.set(from.sampler.subarray(first, end), at);
|
|
252
|
+
this.length = length;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Column by column, by index: a view of each to copy whole was most of what a frame of
|
|
257
|
+
// spans allocated, most spans being short.
|
|
258
|
+
const geometries = from.geometry;
|
|
259
|
+
const blends = from.blend;
|
|
260
|
+
const textures = from.texture;
|
|
261
|
+
const samplers = from.sampler;
|
|
262
|
+
const geometry = this.geometry;
|
|
263
|
+
const blend = this.blend;
|
|
264
|
+
const texture = this.texture;
|
|
265
|
+
const sampler = this.sampler;
|
|
230
266
|
for (let e = first, to = at; e < end; e++, to++) {
|
|
231
267
|
if (kinds[e] !== DRAW) {
|
|
232
268
|
throw new Error(`entry ${e} of a span is no draw, which a span cannot move`);
|
|
233
269
|
}
|
|
234
270
|
|
|
271
|
+
kind[to] = DRAW;
|
|
235
272
|
row[to] = rows[e] + rowShift;
|
|
273
|
+
geometry[to] = geometries[e];
|
|
274
|
+
blend[to] = blends[e];
|
|
275
|
+
texture[to] = textures[e];
|
|
276
|
+
sampler[to] = samplers[e];
|
|
236
277
|
}
|
|
237
278
|
|
|
238
|
-
this.kind.fill(DRAW, at, length);
|
|
239
|
-
this.geometry.set(from.geometry.subarray(first, end), at);
|
|
240
|
-
this.blend.set(from.blend.subarray(first, end), at);
|
|
241
|
-
this.texture.set(from.texture.subarray(first, end), at);
|
|
242
|
-
this.sampler.set(from.sampler.subarray(first, end), at);
|
|
243
279
|
this.length = length;
|
|
244
280
|
}
|
|
245
281
|
|