dsh-plugin-live2d-stage 0.5.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.
Files changed (69) hide show
  1. package/README.md +86 -0
  2. package/assets/core.js +9 -0
  3. package/assets/floating.html +1 -0
  4. package/assets/floating.js +285 -0
  5. package/assets/icon.webp +0 -0
  6. package/assets/shaders/fragshadersrcalphablend.frag +54 -0
  7. package/assets/shaders/fragshadersrccolorblend.frag +298 -0
  8. package/assets/shaders/fragshadersrccopy.frag +18 -0
  9. package/assets/shaders/fragshadersrcmaskinvertedpremultipliedalpha.frag +29 -0
  10. package/assets/shaders/fragshadersrcmaskpremultipliedalpha.frag +29 -0
  11. package/assets/shaders/fragshadersrcpremultipliedalpha.frag +23 -0
  12. package/assets/shaders/fragshadersrcpremultipliedalphablend.frag +67 -0
  13. package/assets/shaders/fragshadersrcsetupmask.frag +25 -0
  14. package/assets/shaders/vertshadersrc.vert +19 -0
  15. package/assets/shaders/vertshadersrcblend.vert +31 -0
  16. package/assets/shaders/vertshadersrccopy.vert +17 -0
  17. package/assets/shaders/vertshadersrcmasked.vert +22 -0
  18. package/assets/shaders/vertshadersrcsetupmask.vert +21 -0
  19. package/character/hiyori/hiyori_free_t08.2048/texture_00.png +0 -0
  20. package/character/hiyori/hiyori_free_t08.cdi3.json +276 -0
  21. package/character/hiyori/hiyori_free_t08.moc3 +0 -0
  22. package/character/hiyori/hiyori_free_t08.model3.json +72 -0
  23. package/character/hiyori/hiyori_free_t08.physics3.json +631 -0
  24. package/character/hiyori/motion/hiyori_m01.motion3.json +951 -0
  25. package/character/hiyori/motion/hiyori_m02.motion3.json +1238 -0
  26. package/character/hiyori/motion/hiyori_m03.motion3.json +1035 -0
  27. package/character/hiyori/motion/hiyori_m04.motion3.json +776 -0
  28. package/character/hiyori/motion/hiyori_m05.motion3.json +1462 -0
  29. package/character/hiyori/motion/hiyori_m06.motion3.json +727 -0
  30. package/character/hiyori/motion/hiyori_m07.motion3.json +874 -0
  31. package/character/hiyori/motion/hiyori_m08.motion3.json +755 -0
  32. package/cordis.patch.yml +3 -0
  33. package/lib/chat.mjs +9 -0
  34. package/lib/client.js +20810 -0
  35. package/lib/floating.mjs +25 -0
  36. package/lib/index.mjs +85 -0
  37. package/lib/native/Live2DFloating.exe +0 -0
  38. package/lib/native/Microsoft.Web.WebView2.Core.dll +0 -0
  39. package/lib/native/Microsoft.Web.WebView2.Wpf.dll +0 -0
  40. package/lib/native/WebView2-LICENSE.txt +27 -0
  41. package/lib/native/WebView2-NOTICE.txt +85 -0
  42. package/lib/native/WebView2Loader.dll +0 -0
  43. package/lib/store.cjs +11064 -0
  44. package/licenses/Cubism-Core.md +7 -0
  45. package/licenses/Cubism-Framework.md +45 -0
  46. package/licenses/Cubism-NOTICE.md +38 -0
  47. package/licenses/Cubism-Samples.md +67 -0
  48. package/licenses/bluebird.txt +21 -0
  49. package/licenses/core-util-is.txt +19 -0
  50. package/licenses/duplexer2.txt +26 -0
  51. package/licenses/fs-extra.txt +15 -0
  52. package/licenses/graceful-fs.txt +15 -0
  53. package/licenses/inherits.txt +16 -0
  54. package/licenses/jsonfile.txt +15 -0
  55. package/licenses/lucide.txt +43 -0
  56. package/licenses/node-int64.txt +19 -0
  57. package/licenses/process-nextick-args.txt +19 -0
  58. package/licenses/react-dom.txt +21 -0
  59. package/licenses/react.txt +21 -0
  60. package/licenses/readable-stream.txt +47 -0
  61. package/licenses/safe-buffer.txt +21 -0
  62. package/licenses/scheduler.txt +21 -0
  63. package/licenses/string_decoder.txt +48 -0
  64. package/licenses/universalify.txt +20 -0
  65. package/licenses/unzipper.txt +25 -0
  66. package/licenses/util-deprecate.txt +24 -0
  67. package/locale/en.json +6 -0
  68. package/locale/zh-CN.json +6 -0
  69. package/package.json +77 -0
