-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCindyGL.js
2612 lines (2612 loc) · 100 KB
/
CindyGL.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function() {
'use strict';
var aa = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
a != Array.prototype && a != Object.prototype && (a[b] = c.value)
},
d = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this;
function ba(a, b) {
if (b) {
var c = d;
a = a.split(".");
for (var e = 0; e < a.length - 1; e++) {
var f = a[e];
f in c || (c[f] = {});
c = c[f]
}
a = a[a.length - 1];
e = c[a];
b = b(e);
b != e && null != b && aa(c, a, {
configurable: !0,
writable: !0,
value: b
})
}
}
ba("String.prototype.repeat", function(a) {
return a ? a : function(a) {
if (null == this)
throw new TypeError("The 'this' value for String.prototype.repeat must not be null or undefined");
var b = this;
if (0 > a || 1342177279 < a)
throw new RangeError("Invalid count value");
a |= 0;
for (var e = ""; a;)
if (a & 1 && (e += b), a >>>= 1)
b += b;
return e
}
});
function ca() {
ca = function() {};
d.Symbol || (d.Symbol = ea)
}
var ea = function() {
var a = 0;
return function(b) {
return "jscomp_symbol_" + (b || "") + a++
}
}();
function fa() {
ca();
var a = d.Symbol.iterator;
a || (a = d.Symbol.iterator = d.Symbol("iterator"));
"function" != typeof Array.prototype[a] && aa(Array.prototype, a, {
configurable: !0,
writable: !0,
value: function() {
return ha(this)
}
});
fa = function() {}
}
function ha(a) {
var b = 0;
return ia(function() {
return b < a.length ? {
done: !1,
value: a[b++]
} : {
done: !0
}
})
}
function ia(a) {
fa();
a = {
next: a
};
a[d.Symbol.iterator] = function() {
return this
};
return a
}
ba("Array.from", function(a) {
return a ? a : function(a, c, e) {
fa();
c = null != c ? c : function(a) {
return a
};
var b = [],
h = a[Symbol.iterator];
if ("function" == typeof h)
for (a = h.call(a); !(h = a.next()).done;)
b.push(c.call(e, h.value));
else {
h = a.length;
for (var k = 0; k < h; k++)
b.push(c.call(e, a[k]))
}
return b
}
});
function ja(a, b) {
fa();
a instanceof String && (a += "");
var c = 0,
e = {
next: function() {
if (c < a.length) {
var f = c++;
return {
value: b(f, a[f]),
done: !1
}
}
e.next = function() {
return {
done: !0,
value: void 0
}
};
return e.next()
}
};
e[Symbol.iterator] = function() {
return e
};
return e
}
ba("Array.prototype.keys", function(a) {
return a ? a : function() {
return ja(this, function(a) {
return a
})
}
});
ba("Array.prototype.fill", function(a) {
return a ? a : function(a, c, e) {
var b = this.length || 0;
0 > c && (c = Math.max(0, b + c));
if (null == e || e > b)
e = b;
e = Number(e);
0 > e && (e = Math.max(0, b + e));
for (c = Number(c || 0); c < e; c++)
this[c] = a;
return this
}
});
var ka = {
addc: "vec2 addc(vec2 a,vec2 b){\nreturn a+b;\n}\n",
addpoints: "vec2 addpoints(vec3 a,vec3 b){\nreturn dehomogenize(a) +dehomogenize(b);\n}\n",
arccosc: "vec2 arccosc(vec2 a){\nvec2 t2=multc(a,negc(a));\nvec2 tmp=sqrtc(addc(vec2(1.0,0.0),t2));\nvec2 tmp1=addc(multc(a,vec2(0.0,1.0)),tmp);\nvec2 erg=addc(multc(logc(tmp1),vec2(0.0,1.0)),vec2(pi*0.5,0.0));\nreturn erg;\n}\n",
arccosf: "vec2 arccosf(float z){\nif(abs(z)<=1.)return vec2(acos(z),0.);\nelse if(z>1.)return vec2(0,log(z+sqrt(z*z-1.)));\nelse return vec2(pi, -log(-z+sqrt(z*z-1.)));\n}\n",
arcsinc: "vec2 arcsinc(vec2 a){\nvec2 t2=multc(a,negc(a));\nvec2 tmp=sqrtc(addc(vec2(1.0,0.0),t2));\nvec2 tmp1=addc(multc(a,vec2(0.0,1.0)),tmp);\nvec2 erg=multc(logc(tmp1),vec2(0.0,-1.0));\nreturn erg;\n}\n",
arcsinf: "vec2 arcsinf(float z){\nif(abs(z)<=1.)return vec2(asin(z),0.);\nelse if(z>1.)return vec2(pi*.5, -log(z+sqrt(z*z-1.)));\nelse return vec2(-pi*.5,log(-z+sqrt(z*z-1.)));\n}\n",
arctan2c: "\n\n\n\nvec2 arctan2c(vec2 x,vec2 y){\nvec2 r=logc(divc(x+vec2(-y.y,y.x),sqrtc(multc(x,x)+multc(y,y))));\nreturn vec2(r.y, -r.x);\n}\n",
arctan2cvec2: "vec2 arctan2cvec2(cvec2 v){\nreturn arctan2c(v.real,v.imag);\n}\n",
arctan2vec2: "float arctan2vec2(vec2 v){\nreturn atan(v.y,v.x);\n}\n",
arctanc: "vec2 arctanc(vec2 a){\nvec2 t1=logc(addc(multc(a,vec2(0.0,-1.0)),vec2(1.0,0.0)));\nvec2 t2=logc(addc(multc(a,vec2(0.0,1.0)),vec2(1.0,0.0)));\nvec2 erg=multc(subc(t1,t2),vec2(0.0,0.5));\nreturn erg;\n}\n",
blue: "vec3 blue(float f)\n{\nreturn vec3(0.,0.,clamp(f,0.,1.));\n}\n",
cimag: "float imagc(vec2 a){\nreturn a.y;\n}\n",
conjugate: "vec2 conjugate(vec2 a){\nreturn vec2(a.x, -a.y);\n}\n",
copytexture_f: "#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D sampler;\nvarying vec2 cgl_pixel;\n\nvoid main(void){\ngl_FragColor=texture2D(sampler,cgl_pixel);\n}\n",
copytexture_v: "attribute vec3 aPos;\nattribute vec2 aTexCoord;\nvarying vec2 cgl_pixel;\n\nvoid main(void){\ngl_Position=vec4(aPos,1.);\ncgl_pixel=aTexCoord;\n}\n",
cosc: "vec2 cosc(vec2 a){\n\nfloat n=exp(a.y);\nfloat imag1=n*sin(-a.x);\nfloat real1=n*cos(-a.x);\nn=exp(-a.y);\nfloat imag2=n*sin(a.x);\nfloat real2=n*cos(a.x);\nfloat i= (imag1+imag2) /2.0;\nfloat r= (real1+real2) /2.0;\n\nreturn vec2(r,i);\n}\n",
creal: "float realc(vec2 a){\nreturn a.x;\n}\n",
dehomogenize: "vec2 dehomogenize(vec3 z){\nreturn vec2(z.x,z.y)/z.z;\n}\n",
dehomogenizex: "float dehomogenizex(vec3 z){\nreturn z.x/z.z;\n}\n",
dehomogenizey: "float dehomogenizey(vec3 z){\nreturn z.y/z.z;\n}\n",
det2: "float det2(mat2 a){\nreturn a[0][0]*a[1][1] -a[0][1]*a[1][0];\n}\n",
det3: "float det3(mat3 a){\nreturn dot(cross(a[0],a[1]),a[2]);\n}\n",
det3v: "float det3v(vec3 a,vec3 b,vec3 c){\nreturn dot(cross(a,b),c);\n}\n",
det4: "float det4(mat4 a){\nfloat s00=a[0][0]*a[1][1] -a[0][1]*a[1][0],\ns01=a[0][0]*a[1][2] -a[0][2]*a[1][0],\ns02=a[0][0]*a[1][3] -a[0][3]*a[1][0],\ns03=a[0][1]*a[1][2] -a[0][2]*a[1][1],\ns04=a[0][1]*a[1][3] -a[0][3]*a[1][1],\ns05=a[0][2]*a[1][3] -a[0][3]*a[1][2],\ns06=a[2][0]*a[3][1] -a[2][1]*a[3][0],\ns07=a[2][0]*a[3][2] -a[2][2]*a[3][0],\ns08=a[2][0]*a[3][3] -a[2][3]*a[3][0],\ns09=a[2][1]*a[3][2] -a[2][2]*a[3][1],\ns10=a[2][1]*a[3][3] -a[2][3]*a[3][1],\ns11=a[2][2]*a[3][3] -a[2][3]*a[3][2];\nreturn s00*s11-s01*s10+s02*s09+s03*s08-s04*s07+s05*s06;\n}\n",
divc: "vec2 divc(vec2 a,vec2 b){\nreturn vec2(dot(a,b),dot(a,vec2(-b.y,b.x)))/dot(b,b);\n}\n",
divfc: "vec2 divfc(float a,vec2 b){\nreturn a*vec2(b.x,-b.y)/dot(b,b);\n}\n",
expc: "vec2 expc(vec2 a){\nfloat n=exp(a.x);\nfloat r=n*cos(a.y);\nfloat i=n*sin(a.y);\nreturn vec2(r,i);\n}\n",
float2color: "vec4 float2color(float f)\n{\nreturn vec4(f,f,f,1.);\n}\n",
gray: "vec3 gray(float f)\n{\nf=clamp(f,0.,1.);\nreturn vec3(f,f,f);\n}\n",
green: "vec3 green(float f)\n{\nreturn vec3(0.,clamp(f,0.,1.),0.);\n}\n",
hsv2rgb: "vec3 hsv2rgb(vec3 c)\n{\nvec4 K=vec4(1.0,2.0/3.0,1.0/3.0,3.0);\nvec3 p=abs(fract(c.xxx+K.xyz) *6.0-K.www);\nreturn c.z*mix(K.xxx,clamp(p-K.xxx,0.0,1.0),c.y);\n}\n",
hue: "vec3 hue(float a){\nreturn hsv2rgb(vec3(a,1.,1.));\n}\n",
imagc: "float imagc(vec2 a){\nreturn a.y;\n}\n",
invc: "vec2 invc(vec2 a){\nfloat n=a.x*a.x+a.y*a.y;\nreturn vec2(a.x/n,-a.y/n);\n}\n",
logc: "vec2 logc(vec2 a){\nfloat re=a.x;\nfloat im=a.y;\nfloat s=sqrt(re*re+im*im);\nfloat i=im;\nfloat imag=atan(im,re);\nif(i<0.0){\nimag+= (2.0*pi);\n}\nif(i==0.0&&re<0.0){\nimag=pi;\n}\nif(imag>pi){\nimag-= (2.0*pi);\n};\nfloat real=log(s);\n\nreturn vec2(real,imag);\n}\n",
logr: "vec2 logr(float a){\nif(a>=0.)return vec2(log(a),0);\nelse return vec2(log(-a),pi);\n}\n",
mat2complex: "mat4 mat2complex(mat2 a)\n{\nreturn mat4(\nvec4(a[0][0],0,a[0][1],0),\nvec4(0,a[0][0],0,a[0][1]),\nvec4(a[1][0],0,a[1][1],0),\nvec4(0,a[1][0],0,a[1][1])\n);\n}\n",
multc: "vec2 multc(vec2 a,vec2 b){\nreturn vec2(dot(a,vec2(b.x,-b.y)),dot(a,b.yx));\n}\n",
negc: "vec2 negc(vec2 a){\nreturn vec2(-a.x,-a.y);\n}\n",
powc: "vec2 powc(vec2 a,vec2 b){\nreturn(b.x==0. &&b.y==0.) ?vec2(1.,0.) : ((a.x==0. &&a.y==0.) ?vec2(0.) :expc(multc(logc(a),b)));\n}\n",
powi: "float powi(float a,int b){\nif(mod(float(b),2.) < .5)\nreturn pow(abs(a),float(b));\nelse\nreturn sign(a)*pow(abs(a),float(b));\n}\n",
random: "uniform float rnd_;\n\nfloat last_rnd= .1231;\nfloat random(){\nfloat a=fract(132422.21*sin(dot(plain_pixel,343433.671228*vec2(.176574+last_rnd, .1131+rnd_))));\nfloat b=fract(last_rnd*2321.2312*sin(dot(plain_pixel+vec2(rnd_,last_rnd),plain_pixel) *43758.5453));\nlast_rnd=fract(rnd_ +last_rnd+a+b);\nreturn last_rnd;\n}\n",
randomnormal: "float randomnormal(){\nreturn sqrt(-2. *log(random())) *cos(6.283185307179586*random());\n}\n",
realc: "float realc(vec2 a){\nreturn a.x;\n}\n",
red: "vec3 red(float f)\n{\nreturn vec3(clamp(f,0.,1.),0.,0.);\n}\n",
rgb2hsv: "vec3 rgb2hsv(vec3 c)\n{\nvec4 K=vec4(0.0, -1.0/3.0,2.0/3.0, -1.0);\nvec4 p=mix(vec4(c.bg,K.wz),vec4(c.gb,K.xy),step(c.b,c.g));\nvec4 q=mix(vec4(p.xyw,c.r),vec4(c.r,p.yzx),step(p.x,c.r));\n\nfloat d=q.x-min(q.w,q.y);\nfloat e=1.0e-10;\nreturn vec3(abs(q.z+ (q.w-q.y) / (6.0*d+e)),d/ (q.x+e),q.x);\n}\n",
sinc: "\n\nvec2 sinc(vec2 a){\n\nfloat n=exp(a.y);\nfloat imag1=n*sin(-a.x);\nfloat real1=n*cos(-a.x);\nn=exp(-a.y);\nfloat imag2=n*sin(a.x);\nfloat real2=n*cos(a.x);\nfloat r= -(imag1-imag2) /2.0;\nfloat i= (real1-real2) /2.0;\n\nreturn vec2(r,i);\n}\n",
sqrtc: "vec2 sqrtc(vec2 a){\nreturn expc(multc(logc(a),vec2(0.5,0.0)));\n}\n",
sqrtf: "vec2 sqrtf(float a){\nif(a>=0.)return vec2(sqrt(a),0.);\nelse return vec2(0.,sqrt(-a));\n}\n",
standardFragmentHeader: "#ifdef GL_ES\nprecision highp float;\nprecision highp int;\n#endif\n\n#define pi 3.141592653589793\n\nvarying vec2 cgl_pixel;\nvarying vec2 plain_pixel;\n",
subc: "vec2 subc(vec2 a,vec2 b){\nreturn a-b;\n}\n",
subpoints: "vec2 subpoints(vec3 a,vec3 b){\nreturn dehomogenize(a) -dehomogenize(b);\n}\n",
tanc: "vec2 tanc(vec2 a){\nvec2 s=sinc(a);\nvec2 c=cosc(a);\nreturn divc(s,c);\n}\n",
vec2complex: "vec4 vec2complex(vec2 a)\n{\nreturn vec4(a.x,0.,a.y,0);\n}\n",
vshader: "attribute vec3 aPos;\nattribute vec2 aTexCoord;\nvarying vec2 cgl_pixel;\nvarying vec2 plain_pixel;\nuniform mat3 transformMatrix;\nvoid main(void){\ngl_Position=vec4(aPos,1.);\nplain_pixel=aTexCoord;\nvec3 r=transformMatrix*vec3(plain_pixel,1);\ncgl_pixel=r.xy/r.z;\n}\n"
};
var la = !1,
g,
m,
n,
ma,
r,
t,
w = !1,
na,
x = !1,
qa = !1,
ra = 1;
function sa() {
function a(c) {
g.removeEventListener("webglcontextcreationerror", a, !1);
c.statusMessage && (b = c.statusMessage)
}
if (!la) {
g = document.createElement("canvas");
g.id = "glcanvas";
g.style.display = "none";
g.width = g.height = 0;
document.body.appendChild(g);
m = document.createElement("canvas");
m.id = "tmpcanvas";
m.style.display = "none";
m.width = m.height = 0;
document.body.appendChild(m);
n = document.createElement("canvas");
n.id = "dummycanvas";
n.style.display = "none";
n.width = n.height = 1;
document.body.appendChild(n);
ma =
{
ctype: "image",
value: {
img: n,
width: 1,
height: 1,
ready: !0,
live: !1,
generation: 0,
whenReady: function() {}
}
};
var b = "Unknown";
g.addEventListener("webglcontextcreationerror", a, !1);
(r = g.getContext("webgl")) || (r = g.getContext("experimental-webgl"));
if (!r)
throw new ta("Could not obtain a WebGL context.\nReason: " + b);
g.removeEventListener("webglcontextcreationerror", a, !1);
qa || (x = r.getExtension("OES_texture_float") && r.getExtension("OES_texture_float_linear"), x || (console.error("Your browser does not suppert OES_texture_float, trying OES_texture_half_float..."),
(w = (na = r.getExtension("OES_texture_half_float")) && r.getExtension("OES_texture_half_float_linear")) || console.error("Your browser does not suppert OES_texture_half_float, will use 8-bit textures.")), navigator.userAgent.match(/(iPad|iPhone)/i) && (console.log("You are using an iPhone/iPad."), x = w = !1, r.getExtension("OES_texture_half_float") && r.getExtension("OES_texture_half_float_linear") && r.getExtension("EXT_color_buffer_half_float") ? w = !0 : console.error("Your browser does not suppert writing to half_float textures, we will use 8-bit textures.")));
la = !0
}
}
;
function ua(a) {
if (null == a || "object" != typeof a)
return a;
if (a instanceof Array) {
var b = [];
for (var c = 0, e = a.length; c < e; c++)
b[c] = ua(a[c]);
return b
}
if (a instanceof Object) {
b = {};
for (c in a)
a.hasOwnProperty(c) && (0 <= "oper impl args ctype stack name arglist value real imag key obj body".split(" ").indexOf(c) && (b[c] = ua(a[c])), a.modifs && (b.modifs = a.modifs));
return b
}
}
function va(a, b) {
if (null == a || "object" != typeof a)
return a === b;
if (a instanceof Array && b instanceof Array) {
if (a.length != b.length)
return !1;
for (var c = 0, e = a.length; c < e; c++)
if (!va(a[c], b[c]))
return !1;
return !0
}
if (a instanceof Object && b instanceof Object) {
c = "oper impl args ctype stack name modifs arglist value real imag key obj body".split(" ");
for (e = 0; e < c.length; e++) {
var f = c[e];
if (!va(a[f], b[f]))
return !1
}
return !0
}
return !1
}
function y(a) {
return -1 === a.indexOf("$") ? a : a.substr(0, a.indexOf("$"))
}
function wa(a) {
if ("boolean" === a.ctype)
return z.B;
if ("number" === a.ctype)
return a = a.value, 1E-5 > Math.abs(a.imag) ? (a.real | 0) === a.real ? z.v : z.f : z.h;
if ("list" === a.ctype) {
var b = a.value;
if (3 === b.length) {
if ("Point" === a.usage)
return z.A;
if ("Line" === a.usage)
return z.line
}
if (0 < b.length) {
for (var c = wa(b[0]), e = 1; e < b.length; e++)
c = A(c, wa(b[e]));
if (c)
return {
type: "list",
length: b.length,
parameters: c
}
}
} else {
if ("string" === a.ctype || "image" === a.ctype)
return z.image;
if ("geo" === a.ctype && "L" === a.value.kind)
return z.line
}
console.error("Cannot guess type of the following type:");
console.log(a);
return !1
}
var xa = 0;
function ya() {
xa++;
return "_h" + xa
}
function za(a, b) {
if (a > g.width || b > g.height)
g.width = Math.ceil(a), g.height = Math.ceil(b)
}
var Aa = {};
function Ba(a, b) {
Aa[b] || (Aa[b] = a.instance.parse(b));
a = a.evaluate(Aa[b]);
return a.ctype && "number" === a.ctype ? a.value.real : 0
}
function Ca(a) {
return {
x: Ba(a, "(screenbounds()_4).x"),
y: Ba(a, "(screenbounds()_4).y")
}
}
function Da(a) {
return {
x: Ba(a, "(screenbounds()_3).x"),
y: Ba(a, "(screenbounds()_3).y")
}
}
var Ea = new Float32Array(1),
Fa = new Int32Array(Ea.buffer);
function Ga(a) {
Ea[0] = a;
a = Fa[0];
var b = a >> 16 & 32768,
c = (a & 2147483647) + 4096;
if (1199570944 <= c)
return 1199570944 <= (a & 2147483647) ? 2139095040 > c ? b | 31744 : b | 31744 | (a & 8388607) >> 13 : b | 31743;
if (947912704 <= c)
return b | c - 939524096 >> 13;
if (855638016 > c)
return b;
c = (a & 2147483647) >> 23;
return b | (a & 8388607 | 8388608) + (8388608 >>> c - 102) >> 126 - c
}
function Ha(a) {
if (x)
return new Float32Array(a);
if (w) {
for (var b = new Uint16Array(a.length), c = 0; c < a.length; c++)
b[c] = Ga(a[c]);
return b
}
b = new Uint8Array(a.length);
for (c = 0; c < a.length; c++)
b[c] = 255 * a[c];
return b
}
function Ia(a) {
return x ? new Float32Array(a) : w ? new Uint16Array(a) : new Uint8Array(a)
}
function Ja() {
return x ? r.FLOAT : w ? na.HALF_FLOAT_OES : r.UNSIGNED_BYTE
}
function Ka(a) {
for (var b = [], c = 0; c < a.length; c++)
if (x)
b.push(a[c]);
else if (w) {
var e = a[c],
f = (e & 31744) >> 10,
h = e & 1023;
b.push((e >> 15 ? -1 : 1) * (f ? 31 === f ? h ? NaN : Infinity : Math.pow(2, f - 15) * (1 + h / 1024) : h / 1024 * 6.103515625E-5))
} else
b.push(a[c] / 255);
return b
}
function Ma(a) {
for (var b = 1; b < a;)
b <<= 1;
return b
}
;
function Na(a, b, c) {
if (a.canvaswrapper) {
if (!a.ready || a.canvaswrapper.canvas != ma && a.canvaswrapper.L == a.width && a.canvaswrapper.G == a.height || (delete a.canvaswrapper, a.canvaswrapper = Na(a, b, c)), c) {
b = a.canvaswrapper;
var e = b.i;
if (c && (c.repeat != e.repeat || c.N != e.N || c.S != e.S))
for (b.i = c, e = 0; 2 > e; e++)
r.bindTexture(r.TEXTURE_2D, b.l[e]), c.N ? r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, c.S ? r.LINEAR_MIPMAP_LINEAR : r.NEAREST_MIPMAP_LINEAR) : r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, c.S ? r.LINEAR : r.NEAREST),
r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, c.S ? r.LINEAR : r.NEAREST)
}
} else
a.canvaswrapper = new Oa(a.ready ? a : ma, c || {
S: !0,
N: !1,
repeat: !1
}), a.ready || console.log("Image is not ready yet.");
return a.canvaswrapper
}
function Oa(a, b) {
this.canvas = a;
this.i = b;
this.L = a.width;
this.G = a.height;
Pa(this);
this.R = 0;
this.l = [];
this.aa = [];
this.generation = -1;
this.bindTexture();
a.drawTo = this.drawTo.bind(this);
a.readPixels = this.qa.bind(this);
a.cdyUpdate = this.sa.bind(this);
a = Ia(this.V * this.M * 4);
for (var c = 0; 2 > c; c++)
this.l[c] = r.createTexture(), r.bindTexture(r.TEXTURE_2D, this.l[c]), r.pixelStorei(r.UNPACK_ALIGNMENT, 1), r.texImage2D(r.TEXTURE_2D, 0, r.RGBA, this.V, this.M, 0, r.RGBA, Ja(), a), b.N ? r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER,
b.S ? r.LINEAR_MIPMAP_LINEAR : r.NEAREST_MIPMAP_LINEAR) : r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, b.S ? r.LINEAR : r.NEAREST), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, b.S ? r.LINEAR : r.NEAREST), this.aa[c] = r.createFramebuffer(), r.bindFramebuffer(r.FRAMEBUFFER, this.aa[c]), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, this.l[c], 0);
this.$ = new Qa(ka.copytexture_v, ka.copytexture_f);
b = r.createBuffer();
r.bindBuffer(r.ARRAY_BUFFER, b);
b = new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0,
1, 1, 0]);
a = r.getAttribLocation(this.$.i, "aPos");
r.enableVertexAttribArray(a);
c = r.getAttribLocation(this.$.i, "aTexCoord");
r.enableVertexAttribArray(c);
var e = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]),
f = b.byteLength;
r.bufferData(r.ARRAY_BUFFER, f + e.byteLength, r.STATIC_DRAW);
r.bufferSubData(r.ARRAY_BUFFER, 0, b);
r.bufferSubData(r.ARRAY_BUFFER, f, e);
r.vertexAttribPointer(a, 3, r.FLOAT, !1, 0, 0);
r.vertexAttribPointer(c, 2, r.FLOAT, !1, 0, f)
}
function Pa(a) {
a.V = Ma(a.L + a.L / 2 * (a.i.N && a.i.repeat));
a.M = Ma(a.G + a.G / 2 * (a.i.N && a.i.repeat))
}
Oa.prototype.bindTexture = function() {
r.bindTexture(r.TEXTURE_2D, this.l[this.R])
};
Oa.prototype.bindFramebuffer = function() {
r.bindFramebuffer(r.FRAMEBUFFER, this.aa[this.R ^ 1]);
this.R ^= 1
};
Oa.prototype.sa = function() {
if (this.canvas.img.hasOwnProperty("getContext"))
var a = this.canvas.img.getContext("2d");
else
this.canvas.img = document.createElement("canvas"), this.canvas.img.style.display = "none", this.canvas.img.width = this.L, this.canvas.img.height = this.G, a = this.canvas.img.getContext("2d");
a.clearRect(0, 0, this.L, this.G);
this.drawTo(a, 0, 0);
this.canvas.img.generation++
};
function Ra(a) {
if (!(a.canvas.live && (a.canvas.img.webkitDecodedFrameCount || a.canvas.img.i) && a.ma >= (a.canvas.img.webkitDecodedFrameCount || a.canvas.img.i) || !a.canvas.live && (!a.canvas.ready || a.generation >= a.canvas.generation))) {
if (a.L != a.canvas.width || a.G != a.canvas.height) {
a.L = a.canvas.width;
a.G = a.canvas.height;
Pa(a);
for (var b = Ia(a.V * a.M * 4), c = 0; 2 > c; c++)
r.bindTexture(r.TEXTURE_2D, a.l[c]), r.texImage2D(r.TEXTURE_2D, 0, r.RGBA, a.V, a.M, 0, r.RGBA, Ja(), b)
}
a.bindTexture();
r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, 1);
a.i.repeat ? (m.width = a.V, m.height = a.M, b = m.getContext("2d"), b.drawImage(a.canvas.img, 0, a.M - a.G), b.drawImage(a.canvas.img, a.L, a.M - a.G), b.drawImage(a.canvas.img, 0, a.M - 2 * a.G), b.drawImage(a.canvas.img, a.L, a.M - 2 * a.G), r.texSubImage2D(r.TEXTURE_2D, 0, 0, 0, r.RGBA, Ja(), m)) : r.texSubImage2D(r.TEXTURE_2D, 0, 0, 0, r.RGBA, Ja(), a.canvas.img);
a.i.N && r.generateMipmap(r.TEXTURE_2D);
r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, 0);
a.generation = a.canvas.generation;
a.ma = Math.min(a.ma + 1, a.canvas.img.webkitDecodedFrameCount || a.canvas.img.i)
}
}
Oa.prototype.drawTo = function(a, b, c) {
za(this.V, this.M);
r.viewport(0, 0, this.V, this.M);
r.useProgram(this.$.i);
r.activeTexture(r.TEXTURE0);
r.bindTexture(r.TEXTURE_2D, this.l[this.R]);
this.$.l.sampler([0]);
r.bindFramebuffer(r.FRAMEBUFFER, null);
r.drawArrays(r.TRIANGLE_STRIP, 0, 4);
r.flush();
a.drawImage(g, 0, g.height - this.G, this.L, this.G, b, c, this.L, this.G)
};
Oa.prototype.qa = function(a, b, c, e) {
r.bindFramebuffer(r.FRAMEBUFFER, this.aa[this.R]);
r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, this.l[this.R], 0);
var f = Ia(c * e * 4);
r.readPixels(a, this.G - b - e, c, e, r.RGBA, Ja(), f);
a = [];
for (--e; 0 <= e; e--)
a = a.concat(Ka(f.slice(e * c * 4, (e + 1) * c * 4)));
return a
};
function Sa(a, b) {
this.C = a;
this.R = b;
Ta(this)
}
function Ta(a) {
var b = Ua(new Va(a.C), a.R);
a.l = b.D;
a.O = b.O;
a.ia = b.ia;
a.$ = ka.standardFragmentHeader + b.code;
a.aa = ka.vshader;
a.i = new Qa(a.aa, a.$);
b = r.createBuffer();
r.bindBuffer(r.ARRAY_BUFFER, b);
b = new Float32Array([-1, -1, 0, 1, -1, 0, -1, 1, 0, 1, 1, 0]);
var c = r.getAttribLocation(a.i.i, "aPos");
r.enableVertexAttribArray(c);
a = r.getAttribLocation(a.i.i, "aTexCoord");
r.enableVertexAttribArray(a);
var e = new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]),
f = b.byteLength;
r.bufferData(r.ARRAY_BUFFER, f + e.byteLength, r.STATIC_DRAW);
r.bufferSubData(r.ARRAY_BUFFER,
0, b);
r.bufferSubData(r.ARRAY_BUFFER, f, e);
r.vertexAttribPointer(c, 3, r.FLOAT, !1, 0, 0);
r.vertexAttribPointer(a, 2, r.FLOAT, !1, 0, f)
}
function Wa(a) {
function b(a, c, e) {
if (a)
if ("function" === typeof a)
switch (c) {
case z.h:
a([e.value.real, e.value.imag]);
break;
case z.B:
e.value ? a([1]) : a([0]);
break;
case z.v:
case z.f:
a([e.value.real]);
break;
case z.A:
case z.line:
"geo" === e.ctype ? a(e.value.homog.value.map(function(a) {
return a.value.real
})) : "list" === e.ctype && 2 === e.value.length ? a(e.value.map(function(a) {
return a.value.real
}).concat([1])) : "list" === e.ctype && 3 === e.value.length && a(e.value.map(function(a) {
return a.value.real
}));
break;
default:
if ("list" ===
c.type && c.parameters === z.f)
a(e.value.map(function(a) {
return a.value.real
}));
else if ("list" === c.type && "list" === c.parameters.type && c.parameters.parameters === z.f) {
for (var f = [], h = 0; h < c.length; h++)
for (var k = 0; k < c.parameters.length; k++)
f.push(e.value[h].value[k].value.real);
a(f)
} else
console.error("Don't know how to set uniform of type " + B(c) + ", to " + e)
}
else if ("list" === c.type)
if (h = Xa(c), 1 === C(c) && h === z.f) {
c = Ya(c.length);
var l = 0;
for (f in c)
b(a["a" + f], z.ea(c[f]), {
ctype: "list",
value: E(c[f]).map(function(a) {
return e.value[l +
a]
})
}), l += c[f]
} else
for (f = 0; f < c.length; f++)
b(a["a" + f], c.parameters, {
ctype: "list",
value: e.value[f].value
});
else
console.error("Don't know how to set uniform of type " + B(c) + ", to"), console.log(e)
}
for (var c in a.l) {
var e = a.C.evaluateAndVal(a.l[c].X),
f = a.l[c].type;
if (!F(Za(e), f)) {
console.log("Type of " + c + " changed (" + B(Za(e)) + " is no subtype of " + B(f) + "); forcing rebuild.");
Ta(a);
r.useProgram(a.i.i);
Wa(a);
return
}
a.i.l[c] && b(a.i.l[c], f, e)
}
[["rnd_", function() {
return [Math.random()]
}], ["_lowerleft", function() {
var b =
Ca(a.C);
return [b.x, b.y]
}], ["_lowerright", function() {
var b = Da(a.C);
return [b.x, b.y]
}]].map(function(b) {
return a.i.l[b[0]] && a.i.l[b[0]](b[1]())
})
}
function $a(a) {
var b = 0,
c;
for (c in a.O) {
r.activeTexture(r.TEXTURE0 + b);
var e = a.O[c],
f = e.name;
e = ab(e);
Ra(e);
e.bindTexture();
[["_sampler" + f, [b]], ["_ratio" + f, [e.L / e.G]], ["_cropfact" + f, [e.L / e.V, e.G / e.M]]].map(function(b) {
return a.i.l[b[0]] && a.i.l[b[0]](b[1])
});
b++
}
}
;
CindyJS.registerPlugin(1, "CindyGL", function(a) {
function b(b, e, f, h, k, l) {
if (!b.oa || b.na < ra)
b.oa = !0, b.na = ra, b.ra = new Sa(a, b);
b = b.ra;
a:
{
for (c in b.ia)
if (b.C.getMyfunction(c).generation > b.ia[c]) {
console.log(c + " is outdated; forcing rebuild.");
var c = !1;
break a
}
c = !0
}c || Ta(b);
var u = k / h;
c = e.x + -(f.y - e.y) * u;
u = e.y + (f.x - e.x) * u;
za(h, k);
l ? r.viewport(0, 0, h, k) : r.viewport(0, g.height - k, h, k);
r.useProgram(b.i.i);
Wa(b);
e = [f.x - e.x, c - e.x, e.x, f.y - e.y, u - e.y, e.y, 0, 0, 1];
b.i.l.hasOwnProperty("transformMatrix") && b.i.l.transformMatrix([e[0],
e[3], e[6], e[1], e[4], e[7], e[2], e[5], e[8]]);
$a(b);
l ? (l.bindFramebuffer(), l.generation = ++l.canvas.generation) : r.bindFramebuffer(r.FRAMEBUFFER, null);
r.drawArrays(r.TRIANGLE_STRIP, 0, 4);
r.flush();
l && (l.generation = Math.max(l.generation, l.canvas.generation + 1))
}
t = a.nada;
a.defineFunction("compile", 1, function(b) {
b = Ua(new Va(a), b[0]);
console.log(b);
return {
ctype: "string",
value: b
}
});
a.defineFunction("use8bittextures", 0, function() {
qa = !0;
x = w = !1;
console.log("Switching to 8-bit textures mode.");
return a.nada
});
a.defineFunction("forcerecompile",
0, function() {
ra++;
return t
});
a.defineFunction("colorplot", 1, function(c) {
sa();
var e = a.instance.canvas.width,
f = a.instance.canvas.height;
b(c[0], Ca(a), Da(a), e, f, null);
c = a.instance.canvas.getContext("2d");
c.save();
c.setTransform(1, 0, 0, 1, 0, 0);
c.drawImage(g, 0, 0, e, f, 0, 0, e, f);
c.restore();
return t
});
a.defineFunction("colorplot", 3, function(c) {
sa();
var e = c[0],
f = a.extractPoint(a.evaluateAndVal(c[1])),
h = a.extractPoint(a.evaluateAndVal(c[2])),
k = {
x: Math.min(f.x, h.x),
y: Math.min(f.y, h.y)
},
l = {
x: Math.max(f.x, h.x),
y: Math.min(f.y,
h.y)
},
q = Math.min(f.x, h.x),
u = Math.max(f.y, h.y);
c = a.instance.canvas.width;
var p = a.instance.canvas.height;
var v = Ba(a, "(screenbounds()_1).x");
var D = Ba(a, "(screenbounds()_1).y");
var da = Da(a),
La = Math.abs((f.x - h.x) / (da.x - v));
f = Math.abs((f.y - h.y) / (da.y - D));
b(e, k, l, c * La, p * f, null);
e = a.instance.canvas.getContext("2d");
a.getInitialMatrix();
v = c * (q - v) / (da.x - v);
D = p * (u - D) / (da.y - D);
e.save();
e.setTransform(1, 0, 0, 1, 0, 0);
e.drawImage(g, 0, 0, c * La, p * f, v, D, c * La, p * f);
e.restore();
return t
});
a.defineFunction("colorplot", 4, function(c) {
sa();
var e = a.extractPoint(a.evaluateAndVal(c[0])),
f = a.extractPoint(a.evaluateAndVal(c[1])),
h = a.evaluateAndVal(c[2]);
c = c[3];
if (!e.ok || !f.ok || "string" !== h.ctype)
return t;
h = a.getImage(h.value, !0);
var k = Na(h, a, !1);
b(c, e, f, h.width, h.height, k);
return t
});
a.defineFunction("colorplot", 2, function(c) {
sa();
var e = Ca(a),
f = Da(a),
h = a.evaluateAndVal(c[0]);
c = c[1];
if ("string" !== h.ctype)
return t;
h = a.getImage(h.value, !0);
var k = Na(h, a, !1);
b(c, e, f, h.width, h.height, k);
return t
});
a.defineFunction("setpixel", 4, function(b) {
var c =
a.evaluateAndVal(b[0]);
var f = void 0 === f ? null : f;
if ("string" === c.ctype)
var h = c.value;
else
console.log("argument is not a string"), h = f;
c = bb(a.evaluateAndVal(b[1]));
f = bb(a.evaluateAndVal(b[2]));
b = cb(a.evaluateAndVal(b[3]));
if (!h)
return t;
var k = a.getImage(h, !0);
k = Na(k, a, !1);
isFinite(c) && isFinite(f) && h && k && b && (k.bindTexture(), h = [b[0], b[1], b[2], 1], r.texSubImage2D(r.TEXTURE_2D, 0, c, f, 1, 1, r.RGBA, Ja(), Ha(h)), b = k.canvas.img.getContext("2d"), k = b.createImageData(1, 1), k.data.d = h, b.putImageData(k, c, f));
return t
})
});
function G(a, b) {
return {
type: "list",
length: a,
parameters: b
}
}
function Za(a) {
return {
type: "constant",
value: a
}
}
function db(a) {
return Za({
ctype: "number",
value: {
real: a,
imag: 0
}
})
}
var z = {
B: 1,
v: 2,
f: 3,
h: 4,
W: 5,
color: 6,
A: 7,
line: 8,
K: 9,
image: 10,
F: G(2, 3),
J: G(3, 3),
P: G(4, 3),
ea: function(a) {
return G(a, 3)
},
ha: function(a) {
return G(a, 4)
},
ba: G(2, G(2, 3)),
ca: G(3, G(3, 3)),
da: G(4, G(4, 3))
};
Object.freeze(z);
function B(a) {
return 1 <= a && 10 >= a ? "bool int float complex voidt color point line coordinate2d image".split(" ")[a - 1] : "list" === a.type ? B(a.parameters) + "[" + a.length + "]" : "constant" === a.type ? "const[" + JSON.stringify(a.value.value) + "]" : JSON.stringify(a)
}
function H(a) {
return "list" === a.type && H(a.parameters) || F(a, z.f)
}
function I(a) {
return "list" === a.type && I(a.parameters) || F(a, z.h)
}
function eb(a) {
return "constant" === a.type && F(a, z.v)
}
function J(a) {
return "constant" === a.type ? wa(a.value) : a
}
function C(a) {
return "list" === a.type ? C(a.parameters) + 1 : 0
}
function Xa(a) {
return void 0 !== a.parameters ? Xa(a.parameters) : a
}
function fb(a, b) {
return C(a) === C(b) && (0 === C(a) || a.length === b.length && fb(a.parameters, b.parameters))
}
function K(a) {
return F(a, z.f) ? z.f : F(a, z.h) ? z.h : {
type: "list",
length: a.length,
parameters: K(a.parameters)
}
}
function gb(a) {
return F(a, z.h) ? z.h : {
type: "list",
length: a.length,
parameters: gb(a.parameters)
}
}
function L(a) {
return "constant" === a.type && L(J(a)) || a === z.B || a === z.v || a === z.f || a === z.h || a === z.A || a === z.line || "list" === a.type && a.parameters === z.f && 1 <= a.length && 4 >= a.length || "list" === a.type && "list" === a.parameters.type && a.parameters.parameters === z.f && a.length === a.parameters.length && 2 <= a.length && 4 >= a.length
}
function hb(a) {
return -1 !== [z.B, z.v, z.f, z.h].indexOf(a)
}
function ib(a, b) {
return a === b || "constant" === a.type && "constant" === b.type && va(a.value, b.value) || "list" === a.type && "list" === b.type && a.length === b.length && ib(a.parameters, b.parameters)
}
function F(a, b) {
return ib(a, b) ? !0 : a ? hb(a) && hb(b) ? a <= b : "constant" === b.type ? !1 : "constant" === a.type ? F(wa(a.value), b) : b === z.K ? F(a, z.h) || F(a, z.F) || F(a, z.A) : b === z.A ? F(a, z.J) || F(a, z.F) : b === z.line ? F(a, z.J) : b === z.color ? F(a, z.f) || "list" === a.type && (3 === a.length || 4 === a.length) && F(a.parameters, z.f) : "list" === a.type && "list" === b.type && a.length === b.length ? F(a.parameters, b.parameters) : !1 : !1
}
function A(a, b) {
if (!a)
return b;
if (!b || ib(a, b))
return a;
"constant" === a.type && (a = wa(a.value));
"constant" === b.type && (b = wa(b.value));
return hb(a) && hb(b) ? Math.max(a, b) : "list" === a.type && "list" === b.type && a.length === b.length && (b = A(a.parameters, b.parameters)) ? {
type: "list",
length: a.length,
parameters: b
} : !1
}
function M(a) {
return function(b) {
var c = {},
e;
for (e in a) {
var f = a[e];
c.ga = f[0];
if (b.length == c.ga.length && b.every(function(a) {
return function(b, c) {
return F(b, a.ga[c])
}
}(c)))
return {
s: c.ga,
u: f[1],
m: f[2]
};
c = {
ga: c.ga
}
}
return !1
}
}
function jb(a) {
switch (a) {
case z.v:
return M([[[z.B], z.v, N("int")]]);
case z.f:
return M([[[z.B], z.f, N("float")], [[z.v], z.f, N("float")]]);
case z.h:
return M([[[z.f], z.h, function(a) {
return "vec2(" + a + ", 0.)"
}]]);
case z.color:
return M([[[z.f], z.color, O("float2color")], [[z.J], z.color, function(a) {
return "vec4(" + a + ",1.0)"
}], [[z.P], z.color, P]]);
case z.A:
return M([[[z.F], z.A, function(a) {
return "vec3(" + a + ",1.0)"
}], [[z.J], z.A, P]]);
case z.line:
return M([[[z.F], z.line, function(a) {
return "vec3(" + a + ",1.0)"
}], [[z.J], z.line,
P]]);
case z.K:
return M([[[z.h], z.K, P], [[z.F], z.K, P], [[z.A], z.K, O("dehomogenize")]]);
default:
if ("list" === a.type)
return function(b) {
var c = b[0],
e = jb(a.parameters)([c.parameters]).m;
return {
s: b,
u: a,
m: function(b, h, k) {
return kb(a)(E(a.length).map(function(a) {
return e([Q(c, a)([b], h, k)], h, k)
}), h, k)
}
}
}
}
console.log("no inclusionfunction ->" + B(a) + " implemented yet; using identity...");
return function(b) {
return {
s: b,
u: a,
m: P
}
}
}
function R(a) {
a = J(a);
switch (a) {
case z.B:
return "bool";
case z.v:
return "int";
case z.f:
return "float";
case z.h:
case z.K: