@rpascene/android-playground 0.30.19 → 0.30.20

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.
@@ -0,0 +1,230 @@
1
+ "use strict";(self.webpackChunkandroid_playground=self.webpackChunkandroid_playground||[]).push([["702"],{43200:function(e,r,o){o.d(r,{d:()=>M,o:()=>U});var t=o(95098),n=o(45025),i=o(92245);function a(e,r,o){if(e)for(let t in e){let n=r[t.toLocaleLowerCase()];if(n){let r=e[t];"header"===t&&(r=r.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),o&&n.push(`//----${o}----//`),n.push(r)}else(0,i.Z)(`${t} placement hook does not exist in shader`)}}let u=/\{\{(.*?)\}\}/g;function l(e){let r={};return(e.match(u)?.map(e=>e.replace(/[{()}]/g,""))??[]).forEach(e=>{r[e]=[]}),r}function s(e,r){let o,t=/@in\s+([^;]+);/g;for(;null!==(o=t.exec(e));)r.push(o[1])}function f(e,r,o=!1){let t=[];s(r,t),e.forEach(e=>{e.header&&s(e.header,t)}),o&&t.sort();let n=t.map((e,r)=>` @location(${r}) ${e},`).join("\n"),i=r.replace(/@in\s+[^;]+;\s*/g,"");return i.replace("{{in}}",`
2
+ ${n}
3
+ `)}function c(e,r){let o,t=/@out\s+([^;]+);/g;for(;null!==(o=t.exec(e));)r.push(o[1])}function v(e,r){let o=e;for(let e in r){let t=r[e];o=t.join("\n").length?o.replace(`{{${e}}}`,`//-----${e} START-----//
4
+ ${t.join("\n")}
5
+ //----${e} FINISH----//`):o.replace(`{{${e}}}`,"")}return o}let d=Object.create(null),m=new Map,x=0;function p(e,r){return r.map(e=>(m.has(e)||m.set(e,x++),m.get(e))).sort((e,r)=>e-r).join("-")+e.vertex+e.fragment}function h(e,r,o){let t=l(e),n=l(r);return o.forEach(e=>{a(e.vertex,t,e.name),a(e.fragment,n,e.name)}),{vertex:v(e,t),fragment:v(r,n)}}let g=`
6
+ @in aPosition: vec2<f32>;
7
+ @in aUV: vec2<f32>;
8
+
9
+ @out @builtin(position) vPosition: vec4<f32>;
10
+ @out vUV : vec2<f32>;
11
+ @out vColor : vec4<f32>;
12
+
13
+ {{header}}
14
+
15
+ struct VSOutput {
16
+ {{struct}}
17
+ };
18
+
19
+ @vertex
20
+ fn main( {{in}} ) -> VSOutput {
21
+
22
+ var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
23
+ var modelMatrix = mat3x3<f32>(
24
+ 1.0, 0.0, 0.0,
25
+ 0.0, 1.0, 0.0,
26
+ 0.0, 0.0, 1.0
27
+ );
28
+ var position = aPosition;
29
+ var uv = aUV;
30
+
31
+ {{start}}
32
+
33
+ vColor = vec4<f32>(1., 1., 1., 1.);
34
+
35
+ {{main}}
36
+
37
+ vUV = uv;
38
+
39
+ var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
40
+
41
+ vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
42
+
43
+ vColor *= globalUniforms.uWorldColorAlpha;
44
+
45
+ {{end}}
46
+
47
+ {{return}}
48
+ };
49
+ `,b=`
50
+ @in vUV : vec2<f32>;
51
+ @in vColor : vec4<f32>;
52
+
53
+ {{header}}
54
+
55
+ @fragment
56
+ fn main(
57
+ {{in}}
58
+ ) -> @location(0) vec4<f32> {
59
+
60
+ {{start}}
61
+
62
+ var outColor:vec4<f32>;
63
+
64
+ {{main}}
65
+
66
+ return outColor * vColor;
67
+ };
68
+ `,C=`
69
+ in vec2 aPosition;
70
+ in vec2 aUV;
71
+
72
+ out vec4 vColor;
73
+ out vec2 vUV;
74
+
75
+ {{header}}
76
+
77
+ void main(void){
78
+
79
+ mat3 worldTransformMatrix = uWorldTransformMatrix;
80
+ mat3 modelMatrix = mat3(
81
+ 1.0, 0.0, 0.0,
82
+ 0.0, 1.0, 0.0,
83
+ 0.0, 0.0, 1.0
84
+ );
85
+ vec2 position = aPosition;
86
+ vec2 uv = aUV;
87
+
88
+ {{start}}
89
+
90
+ vColor = vec4(1.);
91
+
92
+ {{main}}
93
+
94
+ vUV = uv;
95
+
96
+ mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
97
+
98
+ gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
99
+
100
+ vColor *= uWorldColorAlpha;
101
+
102
+ {{end}}
103
+ }
104
+ `,P=`
105
+
106
+ in vec4 vColor;
107
+ in vec2 vUV;
108
+
109
+ out vec4 finalColor;
110
+
111
+ {{header}}
112
+
113
+ void main(void) {
114
+
115
+ {{start}}
116
+
117
+ vec4 outColor;
118
+
119
+ {{main}}
120
+
121
+ finalColor = outColor * vColor;
122
+ }
123
+ `,T={name:"global-uniforms-bit",vertex:{header:`
124
+ struct GlobalUniforms {
125
+ uProjectionMatrix:mat3x3<f32>,
126
+ uWorldTransformMatrix:mat3x3<f32>,
127
+ uWorldColorAlpha: vec4<f32>,
128
+ uResolution: vec2<f32>,
129
+ }
130
+
131
+ @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
132
+ `}},$={name:"global-uniforms-bit",vertex:{header:`
133
+ uniform mat3 uProjectionMatrix;
134
+ uniform mat3 uWorldTransformMatrix;
135
+ uniform vec4 uWorldColorAlpha;
136
+ uniform vec2 uResolution;
137
+ `}};function M({bits:e,name:r}){let o=function({template:e,bits:r}){let o=p(e,r);if(d[o])return d[o];let{vertex:t,fragment:n}=function(e,r){let o=r.map(e=>e.vertex).filter(e=>!!e),t=r.map(e=>e.fragment).filter(e=>!!e),n=f(o,e.vertex,!0);return{vertex:n=function(e,r){let o=[];c(r,o),e.forEach(e=>{e.header&&c(e.header,o)});let t=0,n=o.sort().map(e=>e.indexOf("builtin")>-1?e:`@location(${t++}) ${e}`).join(",\n"),i=o.sort().map(e=>` var ${e.replace(/@.*?\s+/g,"")};`).join("\n"),a=`return VSOutput(
138
+ ${o.sort().map(e=>` ${function(e){let r=/\b(\w+)\s*:/g.exec(e);return r?r[1]:""}(e)}`).join(",\n")});`,u=r.replace(/@out\s+[^;]+;\s*/g,"");return(u=(u=u.replace("{{struct}}",`
139
+ ${n}
140
+ `)).replace("{{start}}",`
141
+ ${i}
142
+ `)).replace("{{return}}",`
143
+ ${a}
144
+ `)}(o,n),fragment:f(t,e.fragment,!0)}}(e,r);return d[o]=h(t,n,r),d[o]}({template:{fragment:b,vertex:g},bits:[T,...e]});return n.O.from({name:r,vertex:{source:o.vertex,entryPoint:"main"},fragment:{source:o.fragment,entryPoint:"main"}})}function U({bits:e,name:r}){return new t.J({name:r,...function({template:e,bits:r}){let o=p(e,r);return d[o]||(d[o]=h(e.vertex,e.fragment,r)),d[o]}({template:{vertex:C,fragment:P},bits:[$,...e]})})}},23149:function(e,r,o){o.d(r,{M:()=>t,T:()=>n});let t={name:"color-bit",vertex:{header:`
145
+ @in aColor: vec4<f32>;
146
+ `,main:`
147
+ vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
148
+ `}},n={name:"color-bit",vertex:{header:`
149
+ in vec4 aColor;
150
+ `,main:`
151
+ vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
152
+ `}}},39193:function(e,r,o){o.d(r,{h:()=>a,m:()=>n});let t={};function n(e){return t[e]||(t[e]={name:"texture-batch-bit",vertex:{header:`
153
+ @in aTextureIdAndRound: vec2<u32>;
154
+ @out @interpolate(flat) vTextureId : u32;
155
+ `,main:`
156
+ vTextureId = aTextureIdAndRound.y;
157
+ `,end:`
158
+ if(aTextureIdAndRound.x == 1)
159
+ {
160
+ vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
161
+ }
162
+ `},fragment:{header:`
163
+ @in @interpolate(flat) vTextureId: u32;
164
+
165
+ ${function(e){let r=[];{let e=0;for(let o=0;o<16;o++)r.push(`@group(1) @binding(${e++}) var textureSource${o+1}: texture_2d<f32>;`),r.push(`@group(1) @binding(${e++}) var textureSampler${o+1}: sampler;`)}return r.join("\n")}(16)}
166
+ `,main:`
167
+ var uvDx = dpdx(vUV);
168
+ var uvDy = dpdy(vUV);
169
+
170
+ ${function(e){let r=[];r.push("switch vTextureId {");for(let o=0;o<16;o++)o===e-1?r.push(" default:{"):r.push(` case ${o}:{`),r.push(` outColor = textureSampleGrad(textureSource${o+1}, textureSampler${o+1}, vUV, uvDx, uvDy);`),r.push(" break;}");return r.push("}"),r.join("\n")}(16)}
171
+ `}}),t[e]}let i={};function a(e){return i[e]||(i[e]={name:"texture-batch-bit",vertex:{header:`
172
+ in vec2 aTextureIdAndRound;
173
+ out float vTextureId;
174
+
175
+ `,main:`
176
+ vTextureId = aTextureIdAndRound.y;
177
+ `,end:`
178
+ if(aTextureIdAndRound.x == 1.)
179
+ {
180
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
181
+ }
182
+ `},fragment:{header:`
183
+ in float vTextureId;
184
+
185
+ uniform sampler2D uTextures[${e}];
186
+
187
+ `,main:`
188
+
189
+ ${function(e){let r=[];for(let e=0;e<16;e++)e>0&&r.push("else"),e<15&&r.push(`if(vTextureId < ${e}.5)`),r.push("{"),r.push(` outColor = texture(uTextures[${e}], vUV);`),r.push("}");return r.join("\n")}(16)}
190
+ `}}),i[e]}},78300:function(e,r,o){o.d(r,{$g:()=>i,Kt:()=>n,XH:()=>t});let t={name:"local-uniform-bit",vertex:{header:`
191
+
192
+ struct LocalUniforms {
193
+ uTransformMatrix:mat3x3<f32>,
194
+ uColor:vec4<f32>,
195
+ uRound:f32,
196
+ }
197
+
198
+ @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
199
+ `,main:`
200
+ vColor *= localUniforms.uColor;
201
+ modelMatrix *= localUniforms.uTransformMatrix;
202
+ `,end:`
203
+ if(localUniforms.uRound == 1)
204
+ {
205
+ vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
206
+ }
207
+ `}},n={...t,vertex:{...t.vertex,header:t.vertex.header.replace("group(1)","group(2)")}},i={name:"local-uniform-bit",vertex:{header:`
208
+
209
+ uniform mat3 uTransformMatrix;
210
+ uniform vec4 uColor;
211
+ uniform float uRound;
212
+ `,main:`
213
+ vColor *= uColor;
214
+ modelMatrix = uTransformMatrix;
215
+ `,end:`
216
+ if(uRound == 1.)
217
+ {
218
+ gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
219
+ }
220
+ `}}},71067:function(e,r,o){o.d(r,{X:()=>n,j:()=>t});let t={name:"round-pixels-bit",vertex:{header:`
221
+ fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
222
+ {
223
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
224
+ }
225
+ `}},n={name:"round-pixels-bit",vertex:{header:`
226
+ vec2 roundPixels(vec2 position, vec2 targetSize)
227
+ {
228
+ return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
229
+ }
230
+ `}}},23947:function(e,r,o){o.d(r,{V:()=>t});function t(e,r,o){let t=(e>>24&255)/255;r[o++]=(255&e)/255*t,r[o++]=(e>>8&255)/255*t,r[o++]=(e>>16&255)/255*t,r[o++]=t}},88556:function(e,r,o){o.d(r,{c:()=>t});class t{constructor(){this.vertexSize=4,this.indexSize=6,this.location=0,this.batcher=null,this.batch=null,this.roundPixels=0}get blendMode(){return this.renderable.groupBlendMode}packAttributes(e,r,o,t){let n=this.renderable,i=this.texture,a=n.groupTransform,u=a.a,l=a.b,s=a.c,f=a.d,c=a.tx,v=a.ty,d=this.bounds,m=d.maxX,x=d.minX,p=d.maxY,h=d.minY,g=i.uvs,b=n.groupColorAlpha,C=t<<16|65535&this.roundPixels;e[o+0]=u*x+s*h+c,e[o+1]=f*h+l*x+v,e[o+2]=g.x0,e[o+3]=g.y0,r[o+4]=b,r[o+5]=C,e[o+6]=u*m+s*h+c,e[o+7]=f*h+l*m+v,e[o+8]=g.x1,e[o+9]=g.y1,r[o+10]=b,r[o+11]=C,e[o+12]=u*m+s*p+c,e[o+13]=f*p+l*m+v,e[o+14]=g.x2,e[o+15]=g.y2,r[o+16]=b,r[o+17]=C,e[o+18]=u*x+s*p+c,e[o+19]=f*p+l*x+v,e[o+20]=g.x3,e[o+21]=g.y3,r[o+22]=b,r[o+23]=C}packIndex(e,r,o){e[r]=o+0,e[r+1]=o+1,e[r+2]=o+2,e[r+3]=o+0,e[r+4]=o+2,e[r+5]=o+3}reset(){this.renderable=null,this.texture=null,this.batcher=null,this.batch=null,this.bounds=null}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkandroid_playground=self.webpackChunkandroid_playground||[]).push([["920"],{96945:function(n,d,u){u.d(d,{A:()=>a});let a={}}}]);