@blakron/core 0.5.10 → 0.5.11
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.
|
@@ -6,7 +6,7 @@ export declare const ShaderLib2: {
|
|
|
6
6
|
readonly default_vert: "#version 300 es\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\nin vec4 aColor;\nuniform vec2 projectionVector;\nout vec2 vTextureCoord;\nout vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4((aVertexPosition / projectionVector) + center, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vColor = aColor;\n}";
|
|
7
7
|
readonly fullscreen_vert: "#version 300 es\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\nin vec4 aColor;\nuniform vec2 projectionVector;\nout vec2 vTextureCoord;\nout vec4 vColor;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4((aVertexPosition / projectionVector) + center, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vColor = aColor;\n}";
|
|
8
8
|
readonly multi_vert: "#version 300 es\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\nin vec4 aColor;\nin float aTextureId;\nuniform vec2 projectionVector;\nout vec2 vTextureCoord;\nout vec4 vColor;\nout float vTextureId;\nconst vec2 center = vec2(-1.0, 1.0);\nvoid main(void) {\n gl_Position = vec4((aVertexPosition / projectionVector) + center, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n vColor = aColor;\n vTextureId = aTextureId;\n}";
|
|
9
|
-
readonly multi_frag: "#version 300 es\nprecision lowp float;\nin vec2 vTextureCoord;\nin vec4 vColor;\nin float vTextureId;\nuniform sampler2D uSamplers[8];\nout vec4 fragColor;\nvoid main(void) {\n
|
|
9
|
+
readonly multi_frag: "#version 300 es\nprecision lowp float;\nin vec2 vTextureCoord;\nin vec4 vColor;\nin float vTextureId;\nuniform sampler2D uSamplers[8];\nout vec4 fragColor;\nvoid main(void) {\n vec4 color;\n int id = int(vTextureId + 0.5);\n if (id == 0) color = texture(uSamplers[0], vTextureCoord);\n else if (id == 1) color = texture(uSamplers[1], vTextureCoord);\n else if (id == 2) color = texture(uSamplers[2], vTextureCoord);\n else if (id == 3) color = texture(uSamplers[3], vTextureCoord);\n else if (id == 4) color = texture(uSamplers[4], vTextureCoord);\n else if (id == 5) color = texture(uSamplers[5], vTextureCoord);\n else if (id == 6) color = texture(uSamplers[6], vTextureCoord);\n else color = texture(uSamplers[7], vTextureCoord);\n fragColor = color * vColor;\n}";
|
|
10
10
|
readonly texture_frag: "#version 300 es\nprecision lowp float;\nin vec2 vTextureCoord;\nin vec4 vColor;\nuniform sampler2D uSampler;\nout vec4 fragColor;\nvoid main(void) {\n fragColor = texture(uSampler, vTextureCoord) * vColor;\n}";
|
|
11
11
|
readonly primitive_frag: "#version 300 es\nprecision lowp float;\nin vec2 vTextureCoord;\nin vec4 vColor;\nout vec4 fragColor;\nvoid main(void) {\n fragColor = vColor;\n}";
|
|
12
12
|
readonly blur_frag: "#version 300 es\nprecision mediump float;\nuniform vec2 blur;\nuniform sampler2D uSampler;\nin vec2 vTextureCoord;\nuniform vec2 uTextureSize;\nout vec4 fragColor;\nvoid main() {\n const int sampleRadius = 5;\n const int samples = sampleRadius * 2 + 1;\n vec2 blurUv = blur / uTextureSize;\n vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 uv = vec2(0.0, 0.0);\n blurUv /= float(sampleRadius);\n for (int i = -sampleRadius; i <= sampleRadius; i++) {\n uv.x = vTextureCoord.x + float(i) * blurUv.x;\n uv.y = vTextureCoord.y + float(i) * blurUv.y;\n color += texture(uSampler, uv);\n }\n color /= float(samples);\n fragColor = color;\n}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderLib2.d.ts","sourceRoot":"","sources":["../../../../../src/blakron/player/webgl/shaders/ShaderLib2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ShaderLib2.d.ts","sourceRoot":"","sources":["../../../../../src/blakron/player/webgl/shaders/ShaderLib2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;CAyOb,CAAC;AAIX,eAAO,MAAM,WAAW,yBAA0B,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAKtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAoBtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAoBtD"}
|
|
@@ -51,7 +51,9 @@ void main(void) {
|
|
|
51
51
|
vTextureId = aTextureId;
|
|
52
52
|
}`,
|
|
53
53
|
// Multi-texture fragment shader.
|
|
54
|
-
//
|
|
54
|
+
// Each branch uses a constant integer to index the sampler array, which
|
|
55
|
+
// satisfies GLSL ES 3.00's requirement that sampler indices be constant or
|
|
56
|
+
// dynamically uniform. (Direct variable indexing is NOT allowed.)
|
|
55
57
|
multi_frag: /* glsl */ `#version 300 es
|
|
56
58
|
precision lowp float;
|
|
57
59
|
in vec2 vTextureCoord;
|
|
@@ -60,7 +62,17 @@ in float vTextureId;
|
|
|
60
62
|
uniform sampler2D uSamplers[8];
|
|
61
63
|
out vec4 fragColor;
|
|
62
64
|
void main(void) {
|
|
63
|
-
|
|
65
|
+
vec4 color;
|
|
66
|
+
int id = int(vTextureId + 0.5);
|
|
67
|
+
if (id == 0) color = texture(uSamplers[0], vTextureCoord);
|
|
68
|
+
else if (id == 1) color = texture(uSamplers[1], vTextureCoord);
|
|
69
|
+
else if (id == 2) color = texture(uSamplers[2], vTextureCoord);
|
|
70
|
+
else if (id == 3) color = texture(uSamplers[3], vTextureCoord);
|
|
71
|
+
else if (id == 4) color = texture(uSamplers[4], vTextureCoord);
|
|
72
|
+
else if (id == 5) color = texture(uSamplers[5], vTextureCoord);
|
|
73
|
+
else if (id == 6) color = texture(uSamplers[6], vTextureCoord);
|
|
74
|
+
else color = texture(uSamplers[7], vTextureCoord);
|
|
75
|
+
fragColor = color * vColor;
|
|
64
76
|
}`,
|
|
65
77
|
texture_frag: /* glsl */ `#version 300 es
|
|
66
78
|
precision lowp float;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderLib2.js","sourceRoot":"","sources":["../../../../../src/blakron/player/webgl/shaders/ShaderLib2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,YAAY,EAAE,UAAU,CAAC;;;;;;;;;;;;EAYxB;IAED,6EAA6E;IAC7E,sEAAsE;IACtE,oEAAoE;IACpE,qCAAqC;IACrC,eAAe,EAAE,UAAU,CAAC;;;;;;;;;;;;EAY3B;IAED,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;EAetB;IAED,iCAAiC;IACjC,
|
|
1
|
+
{"version":3,"file":"ShaderLib2.js","sourceRoot":"","sources":["../../../../../src/blakron/player/webgl/shaders/ShaderLib2.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,YAAY,EAAE,UAAU,CAAC;;;;;;;;;;;;EAYxB;IAED,6EAA6E;IAC7E,sEAAsE;IACtE,oEAAoE;IACpE,qCAAqC;IACrC,eAAe,EAAE,UAAU,CAAC;;;;;;;;;;;;EAY3B;IAED,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;EAetB;IAED,iCAAiC;IACjC,wEAAwE;IACxE,2EAA2E;IAC3E,kEAAkE;IAClE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;EAmBtB;IAED,YAAY,EAAE,UAAU,CAAC;;;;;;;;EAQxB;IAED,cAAc,EAAE,UAAU,CAAC;;;;;;;EAO1B;IAED,SAAS,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;EAqBrB;IAED,6DAA6D;IAC7D,WAAW,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;EAkBvB;IAED,2DAA2D;IAC3D,WAAW,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;EAkBvB;IAED,SAAS,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuDrB;IAED,mBAAmB,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;EAe/B;CACQ,CAAC;AAEX,iFAAiF;AAEjF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAU,CAAC;AAGnD,MAAM,UAAU,YAAY,CAAC,MAAc;IAC1C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAe;IAC7C,OAAO,UAAU,CAAC;;;;;;;;;;;oBAWC,IAAI,UAAU,IAAI;;;;;;;EAOpC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAe;IAC7C,OAAO,UAAU,CAAC;;;;;;;;;;;oBAWC,IAAI,UAAU,IAAI;;;;;;;EAOpC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blakron/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.11",
|
|
4
4
|
"description": "Modern rewrite of the Egret game engine — WebGL multi-texture batching, instruction-driven render pipeline, strict TypeScript, Egret-compatible API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|