Binary file
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ vec4 OverlapRgba(vec3 color, vec3 colorSource, vec3 colorDestination, vec3 parameter)
10
+ {
11
+ vec3 rgb = color * parameter.x + colorSource * parameter.y + colorDestination * parameter.z;
12
+ float alpha = parameter.x + parameter.y + parameter.z;
13
+ return vec4(rgb, alpha);
14
+ }
15
+
16
+ #if defined(ALPHA_BLEND_OVER)
17
+ vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
18
+ {
19
+ vec3 parameter = vec3(colorSource.a * colorDestination.a, colorSource.a * (1.0 - colorDestination.a), colorDestination.a * (1.0 - colorSource.a));
20
+ return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
21
+ }
22
+
23
+ #elif defined(ALPHA_BLEND_ATOP)
24
+ vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
25
+ {
26
+ vec3 parameter = vec3(colorSource.a * colorDestination.a, 0, colorDestination.a * (1.0 - colorSource.a));
27
+ return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
28
+ }
29
+
30
+ #elif defined(ALPHA_BLEND_OUT)
31
+ vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
32
+ {
33
+ vec3 parameter = vec3(0.0, 0.0, colorDestination.a * (1.0 - colorSource.a));
34
+ return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
35
+ }
36
+
37
+ #elif defined(ALPHA_BLEND_CONJOINTOVER)
38
+ vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
39
+ {
40
+ vec3 parameter = vec3(min(colorSource.a, colorDestination.a), max(colorSource.a - colorDestination.a, 0.0), max(colorDestination.a - colorSource.a, 0.0));
41
+ return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
42
+ }
43
+
44
+ #elif defined(ALPHA_BLEND_DISJOINTOVER)
45
+ vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
46
+ {
47
+ vec3 parameter = vec3(max(colorSource.a + colorDestination.a - 1.0, 0.0), min(colorSource.a, 1.0 - colorDestination.a), min(colorDestination.a, 1.0 - colorSource.a));
48
+ return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
49
+ }
50
+
51
+ #else
52
+ #error not supported alpha blend function
53
+
54
+ #endif
@@ -0,0 +1,298 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ #if defined(COLOR_BLEND_NORMAL)
10
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
11
+ {
12
+ return colorSource;
13
+ }
14
+
15
+ #elif defined(COLOR_BLEND_ADDCOMPATIBLE)
16
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
17
+ {
18
+ return vec3(0.0);
19
+ }
20
+
21
+ #elif defined(COLOR_BLEND_MULTCOMPATIBLE)
22
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
23
+ {
24
+ return vec3(0.0);
25
+ }
26
+
27
+ #elif defined(COLOR_BLEND_ADD)
28
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
29
+ {
30
+ return min(colorSource + colorDestination, 1.0);
31
+ }
32
+
33
+ #elif defined(COLOR_BLEND_ADDGLOW)
34
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
35
+ {
36
+ return colorSource + colorDestination;
37
+ }
38
+
39
+ #elif defined(COLOR_BLEND_DARKEN)
40
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
41
+ {
42
+ return min(colorSource, colorDestination);
43
+ }
44
+
45
+ #elif defined(COLOR_BLEND_MULTIPLY)
46
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
47
+ {
48
+ return colorSource * colorDestination;
49
+ }
50
+
51
+ #elif defined(COLOR_BLEND_COLORBURN)
52
+ float ColorBurn(float colorSource, float colorDestination)
53
+ {
54
+ if (abs(colorDestination - 1.0) < 0.000001)
55
+ {
56
+ return 1.0;
57
+ }
58
+ else if (abs(colorSource) < 0.000001)
59
+ {
60
+ return 0.0;
61
+ }
62
+
63
+ return 1.0 - min(1.0, (1.0 - colorDestination) / colorSource);
64
+ }
65
+
66
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
67
+ {
68
+ return vec3(
69
+ ColorBurn(colorSource.r, colorDestination.r),
70
+ ColorBurn(colorSource.g, colorDestination.g),
71
+ ColorBurn(colorSource.b, colorDestination.b)
72
+ );
73
+ }
74
+
75
+ #elif defined(COLOR_BLEND_LINEARBURN)
76
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
77
+ {
78
+ return max(vec3(0.0), colorSource + colorDestination - 1.0);
79
+ }
80
+
81
+ #elif defined(COLOR_BLEND_LIGHTEN)
82
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
83
+ {
84
+ return max(colorSource, colorDestination);
85
+ }
86
+
87
+ #elif defined(COLOR_BLEND_SCREEN)
88
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
89
+ {
90
+ return colorSource + colorDestination - colorSource * colorDestination;
91
+ }
92
+
93
+ #elif defined(COLOR_BLEND_COLORDODGE)
94
+ float ColorDodge(float colorSource, float colorDestination)
95
+ {
96
+ if (colorDestination <= 0.0)
97
+ {
98
+ return 0.0;
99
+ }
100
+ else if (colorSource == 1.0)
101
+ {
102
+ return 1.0;
103
+ }
104
+
105
+ return min(1.0, colorDestination / (1.0 - colorSource));
106
+ }
107
+
108
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
109
+ {
110
+ return vec3(
111
+ ColorDodge(colorSource.r, colorDestination.r),
112
+ ColorDodge(colorSource.g, colorDestination.g),
113
+ ColorDodge(colorSource.b, colorDestination.b)
114
+ );
115
+ }
116
+
117
+ #elif defined(COLOR_BLEND_OVERLAY)
118
+ float Overlay(float colorSource, float colorDestination)
119
+ {
120
+ float mul = 2.0 * colorSource * colorDestination;
121
+ float scr = 1.0 - 2.0 * (1.0 - colorSource) * (1.0 - colorDestination) ;
122
+ return colorDestination < 0.5 ? mul : scr ;
123
+ }
124
+
125
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
126
+ {
127
+ return vec3(
128
+ Overlay(colorSource.r, colorDestination.r),
129
+ Overlay(colorSource.g, colorDestination.g),
130
+ Overlay(colorSource.b, colorDestination.b)
131
+ );
132
+ }
133
+
134
+ #elif defined(COLOR_BLEND_SOFTLIGHT)
135
+ float SoftLight(float colorSource, float colorDestination)
136
+ {
137
+ float val1 = colorDestination - (1.0 - 2.0 * colorSource) * colorDestination * (1.0 - colorDestination);
138
+ float val2 = colorDestination + (2.0 * colorSource - 1.0) * colorDestination * ((16.0 * colorDestination - 12.0) * colorDestination + 3.0);
139
+ float val3 = colorDestination + (2.0 * colorSource - 1.0) * (sqrt(colorDestination) - colorDestination);
140
+
141
+ if (colorSource <= 0.5)
142
+ {
143
+ return val1;
144
+ }
145
+ else if (colorDestination <= 0.25)
146
+ {
147
+ return val2;
148
+ }
149
+
150
+ return val3;
151
+ }
152
+
153
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
154
+ {
155
+ return vec3(
156
+ SoftLight(colorSource.r, colorDestination.r),
157
+ SoftLight(colorSource.g, colorDestination.g),
158
+ SoftLight(colorSource.b, colorDestination.b)
159
+ );
160
+ }
161
+
162
+ #elif defined(COLOR_BLEND_HARDLIGHT)
163
+ float HardLight(float colorSource, float colorDestination)
164
+ {
165
+ float mul = 2.0 * colorSource * colorDestination;
166
+ float scr = 1.0 - 2.0 * (1.0 - colorSource) * (1.0 - colorDestination);
167
+
168
+ if (colorSource < 0.5)
169
+ {
170
+ return mul;
171
+ }
172
+
173
+ return scr;
174
+ }
175
+
176
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
177
+ {
178
+ return vec3(
179
+ HardLight(colorSource.r, colorDestination.r),
180
+ HardLight(colorSource.g, colorDestination.g),
181
+ HardLight(colorSource.b, colorDestination.b)
182
+ );
183
+ }
184
+
185
+ #elif defined(COLOR_BLEND_LINEARLIGHT)
186
+ float LinearLight(float colorSource, float colorDestination)
187
+ {
188
+ float burn = max(0.0, 2.0 * colorSource + colorDestination - 1.0);
189
+ float dodge = min(1.0, 2.0 * (colorSource - 0.5) + colorDestination);
190
+
191
+ if (colorSource < 0.5)
192
+ {
193
+ return burn;
194
+ }
195
+
196
+ return dodge;
197
+ }
198
+
199
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
200
+ {
201
+ return vec3(
202
+ LinearLight(colorSource.r, colorDestination.r),
203
+ LinearLight(colorSource.g, colorDestination.g),
204
+ LinearLight(colorSource.b, colorDestination.b)
205
+ );
206
+ }
207
+
208
+ #elif defined(COLOR_BLEND_HUE) || defined(COLOR_BLEND_COLOR)
209
+ const float rCoeff = 0.30;
210
+ const float gCoeff = 0.59;
211
+ const float bCoeff = 0.11;
212
+
213
+ float GetMax(vec3 rgbC)
214
+ {
215
+ return max(rgbC.r, max(rgbC.g, rgbC.b));
216
+ }
217
+
218
+ float GetMin(vec3 rgbC)
219
+ {
220
+ return min(rgbC.r, min(rgbC.g, rgbC.b));
221
+ }
222
+
223
+ float GetRange(vec3 rgbC)
224
+ {
225
+ return max(rgbC.r, max(rgbC.g, rgbC.b)) - min(rgbC.r, min(rgbC.g, rgbC.b));
226
+ }
227
+
228
+ float Saturation(vec3 rgbC)
229
+ {
230
+ return GetRange(rgbC);
231
+ }
232
+
233
+ float Luma(vec3 rgbC)
234
+ {
235
+ return rCoeff * rgbC.r + gCoeff * rgbC.g + bCoeff * rgbC.b;
236
+ }
237
+
238
+ vec3 ClipColor(vec3 rgbC)
239
+ {
240
+ float luma = Luma(rgbC);
241
+ float maxv = GetMax(rgbC);
242
+ float minv = GetMin(rgbC);
243
+ vec3 outputColor = rgbC;
244
+
245
+ outputColor = minv < 0.0 ? luma + (outputColor - luma) * luma / (luma - minv) : outputColor;
246
+ outputColor = maxv > 1.0 ? luma + (outputColor - luma) * (1.0 - luma) / (maxv - luma) : outputColor;
247
+
248
+ return outputColor;
249
+ }
250
+
251
+ vec3 SetLuma(vec3 rgbC, float luma)
252
+ {
253
+ return ClipColor(rgbC + (luma - Luma(rgbC)));
254
+ }
255
+
256
+ vec3 SetSaturation(vec3 rgbC, float saturation)
257
+ {
258
+ float maxv = GetMax(rgbC);
259
+ float minv = GetMin(rgbC);
260
+ float medv = rgbC.r + rgbC.g + rgbC.b - maxv - minv;
261
+ float outputMax, outputMed, outputMin;
262
+
263
+ outputMax = minv < maxv ? saturation : 0.0;
264
+ outputMed = minv < maxv ? (medv - minv) * saturation / (maxv - minv) : 0.0;
265
+ outputMin = 0.0;
266
+
267
+ if(rgbC.r == maxv)
268
+ {
269
+ return rgbC.b < rgbC.g ? vec3(outputMax, outputMed, outputMin) : vec3(outputMax, outputMin, outputMed);
270
+ }
271
+ else if(rgbC.g == maxv)
272
+ {
273
+ return rgbC.r < rgbC.b ? vec3(outputMin, outputMax, outputMed) : vec3(outputMed, outputMax, outputMin);
274
+ }
275
+ else // if(rgbC.b == maxv)
276
+ {
277
+ return rgbC.g < rgbC.r ? vec3(outputMed, outputMin, outputMax) : vec3(outputMin, outputMed, outputMax);
278
+ }
279
+ }
280
+
281
+ #if defined(COLOR_BLEND_HUE)
282
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
283
+ {
284
+ return SetLuma(SetSaturation(colorSource, Saturation(colorDestination)), Luma(colorDestination));
285
+ }
286
+
287
+ #else
288
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination)
289
+ {
290
+ return SetLuma(colorSource, Luma(colorDestination)) ;
291
+ }
292
+
293
+ #endif
294
+
295
+ #else
296
+ #error not supported color blend function.
297
+
298
+ #endif
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ precision mediump float;
10
+
11
+ varying vec2 v_texCoord;
12
+ uniform vec4 u_baseColor;
13
+ uniform sampler2D s_texture0;
14
+
15
+ void main()
16
+ {
17
+ gl_FragColor = texture2D(s_texture0, v_texCoord) * u_baseColor;
18
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ precision mediump float;
10
+ varying vec2 v_texCoord; //v2f.texcoord
11
+ varying vec4 v_clipPos;
12
+ uniform sampler2D s_texture0; //_MainTex
13
+ uniform sampler2D s_texture1; // _ClippingMaskTex
14
+ uniform vec4 u_channelFlag;
15
+ uniform vec4 u_baseColor; //v2f.color
16
+ uniform vec4 u_multiplyColor;
17
+ uniform vec4 u_screenColor;
18
+
19
+ void main()
20
+ {
21
+ vec4 texColor = texture2D(s_texture0, v_texCoord);
22
+ texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
23
+ texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);
24
+ vec4 col_formask = texColor * u_baseColor;
25
+ vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
26
+ float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
27
+ col_formask = col_formask * (1.0 - maskVal);
28
+ gl_FragColor = col_formask;
29
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ precision mediump float;
10
+ varying vec2 v_texCoord; //v2f.texcoord
11
+ varying vec4 v_clipPos;
12
+ uniform vec4 u_baseColor; //v2f.color
13
+ uniform vec4 u_channelFlag;
14
+ uniform sampler2D s_texture0; //_MainTex
15
+ uniform sampler2D s_texture1; // _ClippingMaskTex
16
+ uniform vec4 u_multiplyColor;
17
+ uniform vec4 u_screenColor;
18
+
19
+ void main()
20
+ {
21
+ vec4 texColor = texture2D(s_texture0, v_texCoord);
22
+ texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
23
+ texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);
24
+ vec4 col_formask = texColor * u_baseColor;
25
+ vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
26
+ float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
27
+ col_formask = col_formask * maskVal;
28
+ gl_FragColor = col_formask;
29
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ precision mediump float;
10
+ varying vec2 v_texCoord; //v2f.texcoord
11
+ uniform vec4 u_baseColor; //v2f.color
12
+ uniform sampler2D s_texture0; //_MainTex
13
+ uniform vec4 u_multiplyColor;
14
+ uniform vec4 u_screenColor;
15
+
16
+ void main()
17
+ {
18
+ vec4 texColor = texture2D(s_texture0, v_texCoord);
19
+ texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
20
+ texColor.rgb = (texColor.rgb + u_screenColor.rgb * texColor.a) - (texColor.rgb * u_screenColor.rgb);
21
+ vec4 color = texColor * u_baseColor;
22
+ gl_FragColor = vec4(color.rgb, color.a);
23
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ varying vec2 v_texCoord; //v2f.texcoord
10
+ varying vec2 v_blendCoord;
11
+ varying vec4 v_clipPos;
12
+ uniform sampler2D s_texture0; //_MainTex
13
+ uniform sampler2D s_blendTexture;
14
+ uniform vec4 u_baseColor; //v2f.color
15
+ uniform vec4 u_multiplyColor;
16
+ uniform vec4 u_screenColor;
17
+ uniform sampler2D s_texture1; // _ClippingMaskTex
18
+ uniform float u_invertClippingMask;
19
+ uniform vec4 u_channelFlag;
20
+
21
+ vec3 ColorBlend(vec3 colorSource, vec3 colorDestination);
22
+ vec4 AlphaBlend(vec3 C, vec3 Cs, float As, vec3 Cd, float Ad);
23
+
24
+ void main()
25
+ {
26
+ vec4 renderTextureColor = texture2D(s_blendTexture, v_blendCoord);
27
+ vec3 colorDestination = renderTextureColor.rgb;
28
+ float alphaDestination = renderTextureColor.a;
29
+
30
+ if (alphaDestination < 0.00001)
31
+ {
32
+ colorDestination = vec3(0.0, 0.0, 0.0);
33
+ }
34
+ else {
35
+ colorDestination /= alphaDestination;
36
+ }
37
+
38
+ vec4 texColor = texture2D(s_texture0, v_texCoord);
39
+ texColor.rgb *= u_multiplyColor.rgb;
40
+ texColor.rgb = (texColor.rgb + u_screenColor.rgb) - (texColor.rgb * u_screenColor.rgb);
41
+
42
+ texColor *= u_baseColor;
43
+ vec3 colorSource = texColor.rgb;
44
+ float alphaSource = texColor.a;
45
+
46
+ if (alphaSource < 0.00001)
47
+ {
48
+ colorSource = vec3(0.0, 0.0, 0.0);
49
+ }
50
+ else {
51
+ colorSource /= alphaSource;
52
+ }
53
+
54
+ #ifdef CLIPPING_MASK
55
+ float maskVal = 1.0;
56
+ vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
57
+ maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
58
+ maskVal = abs(u_invertClippingMask - maskVal);
59
+
60
+ alphaSource *= maskVal;
61
+ #endif
62
+
63
+ vec4 source = vec4(colorSource.r, colorSource.g, colorSource.b, alphaSource);
64
+ vec4 destination = vec4(colorDestination.r, colorDestination.g, colorDestination.b, alphaDestination);
65
+
66
+ gl_FragColor = AlphaBlend(ColorBlend(colorSource, colorDestination), source, destination);
67
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ precision mediump float;
10
+ varying vec2 v_texCoord; //v2f.texcoord
11
+ varying vec4 v_myPos;
12
+ uniform vec4 u_baseColor; //v2f.color
13
+ uniform vec4 u_channelFlag;
14
+ uniform sampler2D s_texture0; //_MainTex
15
+
16
+
17
+ void main()
18
+ {
19
+ float isInside =
20
+ step(u_baseColor.x, v_myPos.x/v_myPos.w)
21
+ * step(u_baseColor.y, v_myPos.y/v_myPos.w)
22
+ * step(v_myPos.x/v_myPos.w, u_baseColor.z)
23
+ * step(v_myPos.y/v_myPos.w, u_baseColor.w);
24
+ gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;
25
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ attribute vec4 a_position;
10
+ attribute vec2 a_texCoord;
11
+ varying vec2 v_texCoord;
12
+ uniform mat4 u_matrix;
13
+
14
+ void main()
15
+ {
16
+ gl_Position = u_matrix * a_position;
17
+ v_texCoord = a_texCoord;
18
+ v_texCoord.y = 1.0 - v_texCoord.y;
19
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ attribute vec4 a_position;
10
+ attribute vec2 a_texCoord;
11
+ varying vec2 v_texCoord;
12
+ varying vec2 v_blendCoord;
13
+ varying vec4 v_clipPos;
14
+ uniform mat4 u_matrix;
15
+ uniform mat4 u_clipMatrix;
16
+
17
+ void main()
18
+ {
19
+ gl_Position = u_matrix * a_position;
20
+
21
+ #ifdef CLIPPING_MASK
22
+ v_clipPos = u_clipMatrix * a_position;
23
+ #else
24
+ v_clipPos = vec4(0.0);
25
+ #endif
26
+
27
+ v_texCoord = a_texCoord;
28
+ v_texCoord.y = 1.0 - v_texCoord.y;
29
+ vec2 ndcPos = gl_Position.xy / gl_Position.w;
30
+ v_blendCoord = ndcPos * 0.5 + 0.5;
31
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ attribute vec4 a_position;
10
+ attribute vec2 a_texCoord;
11
+ varying vec2 v_texCoord;
12
+
13
+ void main()
14
+ {
15
+ v_texCoord = a_texCoord;
16
+ gl_Position = a_position;
17
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ attribute vec4 a_position;
10
+ attribute vec2 a_texCoord;
11
+ varying vec2 v_texCoord;
12
+ varying vec4 v_clipPos;
13
+ uniform mat4 u_matrix;
14
+ uniform mat4 u_clipMatrix;
15
+
16
+ void main()
17
+ {
18
+ gl_Position = u_matrix * a_position;
19
+ v_clipPos = u_clipMatrix * a_position;
20
+ v_texCoord = a_texCoord;
21
+ v_texCoord.y = 1.0 - v_texCoord.y;
22
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright(c) Live2D Inc. All rights reserved.
3
+ *
4
+ * Use of this source code is governed by the Live2D Open Software license
5
+ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6
+ */
7
+
8
+
9
+ attribute vec4 a_position;
10
+ attribute vec2 a_texCoord;
11
+ varying vec2 v_texCoord;
12
+ varying vec4 v_myPos;
13
+ uniform mat4 u_clipMatrix;
14
+
15
+ void main()
16
+ {
17
+ gl_Position = u_clipMatrix * a_position;
18
+ v_myPos = u_clipMatrix * a_position;
19
+ v_texCoord = a_texCoord;
20
+ v_texCoord.y = 1.0 - v_texCoord.y;
21
+ }