@blakron/core 0.4.0 → 0.4.1
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export declare const ShaderLib: {
|
|
2
|
-
readonly default_vert: "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying 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}";
|
|
3
|
-
readonly multi_vert: "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying 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}";
|
|
4
|
-
readonly multi_frag: "\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[8];\nvoid main(void) {\n vec4 color;\n int id = int(vTextureId + 0.5);\n if (id == 0) color = texture2D(uSamplers[0], vTextureCoord);\n else if (id == 1) color = texture2D(uSamplers[1], vTextureCoord);\n else if (id == 2) color = texture2D(uSamplers[2], vTextureCoord);\n else if (id == 3) color = texture2D(uSamplers[3], vTextureCoord);\n else if (id == 4) color = texture2D(uSamplers[4], vTextureCoord);\n else if (id == 5) color = texture2D(uSamplers[5], vTextureCoord);\n else if (id == 6) color = texture2D(uSamplers[6], vTextureCoord);\n else color = texture2D(uSamplers[7], vTextureCoord);\n gl_FragColor = color * vColor;\n}";
|
|
5
|
-
readonly texture_frag: "\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;\n}";
|
|
6
|
-
readonly primitive_frag: "\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
|
|
7
|
-
readonly blur_frag: "\nprecision mediump float;\nuniform vec2 blur;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\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 += texture2D(uSampler, uv);\n }\n color /= float(samples);\n gl_FragColor = color;\n}";
|
|
8
|
-
readonly blur_h_frag: "\nprecision mediump float;\nuniform float blurX;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\nvoid main() {\n float step = 1.0 / uTextureSize.x;\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (int i = -8; i <= 8; i++) {\n if (abs(float(i)) > blurX) continue;\n float weight = 1.0 - abs(float(i)) / (blurX + 1.0);\n color += texture2D(uSampler, vTextureCoord + vec2(float(i) * step, 0.0)) * weight;\n total += weight;\n }\n gl_FragColor = color / total;\n}";
|
|
9
|
-
readonly blur_v_frag: "\nprecision mediump float;\nuniform float blurY;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\nvoid main() {\n float step = 1.0 / uTextureSize.y;\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (int i = -8; i <= 8; i++) {\n if (abs(float(i)) > blurY) continue;\n float weight = 1.0 - abs(float(i)) / (blurY + 1.0);\n color += texture2D(uSampler, vTextureCoord + vec2(0.0, float(i) * step)) * weight;\n total += weight;\n }\n gl_FragColor = color / total;\n}";
|
|
10
|
-
readonly glow_frag: "\nprecision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float dist;\nuniform float angle;\nuniform vec4 color;\nuniform float alpha;\nuniform float blurX;\nuniform float blurY;\nuniform float strength;\nuniform float inner;\nuniform float knockout;\nuniform float hideObject;\nuniform vec2 uTextureSize;\nfloat random(vec2 scale) {\n return fract(sin(dot(gl_FragCoord.xy, scale)) * 43758.5453);\n}\nvoid main(void) {\n vec2 px = vec2(1.0 / uTextureSize.x, 1.0 / uTextureSize.y);\n const float linearSamplingTimes = 7.0;\n const float circleSamplingTimes = 12.0;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float offsetX = dist * cos(angle) * px.x;\n float offsetY = dist * sin(angle) * px.y;\n const float PI = 3.14159265358979323846264;\n float offset = PI * 2.0 / circleSamplingTimes * random(vec2(12.9898, 78.233));\n float stepX = blurX * px.x / linearSamplingTimes;\n float stepY = blurY * px.y / linearSamplingTimes;\n for (float a = 0.0; a <= PI * 2.0; a += PI * 2.0 / circleSamplingTimes) {\n float cosAngle = cos(a + offset);\n float sinAngle = sin(a + offset);\n for (float i = 1.0; i <= linearSamplingTimes; i++) {\n float curDistanceX = i * stepX * cosAngle;\n float curDistanceY = i * stepY * sinAngle;\n if (vTextureCoord.x + curDistanceX - offsetX >= 0.0 && vTextureCoord.y + curDistanceY + offsetY <= 1.0) {\n curColor = texture2D(uSampler, vec2(vTextureCoord.x + curDistanceX - offsetX, vTextureCoord.y + curDistanceY + offsetY));\n totalAlpha += (linearSamplingTimes - i) * curColor.a;\n }\n maxTotalAlpha += (linearSamplingTimes - i);\n }\n }\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * strength * alpha * (1.0 - inner) * max(min(hideObject, knockout), 1.0 - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * strength * alpha * inner * ownColor.a;\n ownColor.a = max(ownColor.a * knockout * (1.0 - hideObject), 0.0001);\n vec3 mix1 = mix(ownColor.rgb, color.rgb, innerGlowAlpha / (innerGlowAlpha + ownColor.a));\n vec3 mix2 = mix(mix1, color.rgb, outerGlowAlpha / (innerGlowAlpha + ownColor.a + outerGlowAlpha));\n float resultAlpha = min(ownColor.a + outerGlowAlpha + innerGlowAlpha, 1.0);\n gl_FragColor = vec4(mix2 * resultAlpha, resultAlpha);\n}";
|
|
11
|
-
readonly colorTransform_frag: "\nprecision mediump float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform mat4 matrix;\nuniform vec4 colorAdd;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n if (texColor.a > 0.0) {\n texColor = vec4(texColor.rgb / texColor.a, texColor.a);\n }\n vec4 locColor = clamp(texColor * matrix + colorAdd, 0.0, 1.0);\n gl_FragColor = vColor * vec4(locColor.rgb * locColor.a, locColor.a);\n}";
|
|
2
|
+
readonly default_vert: "#version 100\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying 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}";
|
|
3
|
+
readonly multi_vert: "#version 100\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\nattribute float aTextureId;\nuniform vec2 projectionVector;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying 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}";
|
|
4
|
+
readonly multi_frag: "#version 100\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvarying float vTextureId;\nuniform sampler2D uSamplers[8];\nvoid main(void) {\n vec4 color;\n int id = int(vTextureId + 0.5);\n if (id == 0) color = texture2D(uSamplers[0], vTextureCoord);\n else if (id == 1) color = texture2D(uSamplers[1], vTextureCoord);\n else if (id == 2) color = texture2D(uSamplers[2], vTextureCoord);\n else if (id == 3) color = texture2D(uSamplers[3], vTextureCoord);\n else if (id == 4) color = texture2D(uSamplers[4], vTextureCoord);\n else if (id == 5) color = texture2D(uSamplers[5], vTextureCoord);\n else if (id == 6) color = texture2D(uSamplers[6], vTextureCoord);\n else color = texture2D(uSamplers[7], vTextureCoord);\n gl_FragColor = color * vColor;\n}";
|
|
5
|
+
readonly texture_frag: "#version 100\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;\n}";
|
|
6
|
+
readonly primitive_frag: "#version 100\nprecision lowp float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}";
|
|
7
|
+
readonly blur_frag: "#version 100\nprecision mediump float;\nuniform vec2 blur;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\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 += texture2D(uSampler, uv);\n }\n color /= float(samples);\n gl_FragColor = color;\n}";
|
|
8
|
+
readonly blur_h_frag: "#version 100\nprecision mediump float;\nuniform float blurX;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\nvoid main() {\n float step = 1.0 / uTextureSize.x;\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (int i = -8; i <= 8; i++) {\n if (abs(float(i)) > blurX) continue;\n float weight = 1.0 - abs(float(i)) / (blurX + 1.0);\n color += texture2D(uSampler, vTextureCoord + vec2(float(i) * step, 0.0)) * weight;\n total += weight;\n }\n gl_FragColor = color / total;\n}";
|
|
9
|
+
readonly blur_v_frag: "#version 100\nprecision mediump float;\nuniform float blurY;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\nuniform vec2 uTextureSize;\nvoid main() {\n float step = 1.0 / uTextureSize.y;\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (int i = -8; i <= 8; i++) {\n if (abs(float(i)) > blurY) continue;\n float weight = 1.0 - abs(float(i)) / (blurY + 1.0);\n color += texture2D(uSampler, vTextureCoord + vec2(0.0, float(i) * step)) * weight;\n total += weight;\n }\n gl_FragColor = color / total;\n}";
|
|
10
|
+
readonly glow_frag: "#version 100\nprecision highp float;\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float dist;\nuniform float angle;\nuniform vec4 color;\nuniform float alpha;\nuniform float blurX;\nuniform float blurY;\nuniform float strength;\nuniform float inner;\nuniform float knockout;\nuniform float hideObject;\nuniform vec2 uTextureSize;\nfloat random(vec2 scale) {\n return fract(sin(dot(gl_FragCoord.xy, scale)) * 43758.5453);\n}\nvoid main(void) {\n vec2 px = vec2(1.0 / uTextureSize.x, 1.0 / uTextureSize.y);\n const float linearSamplingTimes = 7.0;\n const float circleSamplingTimes = 12.0;\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float offsetX = dist * cos(angle) * px.x;\n float offsetY = dist * sin(angle) * px.y;\n const float PI = 3.14159265358979323846264;\n float offset = PI * 2.0 / circleSamplingTimes * random(vec2(12.9898, 78.233));\n float stepX = blurX * px.x / linearSamplingTimes;\n float stepY = blurY * px.y / linearSamplingTimes;\n for (float a = 0.0; a <= PI * 2.0; a += PI * 2.0 / circleSamplingTimes) {\n float cosAngle = cos(a + offset);\n float sinAngle = sin(a + offset);\n for (float i = 1.0; i <= linearSamplingTimes; i++) {\n float curDistanceX = i * stepX * cosAngle;\n float curDistanceY = i * stepY * sinAngle;\n if (vTextureCoord.x + curDistanceX - offsetX >= 0.0 && vTextureCoord.y + curDistanceY + offsetY <= 1.0) {\n curColor = texture2D(uSampler, vec2(vTextureCoord.x + curDistanceX - offsetX, vTextureCoord.y + curDistanceY + offsetY));\n totalAlpha += (linearSamplingTimes - i) * curColor.a;\n }\n maxTotalAlpha += (linearSamplingTimes - i);\n }\n }\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * strength * alpha * (1.0 - inner) * max(min(hideObject, knockout), 1.0 - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * strength * alpha * inner * ownColor.a;\n ownColor.a = max(ownColor.a * knockout * (1.0 - hideObject), 0.0001);\n vec3 mix1 = mix(ownColor.rgb, color.rgb, innerGlowAlpha / (innerGlowAlpha + ownColor.a));\n vec3 mix2 = mix(mix1, color.rgb, outerGlowAlpha / (innerGlowAlpha + ownColor.a + outerGlowAlpha));\n float resultAlpha = min(ownColor.a + outerGlowAlpha + innerGlowAlpha, 1.0);\n gl_FragColor = vec4(mix2 * resultAlpha, resultAlpha);\n}";
|
|
11
|
+
readonly colorTransform_frag: "#version 100\nprecision mediump float;\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\nuniform mat4 matrix;\nuniform vec4 colorAdd;\nuniform sampler2D uSampler;\nvoid main(void) {\n vec4 texColor = texture2D(uSampler, vTextureCoord);\n if (texColor.a > 0.0) {\n texColor = vec4(texColor.rgb / texColor.a, texColor.a);\n }\n vec4 locColor = clamp(texColor * matrix + colorAdd, 0.0, 1.0);\n gl_FragColor = vColor * vec4(locColor.rgb * locColor.a, locColor.a);\n}";
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Blur radius tiers. Each tier generates a dedicated shader variant with a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderLib.d.ts","sourceRoot":"","sources":["../../../../src/blakron/player/webgl/ShaderLib.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ShaderLib.d.ts","sourceRoot":"","sources":["../../../../src/blakron/player/webgl/ShaderLib.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;CA8MZ,CAAC;AAIX;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,yBAA0B,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnD,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAKpD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAmBpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAmBpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ShaderLib = {
|
|
2
|
-
default_vert: /* glsl */
|
|
2
|
+
default_vert: /* glsl */ `#version 100
|
|
3
3
|
attribute vec2 aVertexPosition;
|
|
4
4
|
attribute vec2 aTextureCoord;
|
|
5
5
|
attribute vec4 aColor;
|
|
@@ -13,7 +13,7 @@ void main(void) {
|
|
|
13
13
|
vColor = aColor;
|
|
14
14
|
}`,
|
|
15
15
|
// Multi-texture vertex shader: carries textureId as a float attribute.
|
|
16
|
-
multi_vert: /* glsl */
|
|
16
|
+
multi_vert: /* glsl */ `#version 100
|
|
17
17
|
attribute vec2 aVertexPosition;
|
|
18
18
|
attribute vec2 aTextureCoord;
|
|
19
19
|
attribute vec4 aColor;
|
|
@@ -32,7 +32,7 @@ void main(void) {
|
|
|
32
32
|
// Multi-texture fragment shader: samples from one of up to 8 texture units.
|
|
33
33
|
// WebGL 1 does not support dynamic indexing into sampler arrays, so we use
|
|
34
34
|
// an if/else chain — the same technique used by Pixi.js for WebGL1.
|
|
35
|
-
multi_frag: /* glsl */
|
|
35
|
+
multi_frag: /* glsl */ `#version 100
|
|
36
36
|
precision lowp float;
|
|
37
37
|
varying vec2 vTextureCoord;
|
|
38
38
|
varying vec4 vColor;
|
|
@@ -51,7 +51,7 @@ void main(void) {
|
|
|
51
51
|
else color = texture2D(uSamplers[7], vTextureCoord);
|
|
52
52
|
gl_FragColor = color * vColor;
|
|
53
53
|
}`,
|
|
54
|
-
texture_frag: /* glsl */
|
|
54
|
+
texture_frag: /* glsl */ `#version 100
|
|
55
55
|
precision lowp float;
|
|
56
56
|
varying vec2 vTextureCoord;
|
|
57
57
|
varying vec4 vColor;
|
|
@@ -59,14 +59,14 @@ uniform sampler2D uSampler;
|
|
|
59
59
|
void main(void) {
|
|
60
60
|
gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;
|
|
61
61
|
}`,
|
|
62
|
-
primitive_frag: /* glsl */
|
|
62
|
+
primitive_frag: /* glsl */ `#version 100
|
|
63
63
|
precision lowp float;
|
|
64
64
|
varying vec2 vTextureCoord;
|
|
65
65
|
varying vec4 vColor;
|
|
66
66
|
void main(void) {
|
|
67
67
|
gl_FragColor = vColor;
|
|
68
68
|
}`,
|
|
69
|
-
blur_frag: /* glsl */
|
|
69
|
+
blur_frag: /* glsl */ `#version 100
|
|
70
70
|
precision mediump float;
|
|
71
71
|
uniform vec2 blur;
|
|
72
72
|
uniform sampler2D uSampler;
|
|
@@ -88,9 +88,7 @@ void main() {
|
|
|
88
88
|
gl_FragColor = color;
|
|
89
89
|
}`,
|
|
90
90
|
// Horizontal blur pass for ping-pong two-pass Gaussian blur.
|
|
91
|
-
|
|
92
|
-
// Radius is hardcoded to 8 (legacy fallback, kept for reference).
|
|
93
|
-
blur_h_frag: /* glsl */ `
|
|
91
|
+
blur_h_frag: /* glsl */ `#version 100
|
|
94
92
|
precision mediump float;
|
|
95
93
|
uniform float blurX;
|
|
96
94
|
uniform sampler2D uSampler;
|
|
@@ -109,9 +107,7 @@ void main() {
|
|
|
109
107
|
gl_FragColor = color / total;
|
|
110
108
|
}`,
|
|
111
109
|
// Vertical blur pass for ping-pong two-pass Gaussian blur.
|
|
112
|
-
|
|
113
|
-
// Radius is hardcoded to 8 (legacy fallback, kept for reference).
|
|
114
|
-
blur_v_frag: /* glsl */ `
|
|
110
|
+
blur_v_frag: /* glsl */ `#version 100
|
|
115
111
|
precision mediump float;
|
|
116
112
|
uniform float blurY;
|
|
117
113
|
uniform sampler2D uSampler;
|
|
@@ -129,7 +125,7 @@ void main() {
|
|
|
129
125
|
}
|
|
130
126
|
gl_FragColor = color / total;
|
|
131
127
|
}`,
|
|
132
|
-
glow_frag: /* glsl */
|
|
128
|
+
glow_frag: /* glsl */ `#version 100
|
|
133
129
|
precision highp float;
|
|
134
130
|
varying vec2 vTextureCoord;
|
|
135
131
|
uniform sampler2D uSampler;
|
|
@@ -184,7 +180,7 @@ void main(void) {
|
|
|
184
180
|
float resultAlpha = min(ownColor.a + outerGlowAlpha + innerGlowAlpha, 1.0);
|
|
185
181
|
gl_FragColor = vec4(mix2 * resultAlpha, resultAlpha);
|
|
186
182
|
}`,
|
|
187
|
-
colorTransform_frag: /* glsl */
|
|
183
|
+
colorTransform_frag: /* glsl */ `#version 100
|
|
188
184
|
precision mediump float;
|
|
189
185
|
varying vec2 vTextureCoord;
|
|
190
186
|
varying vec4 vColor;
|
|
@@ -223,7 +219,7 @@ export function getBlurTier(radius) {
|
|
|
223
219
|
* The loop bound is a compile-time constant so it is valid in WebGL1 GLSL.
|
|
224
220
|
*/
|
|
225
221
|
export function makeBlurHFrag(tier) {
|
|
226
|
-
return /* glsl */
|
|
222
|
+
return /* glsl */ `#version 100
|
|
227
223
|
precision mediump float;
|
|
228
224
|
uniform float blurX;
|
|
229
225
|
uniform sampler2D uSampler;
|
|
@@ -246,7 +242,7 @@ void main() {
|
|
|
246
242
|
* Generates a vertical blur fragment shader for the given radius tier.
|
|
247
243
|
*/
|
|
248
244
|
export function makeBlurVFrag(tier) {
|
|
249
|
-
return /* glsl */
|
|
245
|
+
return /* glsl */ `#version 100
|
|
250
246
|
precision mediump float;
|
|
251
247
|
uniform float blurY;
|
|
252
248
|
uniform sampler2D uSampler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderLib.js","sourceRoot":"","sources":["../../../../src/blakron/player/webgl/ShaderLib.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,YAAY,EAAE,UAAU,CAAC;;;;;;;;;;;;EAYxB;IAED,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;EAetB;IAED,4EAA4E;IAC5E,2EAA2E;IAC3E,oEAAoE;IACpE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;EAkBtB;IAED,YAAY,EAAE,UAAU,CAAC;;;;;;;EAOxB;IAED,cAAc,EAAE,UAAU,CAAC;;;;;;EAM1B;IAED,SAAS,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;EAoBrB;IAED,6DAA6D;IAC7D,
|
|
1
|
+
{"version":3,"file":"ShaderLib.js","sourceRoot":"","sources":["../../../../src/blakron/player/webgl/ShaderLib.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,YAAY,EAAE,UAAU,CAAC;;;;;;;;;;;;EAYxB;IAED,uEAAuE;IACvE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;EAetB;IAED,4EAA4E;IAC5E,2EAA2E;IAC3E,oEAAoE;IACpE,UAAU,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;EAkBtB;IAED,YAAY,EAAE,UAAU,CAAC;;;;;;;EAOxB;IAED,cAAc,EAAE,UAAU,CAAC;;;;;;EAM1B;IAED,SAAS,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;EAoBrB;IAED,6DAA6D;IAC7D,WAAW,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;EAiBvB;IAED,2DAA2D;IAC3D,WAAW,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;EAiBvB;IAED,SAAS,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDrB;IAED,mBAAmB,EAAE,UAAU,CAAC;;;;;;;;;;;;;;EAc/B;CACQ,CAAC;AAEX,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAU,CAAC;AAGlD,4EAA4E;AAC5E,MAAM,UAAU,WAAW,CAAC,MAAc;IACzC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAc;IAC3C,OAAO,UAAU,CAAC;;;;;;;;;;oBAUC,IAAI,UAAU,IAAI;;;;;;;EAOpC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAc;IAC3C,OAAO,UAAU,CAAC;;;;;;;;;;oBAUC,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.4.
|
|
3
|
+
"version": "0.4.1",
|
|
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",
|