@swf2es/render 0.1.7 → 0.1.10
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/webgl/atlas.d.ts +8 -1
- package/dist/webgl/atlas.d.ts.map +1 -1
- package/dist/webgl/atlas.js +10 -0
- package/dist/webgl/atlas.js.map +1 -1
- package/dist/webgl/backend.d.ts.map +1 -1
- package/dist/webgl/backend.js +0 -1
- package/dist/webgl/backend.js.map +1 -1
- package/dist/webgl/batches.d.ts +69 -0
- package/dist/webgl/batches.d.ts.map +1 -0
- package/dist/webgl/batches.js +277 -0
- package/dist/webgl/batches.js.map +1 -0
- package/dist/webgl/draws.d.ts +3 -1
- package/dist/webgl/draws.d.ts.map +1 -1
- package/dist/webgl/draws.js +36 -7
- package/dist/webgl/draws.js.map +1 -1
- package/dist/webgl/programs.d.ts +4 -1
- package/dist/webgl/programs.d.ts.map +1 -1
- package/dist/webgl/programs.js +6 -3
- package/dist/webgl/programs.js.map +1 -1
- package/package.json +2 -2
- package/src/webgl/atlas.ts +13 -0
- package/src/webgl/backend.ts +0 -1
- package/src/webgl/batches.ts +344 -0
- package/src/webgl/draws.ts +39 -7
- package/src/webgl/programs.ts +6 -3
package/src/webgl/programs.ts
CHANGED
|
@@ -32,6 +32,8 @@ export const ORIGIN_AT = 4;
|
|
|
32
32
|
export const GLYPH_AT = 5;
|
|
33
33
|
export const RUN_AT = 6;
|
|
34
34
|
export const TINT_AT = 7;
|
|
35
|
+
/** A merged fill's packed row, in the streaming vertex buffer. */
|
|
36
|
+
export const DRAW_AT = 8;
|
|
35
37
|
|
|
36
38
|
/** The most cutoff table entries a text's draw takes, as the player's text/saffron.ts builds them. */
|
|
37
39
|
export const TABLE_ENTRIES = 48;
|
|
@@ -76,7 +78,8 @@ export const RUN_UNIT = FILL_UNIT + FILL_TEXTURES;
|
|
|
76
78
|
* space), and passes on its straight colour, the row's colour transform
|
|
77
79
|
* and the texture it samples. uRow names the draw's row (FILL_SLOT); with
|
|
78
80
|
* `multi` (WEBGL_multi_draw), uRunTable names each draw's of a multi-draw by
|
|
79
|
-
* gl_DrawID, which is 0 in a draw of its own.
|
|
81
|
+
* gl_DrawID, which is 0 in a draw of its own. Merged fills supply the packed
|
|
82
|
+
* row as aDraw; the atlas leaves that attribute disabled and negative.
|
|
80
83
|
*/
|
|
81
84
|
export const fillVertex = (multi: boolean) => `#version 300 es
|
|
82
85
|
${multi ? "#extension GL_ANGLE_multi_draw : require" : ""}
|
|
@@ -85,7 +88,7 @@ layout(location = ${POSITION_AT}) in vec2 aPosition;
|
|
|
85
88
|
layout(location = ${TEXEL_AT}) in vec2 aTexel;
|
|
86
89
|
layout(location = ${COLOR_AT}) in vec4 aColor;
|
|
87
90
|
uniform highp sampler2D uRows;
|
|
88
|
-
${multi ?
|
|
91
|
+
${multi ? `layout(location = ${DRAW_AT}) in int aDraw;\nuniform highp isampler2D uRunTable;\nuniform int uRunBase;` : "uniform int uRow;"}
|
|
89
92
|
uniform vec4 uView;
|
|
90
93
|
uniform float uUnit;
|
|
91
94
|
out vec4 vColor;
|
|
@@ -95,7 +98,7 @@ flat out vec4 vAdd;
|
|
|
95
98
|
flat out int vSlot;
|
|
96
99
|
|
|
97
100
|
void main(void) {
|
|
98
|
-
int draw = ${multi ? `texelFetch(uRunTable, ivec2((uRunBase + gl_DrawID) & ${RUN_MOST - 1}, (uRunBase + gl_DrawID) >> ${Math.log2(RUN_MOST)}), 0).r` : "uRow"};
|
|
101
|
+
int draw = ${multi ? `aDraw >= 0 ? aDraw : texelFetch(uRunTable, ivec2((uRunBase + gl_DrawID) & ${RUN_MOST - 1}, (uRunBase + gl_DrawID) >> ${Math.log2(RUN_MOST)}), 0).r` : "uRow"};
|
|
99
102
|
int row = draw & ${(1 << FILL_SLOT) - 1};
|
|
100
103
|
vSlot = (draw >> ${FILL_SLOT}) & 15;
|
|
101
104
|
ivec2 at = ivec2((row & ${ROWS_A_LINE - 1}) * ${ROW_TEXELS}, row >> ${Math.log2(ROWS_A_LINE)});
|