@driftengine/ui2d 4.4.2 → 4.6.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 +1 -1
- package/dist/spriteGl.js +10 -6
- package/package.json +2 -2
- package/src/spriteGl.ts +10 -6
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The 2D layer: quads with a texture on them, batched, in the order you drew them.
|
|
4
4
|
|
|
5
|
-
**Cost: 8.
|
|
5
|
+
**Cost: 8.8 KB gzipped on top of core.** Measured by `scripts/size-gate.test.mjs`, which fails if it
|
|
6
6
|
drifts more than 3% — the number is derived from the same floors that gate asserts, so a README
|
|
7
7
|
quoting a stale one is a red suite rather than a thing somebody notices.
|
|
8
8
|
|
package/dist/spriteGl.js
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
import { SPRITE_FRAG, SPRITE_VERT } from './shaders/sprite.js';
|
|
3
3
|
import { SPRITE_FLOATS } from './spriteBatch.js';
|
|
4
4
|
/**
|
|
5
|
-
* The unit this pass borrows for the length of one draw
|
|
5
|
+
* The unit this pass borrows for the length of one draw: the last of the thirty-two a program's
|
|
6
|
+
* stages share, which WebGL2 guarantees, and which core's texture-unit gate keeps every lit-pass
|
|
7
|
+
* unit below.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* **It was fourteen, on the reasoning that fourteen was above every unit the lit pass assigned**, and
|
|
10
|
+
* that stopped being true when DriftLight's atlas and the glass tints took units thirteen to
|
|
11
|
+
* sixteen. The pass releases its unit before it returns — a texture left bound where a later pass
|
|
12
|
+
* attaches is a feedback loop — so sprites drawn between two mesh draws unbound the lit pass's
|
|
13
|
+
* texture on fourteen, and the next mesh sampled nothing there. A unit per stage is a separate,
|
|
14
|
+
* smaller guarantee; this program declares one sampler, so the combined pool is the one that binds.
|
|
11
15
|
*/
|
|
12
|
-
const SPRITE_UNIT =
|
|
16
|
+
const SPRITE_UNIT = 31;
|
|
13
17
|
/** Bytes per instance. Fourteen floats; see `SPRITE_FLOATS`. */
|
|
14
18
|
const STRIDE = SPRITE_FLOATS * 4;
|
|
15
19
|
function compile(gl, kind, source, label) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driftengine/ui2d",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "The 2D layer: batched sprites, sheets, tilemaps, and a retained interface tree over them",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@driftengine/core": "4.
|
|
30
|
+
"@driftengine/core": "4.6.0"
|
|
31
31
|
},
|
|
32
32
|
"author": "Drift Technologies",
|
|
33
33
|
"repository": {
|
package/src/spriteGl.ts
CHANGED
|
@@ -6,14 +6,18 @@ import type { SpriteBatch } from './spriteBatch.ts';
|
|
|
6
6
|
import type { SpriteTextureOptions } from './spriteTexture.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* The unit this pass borrows for the length of one draw
|
|
9
|
+
* The unit this pass borrows for the length of one draw: the last of the thirty-two a program's
|
|
10
|
+
* stages share, which WebGL2 guarantees, and which core's texture-unit gate keeps every lit-pass
|
|
11
|
+
* unit below.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* **It was fourteen, on the reasoning that fourteen was above every unit the lit pass assigned**, and
|
|
14
|
+
* that stopped being true when DriftLight's atlas and the glass tints took units thirteen to
|
|
15
|
+
* sixteen. The pass releases its unit before it returns — a texture left bound where a later pass
|
|
16
|
+
* attaches is a feedback loop — so sprites drawn between two mesh draws unbound the lit pass's
|
|
17
|
+
* texture on fourteen, and the next mesh sampled nothing there. A unit per stage is a separate,
|
|
18
|
+
* smaller guarantee; this program declares one sampler, so the combined pool is the one that binds.
|
|
15
19
|
*/
|
|
16
|
-
const SPRITE_UNIT =
|
|
20
|
+
const SPRITE_UNIT = 31;
|
|
17
21
|
|
|
18
22
|
/** Bytes per instance. Fourteen floats; see `SPRITE_FLOATS`. */
|
|
19
23
|
const STRIDE = SPRITE_FLOATS * 4;
|