forked from zauner/vvvv.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvvvv.min.js
503 lines (503 loc) · 220 KB
/
vvvv.min.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
var VVVV_ENV="production";$.ajaxPrefilter(function(a,b,g){if("script"==a.dataType||"script"==b.dataType)a.cache=!0});window.console||(window.console={log:function(a){}});VVVV={Config:{}};VVVV.Config.auto_undo=!1;VVVV.Nodes={};VVVV.PinTypes={};VVVV.NodeLibrary={};VVVV.NodeNames=[];VVVV.Patches={};VVVV.Editors={};VVVV.onNotImplemented=function(a){console.log("Warning: "+a+" is not implemented.")};VVVV.loadCounter=0;
VVVV.loadScript=function(a,b){var g=document.getElementsByTagName("head")[0],e=document.createElement("script");e.async=!1;e.src=VVVV.Root+"/"+a;b&&e.addEventListener("load",b);VVVV.loadCounter++;g.appendChild(e)};
VVVV.init=function(a,b,g){function e(){var d=new VVVV.Core.Patch("");_(VVVV.Nodes).each(function(c){var h=new c(0,d);"development"==VVVV_ENV&&console.log("Registering "+h.nodename);VVVV.NodeLibrary[h.nodename.toLowerCase()]=c;VVVV.NodeNames.push(h.nodename)});"development"==VVVV_ENV&&console.log("done ...");VVVV.MainLoops=[];$("script[language='VVVV']").each(function(c){var d=new VVVV.Core.Patch($(this).attr("src"),function(){var c=new VVVV.Core.MainLoop(this);VVVV.MainLoops.push(c)});VVVV.Patches[c]=
d});"function"===typeof g&&g.call()}VVVV.Root=a||"./";"development"==VVVV_ENV&&console.log("loading vvvv.js ...");if("development"==VVVV_ENV){document.getElementsByTagName("head");var f=function(d){d.target.removeEventListener("load",f);0>=--VVVV.loadCounter&&e()};0==$("script[src*=thirdparty]").length&&VVVV.loadScript("thirdparty.js",f);0==$("script[src*=underscore]").length&&VVVV.loadScript("lib/underscore/underscore-min.js",f);0!=$('script[src*="d3.js"]').length||"full"!=b&&"vvvviewer"!=b||VVVV.loadScript("lib/d3-v3/d3.v3.min.js",
f);0!=$("script[src*=glMatrix]").length||"full"!=b&&"run"!=b||VVVV.loadScript("lib/glMatrix-0.9.5.min.js",f);if(0==$('script[src*="vvvv.core.js"]').length){VVVV.loadScript("core/vvvv.core.js",f);if("run"==b||"full"==b)VVVV.loadScript("mainloop/vvvv.mainloop.js",f),VVVV.loadScript("mainloop/vvvv.dominterface.js",f),VVVV.loadScript("nodes/vvvv.nodes.value.js",f),VVVV.loadScript("nodes/vvvv.nodes.string.js",f),VVVV.loadScript("nodes/vvvv.nodes.boolean.js",f),VVVV.loadScript("nodes/vvvv.nodes.color.js",
f),VVVV.loadScript("nodes/vvvv.nodes.spreads.js",f),VVVV.loadScript("nodes/vvvv.nodes.spectral.js",f),VVVV.loadScript("nodes/vvvv.nodes.animation.js",f),VVVV.loadScript("nodes/vvvv.nodes.network.js",f),VVVV.loadScript("nodes/vvvv.nodes.system.js",f),VVVV.loadScript("nodes/vvvv.nodes.canvas.js",f),VVVV.loadScript("nodes/vvvv.nodes.html5.js",f),VVVV.loadScript("nodes/vvvv.nodes.transform.js",f),VVVV.loadScript("nodes/vvvv.nodes.vectors.js",f),VVVV.loadScript("nodes/vvvv.nodes.webgl.js",f),VVVV.loadScript("nodes/vvvv.nodes.complex.js",
f),VVVV.loadScript("nodes/vvvv.nodes.enumerations.js",f),VVVV.loadScript("nodes/vvvv.nodes.2d.js",f),VVVV.loadScript("nodes/vvvv.nodes.3d.js",f),VVVV.loadScript("nodes/vvvv.nodes.node.js",f),VVVV.loadScript("nodes/vvvv.nodes.astronomy.js",f),VVVV.loadScript("nodes/vvvv.nodes.xml.js",f);VVVV.loadScript("editors/vvvv.editors.browser_editor.js",f)}}"production"==VVVV_ENV&&e()};VVVV.Types={};VVVV.MousePositions={_all:{x:0,y:0,wheel:0,lb:0,mb:0,rb:0}};VVVV.Types.Color=function(a,b,g,e){this.rgba=[a,b,g,e];this.toString=function(){return"r="+100*a+"% g="+100*b+"% b="+100*g+"% a="+100*e+"%"}};var PinDirection={Input:0,Output:1,Configuration:2};VVVV.PinTypes.Generic={typeName:"Generic",reset_on_disconnect:!0,defaultValue:function(){return"0"}};VVVV.PinTypes.Value={typeName:"Value",reset_on_disconnect:!1,defaultValue:function(){return 0},primitive:!0};
VVVV.PinTypes.String={typeName:"String",reset_on_disconnect:!1,defaultValue:function(){return""},primitive:!0};VVVV.PinTypes.Enum={typeName:"Enum",reset_on_disconnect:!1,defaultValue:function(){return""},primitive:!0};
VVVV.Helpers={translateOperators:function(a){a=a.replace("Add","+");a=a.replace("Subtract","-");a=a.replace("Multiply","*");a=a.replace("Divide","/");a=a.replace("EQ","=");a=a.replace("GT",">");a=a.replace("GTE",">=");a=a.replace("LT","<");return a=a.replace("LTE","<=")},prepareFilePath:function(a,b){a=a.replace(/\\/g,"/");return a.match(/^%VVVV%/)?a.replace("%VVVV%",VVVV.Root):a.match(/^%PAGE%/)?a.replace("%PAGE%",location.pathname):a.match(/^(\/|.+:\/\/)/)?a:b?b.getAbsolutePath()+a:a}};
VVVV.Core={Pin:function(a,b,g,e,f){this.direction=b;this.pinname=a;this.links=[];this.values=[];this.node=e;this.changed=!0;this.reset_on_disconnect=this.active=!1;this.masterPin=this.slavePin=void 0;this.connectionChangedHandlers={};this.enumOptions=[];this.getValue=function(d,c){if(!c||1==c)return this.values[d%this.values.length];for(var h=[],f=0;f<c;f++)h.push(this.values[(d*c+f)%this.values.length]);return h};this.setValue=function(d,c,h){h=h||!1;this.values[d]=c;this.changed=!0;this.node.dirty=
!0;if(this.direction==PinDirection.Output)for(var f=this.links.length,e=0;e<f;e++)this.links[e].toPin.setValue(d,c);this.slavePin&&!h&&this.slavePin.setValue(d,c);this.direction==PinDirection.Input&&(this.masterPin&&!this.isConnected())&&this.masterPin.setValue(d,c,!0);this.node.isIOBox&&"Descriptive Name"==this.pinname&&(this.node.parentPatch.domInterface?this.node.parentPatch.domInterface.connect(this.node):this.node.parentPatch.parentPatch&&this.node.registerInterfacePin())};this.markPinAsChanged=
function(){this.changed=!0;this.node.dirty=!0;if(this.direction==PinDirection.Output)for(var d=this.links.length,c=0;c<d;c++)this.links[c].toPin.markPinAsChanged();this.slavePin&&this.slavePin.markPinAsChanged()};this.pinIsChanged=function(){var d=this.changed;this.changed=!1;return d};this.isConnected=function(){return 0<this.links.length||this.masterPin&&this.masterPin.isConnected()};this.getSliceCount=function(){return this.values.length};this.setSliceCount=function(d){if(this.values.length!=d){this.values.length=
d;this.changed=!0;this.node.dirty=!0;if(this.direction==PinDirection.Output)for(var c=this.links.length,h=0;h<c;h++)this.links[h].toPin.setSliceCount(d);this.slavePin&&this.slavePin.setSliceCount(d)}};this.setType=function(d){if(d.typeName!=this.typeName){var c=this;delete this.connectionChangedHandlers.nodepin;delete this.connectionChangedHandlers.webglresource;_(d.connectionChangedHandlers).each(function(h,f){c.connectionChangedHandlers[f]=d.connectionChangedHandlers[f]});this.typeName=d.typeName;
this.defaultValue=d.defaultValue;this.direction==PinDirection.Input&&this.defaultValue&&(this.setValue(0,this.defaultValue()),this.setSliceCount(1));void 0!=d.reset_on_disconnect&&(this.reset_on_disconnect=d.reset_on_disconnect)}};void 0==f&&(f=VVVV.PinTypes.Generic,this.unvalidated=!0);this.setType(f);g&&0<g.length&&(this.values=g.slice(0));this.reset=function(){this.defaultValue?(this.setValue(0,this.defaultValue()),this.setSliceCount(1)):this.values=g.slice(0);this.markPinAsChanged()};this.connectionChanged=
function(){var d=this;_(this.connectionChangedHandlers).each(function(c){d.f=c;d.f()})}},Node:function(a,b,g){this.nodename=b;this.id=a;this.height=this.width=this.y=this.x=0;this.isShader=this.isIOBox=!1;this.resourcesPending=0;this.auto_nil=!0;this.setupObject=function(){this.inputPins={};this.outputPins={};this.invisiblePins={};this.defaultPinValues={}};this.setupObject();this.delays_output=this.auto_evaluate=!1;this.dirty=!0;(this.parentPatch=g)&&(this.parentPatch.nodeMap[a]=this);this.addDefault=
function(e,f){this.defaultPinValues[e]=f};this.addInputPin=function(e,f,d){f=new VVVV.Core.Pin(e,PinDirection.Input,f,this,d);this.inputPins[e]=f;this.parentPatch&&(this.parentPatch.pinMap[this.id+"_in_"+e]=f);this.applyPinValuesFromXML(e);return f};this.addOutputPin=function(e,f,d){f=new VVVV.Core.Pin(e,PinDirection.Output,f,this,d);this.outputPins[e]=f;this.parentPatch&&(this.parentPatch.pinMap[this.id+"_out_"+e]=f);return f};this.removeInputPin=function(e){if(this.inputPins[e]){var f=this.inputPins[e].links[0];
f&&(f.fromPin.connectionChanged(),f.destroy());delete this.inputPins[e];this.dirty=!0}};this.removeOutputPin=function(e){if(this.outputPins[e]){for(var f=this.outputPins[e].links.length,d=0;d<f;d++){var c=this.outputPins[e].links[d];c.toPin.connectionChanged();c.destroy()}delete this.outputPins[e];this.dirty=!0}};this.addInvisiblePin=function(e,f,d){f=new VVVV.Core.Pin(e,PinDirection.Configuration,f,this,d);this.invisiblePins[e]=f;this.parentPatch.pinMap[this.id+"_inv_"+e]=f;void 0!=this.defaultPinValues[e]&&
(f.values=this.defaultPinValues[e]);return f};this.IOBoxType=function(){var e=/^IOBox \((.*)\)/.exec(this.nodename);return e&&1<e.length?e[1]:""};this.IOBoxInputPin=function(){switch(this.IOBoxType()){case "Value Advanced":return this.inputPins["Y Input Value"];case "String":return this.inputPins["Input String"];case "Color":return this.inputPins["Color Input"];case "Node":return this.inputPins["Input Node"]}};this.IOBoxOutputPin=function(){switch(this.IOBoxType()){case "Value Advanced":return this.outputPins["Y Output Value"];
case "String":return this.outputPins["Output String"];case "Color":return this.outputPins["Color Output"];case "Node":return this.outputPins["Output Node"]}};this.IOBoxRows=function(){return this.invisiblePins.Rows?this.invisiblePins.Rows.getValue(0):1};this.isComment=function(){return this.isIOBox&&0==_(this.outputPins).size()};this.label=function(){if(this.isIOBox)return this.IOBoxInputPin().getValue(0)?this.IOBoxInputPin().getValue(0).toString():"";if(this.isSubpatch)return"||"+this.nodename.match(/([^\/]+)\.v4p$/)[1];
var e=this.nodename.replace(/\s\(.+\)/,"");return e=VVVV.Helpers.translateOperators(e)};this.getWidth=function(){var e;e=100==this.width||0==this.width?this.isIOBox?60:Math.max(18,6*(this.label().length+2)):this.width/15;return e=Math.max(e,12*(_(this.inputPins).size()-1)+4)};this.getHeight=function(){return this.isIOBox&&100==this.height?18*this.IOBoxRows():100==this.height||this.isSubpatch?18:Math.max(18,this.height/15)};this.getUpstreamNodes=function(){var e=[];_(this.inputPins).each(function(f){0<
f.links.length&&e.push(f.links[0].fromPin.node)});return e};this.getDownstreamNodes=function(){var e=[];_(this.outputPins).each(function(f){for(var d=0;d<f.links.length;d++)e.push(f.links[d].toPin.node)});return e};this.findDownstreamNodes=function(e){var f=[];_(this.outputPins).each(function(d){for(var c=0;c<d.links.length;c++)d.links[c].toPin.node.nodename==e?f.push(d.links[c].toPin.node):f=d.links[c].toPin.slavePin?f.concat(d.links[c].toPin.slavePin.node.findDownstreamNodes(e)):d.links[c].toPin.node.isIOBox&&
d.links[c].toPin.node.IOBoxOutputPin().slavePin?f.concat(d.links[c].toPin.node.IOBoxOutputPin().slavePin.node.findDownstreamNodes(e)):f.concat(d.links[c].toPin.node.findDownstreamNodes(e))});return f};this.hasNilInputs=function(){var e=!1;_(this.inputPins).each(function(f){0==f.getSliceCount()&&(e=!0)});return e};this.getMaxInputSliceCount=function(){var e=0;_(this.inputPins).each(function(f){f.getSliceCount()>e&&(e=f.values.length)});return e};this.applyPinValuesFromXML=function(e){if(this.inputPins[e]){var f=
this.inputPins[e];e=this.defaultPinValues[e];if(void 0!=e&&(!f.reset_on_disconnect||1<e.length||""!=e[0])){for(var d=0;d<e.length;d++)f.values[d]!=e[d]&&f.setValue(d,e[d]);f.setSliceCount(e.length)}}};this.registerInterfacePin=function(){var e=this;if(this.isIOBox&&this.parentPatch.parentPatch&&""!=this.invisiblePins["Descriptive Name"].getValue(0)){var f=this.invisiblePins["Descriptive Name"].getValue(0);this.IOBoxInputPin().connectionChangedHandlers.subpatchpins=function(){if(0<this.links.length&&
this.masterPin){"development"==VVVV_ENV&&console.log("deleting "+f+" input pin because node has input connection...");for(var d=0;d<this.masterPin.links.length;d++)this.masterPin.links[d].destroy();e.parentPatch.removeInputPin(f);this.masterPin=void 0}e.IOBoxOutputPin().slavePin?e.IOBoxOutputPin().slavePin.pinname!=f&&("development"==VVVV_ENV&&console.log("renaming "+e.IOBoxOutputPin().slavePin.pinname+" to "+f),e.parentPatch.outputPins[f]=e.parentPatch.outputPins[e.IOBoxOutputPin().slavePin.pinname],
e.parentPatch.removeOutputPin(e.IOBoxOutputPin().slavePin.pinname),e.IOBoxOutputPin().slavePin.pinname=f):("development"==VVVV_ENV&&console.log("interfacing output pin detected: "+f),d=e.parentPatch.outputPins[f],void 0==d&&(d=e.parentPatch.addOutputPin(f,e.IOBoxOutputPin().values)),d.setType(VVVV.PinTypes[e.IOBoxOutputPin().typeName]),e.IOBoxOutputPin().slavePin=d,d.masterPin=e.IOBoxOutputPin())};this.IOBoxInputPin().connectionChanged();this.IOBoxOutputPin().connectionChangedHandlers.subpatchpins=
function(){if(0<this.links.length&&this.slavePin){"development"==VVVV_ENV&&console.log("deleting "+f+" output pin because node "+e.id+" has output connection...");for(var d=0;d<this.slavePin.links.length;d++)this.slavePin.links[d].destroy();e.parentPatch.removeOutputPin(f);this.slavePin=void 0}if(e.IOBoxInputPin().masterPin)e.IOBoxInputPin().masterPin.pinname!=f&&(console.log("renaming "+e.IOBoxInputPin().masterPin.pinname+" to "+f),e.parentPatch.inputPins[f]=e.parentPatch.inputPins[e.IOBoxInputPin().masterPin.pinname],
e.parentPatch.removeInputPin(e.IOBoxInputPin().masterPin.pinname),e.IOBoxInputPin().masterPin.pinname=f);else{"development"==VVVV_ENV&&console.log("interfacing input pin detected: "+f);var c=e.parentPatch.inputPins[f];if(void 0==c)"development"==VVVV_ENV&&console.log("creating new input pin at parent patch, using IOBox values"),c=e.parentPatch.addInputPin(f,e.IOBoxInputPin().values);else{slicecount=c.getSliceCount();for(d=0;d<slicecount;d++)e.IOBoxInputPin().setValue(d,c.getValue(d));0<slicecount&&
e.IOBoxInputPin().setSliceCount(c.getSliceCount())}d=c.values.slice();c.setType(VVVV.PinTypes[e.IOBoxInputPin().typeName]);if(c.unvalidated&&VVVV.PinTypes[c.typeName].primitive||c.isConnected())c.values=d,c.unvalidated=!1;c.slavePin=e.IOBoxInputPin();e.IOBoxInputPin().masterPin=c}};this.IOBoxOutputPin().connectionChanged()}};this.setup=function(){this.addInvisiblePin("Descriptive Name",[""],VVVV.PinTypes.String)};this.initialize=function(){};this.evaluate=function(){_(this.outputPins).each(function(e){e.setValue(0,
"not calculated")})};this.destroy=function(){};this.serialize=function(){var e=$("<NODE>");e.attr("id",this.id);e.attr("nodename",this.nodename);e.attr("systemname",this.nodename);this.shaderFile&&e.attr("filename",this.shaderFile.replace(".vvvvjs.fx",".fx").replace("%VVVV%/effects","%VVVV%/lib/nodes/effects"));this.isSubpatch&&(e.attr("filename",this.nodename),e.attr("systemname",this.nodename.match("(.*).v4p$")[1]));this.isIOBox?e.attr("componentmode","InABox"):e.attr("componentmode","Hidden");
var f=$("<BOUNDS>");this.isIOBox?f.attr("type","Box"):f.attr("type","Node");f.attr("left",parseInt(15*this.x));f.attr("top",parseInt(15*this.y));f.attr("width",parseInt(this.width));f.attr("height",parseInt(this.height));e.append(f);var d=this;_(this.inputPins).each(function(c){var h=$("<PIN>");h.attr("pinname",c.pinname);h.attr("visible","1");(!c.isConnected()||c.masterPin)&&(VVVV.PinTypes[c.typeName].primitive&&d.defaultPinValues[c.pinname])&&h.attr("values",_(d.defaultPinValues[c.pinname]).map(function(c){return"|"+
c+"|"}).join(","));e.append(h)});_(this.invisiblePins).each(function(c){var d=$("<PIN>");d.attr("pinname",c.pinname);d.attr("visible","0");VVVV.PinTypes[c.typeName].primitive&&d.attr("values",_(c.values).map(function(c){return"|"+c+"|"}).join(","));e.append(d)});return e}},Link:function(a,b){this.fromPin=a;this.toPin=b;this.fromPin.links.push(this);this.toPin.links.push(this);this.destroy=function(){this.toPin.reset_on_disconnect?this.toPin.reset():this.toPin.node.defaultPinValues[this.toPin.pinname]=
this.toPin.values.slice(0);this.fromPin.links.splice(this.fromPin.links.indexOf(this),1);this.toPin.links.splice(this.toPin.links.indexOf(this),1);this.fromPin.node.parentPatch.linkList.splice(this.fromPin.node.parentPatch.linkList.indexOf(this),1)};this.serialize=function(){var g=$("<LONK>");g.attr("srcnodeid",this.fromPin.node.id);g.attr("srcpinname",this.fromPin.pinname);g.attr("dstnodeid",this.toPin.node.id);g.attr("dstpinname",this.toPin.pinname);return g}},Patch:function(a,b,g,e,f){function d(c){if(void 0==
c)return[];if("45_26">=this.vvvv_version)return separator=/\|/.test(c)?"|":",",c.split(separator).filter(function(c,d){return""!=c});for(var d=[],h="",f=!1,e=c.length,g=0;g<e;g++)","!=c[g]||f?"|"==c[g]?f=!f:h+=c[g]:(d.push(h),h="");d.push(h);return d}function c(){var c=window.location.hash.match("#([^/]+)/"+m.ressource+"$");c&&(console.log("launching editor ..."),(new VVVV.Editors[c[1]]).enable(m))}this.ressource=a;this.vvvv_version="45_26.1";this.boundingBox={width:0,height:0};this.windowHeight=
this.windowWidth=500;this.pinMap={};this.nodeMap={};this.nodeList=[];this.linkList=[];this.success=b;this.error=g;this.XMLCode="";this.editor=void 0;this.setupObject();e&&(this.parentPatch=e);f&&(this.id=f);var h=!1;this.getAbsolutePath=function(){var c=this.getRelativePath();this.parentPatch&&(c=this.parentPatch.getRelativePath()+c);return c};this.getRelativePath=function(){return this.nodename.match(/(.*\/)?[^/]+\.v4p/)[1]||""};this.destroy=function(){for(var c=0;c<this.nodeList.length;c++)this.nodeList[c].destroy(),
delete this.nodeMap[this.nodeList[c].id],delete this.nodeList[c]};if("45_26">=this.vvvv_version)var q={},n={},k={},r={};var m=this;this.doLoad=function(c,h){function f(c){"complete"==g&&(n={});$(c).find('link[deleteme="pronto"]').each(function(){for(var c=!1,d=0;d<m.linkList.length;d++)m.linkList[d].fromPin.node.id==$(this).attr("srcnodeid")&&(m.linkList[d].fromPin.pinname==$(this).attr("srcpinname")&&m.linkList[d].toPin.node.id==$(this).attr("dstnodeid")&&m.linkList[d].toPin.pinname==$(this).attr("dstpinname"))&&
(c=m.linkList[d]);if(c){"development"==VVVV_ENV&&console.log("removing "+c.fromPin.pinname+" -> "+c.toPin.pinname);var d=c.fromPin,h=c.toPin;c.destroy();d.connectionChanged();h.connectionChanged();h.markPinAsChanged()}});$(c).find('link[deleteme!="pronto"]').each(function(){var c=m.pinMap[$(this).attr("srcnodeid")+"_out_"+$(this).attr("srcpinname")],d=m.pinMap[$(this).attr("dstnodeid")+"_in_"+$(this).attr("dstpinname")];void 0==c&&m.nodeMap[$(this).attr("srcnodeid")]&&(c=m.nodeMap[$(this).attr("srcnodeid")].addOutputPin($(this).attr("srcpinname"),
void 0));void 0==d&&m.nodeMap[$(this).attr("dstnodeid")]&&(d=m.nodeMap[$(this).attr("dstnodeid")].addInputPin($(this).attr("dstpinname"),void 0));if(c&&d){for(var h=!1,f=0;f<m.linkList.length;f++)m.linkList[f].fromPin.node.id==c.node.id&&(m.linkList[f].fromPin.pinname==c.pinname&&m.linkList[f].toPin.node.id==d.node.id&&m.linkList[f].toPin.pinname==d.pinname)&&(h=m.linkList[f]);if(!h){h=new VVVV.Core.Link(c,d);c.connectionChanged();d.connectionChanged();m.linkList.push(h);for(f=0;f<c.values.length;f++)d.setValue(f,
c.getValue(f));d.setSliceCount(c.getSliceCount())}"complete"==g&&(n[c.node.id+"_"+c.pinname+"-"+d.node.id+"_"+d.pinname]=h)}});"complete"==g&&(_(q).each(function(c,d){if(void 0==n[d]){"development"==VVVV_ENV&&console.log("removing "+c.fromPin.pinname+" -> "+c.toPin.pinname);var h=c.fromPin,f=c.toPin;c.destroy();h.connectionChanged();f.connectionChanged();f.markPinAsChanged();f.reset_on_disconnect&&f.reset()}}),q={},_(n).each(function(c,d){q[d]=c}))}var e=this;do e.dirty=!0;while(e=e.parentPatch);
if(e=/^<!DOCTYPE\s+PATCH\s+SYSTEM\s+"(.+)\\(.+)\.dtd/.exec(c))m.vvvv_version=e[2].replace(/[a-zA-Z]+/,"_");var g="diff";if(/\s<PATCH/.test(c)||"45_26">=m.vvvv_version)g="complete","development"==VVVV_ENV&&console.log("complete: "+this.nodename),m.XMLCode=c;e=$(c).find('bounds[type="Window"]').first();0<e.length&&(m.windowWidth=e.attr("width")/15,m.windowHeight=e.attr("height")/15);"complete"==g&&(r={});$(c).find("node").each(function(){if("pronto"==$(this).attr("createme")&&void 0!=m.nodeMap[$(this).attr("id")]){var e=
m.nodeMap[$(this).attr("id")];"development"==VVVV_ENV&&console.log("node renamed, so deleting node "+e.id+" / "+e.nodename);_(e.inputPins).each(function(c){_(c.links).each(function(c){c.destroy();c.fromPin.connectionChanged()})});_(e.outputPins).each(function(c){_(c.links).each(function(c){c.destroy();c.toPin.connectionChanged();c.toPin.markPinAsChanged()})});m.nodeList.splice(m.nodeList.indexOf(e),1);delete m.nodeMap[e.id]}var q;q="InABox"==$(this).attr("componentmode")?$(this).find('bounds[type="Box"]').first():
$(this).find('bounds[type="Node"]').first();var a=void 0!=m.nodeMap[$(this).attr("id")];if(a)e=m.nodeMap[$(this).attr("id")];else{var k=""!=$(this).attr("systemname")?$(this).attr("systemname"):$(this).attr("nodename");if(void 0==k)return;if(void 0!=VVVV.NodeLibrary[k.toLowerCase()])e=new (VVVV.NodeLibrary[k.toLowerCase()])($(this).attr("id"),m),VVVV.NodeLibrary[k.toLowerCase()].requirements&&(m.resourcesPending++,_(VVVV.NodeLibrary[k.toLowerCase()].requirements).each(function(c){void 0===VVVV.LoadedLibs[c]&&
VVVV.loadScript(VVVV.ThirdPartyLibs[c],function(){m.resourcesPending--})}));else if(/.fx$/.test($(this).attr("filename")))e=new VVVV.Nodes.GenericShader($(this).attr("id"),m),e.isShader=!0,e.shaderFile=$(this).attr("filename").replace(/\\/g,"/").replace(/\.fx$/,".vvvvjs.fx").replace("lib/nodes/",""),e.nodename=k;else if(/.v4p$/.test($(this).attr("filename"))){m.resourcesPending++;var n=this,e=new VVVV.Core.Patch($(this).attr("filename"),function(){m.resourcesPending--;"development"==VVVV_ENV&&console.log(this.nodename+
"invoking update links");f(c);m.editor&&m.editor.addPatch(this);if(this.auto_evaluate){var d=m;do d.auto_evaluate=!0;while(d=d.parentPatch)}this.setMainloop(m.mainloop);m.afterUpdate();0>=m.resourcesPending&&h&&(h(),h=void 0)},function(){m.resourcesPending--;this.not_implemented=!0;VVVV.onNotImplemented(k);f(c);m.afterUpdate();0>=m.resourcesPending&&h&&(h(),h=void 0)},m,$(n).attr("id"));e.isSubpatch=!0;m.editor&&!e.editor&&m.editor.addPatch(e);m.nodeMap[e.id]=e}else e=new VVVV.Core.Node($(this).attr("id"),
k,m),e.not_implemented=!0,"diff"==g&&!0==VVVV.Config.auto_undo&&m.editor.sendUndo(),VVVV.onNotImplemented(k);"development"==VVVV_ENV&&"complete"!=g&&console.log(m.nodename+": inserted new node "+e.nodename)}if(e.auto_evaluate){n=m;do n.auto_evaluate=!0;while(n=n.parentPatch)}if("pronto"==$(this).attr("deleteme")){"development"==VVVV_ENV&&console.log("removing node "+e.id);if(e.isSubpatch){e.editor&&e.editor.removePatch(e);n=e.getSubPatches();n.push(e);for(var b,p=0;p<n.length;p++)b=VVVV.Helpers.prepareFilePath(n[p].nodename,
n[p].parentPatch),VVVV.Patches[b].splice(VVVV.Patches[b].indexOf(e),1),0==VVVV.Patches[b].length&&delete VVVV.Patches[b]}m.nodeList.splice(m.nodeList.indexOf(e),1);e.destroy();delete m.nodeMap[e.id]}0<q.length&&(q.attr("left")&&(e.x=q.attr("left")/15,e.y=q.attr("top")/15,m.boundingBox.width=Math.max(m.boundingBox.width,e.x+100),m.boundingBox.height=Math.max(m.boundingBox.height,e.y+100)),q.attr("width")&&(e.width=q.attr("width"),e.height=q.attr("height")));/^iobox/.test(e.nodename.toLowerCase())&&
(e.isIOBox=!0);a||e.setup();n=this;$(this).find("pin").each(function(){var h=$(this).attr("pinname"),f=d($(this).attr("values"));void 0!=f&&0<f.length&&e.addDefault(h,f);if(void 0==e.outputPins[h])if(void 0!=e.inputPins[h])e.inputPins[h].isConnected()||e.applyPinValuesFromXML(h);else if(void 0!=e.invisiblePins[h]){if(void 0!=f){for(var g=0;g<f.length;g++)e.invisiblePins[h].values[g]!=f[g]&&e.invisiblePins[h].setValue(g,f[g]);e.invisiblePins[h].setSliceCount(f.length)}}else 1==$(this).attr("visible")&&
"Configuration"!=$(this).attr("pintype")||e.isSubpatch?"Output"==$(this).attr("pintype")||0<$(c).find("link[srcnodeid="+e.id+"]").filter("link[srcpinname='"+h.replace(/[\[\]]/,"")+"']").length?void 0==e.outputPins[h]&&e.addOutputPin(h,f):void 0==e.inputPins[h]&&void 0==e.invisiblePins[h]&&e.addInputPin(h,f):void 0==e.inputPins[h]&&void 0==e.invisiblePins[h]&&e.addInvisiblePin(h,f)});a||(e.initialize(),m.nodeList.push(e));"complete"==g&&(r[e.id]=e)});"complete"==g&&(_(k).each(function(c,d){void 0==
r[d]&&("development"==VVVV_ENV&&console.log("removing node "+c.id),m.nodeList.splice(m.nodeList.indexOf(c),1),delete m.nodeMap[c.id])}),k={},_(r).each(function(c,d){k[d]=c}));0===this.resourcesPending&&f(c);0>=this.resourcesPending&&h&&(h(),h=void 0)};this.getSubPatches=function(){for(var c=[],d=0;d<this.nodeList.length;d++)this.nodeList[d].isSubpatch&&(c.push(this.nodeList[d]),c=c.concat(this.nodeList[d].getSubPatches()));return c};this.setMainloop=function(c){this.mainloop=c;for(var d=0;d<this.nodeList.length;d++)this.nodeList[d].isSubpatch&&
this.nodeList[d].setMainloop(c)};this.afterEvaluate=function(){};this.afterUpdate=function(){};this.toXML=function(){var c=$("<PATCH>"),d=$("<BOUNDS>");d.attr("type","Window");d.attr("width",parseInt(15*this.windowWidth));d.attr("height",parseInt(15*this.windowHeight));c.append(d);for(d=0;d<this.nodeList.length;d++)c.append(this.nodeList[d].serialize());for(d=0;d<this.linkList.length;d++)c.append(this.linkList[d].serialize());c='<!DOCTYPE PATCH SYSTEM "http://vvvv.org/versions/vvvv45beta28.1.dtd" >\r\n '+
c.wrapAll("<d></d>").parent().html();c=c.replace(/<patch/g,"<PATCH");c=c.replace(/<\/patch>/g,"\n </PATCH>");c=c.replace(/<node/g,"\n <NODE");c=c.replace(/<\/node>/g,"\n </NODE>");c=c.replace(/<bounds/g,"\n <BOUNDS");c=c.replace(/<\/bounds>/g,"\n </BOUNDS>");c=c.replace(/<pin/g,"\n <PIN");c=c.replace(/<\/pin>/g,"\n </PIN>");c=c.replace(/<lonk/g,"\n <LINK");return c=c.replace(/<\/lonk>/g,"\n </LINK>")};this.evaluate=function(){function c(d){var e=d.getUpstreamNodes();_(e).each(function(d){void 0==
f[d.id]||d.delays_output||c(d)});if(d.dirty||d.auto_evaluate||d.isSubpatch){if(h)var g=(new Date).getTime();if(d.auto_nil&&!d.isSubpatch&&d.hasNilInputs())_(d.outputPins).each(function(c){c.setSliceCount(0)});else{try{d.evaluate()}catch(q){console.log("VVVV.Js / Error evaluating "+d.nodename+": "+q.message)}h&&console.log(d.nodename+" / "+d.id+": "+((new Date).getTime()-g)+"ms");d.dirty=!1;_(d.inputPins).each(function(c){c.changed=!1})}}delete f[d.id];return!0}if(!(0<this.resourcesPending)){if(h)var d=
(new Date).getTime();for(var f={},e={},g=0;g<this.nodeList.length;g++){if(0==this.nodeList[g].getDownstreamNodes().length||this.nodeList[g].auto_evaluate||this.nodeList[g].delays_output)e[this.nodeList[g].id]=this.nodeList[g];f[this.nodeList[g].id]=this.nodeList[g]}h&&console.log("building node maps: "+((new Date).getTime()-d)+"ms");_(e).each(function(d,h,e){void 0!=f[d.id]&&c(d)});h&&(d=(new Date).getTime());this.afterEvaluate();h&&console.log("patch rendering: "+((new Date).getTime()-d)+"ms");h=
!1}};$(window).keydown(function(c){84==c.which&&(c.altKey&&c.ctrlKey)&&(h=!0)});if(/\.v4p[^<>\s]*$/.test(a)){this.nodename=a;var p=this,s=a;this.parentPatch&&(s=VVVV.Helpers.prepareFilePath(a,this.parentPatch));VVVV.Patches[s]?p.doLoad(VVVV.Patches[s][0].toXML(),function(){VVVV.Patches[s].push(p);p.success&&p.success();p.afterUpdate()}):$.ajax({url:s,type:"get",dataType:"text",success:function(c){p.doLoad(c,function(){VVVV.Patches[s]=VVVV.Patches[s]||[];VVVV.Patches[s].push(p);p.success&&p.success();
p.afterUpdate()})},error:function(){p.error&&p.error()}})}else/^ws:\/\//.test(a)?(p=this,VVVV.Editors.Connector.host=a,VVVV.Editors.Connector.enable(this,{success:function(){p.success&&p.success()},error:function(){p.error&&p.error()}})):this.doLoad(a,function(){this.success&&this.success()});c();$(window).bind("hashchange",function(){c()})}};VVVV.Core.Patch.prototype=new VVVV.Core.Node;VVVV.Core.DOMInterface=function(a){function b(d){if("event"==d.property_class){var c=d.selector;"window"==c&&(c=window);"document"==c&&(c=document);$(c).each(function(c){d.values[c]=0;$(this).bind(d.property,function(){d.values[c]=1;return!1})})}}var g={},e={};a.domInterface=this;this.connect=function(d){_(g).each(function(c,h){c.node.id==d.id&&("event"==c.property_class&&$(c.selector).unbind(c.property),delete g[h])});_(e).each(function(c,h){c.node.id==d.id&&delete e[h]});var c=/([^\/]+)(\/(event|attribute|style)\/(.+))?/.exec(d.invisiblePins["Descriptive Name"].getValue(0));
if(null!=c){var h={selector:c[1],property_class:c[3],property:c[4],values:[],node:d};0!=$(h.selector).length&&(0==d.getUpstreamNodes().length?g[c[0]]=h:0==d.getDownstreamNodes().length&&(e[c[0]]=h),b(h))}};var f=this;_(a.nodeList).each(function(d){d.isIOBox&&void 0!=d.invisiblePins["Descriptive Name"]&&(f.connect(d),d.IOBoxInputPin().connectionChanged=function(){f.connect(d)})});this.populateInputConnectors=function(){var d=this;_(g).each(function(c){switch(c.property_class){case "event":c.values.length!=
c.node.IOBoxInputPin().values.length&&c.node.IOBoxInputPin().setSliceCount(c.values.length);for(var h=0;h<c.values.length;h++)void 0!=c.node.IOBoxInputPin().values[h]&&c.values[h]==c.node.IOBoxInputPin().values[h]||c.node.IOBoxInputPin().setValue(h,c.values[h]);break;default:for(d.fetchValuesFromDOM(c),c.values.length!=c.node.IOBoxInputPin().values.length&&c.node.IOBoxInputPin().setSliceCount(c.values.length),h=0;h<c.values.length;h++)c.node.IOBoxInputPin().getValue(h)!=c.values[h]&&c.node.IOBoxInputPin().setValue(h,
c.values[h])}})};this.processOutputConnectors=function(){var d=this;_(e).each(function(c){switch(c.property_class){default:d.setDOMByIOBox(c)}});_(g).each(function(c){if("event"==c.property_class)for(var d=0;d<c.values.length;d++)c.values[d]=0})};this.fetchValuesFromDOM=function(d){d.values.length=0;$(d.selector).each(function(c){var h;if(void 0==d.property_class)switch(this.nodeName){case "INPUT":"text"==$(this).attr("type")&&(h=$(this).val());"checkbox"==$(this).attr("type")&&(h=$(this).attr("checked")?
1:0);break;default:h=$(this).text()}"attribute"==d.property_class&&(h=$(this).attr(d.property));"style"==d.property_class&&(h=$(this).css(d.property));d.values[c]=h})};this.setDOMByIOBox=function(d){if(d.node.IOBoxOutputPin().pinIsChanged()){var c=d.node.IOBoxInputPin().values,h=$(d.selector).length;void 0==d.property_class&&($(d.selector).empty(),$(d.selector).val(""));for(var f=0;f<Math.max(c.length,h);f++){var e=f%h,g=f%c.length,a=$(d.selector).eq(e);if(0!=a.length){if(void 0==d.property_class)switch(a[0].nodeName){case "INPUT":a.val($(d.selector).eq(e).val()+
c[g]);break;default:a.html($(d.selector).eq(e).html()+c[g])}"attribute"==d.property_class&&a.attr(d.property,c[g]);"style"==d.property_class&&a.css(d.property,c[g])}}}}};VVVV.fps=60;
VVVV.Core.MainLoop=function(a,b){function g(){if(0==a.resourcesPending){e++;var k=(new Date).getTime();c&&(n.deltaT=k-c);c=k;f.populateInputConnectors();a.evaluate();f.processOutputConnectors();k=(new Date).getTime()-c;0==e%10&&(q&&(console.log(1/((c-h)/1E4)+"fps"),q=!1),h=c)}d&&window.setTimeout(g,Math.max(0,Math.round(1E3/VVVV.fps-k)))}VVVV.fps=b||60;var e=0,f=new VVVV.Core.DOMInterface(a),d=!0,c=void 0,h=0,q=!1;this.deltaT=1E3/VVVV.fps;a.setMainloop(this);var n=this;this.stop=function(){d=!1};
this.start=function(){d||(d=!0,g())};this.isRunning=function(){return d};g();$(window).keydown(function(c){(102==c.which||70==c.which)&&(c.altKey&&c.ctrlKey)&&(q=!0)})};VVVV.Nodes.Cross2d=function(a,b){this.constructor(a,"Cross (2d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X In",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y In",[0],VVVV.PinTypes.Value),f=this.addInputPin("Include Upper",[1],VVVV.PinTypes.Value),d=this.addInputPin("Include Lower",[1],VVVV.PinTypes.Value),c=this.addInputPin("Include Equal",[1],VVVV.PinTypes.Value),h=this.addOutputPin("X Out",
[0],VVVV.PinTypes.Value),q=this.addOutputPin("Y Out",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=0,k=0;k<e.getSliceCount();k++)for(var b=0;b<g.getSliceCount();b++)0.5>f.getValue(0)&&k>b||(0.5>d.getValue(0)&&k<b||0.5>c.getValue(0)&&k==b)||(h.setValue(a,g.getValue(b)),q.setValue(a,e.getValue(k)),a++);h.setSliceCount(a);q.setSliceCount(a)}};VVVV.Nodes.Cross2d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Polar2d=function(a,b){this.constructor(a,"Polar (2d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X",[1],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Angle",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Length",[1],VVVV.PinTypes.Value);this.initialize=function(){};this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),h=0;h<
c;h++){var q=g.getValue(h),a=e.getValue(h);f.setValue(h,Math.atan2(a,q)/(2*Math.PI));d.setValue(h,Math.sqrt(q*q+a*a))}f.setSliceCount(c);d.setSliceCount(c)}};VVVV.Nodes.Polar2d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Cartesian2d=function(a,b){this.constructor(a,"Cartesian (2d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Angle",[0],VVVV.PinTypes.Value),e=this.addInputPin("Length",[1],VVVV.PinTypes.Value),f=this.addOutputPin("X",[1],VVVV.PinTypes.Value),d=this.addOutputPin("Y",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),h=0;h<c;h++){var q=g.getValue(h),
a=e.getValue(h);f.setValue(h,a*Math.cos(2*q*Math.PI));d.setValue(h,a*Math.sin(2*q*Math.PI))}f.setSliceCount(c);d.setSliceCount(c)}};VVVV.Nodes.Cartesian2d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Points2Vector2d=function(a,b){this.constructor(a,"Points2Vector (2d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X1",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y1",[0],VVVV.PinTypes.Value),f=this.addInputPin("X2",[1],VVVV.PinTypes.Value),d=this.addInputPin("Y2",[0],VVVV.PinTypes.Value),c=this.addOutputPin("X",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),
q=this.addOutputPin("Length",[1],VVVV.PinTypes.Value),n=this.addOutputPin("Angle",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var m=parseFloat(g.getValue(b)),p=parseFloat(e.getValue(b)),s=parseFloat(f.getValue(b)),u=parseFloat(d.getValue(b)),s=s-m,u=u-p;c.setValue(b,m+s/2);h.setValue(b,p+u/2);q.setValue(b,Math.sqrt(s*s+u*u));n.setValue(b,Math.atan2(u,s)/(2*Math.PI))}c.setSliceCount(a);h.setSliceCount(a);q.setSliceCount(a);n.setSliceCount(a)}};
VVVV.Nodes.Points2Vector2d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Vector2Points2d=function(a,b){this.constructor(a,"Vector2Points (2d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addInputPin("Length",[1],VVVV.PinTypes.Value),d=this.addInputPin("Angle",[0],VVVV.PinTypes.Value),c=this.addOutputPin("X1",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Y1",[0],VVVV.PinTypes.Value),
q=this.addOutputPin("X2",[0],VVVV.PinTypes.Value),n=this.addOutputPin("Y2",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var m=parseFloat(g.getValue(b)),p=parseFloat(e.getValue(b)),s=parseFloat(f.getValue(b)),u=2*parseFloat(d.getValue(b)-0.25)*Math.PI,v=s/2*Math.sin(u),s=-s/2*Math.cos(u);c.setValue(b,m+v);h.setValue(b,p+s);q.setValue(b,m-v);n.setValue(b,p-s)}c.setSliceCount(a);h.setSliceCount(a);q.setSliceCount(a);n.setSliceCount(a)}};
VVVV.Nodes.Vector2Points2d.prototype=new VVVV.Core.Node;VVVV.Nodes.Polar3d=function(a,b){this.constructor(a,"Polar (3d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addInputPin("Z",[-1],VVVV.PinTypes.Value),d=this.addOutputPin("Pitch",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Yaw",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Length",[1],VVVV.PinTypes.Value);
this.evaluate=function(){for(var q=this.getMaxInputSliceCount(),a=0;a<q;a++){var b=g.getValue(a),r=e.getValue(a),m=f.getValue(a),p=Math.sqrt(b*b+r*r+m*m);c.setValue(a,Math.atan2(-b,-m)/(2*Math.PI));d.setValue(a,0==p?0:Math.acos(-r/p)/(2*Math.PI)-0.25);h.setValue(a,p)}c.setSliceCount(q);d.setSliceCount(q);h.setSliceCount(q)}};VVVV.Nodes.Polar3d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Cartesian3d=function(a,b){this.constructor(a,"Cartesian (3d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Pitch",[0],VVVV.PinTypes.Value),e=this.addInputPin("Yaw",[0],VVVV.PinTypes.Value),f=this.addInputPin("Length",[1],VVVV.PinTypes.Value),d=this.addOutputPin("X",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Z",[1],VVVV.PinTypes.Value);
this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var k=2*(g.getValue(b)+0.25)*Math.PI,r=2*e.getValue(b)*Math.PI,m=f.getValue(b);h.setValue(b,-m*Math.cos(r)*Math.sin(k));d.setValue(b,-m*Math.sin(r)*Math.sin(k));c.setValue(b,-m*Math.cos(k))}d.setSliceCount(a);c.setSliceCount(a);h.setSliceCount(a)}};VVVV.Nodes.Cartesian3d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Normalize3d=function(a,b){this.constructor(a,"Normalize (3d)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("X",[1],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addInputPin("Z",[0],VVVV.PinTypes.Value),d=this.addOutputPin("NormalizedX",[1],VVVV.PinTypes.Value),c=this.addOutputPin("NormalizedY",[0],VVVV.PinTypes.Value),h=this.addOutputPin("NormalizedZ",
[0],VVVV.PinTypes.Value),q=this.addOutputPin("Input Length",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var r=g.getValue(b),m=e.getValue(b),p=f.getValue(b),s=Math.sqrt(r*r+m*m+p*p);d.setValue(b,0==s?0:r/s);c.setValue(b,0==s?0:m/s);h.setValue(b,0==s?0:p/s);q.setValue(b,s)}d.setSliceCount(a);c.setSliceCount(a);h.setSliceCount(a);q.setSliceCount(a)}};VVVV.Nodes.Normalize3d.prototype=new VVVV.Core.Node;
VVVV.Nodes.Normalize3dVector=function(a,b){this.constructor(a,"Normalize (3d Vector)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("XYZ",[],VVVV.PinTypes.Value),e=this.addOutputPin("NormalizedXYZ",[],VVVV.PinTypes.Value),f=this.addOutputPin("Input Length",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d/3;c++){var h=g.getValue(c,3),a=Math.sqrt(h[0]*
h[0]+h[1]*h[1]+h[2]*h[2]);e.setValue(3*c,0==a?0:h[0]/a);e.setValue(3*c+1,0==a?0:h[1]/a);e.setValue(3*c+2,0==a?0:h[2]/a);f.setValue(c,a)}e.setSliceCount(3*Math.ceil(d/3));f.setSliceCount(Math.ceil(d/3))}};VVVV.Nodes.Normalize3dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Multiply3dCross=function(a,b){this.constructor(a,"Multiply (3d Cross)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input1 XYZ",[],VVVV.PinTypes.Value),e=this.addInputPin("Input2 XYZ",[],VVVV.PinTypes.Value),f=this.addOutputPin("Output XYZ",[],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d/3;c++){var h=g.getValue(c,3),a=e.getValue(c,
3);f.setValue(3*c+0,h[1]*a[2]-h[2]*a[1]);f.setValue(3*c+1,-(h[0]*a[2]-h[2]*a[0]));f.setValue(3*c+2,h[0]*a[1]-h[1]*a[0])}f.setSliceCount(3*Math.ceil(d/3))}};VVVV.Nodes.Multiply3dCross.prototype=new VVVV.Core.Node;
VVVV.Nodes.Multiply3dDot=function(a,b){this.constructor(a,"Multiply (3d Dot)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input1 XYZ",[],VVVV.PinTypes.Value),e=this.addInputPin("Input2 XYZ",[],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d/3;c++){var h=g.getValue(c,3),a=e.getValue(c,3);f.setValue(c,
h[0]*a[0]+h[1]*a[1]+h[2]*a[2])}f.setSliceCount(Math.ceil(d/3))}};VVVV.Nodes.Multiply3dDot.prototype=new VVVV.Core.Node;
VVVV.Nodes.Multiply3dVector=function(a,b){this.constructor(a,"Multiply (3d Vector)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),e=this.addInputPin("XYZ UnTransformed",[0,0,0],VVVV.PinTypes.Value),f=this.addOutputPin("XYZ Transformed",[0,0,0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=Math.max(g.getSliceCount(),e.getSliceCount()/3),c=0;c<
d;c++){var h=e.getValue(3*c,3),a=g.getValue(c);mat4.multiplyVec3(a,h);f.setValue(3*c+0,h[0]);f.setValue(3*c+1,h[1]);f.setValue(3*c+2,h[2])}f.setSliceCount(Math.ceil(3*d))}};VVVV.Nodes.Multiply3dVector.prototype=new VVVV.Core.Node;VVVV.Nodes.LFO=function(a,b){this.constructor(a,"LFO (Animation)",b);this.meta={authors:["Matthias Zauner, sebl"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Not spreadable yet"]};this.auto_evaluate=!0;var g=this.addInputPin("Period",[1],VVVV.PinTypes.Value),e=this.addInputPin("Pause",[0],VVVV.PinTypes.Value),f=this.addInputPin("Reverse",[0],VVVV.PinTypes.Value),d=this.addInputPin("Reset",[0],VVVV.PinTypes.Value),c=this.addInputPin("Phase",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Output",
[0],VVVV.PinTypes.Value),q=this.addOutputPin("Cycles",[0],VVVV.PinTypes.Value),n=[],k=[],r=(new Date).getTime(),m=(new Date).getTime();this.evaluate=function(){var a=this.getMaxInputSliceCount();r=(new Date).getTime()-m;for(var b=0;b<a;b++){var u=g.getValue(b%g.values.length),v=e.getValue(b%e.values.length),t=f.getValue(b%f.values.length),w=d.getValue(b%d.values.length),l=c.getValue(b%c.values.length);void 0==n[b]&&(n[b]=0);void 0==k[b]&&(k[b]=0);0.5>v&&(0!=u&&isFinite(u))&&(dv=1/(1E3*u)*r,0<t&&(dv*=
-1),n[b]+=dv,0>n[b]&&(k[b]-=Math.ceil(-n[b]),n[b]=1+n[b]),1<n[b]&&(k[b]+=Math.floor(n[b])));m=(new Date).getTime();0.5<=w&&(n[b]=0,k[b]=0);if(0.5>v||0.5<=w)h.setValue(b,(n[b]+l)%1),q.setValue(b,k[b]);n[b]%=1}h.setSliceCount(a);q.setSliceCount(a);n.splice(a);k.splice(a)}};VVVV.Nodes.LFO.prototype=new VVVV.Core.Node;
VVVV.Nodes.LinearFilter=function(a,b){this.constructor(a,"LinearFilter (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Cyclic Pin not implemented","Acceleration Out is not set yet"]};this.auto_evaluate=!0;var g=this.addInputPin("Go To Position",[0],VVVV.PinTypes.Value),e=this.addInputPin("FilterTime",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Position Out",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Velocity Out",[0],VVVV.PinTypes.Value);
this.addOutputPin("Acceleration Out",[0],VVVV.PinTypes.Value);var c=[],h=[],q=[],n=[],k=[],r=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=g.pinIsChanged()||e.pinIsChanged(),s=0;s<a;s++){void 0==c[s]&&(c[s]=(new Date).getTime());var u=this.parentPatch.mainloop.deltaT,v=parseFloat(g.getValue(s)),t=parseFloat(e.getValue(s));void 0==n[s]&&(n[s]=v);if(v!=h[s]||t!=q[s])r[s]=void 0,h[s]=v,q[s]=t,k[s]=0<q[s]?(h[s]-n[s])/(1E3*q[s]):0;Math.abs(k[s]*u)>Math.abs(h[s]-n[s])?n[s]=h[s]:n[s]+=
k[s]*u;0!=r[s]&&(f.setValue(s,n[s]),d.setValue(s,k[s]));r[s]=h[s]-n[s];c[s]=(new Date).getTime()}b&&f.getSliceCount()!=a&&(h.splice(a),q.splice(a),c.splice(a),n.splice(a),k.splice(a),r.splice(a),f.setSliceCount(a))}};VVVV.Nodes.LinearFilter.prototype=new VVVV.Core.Node;
VVVV.Nodes.Damper=function(a,b){this.constructor(a,"Damper (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Cyclic Pin not implemented","Acceleration Out is not set yet"]};this.auto_evaluate=!0;var g=this.addInputPin("Go To Position",[0],VVVV.PinTypes.Value),e=this.addInputPin("FilterTime",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Position Out",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Velocity Out",[0],VVVV.PinTypes.Value);
this.addOutputPin("Acceleration Out",[0],VVVV.PinTypes.Value);var c=[],h=[],q=[],n=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=g.pinIsChanged()||e.pinIsChanged(),m=0;m<a;m++){void 0==c[m]&&(c[m]=(new Date).getTime());var p=this.parentPatch.mainloop.deltaT,s=parseFloat(g.getValue(m)),u=parseFloat(e.getValue(m));void 0==h[m]&&(h[m]=s);void 0==n[m]&&(n[m]=s-h[m]);q[m]=0<u?(s-h[m])/(1E3*u):0;Math.abs(q[m]*p)>Math.abs(s-h[m])?h[m]=s:h[m]+=q[m]*p;0!=n[m]&&(f.setValue(m,h[m]),d.setValue(m,
q[m]));n[m]=s-h[m];c[m]=(new Date).getTime()}b&&f.getSliceCount()!=a&&(c.splice(a),h.splice(a),q.splice(a),n.splice(a),f.setSliceCount(a))}};VVVV.Nodes.Damper.prototype=new VVVV.Core.Node;
VVVV.Nodes.Delay=function(a,b){this.constructor(a,"Delay (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Reset not implemented","Linear Mode not implemented"]};this.auto_evaluate=!0;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Time",[1],VVVV.PinTypes.Value),f=this.addInputPin("Insert",[1],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),c=[],h=Array(1024);this.evaluate=
function(){var a=this.getMaxInputSliceCount();now=(new Date).getTime();var b=g.pinIsChanged();if(void 0==g.getValue(0))b&&d.setValue(0,void 0);else{if(1==f.getValue(0)&&(b||e.pinIsChanged()))for(h.pop(),h.unshift(now),b=0;b<a;b++){if(void 0==c[b]){c[b]=Array(1024);for(var k=1024;k--;)c[b][k]=0}1024<=c[b].length&&c[b].pop();c[b].unshift(g.getValue(b))}for(b=0;b<a;b++){for(var r=now-1E3*e.getValue(b),m=!1,k=0;1024>k;k++)if(h[k]<=r){d.values[b]!=c[b][k]&&d.setValue(b,c[b][k]);m=!0;break}m||0==d.values[b]||
d.setValue(b,0)}d.setSliceCount(a);c.splice(a)}}};VVVV.Nodes.Delay.prototype=new VVVV.Core.Node;
VVVV.Nodes.Change=function(a,b){this.constructor(a,"Change (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addOutputPin("OnChange",[0],VVVV.PinTypes.Value),f=[];this.evaluate=function(){var d=this.getMaxInputSliceCount();if(g.pinIsChanged()){for(var c=0;c<d;c++)f[c]!=g.getValue(c)?e.setValue(c,1):1==e.getValue(c)&&e.setValue(c,0),f[c]=g.getValue(c);
e.setSliceCount(d)}else{for(c=0;c<d;c++)1==e.getValue(c)&&(e.setValue(c,0),e.setSliceCount(d));f[c]=g.getValue(c)}}};VVVV.Nodes.Change.prototype=new VVVV.Core.Node;
VVVV.Nodes.TogEdge=function(a,b){this.constructor(a,"TogEdge (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Up Edge",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Down Edge",[0],VVVV.PinTypes.Value),d=[];this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),h=0;h<c;h++)(0>=Math.round(d[h])||void 0==d[h])&&1<=Math.round(g.getValue(h))?
e.setValue(h,1):0!=e.values[h]&&e.setValue(h,0),1<=Math.round(d[h])&&0>=Math.round(g.getValue(h))?f.setValue(h,1):0!=f.values[h]&&f.setValue(h,0),d[h]=g.getValue(h);e.setSliceCount(c);f.setSliceCount(c)}};VVVV.Nodes.TogEdge.prototype=new VVVV.Core.Node;
VVVV.Nodes.FlipFlop=function(a,b){this.constructor(a,"FlipFlop (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Set",[0],VVVV.PinTypes.Value),e=this.addInputPin("Reset",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Inverse Output",[1],VVVV.PinTypes.Value),c=!1;this.evaluate=function(){var h=this.getMaxInputSliceCount(),a=f.getSliceCount();if(h>a)for(;a<
h;a++)f.setValue(a,0),d.setValue(a,1);for(a=0;a<h;a++){var b=void 0;1<=Math.round(e.getValue(a))&&(b=0);1<=Math.round(g.getValue(a))&&(b=1);void 0!=b?(f.setValue(a,b),d.setValue(a,1-b)):c||(f.setValue(a,0),d.setValue(a,1))}f.setSliceCount(h);d.setSliceCount(h);c=!0}};VVVV.Nodes.FlipFlop.prototype=new VVVV.Core.Node;
VVVV.Nodes.SampleAndHold=function(a,b){this.constructor(a,"S+H (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["different output slice count in pure VVVV, if Set pin has only one slice"]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Set",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){var d=this.getMaxInputSliceCount();if(e.pinIsChanged()||
g.pinIsChanged()){for(var c=0;c<d;c++)void 0==f.values[c]&&f.setValue(c,0),1<=Math.round(e.getValue(c))&&f.setValue(c,g.getValue(c));f.setSliceCount(d)}}};VVVV.Nodes.SampleAndHold.prototype=new VVVV.Core.Node;
VVVV.Nodes.FrameDelay=function(a,b){this.constructor(a,"FrameDelay (Animation)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["no dynamice pin count"]};this.delays_output=!0;var g=this.addInputPin("Input 1",[0],VVVV.PinTypes.Value),e=this.addInputPin("Default 1",[0],VVVV.PinTypes.Value),f=this.addInputPin("Initialize",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Output 1",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),
h=0;h<c;h++)0.5<f.getValue(h)?d.setValue(h,e.getValue(h)):d.setValue(h,g.getValue(h));d.setSliceCount(c)}};VVVV.Nodes.FrameDelay.prototype=new VVVV.Core.Node;
VVVV.Nodes.Toggle=function(a,b){this.constructor(a,"Toggle (Animation)",b);this.meta={authors:["David M\u00f3r\u00e1sz (micro.D)"],original_authors:["VVVV Group"],credits:["Matthias Zauner"],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Reset",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Inverse Output",[1],VVVV.PinTypes.Value),c=!1;this.evaluate=function(){var h=this.getMaxInputSliceCount(),
a=f.getSliceCount();if(h>a)for(;a<h;a++)f.setValue(a,0),d.setValue(a,1);for(a=0;a<h;a++){var b=void 0;1<=Math.round(e.getValue(a))&&(b=0);1<=Math.round(g.getValue(a))&&(b=1-parseFloat(f.getValue(a)));void 0!=b&&f.getValue(a)!=b?(f.setValue(a,b),d.setValue(a,1-b)):c||(f.setValue(a,0),d.setValue(a,1))}f.setSliceCount(h);d.setSliceCount(h);c=!0}};VVVV.Nodes.Toggle.prototype=new VVVV.Core.Node;
VVVV.Nodes.Counter=function(a,b){this.constructor(a,"Counter (Animation)",b);this.meta={authors:["David M\u00f3r\u00e1sz (micro.D)","Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Up",[0],VVVV.PinTypes.Value),e=this.addInputPin("Down",[0],VVVV.PinTypes.Value),f=this.addInputPin("Minimum",[0],VVVV.PinTypes.Value),d=this.addInputPin("Maximum",[15],VVVV.PinTypes.Value),c=this.addInputPin("Increment",[1],VVVV.PinTypes.Value),
h=this.addInputPin("Default",[0],VVVV.PinTypes.Value),q=this.addInputPin("Reset",[0],VVVV.PinTypes.Value),n=this.addInputPin("Mode",["Wrap"],VVVV.PinTypes.Enum);n.enumOptions=["Wrap","Unlimited","Clamp"];var k=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),r=this.addOutputPin("Underflow",[0],VVVV.PinTypes.Value),m=this.addOutputPin("Overflow",[0],VVVV.PinTypes.Value),p=!1;this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=f.pinIsChanged()||d.pinIsChanged()||h.pinIsChanged()||q.pinIsChanged()||
n.pinIsChanged(),v=0;v<a;v++)1!=m.getValue(v)&&p||m.setValue(v,0),1!=r.getValue(v)&&p||r.setValue(v,0),p||k.setValue(v,0),b=b||0.5<=g.getValue(v)||0.5<=e.getValue(v);if(b){for(v=0;v<a;v++){var b=parseFloat(c.getValue(v)),t=v>=k.getSliceCount()?0:parseFloat(k.getValue(v)),w=parseFloat(d.getValue(v)),l=parseFloat(f.getValue(v)),A=0;"Unlimited"==n.getValue(v)&&(A=1);"Clamp"==n.getValue(v)&&(A=2);switch(A){case 1:0.5<=g.getValue(v)&&(t+=b);0.5<=e.getValue(v)&&(t-=b);break;case 2:0.5<=g.getValue(v)&&(t+=
b);0.5<=e.getValue(v)&&(t-=b);t>w&&(t=w,m.setValue(v,1));t<l&&(t=l,r.setValue(v,1));break;default:0.5<=g.getValue(v)&&(t+=b),0.5<=e.getValue(v)&&(t-=b),t>w&&(t=l,m.setValue(v,1)),t<l&&(t=w,r.setValue(v,1))}k.getValue(v)!=t&&k.setValue(v,t);0.5<=q.getValue(v)&&k.setValue(v,h.getValue(v))}k.setSliceCount(a);r.setSliceCount(a);m.setSliceCount(a)}p=!0}};VVVV.Nodes.Counter.prototype=new VVVV.Core.Node;VVVV.Nodes.CurrentTimeAstronomy=function(a,b){this.constructor(a,"CurrentTime (Astronomy)",b);this.meta={authors:["Zauner"],original_authors:["VVVV Group"],credits:["http://javascript.about.com/library/bldst.htm"],compatibility_issues:["Time Zone index differs from classic VVVV","Time Zone Name does not work in Firefox"]};this.auto_evaluate=!0;var g=new Date,e=this.addOutputPin("GMT",[],VVVV.PinTypes.Value),f=this.addOutputPin("Time Zone",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Time Zone Name",
[""],VVVV.PinTypes.String);this.addOutputPin("Daylight Saving Time",[g.getTimezoneOffset()<function(c){var d=new Date(c.getFullYear(),0,1);c=new Date(c.getFullYear(),6,1);return Math.max(d.getTimezoneOffset(),c.getTimezoneOffset())}(g)?1:0],VVVV.PinTypes.Value);var c=this.addOutputPin("Current Time",[],VVVV.PinTypes.Value);this.evaluate=function(){var h=new Date,a=36E5*h.getTimezoneOffset(),b=h.getTime();e.setValue(0,b/1E3/60/60/24+25569);f.setValue(0,a/1E3/60/60);h.toString().match(/\((.+)\)$/)?
d.setValue(0,h.toString().match(/\((.+)\)$/)[1]):d.setValue(0,"n/a");c.setValue(0,(b-a)/1E3/60/60/24+25569)}};VVVV.Nodes.CurrentTimeAstronomy.prototype=new VVVV.Core.Node;
VVVV.Nodes.GregorianAstronomySplit=function(a,b){this.constructor(a,"Gregorian (Astronomy Split)",b);this.meta={authors:["Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Time",[41491.4301],VVVV.PinTypes.Value),e=this.addOutputPin("Millisecond",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Second",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Minute",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Hour",[0],VVVV.PinTypes.Value),
h=this.addOutputPin("DayOfWeek",[0],VVVV.PinTypes.Value),q=this.addOutputPin("Day",[1],VVVV.PinTypes.Value),n=this.addOutputPin("Month",[1],VVVV.PinTypes.Value),k=this.addOutputPin("Year",[2E3],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var p=864E5*(g.getValue(b)-25569),p=new Date(p);x=p.getMilliseconds();x!=e.values[b]&&e.setValue(b,x);x=p.getSeconds();x!=f.values[b]&&f.setValue(b,x);x=p.getMinutes();x!=d.values[b]&&d.setValue(b,x);x=p.getHours();
x!=c.values[b]&&c.setValue(b,x);x=p.getDay();x!=h.values[b]&&h.setValue(b,x);x=p.getDate();x!=q.values[b]&&q.setValue(b,x);x=p.getMonth()+1;x!=n.values[b]&&n.setValue(b,x);x=p.getYear()+1900;x!=k.values[b]&&k.setValue(b,x)}e.setSliceCount(a);f.setSliceCount(a);d.setSliceCount(a);c.setSliceCount(a);h.setSliceCount(a);q.setSliceCount(a);n.setSliceCount(a);k.setSliceCount(a)}};VVVV.Nodes.GregorianAstronomySplit.prototype=new VVVV.Core.Node;VVVV.Nodes.And=function(a,b){this.constructor(a,"AND (Boolean)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Input 1",[1],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[1],VVVV.PinTypes.Value);this.evaluate=function(){if(g.pinIsChanged()||e.pinIsChanged()){for(var d=0;d<this.getMaxInputSliceCount();d++)1<=Math.round(g.getValue(d))&&
1<=Math.round(e.getValue(d))?f.setValue(d,1):f.setValue(d,0);f.setSliceCount(this.getMaxInputSliceCount())}}};VVVV.Nodes.And.prototype=new VVVV.Core.Node;
VVVV.Nodes.Or=function(a,b){this.constructor(a,"OR (Boolean)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Input 1",[1],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[1],VVVV.PinTypes.Value);this.evaluate=function(){if(g.pinIsChanged()||e.pinIsChanged()){for(var d=0;d<this.getMaxInputSliceCount();d++)1<=Math.round(g.getValue(d))||
1<=Math.round(e.getValue(d))?f.setValue(d,1):f.setValue(d,0);f.setSliceCount(this.getMaxInputSliceCount())}}};VVVV.Nodes.Or.prototype=new VVVV.Core.Node;
VVVV.Nodes.Not=function(a,b){this.constructor(a,"NOT (Boolean)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[1],VVVV.PinTypes.Value),e=this.addOutputPin("Output",[1],VVVV.PinTypes.Value);this.evaluate=function(){if(g.pinIsChanged()){for(var f=0;f<this.getMaxInputSliceCount();f++)e.setValue(f,1-Math.round(parseFloat(g.getValue(f))));e.setSliceCount(this.getMaxInputSliceCount())}}};
VVVV.Nodes.Not.prototype=new VVVV.Core.Node;
VVVV.Nodes.OrSpectral=function(a,b){this.constructor(a,"OR (Boolean Spectral)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Bin Size",[-1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0,h=0,a=!1,b=0;b<d||0<e.getValue(0)&&(0<h||0!=c%e.values.length);b++)0==h&&(a=!1),
a=a||0.5<=g.getValue(b),h++,0<e.getValue(0)?h>=e.getValue(c)&&(f.setValue(c,a?1:0),c++,h=0):f.setValue(0,a?1:0);f.setSliceCount(c+(0<h))}};VVVV.Nodes.OrSpectral.prototype=new VVVV.Core.Node;
VVVV.Nodes.AndSpectral=function(a,b){this.constructor(a,"AND (Boolean Spectral)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Bin Size",[-1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0,h=0,a=!1,b=0;b<d||0<e.getValue(0)&&(0<h||0!=c%e.values.length);b++)0==h&&(a=
!0),a=a&&0.5<=g.getValue(b),h++,0<e.getValue(0)?h>=e.getValue(c)&&(f.setValue(c,a?1:0),c++,h=0):f.setValue(0,a?1:0);f.setSliceCount(c+(0<h))}};VVVV.Nodes.AndSpectral.prototype=new VVVV.Core.Node;VVVV.Types.CanvasTexture={imageObject:void 0,loaded:!1};
VVVV.Types.CanvasRenderState=function(){this.fillColor=[1,1,1,1];this.strokeColor=[0,0,0,0];this.lineWidth=1;this.capStyle="butt";this.joinStyle="miter";this.gradient={type:"none"};this.shadowBlur=this.shadowOffsetY=this.shadowOffsetX=0;this.shadowColor=[0,0,0,1];this.blendMode="source-over";this.copy_attributes=function(a){this.fillColor=a.fillColor;this.strokeColor=a.strokeColor;this.lineWidth=a.lineWidth;this.capStyle=a.capStyle;this.joinStyle=a.joinStyle;this.gradient=a.gradient;this.shadowOffsetX=
a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.blendMode=a.blendMode};this.apply=function(a){if("none"!=this.gradient.type){if("linear"==this.gradient.type)var b=a.createLinearGradient(this.gradient.startX,this.gradient.startY,this.gradient.endX,this.gradient.endY);for(var g=Math.max(this.gradient.colors.length,this.gradient.colorPositions.length),e=0;e<g;e++){var f=this.gradient.colors[e];b.addColorStop(this.gradient.colorPositions[e],
"rgba("+parseInt(255*f[0])+","+parseInt(255*f[1])+","+parseInt(255*f[2])+","+f[3]+")")}a.fillStyle=b}else a.fillStyle="rgba("+parseInt(255*this.fillColor[0])+","+parseInt(255*this.fillColor[1])+","+parseInt(255*this.fillColor[2])+","+this.fillColor[3]+")";a.strokeStyle="rgba("+parseInt(255*this.strokeColor[0])+","+parseInt(255*this.strokeColor[1])+","+parseInt(255*this.strokeColor[2])+","+this.strokeColor[3]+")";a.lineWidth=this.lineWidth/a.canvas.height;a.lineCap=this.capStyle;a.lineJoin=this.joinStyle;
a.shadowOffsetX=this.shadowOffsetX;a.shadowOffsetY=this.shadowOffsetY;a.shadowBlur=this.shadowBlur;a.shadowColor="rgba("+parseInt(255*this.shadowColor[0])+","+parseInt(255*this.shadowColor[1])+","+parseInt(255*this.shadowColor[2])+","+this.shadowColor[3]+")";a.globalCompositeOperation=this.blendMode}};var defaultRenderState=new VVVV.Types.CanvasRenderState,invisibleRenderState=new VVVV.Types.CanvasRenderState;invisibleRenderState.fillColor=[0,0,0,0];
VVVV.PinTypes.CanvasRenderState={typeName:"CanvasRenderState",reset_on_disconnect:!0,defaultValue:function(){return defaultRenderState}};var defaultCanvasLayer=function(){this.draw=function(){}};VVVV.PinTypes.CanvasLayer={typeName:"CanvasLayer",reset_on_disconnect:!0,defaultValue:defaultCanvasLayer};
VVVV.Nodes.FillCanvas=function(a,b){this.constructor(a,"Fill (Canvas VVVVjs RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Color",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color),f=this.addOutputPin("Render State Out",[],VVVV.PinTypes.CanvasRenderState),d=[];this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),h=0;h<c;h++)void 0==d[h]&&
(d[h]=new VVVV.Types.CanvasRenderState),d[h].copy_attributes(g.getValue(h)),d[h].fillColor=e.getValue(h).split(","),f.setValue(h,d[h]);f.setSliceCount(c)}};VVVV.Nodes.FillCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.StrokeCanvas=function(a,b){this.constructor(a,"Stroke (Canvas VVVVjs RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Color",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color),f=this.addInputPin("Width",[1],VVVV.PinTypes.Value),d=this.addInputPin("Cap Style",["butt"],VVVV.PinTypes.Enum);d.enumOptions=["butt","round","square"];var c=this.addInputPin("Join Style",
["miter"],VVVV.PinTypes.Enum);c.enumOptions=["miter","round","bevel"];var h=this.addOutputPin("Render State Out",[],VVVV.PinTypes.CanvasRenderState),q=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==q[b]&&(q[b]=new VVVV.Types.CanvasRenderState),q[b].copy_attributes(g.getValue(b)),q[b].strokeColor=e.getValue(b).split(","),q[b].lineWidth=f.getValue(b),q[b].capStyle=d.getValue(b),q[b].joinStyle=c.getValue(b),h.setValue(b,q[b]);h.setSliceCount(a)}};
VVVV.Nodes.StrokeCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.ShadowCanvas=function(a,b){this.constructor(a,"Shadow (Canvas VVVVjs RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Color",["0.0, 0.0, 0.0, 1.0"],VVVV.PinTypes.Color),f=this.addInputPin("Offset X",[0],VVVV.PinTypes.Value),d=this.addInputPin("Offset Y",[0],VVVV.PinTypes.Value),c=this.addInputPin("Blur",[0],VVVV.PinTypes.Value),
h=this.addOutputPin("Render State Out",[],VVVV.PinTypes.CanvasRenderState),q=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==q[b]&&(q[b]=new VVVV.Types.CanvasRenderState),q[b].copy_attributes(g.getValue(b)),q[b].shadowOffsetX=f.getValue(b),q[b].shadowOffsetY=d.getValue(b),q[b].shadowBlur=c.getValue(b),q[b].shadowColor=e.getValue(b).split(","),h.setValue(b,q[b]);h.setSliceCount(a)}};VVVV.Nodes.ShadowCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.BlendCanvas=function(a,b){this.constructor(a,"Blend (Canvas VVVVjs RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Mode",["source-over"],VVVV.PinTypes.Enum);e.enumOptions="source-over source-out source-in source-atop destination-over destination-out destination-in destination-atop copy lighter xor".split(" ");var f=this.addOutputPin("Render State Out",
[],VVVV.PinTypes.CanvasRenderState),d=[];this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),h=0;h<c;h++)void 0==d[h]&&(d[h]=new VVVV.Types.CanvasRenderState),d[h].copy_attributes(g.getValue(h)),d[h].blendMode=e.getValue(h),f.setValue(h,d[h]);f.setSliceCount(c)}};VVVV.Nodes.BlendCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.LinearGradientCanvas=function(a,b){this.constructor(a,"LinearGradient (Canvas VVVVjs RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Start X",[0],VVVV.PinTypes.Value),f=this.addInputPin("Start Y",[0],VVVV.PinTypes.Value),d=this.addInputPin("End X",[0],VVVV.PinTypes.Value),c=this.addInputPin("End Y",[0],VVVV.PinTypes.Value),h=this.addInputPin("Colors",
["1.0, 1.0, 1.0, 1.0","0.0, 0.0, 0.0, 1.0"],VVVV.PinTypes.Color),q=this.addInputPin("Color Positions",[0,1],VVVV.PinTypes.Value),n=this.addOutputPin("Render State Out",[],VVVV.PinTypes.CanvasRenderState),k=[];this.evaluate=function(){for(var a=Math.max(g.values.length,e.values.length),a=Math.max(a,f.values.length),a=Math.max(a,d.values.length),a=Math.max(a,c.values.length),b=0;b<a;b++){void 0==k[b]&&(k[b]=new VVVV.Types.CanvasRenderState);k[b].copy_attributes(g.getValue(b));k[b].gradient={type:"linear"};
k[b].gradient.startX=e.getValue(b);k[b].gradient.startY=f.getValue(b);k[b].gradient.endX=d.getValue(b);k[b].gradient.endY=c.getValue(b);k[b].gradient.colors=[];k[b].gradient.colorPositions=[];for(var p=Math.max(h.values.length,q.values.length),s=0;s<p;s++)k[b].gradient.colors.push(h.getValue(s).split(",")),k[b].gradient.colorPositions.push(q.getValue(s));n.setValue(b,k[b])}n.setSliceCount(a)}};VVVV.Nodes.LinearGradientCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.ArcCanvas=function(a,b){this.constructor(a,"Arc (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),f=this.addInputPin("Clipping Layer",[],VVVV.PinTypes.CanvasLayer),d=this.addInputPin("Radius",[1],VVVV.PinTypes.Value),c=this.addInputPin("Start Angle",[0],VVVV.PinTypes.Value),h=this.addInputPin("End Angle",
[0.5],VVVV.PinTypes.Value),q=this.addInputPin("Draw Segment",[0],VVVV.PinTypes.Value),n=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer),k=[],r=function(){this.transform=mat4.create();mat4.identity(this.transform);this.startAngle=0;this.endAngle=0.5;this.strokeColor=[1,1,1,1];this.lineWidth=1;this.renderState=defaultRenderState;this.clippingLayer=void 0;this.drawSegment=!1;this.draw=function(c,d){c.save();this.clippingLayer&&(this.clippingLayer.draw(c,!0),c.clip());c.save();this.transform&&
c.transform(this.transform[0],this.transform[1],this.transform[4],this.transform[5],this.transform[12],this.transform[13]);c.beginPath();d?invisibleRenderState.apply(c):this.renderState.apply(c);this.drawSegment&&(c.moveTo(0,0),c.lineTo(Math.cos(this.startAngle)*this.radius,Math.sin(this.startAngle)*this.radius));c.arc(0,0,this.radius,this.startAngle,this.endAngle,!1);this.drawSegment&&(c.moveTo(Math.cos(this.endAngle)*this.radius,Math.sin(this.endAngle)*this.radius),c.lineTo(0,0));0<this.renderState.fillColor[3]&&
c.fill();0<this.renderState.strokeColor[3]&&c.stroke();c.restore();c.restore()}};this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==k[b]&&(k[b]=new r),k[b].transform=e.getValue(b),k[b].radius=parseFloat(d.getValue(b)),k[b].startAngle=2*parseFloat(c.getValue(b))*Math.PI,k[b].endAngle=2*parseFloat(h.getValue(b))*Math.PI,k[b].renderState=g.getValue(b),k[b].drawSegment=1==q.getValue(b),f.isConnected()&&(k[b].clippingLayer=f.getValue(b));for(b=0;b<k.length;b++)n.setValue(b,
k[b]);n.setSliceCount(a)}};VVVV.Nodes.ArcCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.RectangleCanvas=function(a,b){this.constructor(a,"Rectangle (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),f=this.addInputPin("Clipping Layer",[],VVVV.PinTypes.CanvasLayer),d=this.addInputPin("Width",[1],VVVV.PinTypes.Value),c=this.addInputPin("Height",[1],VVVV.PinTypes.Value),h=this.addInputPin("Corner Radius",
[0],VVVV.PinTypes.Value),q=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer),n=[],k=function(){this.transform=mat4.create();mat4.identity(this.transform);this.renderState=defaultRenderState;this.clippingLayer=void 0;this.draw=function(c,d){c.save();this.clippingLayer&&(this.clippingLayer.draw(c,!0),c.clip());c.save();this.transform&&c.transform(this.transform[0],this.transform[1],this.transform[4],this.transform[5],this.transform[12],this.transform[13]);c.beginPath();d?invisibleRenderState.apply(c):
this.renderState.apply(c);var h=this.width/2,f=h-this.cornerRadius,e=this.height/2,b=e-this.cornerRadius,a=-h,g=-f,q=-e,k=-b;c.moveTo(g,q);c.lineTo(f,q);c.arc(f,k,this.cornerRadius,1.5*Math.PI,0,!1);c.lineTo(h,b);c.arc(f,b,this.cornerRadius,0,0.5*Math.PI,!1);c.lineTo(g,e);c.arc(g,b,this.cornerRadius,0.5*Math.PI,Math.PI,!1);c.lineTo(a,k);c.arc(g,k,this.cornerRadius,Math.PI,1.5*Math.PI,!1);c.closePath();0<this.renderState.fillColor[3]&&c.fill();0<this.renderState.strokeColor[3]&&c.stroke();c.restore();
c.restore()}};this.evaluate=function(){for(var b=this.getMaxInputSliceCount(),a=0;a<b;a++)void 0==n[a]&&(n[a]=new k),n[a].transform=e.getValue(a),n[a].width=d.getValue(a),n[a].height=c.getValue(a),n[a].cornerRadius=h.getValue(a),n[a].renderState=g.getValue(a),f.isConnected()&&(n[a].clippingLayer=f.getValue(a));for(a=0;a<n.length;a++)q.setValue(a,n[a]);q.setSliceCount(b)}};VVVV.Nodes.RectangleCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.TextCanvas=function(a,b){this.constructor(a,"Text (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Render State",[],VVVV.PinTypes.CanvasRenderState),e=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),f=this.addInputPin("Clipping Layer",[],VVVV.PinTypes.CanvasLayer),d=this.addInputPin("Text",["VVVV.js"],VVVV.PinTypes.String),c=this.addInputPin("Font",["10px sans-serif"],VVVV.PinTypes.String),
h=this.addInputPin("Align",["start"],VVVV.PinTypes.Enum);h.enumOptions=["start","left","end","right","center"];var q=this.addInputPin("Baseline",["alphabetic"],VVVV.PinTypes.Enum);q.enumOptions="top hanging middle alphabetic ideographic bottom".split(" ");var n=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer),k=[],r=function(){this.transform=mat4.create();mat4.identity(this.transform);this.text="VVVV.js";this.font="sans-serif";this.align="start";this.baseline="top";this.renderState=defaultRenderState;
this.clippingLayer=void 0;this.draw=function(c,d){c.save();this.clippingLayer&&(this.clippingLayer.draw(c,!0),c.clip());c.save();this.transform&&c.transform(this.transform[0],this.transform[1],this.transform[4],this.transform[5],this.transform[12],this.transform[13]);c.scale(0.01,-0.01);c.font="100px "+this.font;c.textAlign=this.align;c.textBaseline=this.baseline;d?invisibleRenderState.apply(c):this.renderState.apply(c);0<this.renderState.fillColor[3]&&c.fillText(this.text,0,0);0<this.renderState.strokeColor[3]&&
c.strokeText(this.text,0,0);c.restore();c.restore()}};this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==k[b]&&(k[b]=new r),k[b].transform=e.getValue(b),k[b].text=d.getValue(b),k[b].font=c.getValue(b),k[b].align=h.getValue(b),k[b].baseline=q.getValue(b),k[b].renderState=g.getValue(b),k[b].clippingLayer=f.getValue(b);for(b=0;b<k.length;b++)n.setValue(b,k[b]);n.setSliceCount(a)}};VVVV.Nodes.TextCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.BezierCurveCanvas=function(a,b){function g(c,d){c.x.splice(d);c.y.splice(d);c.c1x.splice(d);c.c1y.splice(d);c.c2x.splice(d);c.c2y.splice(d)}this.constructor(a,"BezierCurve (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var e=this.addInputPin("Render State",[],VVVV.PinTypes.CanvasRenderState),f=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),d=this.addInputPin("Clipping Layer",[],VVVV.PinTypes.CanvasLayer),c=this.addInputPin("X",
[0],VVVV.PinTypes.Value),h=this.addInputPin("Y",[0],VVVV.PinTypes.Value),q=this.addInputPin("Control 1 X",[0],VVVV.PinTypes.Value),n=this.addInputPin("Control 1 Y",[0],VVVV.PinTypes.Value),k=this.addInputPin("Control 2 X",[0],VVVV.PinTypes.Value),r=this.addInputPin("Control 2 Y",[0],VVVV.PinTypes.Value),m=this.addInputPin("BinSize",[-1],VVVV.PinTypes.Value),p=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer),s=[],u=function(){this.transform=mat4.create();mat4.identity(this.transform);this.x=
[];this.y=[];this.c1x=[];this.c1y=[];this.c2x=[];this.c2y=[];this.strokeColor=[1,1,1,1];this.lineWidth=1;this.fillColor=[1,1,1,1];this.renderState=defaultRenderState;this.clippingLayer=void 0;this.draw=function(c,d){if(!(1>this.x.length)){c.save();this.clippingLayer&&(this.clippingLayer.draw(c,!0),c.clip());d?invisibleRenderState.apply(c):this.renderState.apply(c);c.save();this.transform&&c.transform(this.transform[0],this.transform[1],this.transform[4],this.transform[5],this.transform[12],this.transform[13]);
c.beginPath();c.moveTo(this.x[0],this.y[0]);for(var h=1;h<this.x.length;h++)c.bezierCurveTo(this.c1x[h-1]+this.x[h-1],this.c1y[h-1]+this.y[h-1],this.c2x[h]+this.x[h],this.c2y[h]+this.y[h],this.x[h],this.y[h]);0<this.renderState.fillColor[3]&&c.fill();0<this.renderState.strokeColor[3]&&c.stroke();c.restore();c.restore()}}};this.evaluate=function(){for(var b=this.getMaxInputSliceCount(),a=0,w=0,l=0;l<b||0<m.getValue(0)&&(0<w||0<a%f.getSliceCount());l++)void 0==s[a]&&(s[a]=new u),0==w&&(s[a].renderState=
e.getValue(a),s[a].transform=f.getValue(a),d.isConnected()&&(s[a].clippingLayer=d.getValue(a))),s[a].x[w]=parseFloat(c.getValue(l)),s[a].y[w]=parseFloat(h.getValue(l)),s[a].c1x[w]=parseFloat(q.getValue(l)),s[a].c1y[w]=parseFloat(n.getValue(l)),s[a].c2x[w]=parseFloat(k.getValue(l)),s[a].c2y[w]=parseFloat(r.getValue(l)),w++,0<m.getValue(0)&&w>=m.getValue(a)&&(w<s[a].x.length&&g(s[a],w),a++,w=0);0>m.getValue(0)&&w<s[a].x.length?(g(s[a],w),s.splice(1)):s.splice(a);for(b=0;b<s.length;b++)p.setValue(b,
s[b]);p.setSliceCount(s.length)}};VVVV.Nodes.BezierCurveCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.QuadCanvas=function(a,b){this.constructor(a,"Quad (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),e=this.addInputPin("Clipping Layer",[],VVVV.PinTypes.CanvasLayer),f=this.addInputPin("Texture",[],VVVV.PinTypes.HTML5Texture),d=this.addInputPin("Color",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color),c=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer),h=[],q=
function(){this.transform=mat4.create();this.clippingLayer=void 0;mat4.identity(this.transform);this.texture=VVVV.PinTypes.HTML5Texture.defaultValue();this.color=[1,1,1,1];this.draw=function(c,d){c.save();this.clippingLayer&&(this.clippingLayer.draw(c,!0),c.clip());c.save();this.transform&&c.transform(this.transform[0],this.transform[1],this.transform[4],this.transform[5],this.transform[12],this.transform[13]);"Empty Texture"!=this.texture?this.texture.loaded&&(c.globalAlpha=this.color[3],c.save(),
c.translate(-0.5,0.5),this.texture.videoWidth?c.scale(1/this.texture.videoWidth,-1/this.texture.videoHeight):c.scale(1/this.texture.width,-1/this.texture.height),c.drawImage(this.texture,0,0),c.restore(),c.fillStyle="rgba(0, 0, 0, .001)",c.fillRect(-0.5,-0.5,1,1),c.globalAlpha=1):(c.fillStyle="rgba("+parseInt(255*this.color[0])+", "+parseInt(255*this.color[1])+", "+parseInt(255*this.color[2])+", "+this.color[3]+")",c.fillRect(-0.5,-0.5,1,1));c.restore();c.restore()}};this.evaluate=function(){for(var a=
this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==h[b]&&(h[b]=new q),h[b].transform=g.getValue(b),h[b].texture=f.getValue(b),h[b].color=d.getValue(b).split(","),e.isConnected()&&(h[b].clippingLayer=e.getValue(b));for(b=0;b<h.length;b++)c.setValue(b,h[b]);c.setSliceCount(a)}};VVVV.Nodes.QuadCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.GroupCanvas=function(a,b){this.constructor(a,"Group (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=[],e=this.addOutputPin("Layer",[],VVVV.PinTypes.CanvasLayer);this.initialize=function(){for(var f=0;2>f;f++)g[f]=this.addInputPin("Layer "+(f+1),[],VVVV.PinTypes.CanvasLayer)};this.evaluate=function(){for(var f=0,d=0;2>d;d++)if(g[d].isConnected())for(var c=0;c<g[d].values.length;c++)e.setValue(f++,g[d].getValue(c));
e.setSliceCount(f)}};VVVV.Nodes.GroupCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.RendererCanvas=function(a,b){function g(c){$(c).detach("mousemove");$(c).detach("mousedown");$(c).detach("mouseup");VVVV.MousePositions[c.id]={x:0,y:0,wheel:0,lb:0,mb:0,rb:0};$(c).mousemove(function(d){var h=2*(d.pageX-$(this).offset().left)/$(this).width()-1;d=-(2*(d.pageY-$(this).offset().top)/$(this).height()-1);VVVV.MousePositions._all.x=h;VVVV.MousePositions._all.y=d;VVVV.MousePositions[c.id].x=h;VVVV.MousePositions[c.id].y=d});$(c).bind("mousewheel",function(d){d=d.originalEvent.wheelDelta/
120;VVVV.MousePositions[c.id].wheel+=d;VVVV.MousePositions._all.wheel+=d});$(c).bind("DOMMouseScroll",function(d){d=-d.originalEvent.detail/3;VVVV.MousePositions[c.id].wheel+=d;VVVV.MousePositions._all.wheel+=d});$(c).mousedown(function(d){switch(d.which){case 1:VVVV.MousePositions._all.lb=1;VVVV.MousePositions[c.id].lb=1;break;case 2:VVVV.MousePositions._all.mb=1;VVVV.MousePositions[c.id].mb=1;break;case 3:VVVV.MousePositions._all.rb=1,VVVV.MousePositions[c.id].rb=1}});$(c).mouseup(function(d){switch(d.which){case 1:VVVV.MousePositions._all.lb=
0;VVVV.MousePositions[c.id].lb=0;break;case 2:VVVV.MousePositions._all.mb=0;VVVV.MousePositions[c.id].mb=0;break;case 3:VVVV.MousePositions._all.rb=0,VVVV.MousePositions[c.id].rb=0}})}this.constructor(a,"Renderer (Canvas VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var e=this.addInputPin("Layers",[],VVVV.PinTypes.CanvasLayer);this.addInputPin("Clear",[1],VVVV.PinTypes.Value);var f=this.addInputPin("Background Color",["0.0, 0.0, 0.0, 1.0"],
VVVV.PinTypes.Color),d=this.addInputPin("Backbuffer Width",[0],VVVV.PinTypes.Value),c=this.addInputPin("Backbuffer Height",[0],VVVV.PinTypes.Value),h=this.addInputPin("View",[],VVVV.PinTypes.Transform),q=this.addOutputPin("Canvas Out",[],this),n,k,r,m=[0,0,0,1],p;this.getContext=function(){var h=this.invisiblePins["Descriptive Name"].getValue(0);if((h=$(h).get(0))&&"CANVAS"==h.nodeName)p=h;else{var f=parseInt(d.getValue(0)),e=parseInt(c.getValue(0));p=$('<canvas width="'+(0<f?f:512)+'" height="'+
(0<e?e:512)+'" id="vvvv-js-generated-renderer-'+(new Date).getTime()+'" class="vvvv-js-generated-renderer"></canvas>');h||(h="body");$(h).append(p);p=p.get(0)}k=p.width;r=p.height;p&&p.getContext&&(g(p),n=p.getContext("2d"),p.ctx=n)};this.destroy=function(){$(p).remove()};this.evaluate=function(){this.invisiblePins["Descriptive Name"].pinIsChanged()&&($(p).hasClass("vvvv-js-generated-renderer")&&$(p).remove(),this.getContext());if(n){if(d.pinIsChanged()){var b=parseInt(d.getValue(0));0<b&&(k=b,$(p).attr("width",
k))}c.pinIsChanged()&&(b=parseInt(c.getValue(0)),0<b&&(r=b,$(p).attr("height",r)));f.pinIsChanged()&&(m=f.getValue(0).split(","),m[0]=parseInt(255*m[0]),m[1]=parseInt(255*m[1]),m[2]=parseInt(255*m[2]));defaultRenderState.apply(n);n.clearRect(0,0,k,r);n.save();n.translate(k/2,r/2);n.scale(k/2,-r/2);h.isConnected()&&(b=h.getValue(0),n.transform(b[0],b[1],b[4],b[5],b[12],b[13]));if(e.isConnected())for(b=0;b<e.values.length;b++)e.getValue(b).draw(n);n.restore();defaultRenderState.apply(n);n.globalCompositeOperation=
"destination-over";n.fillStyle="rgba("+m[0]+","+m[1]+","+m[2]+","+m[3]+")";n.fillRect(0,0,k,r);q.setValue(0,p);p.loaded=!0}}};VVVV.Nodes.RendererCanvas.prototype=new VVVV.Core.Node;VVVV.PinTypes.Color={typeName:"Color",reset_on_disconnect:!1,defaultValue:function(){return"1.0, 1.0, 1.0, 1.0"},primitive:!0,hsvToRgb:function(a,b,g){a=360*((a%1+1)%1);var e=Math.floor(a/60),f=a/60-e;a=g*(1-b);var d=g*(1-b*f);b=g*(1-b*(1-f));switch(e){case 1:return[d,g,a];case 2:return[a,g,b];case 3:return[a,d,g];case 4:return[b,a,g];case 5:return[g,a,d];default:return[g,b,a]}},rgbToHsv:function(a,b,g){var e=Math.max(a,Math.max(b,g)),f=Math.min(a,Math.min(b,g)),d;e==f?d=0:e==a?d=60*(0+(b-g)/(e-f)):
e==b?d=60*(2+(g-a)/(e-f)):e==g&&(d=60*(4+(a-b)/(e-f)));0>d&&(d+=360);a=0;0!=e&&(a=(e-f)/e);return[d/360,a,e]}};
VVVV.Nodes.RGBJoin=function(a,b){this.constructor(a,"RGB (Color Join)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Red",[1],VVVV.PinTypes.Value),e=this.addInputPin("Green",[1],VVVV.PinTypes.Value),f=this.addInputPin("Blue",[1],VVVV.PinTypes.Value),d=this.addInputPin("Alpha",[1],VVVV.PinTypes.Value),c=this.addOutputPin("Output",["1.0,1.0,1.0,1.0"],VVVV.PinTypes.Color);this.evaluate=function(){if(g.pinIsChanged()||
e.pinIsChanged||f.pinIsChanged()||d.pinIsChanged()){for(var h=this.getMaxInputSliceCount(),b=0;b<h;b++){var a=g.getValue(b)||0,k=e.getValue(b)||0,r=f.getValue(b)||0,m=d.getValue(b)||0;c.setValue(b,a+","+k+","+r+","+m)}c.setSliceCount(h)}}};VVVV.Nodes.RGBJoin.prototype=new VVVV.Core.Node;
VVVV.Nodes.HSVJoin=function(a,b){this.constructor(a,"HSV (Color Join)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Hue",[0.33],VVVV.PinTypes.Value),e=this.addInputPin("Saturation",[0],VVVV.PinTypes.Value),f=this.addInputPin("Value",[1],VVVV.PinTypes.Value),d=this.addInputPin("Alpha",[1],VVVV.PinTypes.Value),c=this.addOutputPin("Output",["1.0,1.0,1.0,1.0"],VVVV.PinTypes.Color);this.evaluate=function(){for(var h=
this.getMaxInputSliceCount(),b=0;b<h;b++){var a=g.getValue(b),k=e.getValue(b),r=f.getValue(b),m=d.getValue(b),a=VVVV.PinTypes.Color.hsvToRgb(a,k,r);c.setValue(b,a[0]+","+a[1]+","+a[2]+","+m)}c.setSliceCount(h)}};VVVV.Nodes.HSVJoin.prototype=new VVVV.Core.Node;
VVVV.Nodes.IOBoxColor=function(a,b){this.constructor(a,"IOBox (Color)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Color Input",["0.0, 1.0, 0.0, 1.0"],VVVV.PinTypes.Color),e=this.addOutputPin("Color Output",["0.0, 1.0, 0.0, 1.0"],VVVV.PinTypes.Color);this.addInvisiblePin("Rows",[1],VVVV.PinTypes.Value);this.evaluate=function(){for(var f=this.getMaxInputSliceCount(),d=0;d<f;d++)e.setValue(d,
g.getValue(d));e.setSliceCount(f)}};VVVV.Nodes.IOBoxColor.prototype=new VVVV.Core.Node;
VVVV.Nodes.SetAlphaColor=function(a,b){this.constructor(a,"SetAlpha (Color)",b);this.meta={authors:["Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["0.0, 0.0, 0.0, 0.0"],VVVV.PinTypes.Color),e=this.addInputPin("Alpha",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",["0.0, 0.0, 0.0, 1.0"],VVVV.PinTypes.Color);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var h=g.getValue(c),b=e.getValue(c);
f.setValue(c,h.replace(/[^, ]+$/,b))}f.setSliceCount(d)}};VVVV.Nodes.SetAlphaColor.prototype=new VVVV.Core.Node;
VVVV.Nodes.SwitchColorInput=function(a,b){this.constructor(a,"Switch (Color Input)",b);this.meta={authors:["Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Switch",[0],VVVV.PinTypes.Value),e=[];e[0]=this.addInputPin("Input 1",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color);e[1]=this.addInputPin("Input 2",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color);var f=this.addOutputPin("Output",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color);this.addInvisiblePin("Input Count",
[2],VVVV.PinTypes.Value);this.evaluate=function(){var d=this.getMaxInputSliceCount();if(this.hasNilInputs())f.setSliceCount(0);else{for(var c=0;c<d;c++)f.setValue(c,e[Math.round(Math.abs(g.getValue(c)))%e.length].getValue(c));f.setSliceCount(d)}}};VVVV.Nodes.SwitchColorInput.prototype=new VVVV.Core.Node;VVVV.Nodes.Abs=function(a,b){this.constructor(a,"Abs (Complex)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input Real",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input Imagiary",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0.5],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++)f.setValue(c,Math.sqrt(Math.pow(parseFloat(g.getValue(c)),2)+Math.pow(parseFloat(e.getValue(c)),
2)));f.setSliceCount(d)}};VVVV.Nodes.Abs.prototype=new VVVV.Core.Node;VVVV.Nodes.String2Enum=function(a,b){this.constructor(a,"String2Enum (Enumerations)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Validation check does not work"]};var g=this.addInputPin("String Value",[],VVVV.PinTypes.String),e=this.addOutputPin("Enum",[],VVVV.PinTypes.Enum);this.evaluate=function(){for(var f=this.getMaxInputSliceCount(),d=0;d<f;d++)e.setValue(d,g.getValue(d));e.setSliceCount(f)}};VVVV.Nodes.String2Enum.prototype=new VVVV.Core.Node;VVVV.PinTypes.HTML5Texture={typeName:"HTML5Texture",reset_on_disconnect:!0,defaultValue:function(){return"Empty Texture"}};
VVVV.Nodes.FileTextureCanvas=function(a,b){this.constructor(a,"FileTexture (HTML5 VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Filename",[],VVVV.PinTypes.String),e=this.addOutputPin("Texture Out",[],VVVV.PinTypes.HTML5Texture),f=this.addOutputPin("Width",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Height",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Up and Running",[0],VVVV.PinTypes.Value),
h=[],q=!1;this.evaluate=function(){var b=this.getMaxInputSliceCount();if(g.pinIsChanged()){for(var a=0;a<b;a++){var r=VVVV.Helpers.prepareFilePath(g.getValue(a),this.parentPatch);0===r.indexOf("http://")&&void 0!==VVVV.ImageProxyPrefix&&(r=VVVV.ImageProxyPrefix+encodeURI(r));if(void 0==h[a]||h[a].origSrc!=r)h[a]=new Image,h[a].loaded=!1,h[a].origSrc=r,h[a].onload=function(c){return function(){q=h[c].loaded=!0}}(a),h[a].src=r,c.setValue(a,0),e.setValue(a,h[a])}h.length=b;e.setSliceCount(b);f.setSliceCount(b);
d.setSliceCount(b);c.setSliceCount(b)}if(q){for(a=0;a<b;a++)e.setValue(a,h[a]),f.setValue(a,h[a].width),d.setValue(a,h[a].height),c.setValue(a,h[a].loaded?1:0);q=!1}}};VVVV.Nodes.FileTextureCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.FileStreamCanvas=function(a,b){this.constructor(a,"FileStream (HTML5 VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=["NETWORK_EMPTY","NETWORK_IDLE","NETWORK_LOADING","NETWORK_NO_SOURCE"],e=["HAVE_NOTHING","HAVE_METADATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","HAVE_CURRENT_DATA"],f=this.addInputPin("Play",[1],VVVV.PinTypes.Value),d=this.addInputPin("Loop",[0],VVVV.PinTypes.Value),c=this.addInputPin("Start Time",
[0],VVVV.PinTypes.Value),h=this.addInputPin("End Time",[-1],VVVV.PinTypes.Value),q=this.addInputPin("Do Seek",[0],VVVV.PinTypes.Value),n=this.addInputPin("Seek Position",[0],VVVV.PinTypes.Value),k=this.addInputPin("Filename",["http://html5doctor.com/demos/video-canvas-magic/video.ogg"],VVVV.PinTypes.String),r=this.addOutputPin("Video",[],this),m=this.addOutputPin("Audio",[],this),p=this.addOutputPin("Duration",[0],VVVV.PinTypes.Value),s=this.addOutputPin("Position",[0],VVVV.PinTypes.Value),u=this.addOutputPin("Video Width",
[0],VVVV.PinTypes.Value),v=this.addOutputPin("Video Height",[0],VVVV.PinTypes.Value),t=this.addOutputPin("Network Status",[""],VVVV.PinTypes.String),w=this.addOutputPin("Ready Status",[""],VVVV.PinTypes.String),l=[];this.evaluate=function(){var b=this.getMaxInputSliceCount();if(k.pinIsChanged())for(var a=0;a<b;a++){filename=VVVV.Helpers.prepareFilePath(k.getValue(a),this.parentPatch);if(void 0==l[a]){var z=$('<video style="display:none"><source src="" type=video/ogg></video>');$("body").append(z);
l[a]=z[0];l[a].volume=0;z=function(c){return function(){}}(a);l[a].onprogress=z;l[a].oncanplay=z;l[a].oncanplaythrough=z}filename!=l[a].currentSrc&&($(l[a]).find("source").first().attr("src",filename),l[a].load(),0.5<f.getValue(a)?l[a].play():l[a].pause(),l[a].loaded=!0,r.setValue(a,l[a]),m.setValue(a,l[a]))}if(f.pinIsChanged())for(a=0;a<b;a++)0.5<f.getValue(a)?l[a].play():l[a].pause();if(q.pinIsChanged())for(a=0;a<b;a++)l[a%l.length].loaded&&0.5<=q.getValue(a)&&(l[a%l.length].currentTime=parseFloat(n.getValue(a)),
0.5<f.getValue(a)&&l[a].play());for(a=0;a<b;a++){if(!l[a].paused){r.setValue(a,l[a]);m.setValue(a,l[a]);p.getValue(a)!=l[a].duration&&p.setValue(a,l[a].duration);s.setValue(a,l[a].currentTime);var z=parseFloat(h.getValue(a)),F=parseFloat(c.getValue(a));l[a].currentTime<F&&(l[a].currentTime=F);if(l[a].currentTime>=l[a].duration||0<=z&&l[a].currentTime>=z)0.5<=d.getValue(a)?l[a].currentTime=F:l[a].pause()}if(l[a].videoWidth!=u.getValue(a)||l[a].videoHeight!=v.getValue(a))u.setValue(a,l[a].videoWidth),
v.setValue(a,l[a].videoHeight);t.getValue(a)!=g[l[a].networkState]&&t.setValue(a,g[l[a].networkState]);w.getValue(a)!=e[l[a].readyState]&&w.setValue(a,e[l[a].readyState])}r.setSliceCount(b);m.setSliceCount(b)}};VVVV.Nodes.FileStreamCanvas.prototype=new VVVV.Core.Node;
VVVV.Nodes.AudioOutHTML5=function(a,b){this.constructor(a,"AudioOut (HTML5 VVVVjs)",b);this.meta={authors:["Matthias Zauner"],original_authors:[],credits:[],compatibility_issues:[]};var g=this.addInputPin("Audio",[],this),e=this.addInputPin("Volume",[0.5],VVVV.PinTypes.Value);this.evaluate=function(){var a=this.getMaxInputSliceCount();if(e.pinIsChanged())for(var d=0;d<a;d++)g.getValue(d).volume=Math.max(0,Math.min(1,parseFloat(e.getValue(d))))}};VVVV.Nodes.AudioOutHTML5.prototype=new VVVV.Core.Node;VVVV.Nodes.HTTPGet=function(a,b){this.constructor(a,"HTTP (Network Get)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Doesnt handle get variables yet","Doesnt support proxies","No header output pin yet"]};this.auto_evaluate=!0;var g=this.addInputPin("URL",["http://localhost"],VVVV.PinTypes.String),e=this.addInputPin("Name",[""],VVVV.PinTypes.String),f=this.addInputPin("Value",[""],VVVV.PinTypes.String),d=this.addInputPin("Refresh",[0],
VVVV.PinTypes.Value),c=this.addOutputPin("Status",[""],VVVV.PinTypes.String),h=this.addOutputPin("Body",[""],VVVV.PinTypes.String),q=this.addOutputPin("Fail",[0],VVVV.PinTypes.Value),n=this.addOutputPin("Success",[0],VVVV.PinTypes.Value),k,r,m,p=!1;this.evaluate=function(){this.getMaxInputSliceCount();var a=g.pinIsChanged()||e.pinIsChanged()||f.pinIsChanged()||d.pinIsChanged()&&1==d.getValue(0);1==n.getValue(0)&&n.setValue(0,0);1==q.getValue(0)&&q.setValue(0,0);p&&(h.setValue(0,k),c.setValue(0,void 0),
n.setValue(0,r),q.setValue(0,m),p=!1);a&&(void 0==g.getValue(0)?(h.setValue(0,""),c.setValue(0,"")):$.ajax({url:g.getValue(0),type:"get",success:function(c,d,h){k=c;r=1;p=!0},error:function(c,d){k="";m=1;p=!0}}))}};VVVV.Nodes.HTTPGet.prototype=new VVVV.Core.Node;VVVV.PinTypes.Node={typeName:"Node"};
VVVV.Nodes.IOBoxNode=function(a,b){this.constructor(a,"IOBox (Node)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input Node",[],VVVV.PinTypes.Node),e=this.addOutputPin("Output Node",[],VVVV.PinTypes.Node);this.initialize=function(){g.connectionChangedHandlers.nodepin=function(){if(this.isConnected()){var a;0<this.links.length?a=this.links[0].fromPin:this.masterPin&&(a=this.masterPin);this.setType(VVVV.PinTypes[a.typeName]);
e.setType(VVVV.PinTypes[a.typeName]);e.slavePin&&e.slavePin.setType(VVVV.PinTypes[a.typeName])}else e.isConnected()||(this.setType(VVVV.PinTypes.Node),e.setType(VVVV.PinTypes.Node),e.slavePin&&e.slavePin.setType(VVVV.PinTypes.Node))};e.connectionChangedHandlers.nodepin=function(){if(this.isConnected()){var a;0<this.links.length?a=this.links[0].toPin:this.slavePin&&(a=this.slavePin);this.setType(VVVV.PinTypes[a.typeName]);g.setType(VVVV.PinTypes[a.typeName]);g.masterPin&&g.masterPin.setType(VVVV.PinTypes[a.typeName])}else g.isConnected()||
(this.setType(VVVV.PinTypes.Node),g.setType(VVVV.PinTypes.Node),g.masterPin&&g.masterPin.setType(VVVV.PinTypes.Node))}};this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),d=0;d<a;d++)e.setValue(d,g.getValue(d));e.setSliceCount(a)}};VVVV.Nodes.IOBoxNode.prototype=new VVVV.Core.Node;
VVVV.Nodes.SwitchNodeInput=function(a,b){this.constructor(a,"Switch (Node Input)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Switch",[0],VVVV.PinTypes.Value),e=this.addInvisiblePin("Input Count",[2],VVVV.PinTypes.Value),f=[],d=this.addOutputPin("Output",[0],VVVV.PinTypes.Node);this.initialize=function(){for(var c=e.getValue(0),d=f.length;d<c;d++)f[d]=this.addInputPin("Input "+(d+1),
[],VVVV.PinTypes.Node);f.length=c};this.evaluate=function(){e.pinIsChanged()&&this.initialize();if(void 0==g.getValue(0))d.setValue(0,void 0);else{for(var c=f[Math.round(Math.abs(g.getValue(0)))%f.length],a=c.getSliceCount(),b=0;b<a;b++)d.setValue(b,c.getValue(b));d.setSliceCount(a)}}};VVVV.Nodes.SwitchNodeInput.prototype=new VVVV.Core.Node;VVVV.Nodes.BoundsSpectral=function(a,b){this.constructor(a,"Bounds (Spectral)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Bin Size",[-1],VVVV.PinTypes.Value),f=this.addOutputPin("Center",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Width",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Minimum",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Maximum",
[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0,k=0,r,m,p,s=0;s<a||0<e.getValue(0)&&(0<k||0!=b%e.values.length);s++)r=g.getValue(s),0==k&&(center=m=p=r,width=0),m=Math.min(r,m),p=Math.max(r,p),k++,0<e.getValue(0)&&k>=e.getValue(b)&&(c.setValue(b,m),h.setValue(b,p),f.setValue(b,m+(p-m)/2),d.setValue(b,Math.abs(p-m)),b++,k=0);-1==e.getValue(0)&&(c.setValue(b,m),h.setValue(b,p),f.setValue(b,m+(p-m)/2),d.setValue(b,Math.abs(p-m)));f.setSliceCount(b+(0<k));
d.setSliceCount(b+(0<k));c.setSliceCount(b+(0<k));h.setSliceCount(b+(0<k))}};VVVV.Nodes.BoundsSpectral.prototype=new VVVV.Core.Node;VVVV.Nodes.GetSliceSpreads=function(a,b){this.constructor(a,"GetSlice (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Bin Size",[1],VVVV.PinTypes.Value),f=this.addInputPin("Index",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=f.getSliceCount(),a,b,n=0,k=0;k<c;k++)if(b=e.getValue(k),a=
g.getValue(Math.round(f.getValue(k)),b),1<b)for(b=0;b<a.length;b++)d.setValue(n,parseFloat(a[b])),n++;else d.setValue(k,parseFloat(a)),n++;d.setSliceCount(n)}};VVVV.Nodes.GetSliceSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.SetSliceSpreads=function(a,b){this.constructor(a,"SetSlice (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Spread",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input",[0],VVVV.PinTypes.Value),f=this.addInputPin("Index",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=g.getSliceCount(),a=0;a<c;a++)d.setValue(a,
g.getValue(a));size=Math.max(e.getSliceCount(),f.getSliceCount());for(a=0;a<size;a++)d.setValue(f.getValue(a)%c,e.getValue(a));d.setSliceCount(c)}};VVVV.Nodes.SetSliceSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.RandomSpread=function(a,b){function g(a){var b=[],d=0,c=0;(function(c){for(var d=0;256>d;d++)b[d]=d;for(var a=0,d=0;256>d;d++){var a=(a+b[d]+c.charCodeAt(d%c.length))%256,e=b[d];b[d]=b[a];b[a]=e}})(a);this.getRandomNumber=function(){for(var a=0,e=1,g=0;8>g;g++){d=(d+1)%256;c=(c+b[d])%256;var k=b[d];b[d]=b[c];b[c]=k;a+=b[(b[d]+b[c])%256]*e;e*=256}return a/1.8446744073709552E19}}this.constructor(a,"RandomSpread (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],
credits:["http://www.webdeveloper.com/forum/showthread.php?t=140572"],compatibility_issues:["Doesnt handle spreaded inputs","random result will differ from original vvvv node because of different algorithm"]};this.addInputPin("Input",[0],VVVV.PinTypes.Value);this.addInputPin("Width",[1],VVVV.PinTypes.Value);this.addInputPin("Random Seed",[0],VVVV.PinTypes.Value);this.addInputPin("Spread Count",[1],VVVV.PinTypes.Value);this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){var a=
parseInt(this.inputPins["Spread Count"].getValue(0)),b=parseFloat(this.inputPins.Input.getValue(0)),d=parseFloat(this.inputPins.Width.getValue(0)),c=parseInt(this.inputPins["Random Seed"].getValue(0));rng=new g(c.toString());this.outputPins.Output.setSliceCount(a);for(c=0;c<a;c++)this.outputPins.Output.setValue(c,rng.getRandomNumber()*d-d/2+b)}};VVVV.Nodes.RandomSpread.prototype=new VVVV.Core.Node;
VVVV.Nodes.SortSpreads=function(a,b){this.constructor(a,"Sort (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInputPin("Input",[0],VVVV.PinTypes.Value);this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.addOutputPin("Former Index",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=_(this.inputPins.Input.values).map(function(a,d){return[a,d]}),a=_(a).sortBy(function(a){return a[0]}),b=0;b<a.length;b++)this.outputPins.Output.setValue(b,
a[b][0]),this.outputPins["Former Index"].setValue(b,a[b][1]);this.outputPins.Output.setSliceCount(a.length);this.outputPins["Former Index"].setSliceCount(a.length)}};VVVV.Nodes.SortSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.LinearSpread=function(a,b){this.constructor(a,"LinearSpread (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["phase does not work with Block alignment"]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Width",[1],VVVV.PinTypes.Value),f=this.addInputPin("Alignment",["Centered"],VVVV.PinTypes.Enum);f.enumOptions=["Centered","Block","LeftJustified","RightJustified"];var d=this.addInputPin("Phase",
[0],VVVV.PinTypes.Value),c=this.addInputPin("Spread Count",[1],VVVV.PinTypes.Value),h=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){var a=parseInt(c.getValue(0)),b=parseFloat(e.getValue(0)),k=parseFloat(d.getValue(0)),r=parseFloat(g.getValue(0)),m=f.getValue(0);""==m&&(m="Centered");var p=b/a;"Block"==m&&(p=b/(a-1));var s=p/2;if("Block"==m||"LeftJustified"==m)s=0;"RightJustified"==m&&(s=p);for(var u,v=0;v<a;v++)u=v*p+s,"Block"!=m&&0!=b&&(u=(u+k*b)%b),u=r-b/2+u,h.setValue(v,
u.toFixed(4));h.setSliceCount(a)}};VVVV.Nodes.LinearSpread.prototype=new VVVV.Core.Node;
VVVV.Nodes.AvoidNil=function(a,b){this.constructor(a,"AvoidNIL (Spreads)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["Kalle"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Default",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){if(g.pinIsChanged()||e.pinIsChanged()){var d=g;void 0==g.values[0]&&(d=e);for(var c=0;c<d.values.length;c++)f.setValue(c,
d.getValue(c));f.setSliceCount(d.getSliceCount())}}};VVVV.Nodes.AvoidNil.prototype=new VVVV.Core.Node;
VVVV.Nodes.SwapDim=function(a,b){this.constructor(a,"SwapDim (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["BinSize not implemented"]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Column Count",[0],VVVV.PinTypes.Value),f=this.addInputPin("Row Count",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=parseInt(e.getValue(0)),a=parseInt(f.getValue(0)),
b=c*a,n=0;n<b;n++)d.setValue(n%c*a+parseInt(n/c),g.getValue(n));d.setSliceCount(b)}};VVVV.Nodes.SwapDim.prototype=new VVVV.Core.Node;
VVVV.Nodes.I=function(a,b){this.constructor(a,"I (Spreads)",b);this.meta={authors:["M\u00f3r\u00e1sz D\u00e1vid (micro.D)"],original_authors:["VVVV Group"],credits:["Matthias Zauner"],compatibility_issues:["This has no phase pin.",'Smaller "from" than "to" isn\'t working yet']};var g=this.addInputPin("[ From ..",[0],VVVV.PinTypes.Value),e=this.addInputPin(".. To [",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){var d=Math.round(g.getValue(0)),
c=Math.round(e.getValue(0)),a=0;if(d<=c){for(var b=d;b<c;b++,a++)f.setValue(a,b);f.setSliceCount(c-d)}else{for(b=d;b>c;b--,a++)f.setValue(a,b);f.setSliceCount(d-c)}}};VVVV.Nodes.I.prototype=new VVVV.Core.Node;
VVVV.Nodes.CircularSpread=function(a,b){this.constructor(a,"CircularSpread (Spreads)",b);this.meta={authors:["Matija Miloslavich"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["only x and y inputs are spreadable"]};this.inpxin=this.addInputPin("Input X",[0],VVVV.PinTypes.Value);this.inpyin=this.addInputPin("Input Y",[0],VVVV.PinTypes.Value);this.widhin=this.addInputPin("Width",[1],VVVV.PinTypes.Value);this.heightin=this.addInputPin("Height",[1],VVVV.PinTypes.Value);this.factorin=
this.addInputPin("Factor",[1],VVVV.PinTypes.Value);this.phasein=this.addInputPin("Phase",[0],VVVV.PinTypes.Value);this.sprcntin=this.addInputPin("Spread Count",[1],VVVV.PinTypes.Value);this.xout=this.addOutputPin("Output X",[0],VVVV.PinTypes.Value);this.yout=this.addOutputPin("Output Y",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=0.5*parseFloat(this.widhin.getValue(0)),b=0.5*parseFloat(this.heightin.getValue(0)),f=parseFloat(this.factorin.getValue(0)),d=parseFloat(this.phasein.getValue(0)),
c=parseInt(this.sprcntin.getValue(0)),h=2*Math.PI,d=h*d,q=0,n=Math.max(this.inpyin.getSliceCount(),this.inpxin.getSliceCount()),k=0;k<n*c;k++)for(var r=parseFloat(this.inpxin.getValue(k)),m=parseFloat(this.inpyin.getValue(k)),p=0;p<c;p++){var s=d+h*(p/c)*f,u=r+Math.cos(s)*a,s=m+Math.sin(s)*b;this.xout.setValue(q,u);this.yout.setValue(q,s);q++}this.xout.setSliceCount(c*n);this.yout.setSliceCount(c*n)}};VVVV.Nodes.CircularSpread.prototype=new VVVV.Core.Node;
VVVV.Nodes.ReverseSpreads=function(a,b){this.constructor(a,"Reverse (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=g.getSliceCount(),d=0;d<a;d++){var c=g.getValue(d);e.setValue(a-d-1,c)}e.setSliceCount(a)}};VVVV.Nodes.ReverseSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.IntegralSpreads=function(a,b){this.constructor(a,"Integral (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Offset",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){var d=g.getSliceCount(),c=parseFloat(e.getValue(0));f.setValue(0,c);for(var a=0;a<d;a++){var b=parseFloat(g.getValue(a)),
c=c+b;f.setValue(a+1,c)}f.setSliceCount(d+1)}};VVVV.Nodes.IntegralSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.ConsSpreads=function(a,b){this.constructor(a,"Cons (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=[],e=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),f=this.addInvisiblePin("Input Count",[2],VVVV.PinTypes.Value);this.initialize=function(){for(var d=f.getValue(0),c=g.length;c<d;c++)g[c]=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);g.length=d};this.evaluate=function(){f.pinIsChanged()&&
this.initialize();for(var d=0,c=0;c<g.length;c++)for(var a=0;a<g[c].getSliceCount();a++)e.setValue(d++,g[c].getValue(a));e.setSliceCount(d)}};VVVV.Nodes.ConsSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.IntervalSpreads=function(a,b){this.constructor(a,"Interval (Spreads)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0.5],VVVV.PinTypes.Value),e=this.addInputPin("Intervals",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Index",[0],VVVV.PinTypes.Value),d=0;this.evaluate=function(){var c=g.getSliceCount(),a=e.getSliceCount();if(e.pinIsChanged()){d=void 0;for(var b=0;b<a;b++)if(e.getValue(b)<
d||void 0==d)d=e.getValue(b)}for(b=0;b<c;b++){var n=g.getValue(b);if(n<d)f.setValue(b,-1);else{for(var k=0;k<a-1&&!(n>=e.getValue(k)&&n<e.getValue(k+1));k++);f.setValue(b,k)}}f.setSliceCount(c)}};VVVV.Nodes.IntervalSpreads.prototype=new VVVV.Core.Node;
VVVV.Nodes.QueueSpreads=function(a,b){this.constructor(a,"Queue (Spreads)",b);this.meta={authors:["Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Insert",[0],VVVV.PinTypes.Value),f=this.addInputPin("Frame Count",[1],VVVV.PinTypes.Value),d=this.addInputPin("Reset",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Output",[],VVVV.PinTypes.Value),h=this.addOutputPin("Output Bin Size",
[],VVVV.PinTypes.Value);this.evaluate=function(){var a=e.getValue(0),b=f.getValue(0),k=d.getValue(0),r=!1;if(0.5<=a&&0.5>k){a=g.getSliceCount();for(r=a-1;0<=r;r--)c.values.unshift(g.getValue(r));h.values.unshift(a);r=!0}if(f.pinIsChanged()||r){for(r=currFrameCount=h.values.length;r>b;r--)c.values.splice(-h.values[r-1]);h.values.splice(b);r=!0}if(r){for(r=0;r<c.values.length;r++)c.setValue(r,c.values[r]);for(r=0;r<h.values.length;r++)h.setValue(r,h.values[r])}0.5<=k&&(c.setSliceCount(0),h.setSliceCount(0))}};
VVVV.Nodes.QueueSpreads.prototype=new VVVV.Core.Node;VVVV.Nodes.IOBoxString=function(a,b){this.constructor(a,"IOBox (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInvisiblePin("Rows",[1],VVVV.PinTypes.Value);this.addInputPin("SliceOffset",[0],VVVV.PinTypes.Value);this.addInputPin("Input String",[""],VVVV.PinTypes.String);this.addOutputPin("Output String",[""],VVVV.PinTypes.String);this.evaluate=function(){this.outputPins["Output String"].setSliceCount(this.inputPins["Input String"].getSliceCount());
for(var a=0;a<this.inputPins["Input String"].getSliceCount();a++)this.outputPins["Output String"].setValue(a,this.inputPins["Input String"].values[a])}};VVVV.Nodes.IOBoxString.prototype=new VVVV.Core.Node;
VVVV.Nodes.SwitchStringInput=function(a,b){this.constructor(a,"Switch (String Input)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Switch",[0],VVVV.PinTypes.Value),e=[];e[0]=this.addInputPin("Input 1",["text"],VVVV.PinTypes.String);e[1]=this.addInputPin("Input 2",["text"],VVVV.PinTypes.String);var f=this.addOutputPin("Output",["text"],VVVV.PinTypes.String);this.evaluate=function(){var d=
this.getMaxInputSliceCount();if(void 0==g.getValue(0))f.setValue(0,void 0);else{for(var c=0;c<d;c++)f.setValue(c,e[g.getValue(c)%e.length].getValue(c));f.setSliceCount(d)}}};VVVV.Nodes.SwitchStringInput.prototype=new VVVV.Core.Node;
VVVV.Nodes.AddString=function(a,b){this.constructor(a,"Add (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet","Intersperse *Enum* not implemented"]};var g=[];g[0]=this.addInputPin("Input 1",["text"],VVVV.PinTypes.String);g[1]=this.addInputPin("Input 2",["text"],VVVV.PinTypes.String);var e=this.addInputPin("Intersperse String",[""],VVVV.PinTypes.String),f=this.addOutputPin("Output",["texttext"],VVVV.PinTypes.String);
this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=[],b=e.getValue(c);void 0==b&&(b="");for(var n=0;n<g.length;n++)a.push(g[n].getValue(c));f.setValue(c,a.join(b))}f.setSliceCount(d)}};VVVV.Nodes.AddString.prototype=new VVVV.Core.Node;
VVVV.Nodes.GetSliceString=function(a,b){this.constructor(a,"GetSlice (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Bin Size not implemented"]};var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String);this.addInputPin("Bin Size",[1],VVVV.PinTypes.Value);var e=this.addInputPin("Index",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",["text"],VVVV.PinTypes.String);this.evaluate=function(){for(var d=0;d<e.values.length;d++)f.setValue(d,
g.getValue(Math.round(e.getValue(d))));f.setSliceCount(e.getSliceCount())}};VVVV.Nodes.GetSliceString.prototype=new VVVV.Core.Node;
VVVV.Nodes.AsValue=function(a,b){this.constructor(a,"AsValue (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[],VVVV.PinTypes.String),e=this.addInputPin("Default",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=g.getValue(c);/^\s*-?[0-9.e]+\s*$/.test(a)?f.setValue(c,parseFloat(a)):f.setValue(c,
parseFloat(e.getValue(c)))}f.setSliceCount(d)}};VVVV.Nodes.AsValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.SortString=function(a,b){this.constructor(a,"Sort (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String);this.addInputPin("Reverse Sorting",[0],VVVV.PinTypes.Value);var e=this.addOutputPin("Output",["text"],VVVV.PinTypes.String),f=this.addOutputPin("Former Index",[0],VVVV.PinTypes.Value);this.initialize=function(){};this.evaluate=function(){xxx=
g.values;for(var d=_(g.values).map(function(c,d){return[c,d]}),d=_(d).sortBy(function(c){return c[0]}),c=0;c<d.length;c++)e.setValue(c,d[c][0]),f.setValue(c,d[c][1]);e.setSliceCount(d.length);f.setSliceCount(d.length)}};VVVV.Nodes.SortString.prototype=new VVVV.Core.Node;
VVVV.Nodes.LengthString=function(a,b){this.constructor(a,"Length (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String),e=this.addOutputPin("Count",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),d=0;d<a;d++){var c=g.getValue(d);e.setValue(d,c.length)}e.setSliceCount(a)}};VVVV.Nodes.LengthString.prototype=new VVVV.Core.Node;
VVVV.Nodes.SiftString=function(a,b){this.constructor(a,"Sift (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String),e=this.addInputPin("Filter",["text"],VVVV.PinTypes.String),f=this.addInputPin("Comparison",["Matches"],VVVV.PinTypes.Enum);f.enumOptions=["Matches","Contains","MatchesAny","ContainsAny"];var d=this.addInputPin("Case Sensitive",[0],VVVV.PinTypes.Value),
c=this.addOutputPin("Hits",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Input Index",[0],VVVV.PinTypes.Value),q=this.addOutputPin("Filter Index",[0],VVVV.PinTypes.Value),n=this.addOutputPin("Found At Position",[0],VVVV.PinTypes.Value);this.evaluate=function(){var a=this.getMaxInputSliceCount();c.setSliceCount(a);var b=f.getValue(0);d.getValue(0);for(var m=0,p=0;p<a;p++){var s=g.getValue(p),u=1;if("MatchesAny"==b||"ContainsAny"==b)u=e.getSliceCount();for(var v=0,t=0;t<u;t++){var w=e.getValue(t+p),
l=[];if("Matches"==b||"MatchesAny"==b)w==s&&l.push(-1);else for(var w=RegExp(w,"gi"),A;A=w.exec(s);)l.push(A.index);for(w=0;w<l.length;w++)h.setValue(m,p%g.getSliceCount()),q.setValue(m,(p+t)%e.getSliceCount()),n.setValue(m,l[w]+1),m++,v++}c.setValue(p,v)}h.setSliceCount(m);q.setSliceCount(m);n.setSliceCount(m)}};VVVV.Nodes.SiftString.prototype=new VVVV.Core.Node;
VVVV.Nodes.SeparateString=function(a,b){this.constructor(a,"Separate (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Quotes don't work"]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String),e=this.addInputPin("Intersperse",["None"],VVVV.PinTypes.Enum);e.enumOptions="None Space Comma CommaPlusSpace Semicolon Colon Pipe UnixPath DosPath Dash NewLineAutoDetection Dot UnderScore Minus".split(" ");var f=
this.addInputPin("Intersperse String",[""],VVVV.PinTypes.String),d=this.addInputPin("Ignore between",["Double"],VVVV.PinTypes.Enum);d.enumOptions=["Single","Double"];var c=this.addInputPin("Keep Quotes",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Output",["text"],VVVV.PinTypes.String),q=this.addOutputPin("Former Index",[0],VVVV.PinTypes.Value),n={None:"",Space:" ",Comma:",",CommaPlusSpace:", ",Semicolon:";",Colon:":",Pipe:"|",UnixPath:"/",DosPath:"\\",Dash:"-",NewLineAutoDetection:"\n",Dot:".",
UnderScore:"_",Minus:"-"},k={Single:"'",Double:'"'};this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0,p=0;p<a;p++){var s=g.getValue(p),u=n[e.getValue(p)],v=f.getValue(p),t=k[d.getValue(p)],w=c.getValue(p);""==u&&(u=v);""==u&&(u=void 0);s=s.split(u);u=s.length;t=RegExp("[^"+t+"]*","g");for(v=0;v<u;v++)1==w?h.setValue(b,s[v]):h.setValue(b,s[v].match(t).join("")),q.setValue(b,p),b++}h.setSliceCount(b);q.setSliceCount(b)}};VVVV.Nodes.SeparateString.prototype=new VVVV.Core.Node;
VVVV.Nodes.EQString=function(a,b){this.constructor(a,"EQ (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input 1",[""],VVVV.PinTypes.String),e=this.addInputPin("Input 2",[""],VVVV.PinTypes.String),f=this.addInputPin("Case Sensitive",[1],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Inverse Output",[0],VVVV.PinTypes.Value);this.evaluate=
function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var n=g.getValue(b),k=e.getValue(b),r=f.getValue(b),n=n==k||0==r&&n.toLowerCase()==k.toLowerCase()?1:0;d.setValue(b,n);c.setValue(b,1-n)}d.setSliceCount(a);c.setSliceCount(a)}};VVVV.Nodes.EQString.prototype=new VVVV.Core.Node;
VVVV.Nodes.SelectString=function(a,b){this.constructor(a,"Select (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[""],VVVV.PinTypes.String),e=this.addInputPin("Select",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[""],VVVV.PinTypes.String),d=this.addOutputPin("Former Slice",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),a=0,b=0;b<c;b++)for(var n=
0;n<e.getValue(b);n++)f.setValue(a,g.getValue(b)),d.setValue(a,b),a++;f.setSliceCount(a);d.setSliceCount(a)}};VVVV.Nodes.SelectString.prototype=new VVVV.Core.Node;
VVVV.Nodes.CountString=function(a,b){this.constructor(a,"Count (String)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInputPin("Input",[""],VVVV.PinTypes.String);this.addOutputPin("Count",[1],VVVV.PinTypes.Value);this.addOutputPin("High",[0],VVVV.PinTypes.Value);this.evaluate=function(){this.inputPins.Input.pinIsChanged()&&(this.outputPins.Count.setValue(0,this.inputPins.Input.values.length),this.outputPins.High.setValue(0,
this.inputPins.Input.values.length-1))}};VVVV.Nodes.CountString.prototype=new VVVV.Core.Node;
VVVV.Nodes.CleanString=function(a,b){this.constructor(a,"Clean (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String),e=this.addOutputPin("Output",["text"],VVVV.PinTypes.String);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),d=0;d<a;d++)g.getValue(d)?e.setValue(d,g.getValue(d).trim()):e.setValue(d,void 0);e.setSliceCount(a)}};
VVVV.Nodes.CleanString.prototype=new VVVV.Core.Node;
VVVV.Nodes.AvoidNilString=function(a,b){this.constructor(a,"AvoidNIL (String)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["Kalle"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",["text"],VVVV.PinTypes.String),e=this.addInputPin("Default",["text"],VVVV.PinTypes.String),f=this.addOutputPin("Output",["text"],VVVV.PinTypes.String);this.evaluate=function(){if(g.pinIsChanged()||e.pinIsChanged()){var d=g;void 0==g.values[0]&&(d=e);for(var c=0;c<d.values.length;c++)f.setValue(c,
d.getValue(c));f.setSliceCount(d.getSliceCount())}}};VVVV.Nodes.AvoidNilString.prototype=new VVVV.Core.Node;
VVVV.Nodes.FormatValueString=function(a,b){this.constructor(a,"FormatValue (String)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:["pad function: http://stackoverflow.com/a/10073788","thousands separator regex: http://stackoverflow.com/a/2901298"],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Characters before Comma",[1],VVVV.PinTypes.Value),f=this.addInputPin("Characters after Comma",
[0],VVVV.PinTypes.Value),d=this.addInputPin("Thousands Symbol",["None"],VVVV.PinTypes.Enum);d.enumOptions=["None","Dot","Comma","Space"];var c=this.addInputPin("Comma Symbol",["Dot"],VVVV.PinTypes.Enum);c.enumOptions=["Dot","Comma"];var h=this.addInputPin("Leading Zeroes",[0],VVVV.PinTypes.Value),q=this.addOutputPin("Output",["0"],VVVV.PinTypes.String),n={Dot:".",Comma:",",None:"",Space:" "};this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var m=g.getValue(b),p=parseInt(e.getValue(b)),
s=parseInt(f.getValue(b)),u=d.getValue(b),v=c.getValue(b),t=h.getValue(b),p=p+s+(0<s),m=parseFloat(m).toFixed(s),t=t=0.5<=t?"0":" ",m=m+"",m=m.length>=p?m:Array(p-m.length+1).join(t)+m,m=m.replace(".",n[v]).replace(/\B(?=(\d{3})+(?!\d))/g,n[u]);q.setValue(b,m)}q.setSliceCount(a)}};VVVV.Nodes.FormatValueString.prototype=new VVVV.Core.Node;VVVV.Nodes.MouseGlobal=function(a,b){this.constructor(a,"Mouse (System Global)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Cyclic mode not supported","No Mouse Wheel pin","No Left Button Pin","No Right Button Pin","No Middle Button Pin"]};this.auto_evaluate=!0;var g=this.addOutputPin("X",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Mouse Wheel",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Left Button",
[0],VVVV.PinTypes.Value),c=this.addOutputPin("Middle Button",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Right Button",[0],VVVV.PinTypes.Value),q=0,n=0,k=0,r=0,m=0,p=0;$(document).mousemove(function(c){q=2*c.pageX/parseInt($("body").css("width"))-1;n=-(2*c.pageY/parseInt($("body").css("height"))-1)});$(document).bind("mousewheel",function(c){k+=c.originalEvent.wheelDelta/120});$(document).bind("DOMMouseScroll",function(c){k+=-c.originalEvent.detail/3});$(document).mousedown(function(c){switch(c.which){case 1:r=
1;break;case 2:m=1;break;case 3:p=1}});$(document).mouseup(function(c){switch(c.which){case 1:r=0;break;case 2:m=0;break;case 3:p=0}});this.evaluate=function(){g.getValue(0)!=q&&g.setValue(0,q);e.getValue(0)!=n&&e.setValue(0,n);f.getValue(0)!=k&&f.setValue(0,k);d.getValue(0)!=r&&d.setValue(0,r);c.getValue(0)!=m&&c.setValue(0,m);h.getValue(0)!=p&&h.setValue(0,p)}};VVVV.Nodes.MouseGlobal.prototype=new VVVV.Core.Node;
VVVV.Nodes.MouseWindow=function(a,b){this.constructor(a,"Mouse (System Window)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Cyclic mode not supported","No Mouse Wheel pin","No Left Button Pin","No Right Button Pin","No Middle Button Pin"]};this.auto_evaluate=!0;var g=this.addOutputPin("X",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Mouse Wheel",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Left Button",
[0],VVVV.PinTypes.Value),c=this.addOutputPin("Middle Button",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Right Button",[0],VVVV.PinTypes.Value);this.evaluate=function(){g.getValue(0)!=VVVV.MousePositions._all.x&&g.setValue(0,VVVV.MousePositions._all.x);e.getValue(0)!=VVVV.MousePositions._all.y&&e.setValue(0,VVVV.MousePositions._all.y);f.getValue(0)!=VVVV.MousePositions._all.wheel&&f.setValue(0,VVVV.MousePositions._all.wheel);d.getValue(0)!=VVVV.MousePositions._all.lb&&d.setValue(0,VVVV.MousePositions._all.lb);
c.getValue(0)!=VVVV.MousePositions._all.mb&&c.setValue(0,VVVV.MousePositions._all.mb);h.getValue(0)!=VVVV.MousePositions._all.rb&&h.setValue(0,VVVV.MousePositions._all.rb)}};VVVV.Nodes.MouseWindow.prototype=new VVVV.Core.Node;
VVVV.Nodes.ShellExecute=function(a,b){this.constructor(a,"ShellExecute (Windows)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["This actually does something completely different from the original node: the origin node executes a shell command, this node evals javascript code"]};var g=this.addInputPin("File",[0],VVVV.PinTypes.String),e=this.addInputPin("Do Execute",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Result",[""],VVVV.PinTypes.String);
this.evaluate=function(){if(1<=Math.round(e.getValue(0))){var d=eval(g.getValue(0));d instanceof Array||d instanceof Object||(d=[d]);if(void 0!=d)for(var c=0;c<d.length;c++)f.setValue(c,d[c])}}};VVVV.Nodes.ShellExecute.prototype=new VVVV.Core.Node;
VVVV.Nodes.ScreenInfo=function(a,b){this.constructor(a,"ScreenInfo (Windows)",b);this.meta={authors:["David M\u00f3r\u00e1sz (micro.D)"],original_authors:["VVVV Group"],credits:["Matthias Zauner"],compatibility_issues:["Outputs the window size (ResolutionXY) and the document size (Working AreaXY) only","no Bits per pixel"]};var g=this.addOutputPin("ResolutionXY",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Working AreaXY",[0],VVVV.PinTypes.Value),f=0,d=0,c=0,h=0;$(document).ready(function(){d=$(window).height();
f=$(window).width();h=$(document).height();c=$(document).width()});$(window).resize(function(){d=$(window).height();f=$(window).width();h=$(document).height();c=$(document).width()});this.evaluate=function(){if(g.getValue(0)!=f||g.getValue(1)!=d)g.setValue(0,f),g.setValue(1,d);if(e.getValue(0)!=c||e.getValue(1)!=h)e.setValue(0,c),e.setValue(1,h)}};VVVV.Nodes.ScreenInfo.prototype=new VVVV.Core.Node;VVVV.PinTypes.Transform={typeName:"Transform",reset_on_disconnect:!0,defaultValue:function(){return mat4.identity(mat4.create())}};
VVVV.Nodes.Rotate=function(a,b){this.constructor(a,"Rotate (Transform)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};mat4.identity(mat4.create());this.trIn=this.addInputPin("Transform In",[],VVVV.PinTypes.Transform);this.xIn=this.addInputPin("X",[0],VVVV.PinTypes.Value);this.yIn=this.addInputPin("Y",[0],VVVV.PinTypes.Value);this.zIn=this.addInputPin("Z",[0],VVVV.PinTypes.Value);this.trOut=this.addOutputPin("Transform Out",[],VVVV.PinTypes.Transform);
this.evaluate=function(){for(var a=this.trIn.isConnected()?this.getMaxInputSliceCount():Math.max(this.xIn.getSliceCount(),this.yIn.getSliceCount(),this.zIn.getSliceCount()),b=0;b<a;b++){var f=this.inputPins["Transform In"].getValue(b),d=parseFloat(this.inputPins.X.getValue(b)),c=parseFloat(this.inputPins.Y.getValue(b)),h=parseFloat(this.inputPins.Z.getValue(b)),q=mat4.create();mat4.identity(q);mat4.rotate(q,2*c*Math.PI,[0,1,0]);mat4.rotate(q,2*d*Math.PI,[1,0,0]);mat4.rotate(q,2*h*Math.PI,[0,0,1]);
this.trIn.isConnected()&&mat4.multiply(f,q,q);this.trOut.setValue(b,q)}this.trOut.setSliceCount(a)}};VVVV.Nodes.Rotate.prototype=new VVVV.Core.Node;
VVVV.Nodes.Translate=function(a,b){this.constructor(a,"Translate (Transform)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};mat4.identity(mat4.create());this.trIn=this.addInputPin("Transform In",[],VVVV.PinTypes.Transform);this.xIn=this.addInputPin("X",[0],VVVV.PinTypes.Value);this.yIn=this.addInputPin("Y",[0],VVVV.PinTypes.Value);this.zIn=this.addInputPin("Z",[0],VVVV.PinTypes.Value);this.trOut=this.addOutputPin("Transform Out",[],VVVV.PinTypes.Transform);
this.evaluate=function(){for(var a=this.trIn.isConnected()?this.getMaxInputSliceCount():Math.max(this.xIn.getSliceCount(),this.yIn.getSliceCount(),this.zIn.getSliceCount()),b=0;b<a;b++){var f=parseFloat(this.xIn.getValue(b)),d=parseFloat(this.yIn.getValue(b)),c=parseFloat(this.zIn.getValue(b)),h=mat4.create();mat4.identity(h);mat4.translate(h,[f,d,c]);this.trIn.isConnected()&&(f=this.trIn.getValue(b),mat4.multiply(f,h,h));this.trOut.setValue(b,h)}this.trOut.setSliceCount(a)}};
VVVV.Nodes.Translate.prototype=new VVVV.Core.Node;
VVVV.Nodes.Scale=function(a,b){this.constructor(a,"Scale (Transform)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};mat4.identity(mat4.create());this.trIn=this.addInputPin("Transform In",[],VVVV.PinTypes.Transform);this.xIn=this.addInputPin("X",[1],VVVV.PinTypes.Value);this.yIn=this.addInputPin("Y",[1],VVVV.PinTypes.Value);this.zIn=this.addInputPin("Z",[1],VVVV.PinTypes.Value);this.trOut=this.addOutputPin("Transform Out",[],VVVV.PinTypes.Transform);
this.evaluate=function(){for(var a=this.trIn.isConnected()?this.getMaxInputSliceCount():Math.max(this.xIn.getSliceCount(),this.yIn.getSliceCount(),this.zIn.getSliceCount()),b=0;b<a;b++){var f=parseFloat(this.inputPins.X.getValue(b)),d=parseFloat(this.inputPins.Y.getValue(b)),c=parseFloat(this.inputPins.Z.getValue(b)),h=mat4.create();mat4.identity(h);mat4.scale(h,[f,d,c]);this.inputPins["Transform In"].isConnected()&&(f=this.inputPins["Transform In"].getValue(b),mat4.multiply(f,h,h));this.trOut.setValue(b,
h)}this.trOut.setSliceCount(a)}};VVVV.Nodes.Scale.prototype=new VVVV.Core.Node;
VVVV.Nodes.Perspective=function(a,b){this.constructor(a,"Perspective (Transform)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Not spreadable"]};mat4.identity(mat4.create());this.addInputPin("Transform In",[],VVVV.PinTypes.Transform);this.addInputPin("FOV",[0.25],VVVV.PinTypes.Value);this.addInputPin("Near Plane",[0.05],VVVV.PinTypes.Value);this.addInputPin("Far Plane",[100],VVVV.PinTypes.Value);this.addOutputPin("Transform Out",[],VVVV.PinTypes.Transform);
this.evaluate=function(){var a=parseFloat(this.inputPins.FOV.getValue(0)),b=parseFloat(this.inputPins["Near Plane"].getValue(0)),f=parseFloat(this.inputPins["Far Plane"].getValue(0)),d=mat4.create();mat4.identity(d);mat4.perspective(360*a,1,b,f,d);this.inputPins["Transform In"].isConnected()&&(a=this.inputPins["Transform In"].getValue(0),mat4.multiply(a,d,d));this.outputPins["Transform Out"].setValue(0,d)}};VVVV.Nodes.Perspective.prototype=new VVVV.Core.Node;
VVVV.Nodes.InverseTransform=function(a,b){this.constructor(a,"Inverse (Transform)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Transform In",[],VVVV.PinTypes.Transform),e=this.addInputPin("Source",[],VVVV.PinTypes.Transform),f=this.addOutputPin("Transform Out",[],VVVV.PinTypes.Transform);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=mat4.create();mat4.set(e.getValue(c),a);
mat4.multiply(g.getValue(c),mat4.inverse(a,a),a);f.setValue(c,a)}f.setSliceCount(d)}};VVVV.Nodes.InverseTransform.prototype=new VVVV.Core.Node;VVVV.Nodes.AddValue=function(a,b){this.constructor(a,"Add (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInvisiblePin("Input Count",[2],VVVV.PinTypes.Value),e=[],f;this.initialize=function(){f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);for(var d=g.getValue(0),c=0;c<d;c++){var a=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);e[c]=a}};this.evaluate=function(){var d=this.getMaxInputSliceCount();
f.setSliceCount(d);for(var c=0;c<d;c++){for(var a=parseFloat(e[0].getValue(c)),b=1;b<e.length;b++)a+=parseFloat(e[b].getValue(c));f.setValue(c,a)}}};VVVV.Nodes.AddValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.SubtractValue=function(a,b){this.constructor(a,"Subtract (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInvisiblePin("Input Count",[2],VVVV.PinTypes.Value),e=[],f;this.initialize=function(){f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);for(var d=g.getValue(0),c=0;c<d;c++){var a=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);e[c]=a}};this.evaluate=function(){var d=this.getMaxInputSliceCount();
f.setSliceCount(d);for(var c=0;c<d;c++){for(var a=parseFloat(e[0].getValue(c)),b=1;b<e.length;b++)a-=parseFloat(e[b].getValue(c));f.setValue(c,a)}}};VVVV.Nodes.SubtractValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.EqValue=function(a,b){this.constructor(a,"EQ (Value)",b);this.meta={authors:["Matthias Zauner","Fibo"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input 1",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[0],VVVV.PinTypes.Value),f=this.addInputPin("Epsilon",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),c=this.addOutputPin("Inverse Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),
b=0;b<a;b++){var n=0;Math.abs(g.getValue(b)-e.getValue(b))<=Math.abs(f.getValue(b))&&(n=1);d.setValue(b,n);c.setValue(b,1-n)}d.setSliceCount(a);c.setSliceCount(a)}};VVVV.Nodes.EqValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.GtValue=function(a,b){this.constructor(a,"GT (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Input 1",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=0;parseFloat(g.getValue(c))>parseFloat(e.getValue(c))&&
(a=1);f.setValue(c,a)}f.setSliceCount(d)}};VVVV.Nodes.GtValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.LtValue=function(a,b){this.constructor(a,"LT (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Input 1",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=0;parseFloat(g.getValue(c))<parseFloat(e.getValue(c))&&
(a=1);f.setValue(c,a)}f.setSliceCount(d)}};VVVV.Nodes.LtValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.MultiplyValue=function(a,b){this.constructor(a,"Multiply (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInvisiblePin("Input Count",[2],VVVV.PinTypes.Value),e=[],f;this.initialize=function(){f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);for(var d=g.getValue(0),c=0;c<d;c++){var a=this.addInputPin("Input "+(c+1),[1],VVVV.PinTypes.Value);e[c]=a}};this.evaluate=function(){var d=this.getMaxInputSliceCount();
f.setSliceCount(d);for(var c=0;c<d;c++){for(var a=parseFloat(e[0].getValue(c)),b=1;b<e.length;b++)a*=parseFloat(e[b].getValue(c));f.setValue(c,a)}}};VVVV.Nodes.MultiplyValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.DivideValue=function(a,b){this.constructor(a,"Divide (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInvisiblePin("Inputs Count",[2],VVVV.PinTypes.Value);var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Input 2",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.initialize=function(){};this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),
c=0;c<d;c++)0==e.getValue(c)?f.setValue(c,1):f.setValue(c,g.getValue(c)/e.getValue(c));f.setSliceCount(d)}};VVVV.Nodes.DivideValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.IOBoxValueAdvanced=function(a,b){this.constructor(a,"IOBox (Value Advanced)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInputPin("Y Input Value",[0],VVVV.PinTypes.Value);this.addInvisiblePin("Rows",[1],VVVV.PinTypes.Value);this.addOutputPin("Y Output Value",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.inputPins["Y Input Value"].getSliceCount(),b,f=0;f<a;f++)b=parseFloat(this.inputPins["Y Input Value"].getValue(f)),
isFinite(b)||(b=0),this.outputPins["Y Output Value"].setValue(f,b);this.outputPins["Y Output Value"].setSliceCount(this.inputPins["Y Input Value"].getSliceCount())}};VVVV.Nodes.IOBoxValueAdvanced.prototype=new VVVV.Core.Node;
VVVV.Nodes.CountValue=function(a,b){this.constructor(a,"Count (Value)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInputPin("Input",[0],VVVV.PinTypes.Value);this.addOutputPin("Count",[1],VVVV.PinTypes.Value);this.addOutputPin("High",[0],VVVV.PinTypes.Value);this.evaluate=function(){this.inputPins.Input.pinIsChanged()&&(this.outputPins.Count.setValue(0,this.inputPins.Input.values.length),this.outputPins.High.setValue(0,
this.inputPins.Input.values.length-1))}};VVVV.Nodes.CountValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.SwitchValueInput=function(a,b){this.constructor(a,"Switch (Value Input)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No dynamic pin count yet"]};var g=this.addInputPin("Switch",[0],VVVV.PinTypes.Value),e=[];e[0]=this.addInputPin("Input 1",[0],VVVV.PinTypes.Value);e[1]=this.addInputPin("Input 2",[0],VVVV.PinTypes.Value);var f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),
c=0;c<d;c++)f.setValue(c,e[Math.round(Math.abs(g.getValue(c)))%e.length].getValue(c));f.setSliceCount(d)}};VVVV.Nodes.SwitchValueInput.prototype=new VVVV.Core.Node;
VVVV.Nodes.SelectValue=function(a,b){this.constructor(a,"Select (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Select",[1],VVVV.PinTypes.Value),f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Former Slice",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),a=0,b=0;b<c;b++)for(var n=0;n<e.getValue(b);n++)f.setValue(a,
parseFloat(g.getValue(b))),d.setValue(a,b),a++;f.setSliceCount(a);d.setSliceCount(a)}};VVVV.Nodes.SelectValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.AsString=function(a,b){this.constructor(a,"AsString (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["SubType not implemented, always returns float formatting"]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("SubType",["Real (MinFloat .. MaxFloat)"],VVVV.PinTypes.Enum);e.enumOptions=["Real (MinFloat .. MaxFloat)","Integer (MinInt .. MaxInt)"];var f=this.addOutputPin("Output",[0],VVVV.PinTypes.String);
this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){subtype=e.getValue(c).match(/^(.+) \(/)[1];var a;switch(subtype){case "Real":a=parseFloat(g.getValue(c)).toFixed(4);break;case "Integer":a=parseInt(g.getValue(c)).toFixed(0)}f.setValue(c,a)}f.setSliceCount(d)}};VVVV.Nodes.AsString.prototype=new VVVV.Core.Node;
VVVV.Nodes.Frac=function(a,b){this.constructor(a,"Frac (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Whole Part",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Real Part",[0.5],VVVV.PinTypes.Value);this.evaluate=function(){for(var d=this.getMaxInputSliceCount(),c=0;c<d;c++){var a=parseFloat(g.getValue(c));e.setValue(c,Math.floor(a));f.setValue(c,a-Math.floor(a))}e.setSliceCount(d);
f.setSliceCount(d)}};VVVV.Nodes.Frac.prototype=new VVVV.Core.Node;
VVVV.Nodes.AddValueSpectral=function(a,b){this.constructor(a,"Add (Value Spectral)",b);this.meta={authors:["David M\u00f3r\u00e1sz (micro.D)","Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.addInputPin("Input",[0],VVVV.PinTypes.Value);this.addInputPin("Bin Size",[-1],VVVV.PinTypes.Value);this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0,f=0,d=0;d<a||0<this.inputPins["Bin Size"].getValue(0)&&
(0<f||0!=b%this.inputPins["Bin Size"].values.length);d++){if(0==f)var c=0;c+=parseFloat(this.inputPins.Input.getValue(d));f++;0<this.inputPins["Bin Size"].getValue(0)?f>=this.inputPins["Bin Size"].getValue(b)&&(this.outputPins.Output.setValue(b,c),b++,f=0):this.outputPins.Output.setValue(0,c)}this.outputPins.Output.setSliceCount(b+(0<f))}};VVVV.Nodes.AddValueSpectral.prototype=new VVVV.Core.Node;
VVVV.Nodes.WaveShaperValue=function(a,b){this.constructor(a,"WaveShaper (Value)",b);this.meta={authors:["sebl"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Shape",["Linear"],VVVV.PinTypes.Enum);e.enumOptions=["Linear","Inverse","Triangle","Sine","Rectangle"];var f=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.initialize=function(){};this.evaluate=function(){for(var d=
this.getMaxInputSliceCount(),c=0;c<d;c++){var a=parseFloat(g.getValue(c));switch(e.getValue(c)){case "Linear":f.setValue(c,a);break;case "Inverse":f.setValue(c,1-a);break;case "Triangle":0.5>a?f.setValue(c,2*a):f.setValue(c,2*(1-a));break;case "Sine":inp=6.28318530717959*((a+0.25)%1);f.setValue(c,Math.sin(inp)/2+0.5);break;case "Rectangle":0.5>a?f.setValue(c,0):f.setValue(c,1)}}f.setSliceCount(d)}};VVVV.Nodes.WaveShaperValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.MapValue=function(a,b){this.constructor(a,"Map (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Mirror Mapping Mode not implemented"]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0.5],VVVV.PinTypes.Value),e=this.addInputPin("Source Minimum",[0],VVVV.PinTypes.Value),f=this.addInputPin("Source Maximum",[1],VVVV.PinTypes.Value),d=this.addInputPin("Destination Minimum",[0],VVVV.PinTypes.Value),c=this.addInputPin("Destination Maximum",
[1],VVVV.PinTypes.Value),h=this.addInputPin("Mapping",["Float"],VVVV.PinTypes.Enum);h.enumOptions=["Float","Wrap","Clamp"];var q=this.addOutputPin("Output",[0.5],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var r=parseFloat(g.getValue(b)),m=parseFloat(e.getValue(b)),p=parseFloat(f.getValue(b)),s=parseFloat(d.getValue(b)),u=parseFloat(c.getValue(b)),v=h.getValue(b);if(p==m)q.setValue(b,s);else{r-=m;p-=m;switch(v){case "Clamp":r=Math.max(0,Math.min(p,
r));break;case "Wrap":r=(p+r%p)%p}q.setValue(b,r*((u-s)/p)+s)}}q.setSliceCount(a)}};VVVV.Nodes.MapValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.MinValue=function(a,b){this.constructor(a,"Min (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),e=this.addInvisiblePin("Input Count",[0],VVVV.PinTypes.Value),f=[];this.initialize=function(){for(var a=Math.max(2,e.getValue(0)),c=f.length;c<a;c++)f[c]=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);f.length=a};this.evaluate=function(){e.pinIsChanged()&&
this.initialize();for(var a=this.getMaxInputSliceCount(),c=0;c<a;c++){for(var b=void 0,q=0;q<f.length;q++)if(void 0==b||f[q].getValue(c)<b)b=f[q].getValue(c);g.setValue(c,b)}g.setSliceCount(a)}};VVVV.Nodes.MinValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.MaxValue=function(a,b){this.constructor(a,"Max (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),e=this.addInvisiblePin("Input Count",[0],VVVV.PinTypes.Value),f=[];this.initialize=function(){for(var a=Math.max(2,e.getValue(0)),c=f.length;c<a;c++)f[c]=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);f.length=a};this.evaluate=function(){e.pinIsChanged()&&
this.initialize();for(var a=this.getMaxInputSliceCount(),c=0;c<a;c++){for(var b=void 0,q=0;q<f.length;q++)if(void 0==b||f[q].getValue(c)>b)b=f[q].getValue(c);g.setValue(c,b)}g.setSliceCount(a)}};VVVV.Nodes.MaxValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.ModValue=function(a,b){this.constructor(a,"Mod (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),e=this.addInvisiblePin("Input Count",[0],VVVV.PinTypes.Value),f=[];this.initialize=function(){for(var a=Math.max(2,e.getValue(0)),c=f.length;c<a;c++)f[c]=this.addInputPin("Input "+(c+1),[0],VVVV.PinTypes.Value);f.length=a};this.evaluate=function(){e.pinIsChanged()&&
this.initialize();for(var a=this.getMaxInputSliceCount(),c=0;c<a;c++){for(var b=f[0].getValue(c),q=1;q<f.length;q++)b=0==f[q].getValue(c)?0:b%f[q].getValue(c);g.setValue(c,b)}g.setSliceCount(a)}};VVVV.Nodes.ModValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.PowerValue=function(a,b){this.constructor(a,"Power (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),e=this.addInvisiblePin("Input Count",[0],VVVV.PinTypes.Value),f=[];this.initialize=function(){for(var a=Math.max(2,e.getValue(0)),c=f.length;c<a;c++)f[c]=this.addInputPin("Input "+(c+1),[1],VVVV.PinTypes.Value);f.length=a};this.evaluate=function(){e.pinIsChanged()&&
this.initialize();for(var a=this.getMaxInputSliceCount(),c=0;c<a;c++){for(var b=f[0].getValue(c),q=1;q<f.length;q++)b=Math.pow(b,f[q].getValue(c));g.setValue(c,b)}g.setSliceCount(a)}};VVVV.Nodes.PowerValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.RandomValue=function(a,b){this.constructor(a,"Random (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!0;var g=this.addInputPin("Enabled",[1],VVVV.PinTypes.Value),e=this.addInputPin("Is Integer",[0],VVVV.PinTypes.Value),f=this.addInputPin("Scale",[1],VVVV.PinTypes.Value),d=this.addInputPin("Prevent from doubles",[1],VVVV.PinTypes.Value),c=this.addOutputPin("Output",[0],VVVV.PinTypes.Value);this.evaluate=
function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){var n=g.getValue(b),k=e.getValue(b),r=f.getValue(b),m=d.getValue(b),p=c.values[b];void 0==p&&c.setValue(b,0);if(0.5<=n){p=c.values[b];do n=Math.random()*r,0.5<=k&&(n=Math.round(n));while(0.5<=m&&n==p);c.setValue(b,n)}}c.setSliceCount(a)}};VVVV.Nodes.RandomValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.SignValue=function(a,b){this.constructor(a,"Sign (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Sign Part",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Absolute Part",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),c=0;c<a;c++){var b=g.getValue(c);e.setValue(c,0==b?0:b/Math.abs(b));
f.setValue(c,Math.abs(b))}f.setSliceCount(a)}};VVVV.Nodes.SignValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.InputMorphValue=function(a,b){this.constructor(a,"InputMorph (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Switch",[0],VVVV.PinTypes.Value),e=this.addOutputPin("Output",[0],VVVV.PinTypes.Value),f=this.addInvisiblePin("Input Count",[0],VVVV.PinTypes.Value),d=[];this.initialize=function(){for(var c=Math.max(2,f.getValue(0)),a=d.length;a<c;a++)d[a]=this.addInputPin("Input "+
(a+1),[0],VVVV.PinTypes.Value);d.length=c};this.evaluate=function(){f.pinIsChanged()&&this.initialize();for(var c=this.getMaxInputSliceCount(),a,b,n,k=0;k<c;k++)a=g.getValue(k),b=((Math.floor(a)+d.length)%d.length+d.length)%d.length,n=((Math.ceil(a)+d.length)%d.length+d.length)%d.length,a-=Math.floor(a),e.setValue(k,(1-a)*d[b].getValue(k)+a*d[n].getValue(k));e.setSliceCount(c)}};VVVV.Nodes.InputMorphValue.prototype=new VVVV.Core.Node;
VVVV.Nodes.Sift=function(a,b){this.constructor(a,"Sift (Value)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.auto_evaluate=!1;var g=this.addInputPin("Input",[0],VVVV.PinTypes.Value),e=this.addInputPin("Filter",[0],VVVV.PinTypes.Value),f=this.addInputPin("Epsilon",[0],VVVV.PinTypes.Value),d=this.addInputPin("Find",["First"],VVVV.PinTypes.Enum);d.enumOptions=["First","Last","All"];var c=this.addOutputPin("Hits",[0],VVVV.PinTypes.Value),
h=this.addOutputPin("Input Index",[0],VVVV.PinTypes.Value),q=this.addOutputPin("Filter Index",[0],VVVV.PinTypes.Value);this.evaluate=function(){this.getMaxInputSliceCount();var a=g.getSliceCount(),b=e.getSliceCount();c.setSliceCount(a);f.getValue(0);for(var r=d.getValue(0),m={},p=0,s=0;s<a;s++){var u=s;"Last"==r&&(u=a-s-1);var v=g.getValue(u);if("All"!=r){if(m[v]){c.setValue(u,0);continue}m[v]=!0}for(var t=0,w=0;w<b;w++)if(filter=e.getValue(w),filter==v){h.setValue(p,u);q.setValue(p,w);p++;t++;break}c.setValue(u,
t)}h.setSliceCount(p);q.setSliceCount(p)}};VVVV.Nodes.Sift.prototype=new VVVV.Core.Node;VVVV.Nodes.Join2dVector=function(a,b){this.constructor(a,"Vector (2d Join)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("X",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addOutputPin("XY",[0,0],VVVV.PinTypes.Value);this.evaluate=function(){var a=this.getMaxInputSliceCount();f.setSliceCount(2*a);for(var c=0;c<a;c++)f.setValue(2*c,g.getValue(c)),f.setValue(2*c+1,e.getValue(c))}};
VVVV.Nodes.Join2dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Join3dVector=function(a,b){this.constructor(a,"Vector (3d Join)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("X",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addInputPin("Z",[0],VVVV.PinTypes.Value),d=this.addOutputPin("XYZ",[0,0,0],VVVV.PinTypes.Value);this.evaluate=function(){var c=this.getMaxInputSliceCount();d.setSliceCount(3*c);for(var a=0;a<c;a++)d.setValue(3*
a,g.getValue(a)),d.setValue(3*a+1,e.getValue(a)),d.setValue(3*a+2,f.getValue(a))}};VVVV.Nodes.Join3dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Join4dVector=function(a,b){this.constructor(a,"Vector (4d Join)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("X",[0],VVVV.PinTypes.Value),e=this.addInputPin("Y",[0],VVVV.PinTypes.Value),f=this.addInputPin("Z",[0],VVVV.PinTypes.Value),d=this.addInputPin("W",[0],VVVV.PinTypes.Value),c=this.addOutputPin("XYZW",[0,0,0,1],VVVV.PinTypes.Value);this.evaluate=function(){var a=this.getMaxInputSliceCount();
c.setSliceCount(4*a);for(var b=0;b<a;b++)c.setValue(4*b,g.getValue(b)),c.setValue(4*b+1,e.getValue(b)),c.setValue(4*b+2,f.getValue(b)),c.setValue(4*b+3,d.getValue(b))}};VVVV.Nodes.Join4dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Split2dVector=function(a,b){this.constructor(a,"Vector (2d Split)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("XY",[0],VVVV.PinTypes.Value),e=this.addOutputPin("X",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Y",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),c=0,b=0;b<a;b+=2)e.setValue(c,g.getValue(b)),f.setValue(c,g.getValue(b+1)),c++;e.setSliceCount(c);
f.setSliceCount(c)}};VVVV.Nodes.Split2dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Split3dVector=function(a,b){this.constructor(a,"Vector (3d Split)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("XYZ",[0],VVVV.PinTypes.Value),e=this.addOutputPin("X",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Z",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var c=this.getMaxInputSliceCount(),a=0,b=0;b<c;b+=3)e.setValue(a,g.getValue(b)),f.setValue(a,
g.getValue(b+1)),d.setValue(a,g.getValue(b+2)),a++;e.setSliceCount(a);f.setSliceCount(a);d.setSliceCount(a)}};VVVV.Nodes.Split3dVector.prototype=new VVVV.Core.Node;
VVVV.Nodes.Split4dVector=function(a,b){this.constructor(a,"Vector (4d Split)",b);this.meta={authors:["Julien Vulliet"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[""]};var g=this.addInputPin("XYZW",[0,0,0,1],VVVV.PinTypes.Value),e=this.addOutputPin("X",[0],VVVV.PinTypes.Value),f=this.addOutputPin("Y",[0],VVVV.PinTypes.Value),d=this.addOutputPin("Z",[0],VVVV.PinTypes.Value),c=this.addOutputPin("W",[0],VVVV.PinTypes.Value);this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),
b=0,n=0;n<a;n+=4)e.setValue(b,g.getValue(n)),f.setValue(b,g.getValue(n+1)),d.setValue(b,g.getValue(n+2)),c.setValue(b,g.getValue(n+3)),b++;e.setSliceCount(b);f.setSliceCount(b);d.setSliceCount(b);c.setSliceCount(b)}};VVVV.Nodes.Split4dVector.prototype=new VVVV.Core.Node;VVVV.ShaderCodeResources={};VVVV.Types.ShaderCodeResource=function(){var a="";this.relatedNodes=[];this.definingNode=void 0;this.setSourceCode=function(b){a=b;for(b=0;b<this.relatedNodes.length;b++)this.relatedNodes[b].shaderSourceUpdated(a)};this.addRelatedNode=function(b){this.relatedNodes.push(b);""!=a&&b.shaderSourceUpdated(a)}};var identity=mat4.identity(mat4.create());
VVVV.Types.WebGlRenderState=function(){this.alphaBlending=!0;this.srcBlendMode="SRC_ALPHA";this.destBlendMode="ONE_MINUS_SRC_ALPHA";this.enableZWrite=!0;this.depthFunc="LEQUAL";this.depthOffset=0;this.polygonDrawMode="TRIANGLES";this.copy_attributes=function(a){this.alphaBlending=a.alphaBlending;this.alphaFunc=a.alphaFunc;this.srcBlendMode=a.srcBlendMode;this.destBlendMode=a.destBlendMode;this.enableZwrite=a.enableZWrite;this.depthFunc=a.depthFunc;this.depthOffset=a.depthOffset;this.polygonDrawMode=
a.polygonDrawMode};this.apply=function(a){this.alphaBlending?a.enable(a.BLEND):a.disable(a.BLEND);a.blendFunc(a[this.srcBlendMode],a[this.destBlendMode]);a.depthMask(this.enableZWrite)}};
VVVV.Types.VertexBuffer=function(a,b){this.vbo=void 0;this.subBuffers={};this.length=0;this.setSubBuffer=function(a,b,f){this.subBuffers[a]={usage:a,data:new Float32Array(f),size:b,offset:this.length};this.length+=this.subBuffers[a].data.byteLength};this.setSubBuffer("POSITION",3,b);this.create=function(){this.vbo=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,this.vbo);a.bufferData(a.ARRAY_BUFFER,this.length,a.STATIC_DRAW);_(this.subBuffers).each(function(b){a.bufferSubData(a.ARRAY_BUFFER,b.offset,
b.data)})}};VVVV.Types.Mesh=function(a,b,g){this.vertexBuffer=b;this.indexBuffer=a.createBuffer();a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer);a.bufferData(a.ELEMENT_ARRAY_BUFFER,new Uint16Array(g),a.STATIC_DRAW);this.numIndices=g.length};VVVV.Types.Layer=function(){this.mesh=null;this.textures=[];this.shader=null;this.uniforms={};this.uniformNames=[];this.renderState=defaultWebGlRenderState;this.toString=function(){return"Layer"}};
VVVV.PinTypes.WebGlResource={typeName:"WebGlResource",reset_on_disconnect:!0,connectionChangedHandlers:{webglresource:function(){function a(a){return"WebGlResource"==a||"WebGlTexture"==a}if(this.direction!=PinDirection.Input){var b=this.node,g=b.findDownstreamNodes("Renderer (EX9)");b.renderContexts||(b.renderContexts=[]);void 0==b.contextChanged&&(b.contextChanged=!1);for(var e=0;e<g.length;e++)b.contextChanged|=!b.renderContexts[e]||b.renderContexts[e].canvas.id!=g[e].ctxt.id,b.renderContexts[e]=
g[e].ctxt,b.dirty=!0;b.renderContexts.length!=g.length&&(b.renderContexts.length=g.length,b.contextChanged=!0,b.dirty=!0);b.isSubpatch||_(b.inputPins).each(function(f){var d;f.markPinAsChanged();"Renderer (EX9)"!=b.nodename&&f.isConnected()&&(0<f.links.length?d=f.links[0].fromPin:0<f.masterPin.links[0].fromPin.links.length&&(d=f.masterPin.links[0].fromPin),d&&a(d.typeName)&&d.connectionChanged())});this.masterPin&&a(this.masterPin.typeName)&&this.masterPin.connectionChanged()}}},defaultValue:function(){return new VVVV.Types.Layer}};
VVVV.PinTypes.WebGlTexture={typeName:"WebGlTexture",reset_on_disconnect:!0,connectionChangedHandlers:{webglresource:VVVV.PinTypes.WebGlResource.connectionChangedHandlers.webglresource},defaultValue:function(){return VVVV.DefaultTexture}};var defaultWebGlRenderState=new VVVV.Types.WebGlRenderState;VVVV.PinTypes.WebGlRenderState={typeName:"WebGlRenderState",reset_on_disconnect:!0,defaultValue:function(){return defaultWebGlRenderState}};VVVV.DefaultTexture="Empty Texture";
VVVV.Types.ShaderProgram=function(){this.uniformSpecs={};this.attributeSpecs={};this.attribSemanticMap={};this.uniformSemanticMap={};var a="",b="",g,e;this.isSetup=!1;this.shaderProgram=void 0;this.log="";var f=this;this.extractSemantics=function(a){f.attributeSpecs={};f.attribSemanticMap={};f.uniformSpecs={};f.uniformSemanticMap={};for(var c=/(uniform|attribute) ([a-zA-Z]+)([0-9xD]*) ([a-zA-Z0-9_]+)( : ([A-Z0-9]+))?( = \{?([^;\}]+)\}?)?;/g,b;b=c.exec(a);)"attribute"!=b[1]||f.attributeSpecs[b[4]]?
"uniform"!=b[1]||f.uniformSpecs[b[4]]||(f.uniformSpecs[b[4]]={varname:b[4],semantic:b[6],position:0,type:b[2],defaultValue:b[8],dimension:""==b[3]?1:b[3]},void 0!=b[6]&&(f.uniformSemanticMap[b[6]]=b[4])):(f.attributeSpecs[b[4]]={varname:b[4],semantic:b[6],position:0},void 0!=b[6]&&(f.attribSemanticMap[b[6]]=b[4]))};this.setVertexShader=function(b){a=b};this.setFragmentShader=function(a){b=a};this.setup=function(d){this.log="";g=d.createShader(d.VERTEX_SHADER);d.shaderSource(g,a.replace(/((uniform|attribute) [a-zA-Z0-9]+ [a-zA-Z0-9_]+)[^;]*/g,
"$1"));d.compileShader(g);d.getShaderParameter(g,d.COMPILE_STATUS)||(this.log=d.getShaderInfoLog(g),console.log(this.log));e=d.createShader(d.FRAGMENT_SHADER);d.shaderSource(e,b.replace(/((uniform|attribute) [a-zA-Z0-9]+ [a-zA-Z0-9_]+)[^;]*/g,"$1"));d.compileShader(e);d.getShaderParameter(e,d.COMPILE_STATUS)||(this.log=d.getShaderInfoLog(e),console.log(this.log));this.shaderProgram=d.createProgram();d.attachShader(this.shaderProgram,g);d.attachShader(this.shaderProgram,e);d.linkProgram(this.shaderProgram);
d.getProgramParameter(this.shaderProgram,d.LINK_STATUS)||console.log("Could not initialise shaders");_(this.attributeSpecs).each(function(c){c.position=d.getAttribLocation(f.shaderProgram,c.varname)});_(this.uniformSpecs).each(function(c){c.position=d.getUniformLocation(f.shaderProgram,c.varname)});this.isSetup=!0;return""==this.log}};
VVVV.Nodes.FileTexture=function(a,b){this.constructor(a,"FileTexture (EX9.Texture)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Always loads in background","No reload pin","No preload pin (preloading handled by browser)","No up and running pin","No texture info outputs"]};this.auto_evaluate=!1;var g=this.addInputPin("Filename",[""],VVVV.PinTypes.String),e=this.addOutputPin("Texture Out",[],VVVV.PinTypes.WebGlTexture),
f=this.addInvisiblePin("Type",["Texture"],VVVV.PinTypes.Enum);f.enumOptions=["Texture","Cube Texture"];var d=[];this.evaluate=function(){if(this.renderContexts){var c=this.renderContexts[0];if(c){if(this.contextChanged){for(var a=0;a<d.length;a++)d[a].context.deleteTexture(d[a]);d=[]}if(g.pinIsChanged()||f.pinIsChanged()||this.contextChanged){for(var b=f.getValue(0),n=this.getMaxInputSliceCount(),a=0;a<n;a++){var k=VVVV.Helpers.prepareFilePath(g.getValue(a),this.parentPatch);0===k.indexOf("http://")&&
void 0!==VVVV.ImageProxyPrefix&&(k=VVVV.ImageProxyPrefix+encodeURI(k));d[a]=c.createTexture();d[a].context=c;"Texture"==b?(d[a].image=new Image,d[a].image.onload=function(a){return function(){c.bindTexture(c.TEXTURE_CUBE_MAP,null);c.bindTexture(c.TEXTURE_2D,d[a]);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,d[a].image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.NEAREST);c.bindTexture(c.TEXTURE_2D,null);e.setValue(a,
d[a])}}(a),d[a].image.src=k):"Cube Texture"==b&&(d[a].image=new Image,d[a].image.onload=function(a){return function(){var b=[{face:c.TEXTURE_CUBE_MAP_POSITIVE_X,offset:[2,1]},{face:c.TEXTURE_CUBE_MAP_NEGATIVE_X,offset:[0,1]},{face:c.TEXTURE_CUBE_MAP_POSITIVE_Y,offset:[1,0]},{face:c.TEXTURE_CUBE_MAP_NEGATIVE_Y,offset:[1,2]},{face:c.TEXTURE_CUBE_MAP_POSITIVE_Z,offset:[1,1]},{face:c.TEXTURE_CUBE_MAP_NEGATIVE_Z,offset:[3,1]}];c.bindTexture(c.TEXTURE_CUBE_MAP,d[a]);var f=$('<canvas style="display:none" width="'+
this.width/4+'" height="'+this.height/3+'"></canvas>');$("body").append(f);for(var h=f.get(0).getContext("2d"),g=0;6>g;g++)h.save(),h.translate(-this.width/4*b[g].offset[0],-this.height/3*b[g].offset[1]),h.drawImage(this,0,0),c.texImage2D(b[g].face,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,f.get(0)),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.NEAREST),h.restore();c.bindTexture(c.TEXTURE_CUBE_MAP,null);f.remove();e.setValue(a,d[a])}}(a),
d[a].image.src=k);e.setValue(a,VVVV.defaultTexture)}e.setSliceCount(n)}this.contextChanged=!1}}};this.destroy=function(){for(var c=0;c<d.length;c++)d[c].context.deleteTexture(d[c])}};VVVV.Nodes.FileTexture.prototype=new VVVV.Core.Node;
VVVV.Nodes.DX9Texture=function(a,b){this.constructor(a,"DX9Texture (EX9.Texture)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Using WebGL renderer as source doesnt work correctly in Chrome."]};var g=this.addInputPin("Source",[],VVVV.PinTypes.WebGlResource),e=this.addOutputPin("Texture Out",[],VVVV.PinTypes.WebGlTexture),f;this.evaluate=function(){if(this.renderContexts){var a=this.renderContexts[0];if(a){this.contextChanged&&
f&&(f.context.deleteTexture(f),f=void 0);if(g.isConnected()){var c=g.getValue(0);if(!c)return;0==(c.width&c.width-1)&&0==(c.height&c.height-1)||console.log("Warning: Source renderer's width/height is not a power of 2. DX9Texture will most likely not work.");c instanceof WebGLTexture?e.setValue(0,c):(void 0==f&&(f=a.createTexture(),f.context=a),a.bindTexture(a.TEXTURE_2D,f),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,c),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,
a.TEXTURE_MIN_FILTER,a.LINEAR),a.bindTexture(a.TEXTURE_2D,null),e.setValue(0,f))}else delete f,a.deleteTexture(f),e.setValue(0,void 0);this.contextChanged=!1}}};this.destroy=function(){f&&f.context.deleteTexture(f)}};VVVV.Nodes.DX9Texture.prototype=new VVVV.Core.Node;
VVVV.Nodes.VideoTexture=function(a,b){this.constructor(a,"VideoTexture (EX9.Texture VMR9)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Only supports power-of-2 sized videos","Has no output pins for meta data"]};var g=this.addInputPin("Video",[],this),e=this.addOutputPin("Texture Out",[],VVVV.PinTypes.WebGlTexture),f;this.evaluate=function(){if(this.renderContexts){var a=this.renderContexts[0];if(a)if(g.isConnected()){var c=
g.getValue(0);0==(c.videoWidth&c.videoWidth-1)&&0==(c.videoHeight&c.videoHeight-1)||console.log("Warning: Video width/height is not a power of 2. VideoTexture will most likely not work.");if(void 0==f||this.contextChanged)f=a.createTexture();a.bindTexture(a.TEXTURE_2D,f);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,c);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.bindTexture(a.TEXTURE_2D,null);e.setValue(0,
f);this.contextChanged=!1}else delete f,a.deleteTexture(f),e.setValue(0,void 0)}}};VVVV.Nodes.VideoTexture.prototype=new VVVV.Core.Node;
VVVV.Nodes.VertexBufferJoin=function(a,b){this.constructor(a,"VertexBuffer (EX9.Geometry Join)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Position XYZ",[0,0,0],VVVV.PinTypes.Value),e=this.addInputPin("Normal XYZ",[0,0,0],VVVV.PinTypes.Value),f=this.addInputPin("Texture Coordinate 0 XY",[0,0],VVVV.PinTypes.Value),d=this.addInputPin("Apply",[1],VVVV.PinTypes.Value),c=this.addOutputPin("Vertex Buffer",
[],VVVV.PinTypes.WebGlResource),h=null;this.evaluate=function(){var a=this.renderContexts[0];if(a&&0.5<=d.getValue(0)){for(var b=[],k=[],r=[],m=0;m<this.getMaxInputSliceCount();m++)b[m]=parseFloat(g.getValue(m)),k[m]=parseFloat(f.getValue(m)),r[m]=parseFloat(e.getValue(m));h=new VVVV.Types.VertexBuffer(a,b);h.setSubBuffer("TEXCOORD0",2,k);h.setSubBuffer("NORMAL",3,r);h.create();c.setValue(0,h)}}};VVVV.Nodes.VertexBufferJoin.prototype=new VVVV.Core.Node;
VVVV.Nodes.MeshJoin=function(a,b){this.constructor(a,"Mesh (EX9.Geometry Join)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Vertex Buffer",[],VVVV.PinTypes.WebGlResource),e=this.addInputPin("Indices",[0],VVVV.PinTypes.Value),f=this.addInputPin("Apply",[1],VVVV.PinTypes.Value),d=this.addOutputPin("Mesh",[],VVVV.PinTypes.WebGlResource),c=null;this.evaluate=function(){var a=this.renderContexts[0];
a&&0.5<=f.getValue(0)&&(g.isConnected()?(c=new VVVV.Types.Mesh(a,g.getValue(0),e.values),d.setValue(0,c)):(d.setValue(0,void 0),delete c))}};VVVV.Nodes.MeshJoin.prototype=new VVVV.Core.Node;
VVVV.Nodes.Grid=function(a,b){this.constructor(a,"Grid (EX9.Geometry)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Resolution X",[2],VVVV.PinTypes.Value),e=this.addInputPin("Resolution Y",[2],VVVV.PinTypes.Value),f=this.addOutputPin("Mesh",[],VVVV.PinTypes.WebGlResource),d=null;this.evaluate=function(){if(this.renderContexts){var c=this.renderContexts[0];if(c){for(var a=parseInt(g.getValue(0)),
b=parseInt(e.getValue(0)),n=[],k=[],r=[],m=0,p=0;p<b;p++)for(var s=0;s<a;s++)n.push(parseFloat(s)/(a-1)-0.5),n.push(0.5-parseFloat(p)/(b-1)),n.push(0),m++,k.push(0),k.push(0),k.push(1),r.push(parseFloat(s)/(a-1)),r.push(parseFloat(p)/(b-1));n=new VVVV.Types.VertexBuffer(c,n);n.setSubBuffer("TEXCOORD0",2,r);n.setSubBuffer("NORMAL",3,k);n.create();k=[];for(p=0;p<b-1;p++)for(s=0;s<a-1;s++)r=s+a*p,k.push(r),k.push(r+1),k.push(r+a+1),k.push(r+a+1),k.push(r+a),k.push(r);d=new VVVV.Types.Mesh(c,n,k);f.setValue(0,
d)}}}};VVVV.Nodes.Grid.prototype=new VVVV.Core.Node;
VVVV.Nodes.Sphere=function(a,b){this.constructor(a,"Sphere (EX9.Geometry)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Radius",[0.5],VVVV.PinTypes.Value),e=this.addInputPin("Resolution X",[15],VVVV.PinTypes.Value),f=this.addInputPin("Resolution Y",[15],VVVV.PinTypes.Value),d=this.addOutputPin("Mesh",[],VVVV.PinTypes.WebGlResource),c=null;this.evaluate=function(){if(this.renderContexts){var a=
this.renderContexts[0];if(a){for(var b=parseInt(e.getValue(0)),n=parseInt(f.getValue(0)),k=parseFloat(g.getValue(0)),r=[],m=[],p=[],s=0;s<n+1;s++)for(var u=Math.cos(-parseFloat(s)/n*Math.PI),v=0;v<b;v++){var t=Math.cos(2*(parseFloat(v)/b)*Math.PI)*Math.cos(Math.asin(u)),w=Math.sin(2*(parseFloat(v)/b)*Math.PI)*Math.cos(Math.asin(u));r.push(t*k);r.push(u*k);r.push(w*k);m.push(t);m.push(u);m.push(w);p.push(parseFloat(v)/b);p.push(parseFloat(s)/n)}k=new VVVV.Types.VertexBuffer(a,r);k.setSubBuffer("TEXCOORD0",
2,p);k.setSubBuffer("NORMAL",3,m);k.create();m=[];for(s=0;s<n;s++)for(v=0;v<b;v++)p=b*s,r=v+p,m.push(r),m.push((r+1)%b+p),m.push((r+1)%b+b+p),m.push((r+1)%b+b+p),m.push(r+b),m.push(r);c=new VVVV.Types.Mesh(a,k,m);d.setValue(0,c)}}}};VVVV.Nodes.Sphere.prototype=new VVVV.Core.Node;
VVVV.Nodes.Cylinder=function(a,b){this.constructor(a,"Cylinder (EX9.Geometry)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=this.addInputPin("Radius 1",[0.5],VVVV.PinTypes.Value),e=this.addInputPin("Radius 2",[0.5],VVVV.PinTypes.Value),f=this.addInputPin("Length",[1],VVVV.PinTypes.Value),d=this.addInputPin("Cycles",[1],VVVV.PinTypes.Value),c=this.addInputPin("Caps",[1],VVVV.PinTypes.Value),h=this.addInputPin("Resolution X",
[15],VVVV.PinTypes.Value),q=this.addInputPin("Resolution Y",[1],VVVV.PinTypes.Value),n=this.addOutputPin("Mesh",[],VVVV.PinTypes.WebGlResource),k=null;this.evaluate=function(){if(this.renderContexts){var a=this.renderContexts[0];if(a){var b=parseInt(h.getValue(0)),p=parseInt(q.getValue(0)),s=parseFloat(g.getValue(0)),u=parseFloat(e.getValue(0)),v=parseFloat(f.getValue(0)),t=parseFloat(d.getValue(0)),w=[],l=[],A=[];w.push(0);w.push(v/2);w.push(0);l.push(0);l.push(1);l.push(0);A.push(0);A.push(0);w.push(0);
w.push(-v/2);w.push(0);l.push(0);l.push(-1);l.push(0);A.push(0);A.push(0);for(var y=0;y<p+1;y++)for(var z=parseFloat(y)/p,F=(z-0.5)*-v,C=0;C<b+1;C++){var I=Math.cos(2*(parseFloat(C)/b)*Math.PI*t-Math.PI*t-Math.PI/2),J=Math.sin(2*(parseFloat(C)/b)*Math.PI*t-Math.PI*t-Math.PI/2),H=z*u+(1-z)*s;w.push(I*H);w.push(F);w.push(J*H);l.push(I);l.push(0);l.push(J);A.push(parseFloat(C)/b);A.push(parseFloat(y)/p)}s=new VVVV.Types.VertexBuffer(a,w);s.setSubBuffer("TEXCOORD0",2,A);s.setSubBuffer("NORMAL",3,l);s.create();
l=[];if(0.5<c.getValue(0))for(z=0;2>z;z++)for(C=0;C<b;C++)l.push(z),l.push(2+C+z+z*p*(b+1)),l.push(2+C+(1-z)+z*p*(b+1));for(y=0;y<p;y++)for(C=0;C<b;C++)z=C+(b+1)*y+2,l.push(z),l.push(z+1),l.push(z+b+2),l.push(z+b+2),l.push(z+b+1),l.push(z);k=new VVVV.Types.Mesh(a,s,l);n.setValue(0,k)}}}};VVVV.Nodes.Cylinder.prototype=new VVVV.Core.Node;
VVVV.Nodes.BlendWebGLAdvanced=function(a,b){function g(a){switch(a){case "One":return"ONE";case "Zero":return"ZERO";case "SrcAlpha":return"SRC_ALPHA";case "InvSrcAlpha":return"ONE_MINUS_SRC_ALPHA";case "DestAlpha":return"DST_ALPHA";case "InvDestAlpha":return"ONE_MINUS_DST_ALPHA";case "SrcColor":return"SRC_COLOR";case "InvSrcColor":return"ONE_MINUS_SRC_COLOR";case "DestColor":return"DST_COLOR";case "InvDestColor":return"ONE_MINUS_DST_COLOR"}return null}this.constructor(a,"Blend (EX9.RenderState Advanced)",
b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var e=this.addInputPin("Render State In",[],VVVV.PinTypes.WebGlRenderState),f=this.addInputPin("Alpha Blending",[1],VVVV.PinTypes.Value),d=this.addInputPin("Source Blend Mode",["SrcAlpha"],VVVV.PinTypes.Enum),c=this.addInputPin("Destination Blend Mode",["SrcAlpha"],VVVV.PinTypes.Enum);d.enumOptions=c.enumOptions="One Zero SrcAlpha InvSrcAlpha DestAlpha InvDestAlpha SrcColor InvSrcColor DestColor InvDestColor".split(" ");
var h=this.addOutputPin("Render State Out",[],VVVV.PinTypes.WebGlRenderState),q=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==q[b]&&(q[b]=new VVVV.Types.WebGlRenderState),q[b].copy_attributes(e.getValue(b)),q[b].alphaBlending=0.5<parseFloat(f.getValue(b)),q[b].srcBlendMode=g(d.getValue(b)),q[b].destBlendMode=g(c.getValue(b)),h.setValue(b,q[b]);h.setSliceCount(a)}};VVVV.Nodes.BlendWebGLAdvanced.prototype=new VVVV.Core.Node;
VVVV.Nodes.BlendWebGL=function(a,b){this.constructor(a,"Blend (EX9.RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["results differ from VVVV","Multiply mode not supported"]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.WebGlRenderState),e=this.addInputPin("Draw Mode",["Blend"],VVVV.PinTypes.Enum);e.enumOptions=["Add","Multiply","Blend","ColorAsAlphaAdd","ColorAsAlphaBlend"];var f=this.addOutputPin("Render State Out",
[],VVVV.PinTypes.WebGlRenderState),d=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){void 0==d[b]&&(d[b]=new VVVV.Types.WebGlRenderState);d[b].copy_attributes(g.getValue(b));switch(e.getValue(b)){case "Add":d[b].srcBlendMode="SRC_ALPHA";d[b].destBlendMode="ONE";break;case "Multiply":console.log("Multiply Blend Mode not supported (or we just missed it)");case "Blend":d[b].srcBlendMode="SRC_ALPHA";d[b].destBlendMode="ONE_MINUS_SRC_ALPHA";break;case "ColorAsAlphaAdd":d[b].srcBlendMode=
"SRC_COLOR";d[b].destBlendMode="ONE";break;case "ColorAsAlphaBlend":d[b].srcBlendMode="SRC_COLOR",d[b].destBlendMode="ONE_MINUS_SRC_COLOR"}f.setValue(b,d[b])}f.setSliceCount(a)}};VVVV.Nodes.BlendWebGL.prototype=new VVVV.Core.Node;
VVVV.Nodes.FillWebGL=function(a,b){this.constructor(a,"Fill (EX9.RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["does not actually draw wireframe, because this is not supported in WebGL, but makes renderer use gl.LINE instead of gl.TRIANGLES when drawing"]};var g=this.addInputPin("Render State In",[],VVVV.PinTypes.WebGlRenderState),e=this.addInputPin("Fill Mode",["Solid"],VVVV.PinTypes.Enum);e.enumOptions=["Point","Solid","WireFrame"];
var f=this.addOutputPin("Render State Out",[],VVVV.PinTypes.WebGlRenderState),d=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++){void 0==d[b]&&(d[b]=new VVVV.Types.WebGlRenderState);d[b].copy_attributes(g.getValue(b));switch(e.getValue(b)){case "Point":d[b].polygonDrawMode="POINTS";break;case "Solid":d[b].polygonDrawMode="TRIANGLES";break;case "WireFrame":d[b].polygonDrawMode="LINES"}f.setValue(b,d[b])}f.setSliceCount(a)}};VVVV.Nodes.FillWebGL.prototype=new VVVV.Core.Node;
VVVV.Nodes.ZWriteEnableWebGL=function(a,b){function g(a){switch(a){case "Never":return"NEVER";case "Less":return"LESS";case "LessEqual":return"LEQUAL";case "Equal":return"EQUAL";case "NotEqual":return"NOTEQUAL";case "Greater":return"GREATER";case "GreaterEqual":return"GEQUAL";case "Always":return"ALWAYS"}return null}this.constructor(a,"ZWriteEnable (EX9.RenderState)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var e=this.addInputPin("Render State In",
[],VVVV.PinTypes.WebGlRenderState),f=this.addInputPin("ZWrite Enable",[1],VVVV.PinTypes.Value),d=this.addInputPin("Compare Function",["Always"],VVVV.PinTypes.Enum);d.enumOptions="Never Less LessEqual Equal NotEqual Greater GreaterEqual Always".split(" ");var c=this.addInputPin("Depth Bias",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Render State Out",[],VVVV.PinTypes.WebGlRenderState),q=[];this.evaluate=function(){for(var a=this.getMaxInputSliceCount(),b=0;b<a;b++)void 0==q[b]&&(q[b]=new VVVV.Types.WebGlRenderState),
q[b].copy_attributes(e.getValue(b)),q[b].enableZWrite=0.5<parseFloat(f.getValue(b)),q[b].depthFunc=g(d.getValue(b)),q[b].depthOffset=parseFloat(c.getValue(0)),h.setValue(b,q[b]);h.setSliceCount(a)}};VVVV.Nodes.ZWriteEnableWebGL.prototype=new VVVV.Core.Node;
VVVV.Nodes.GenericShader=function(a,b){this.constructor(a,"GenericShader (EX9.Effect)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};this.shaderFile="";var g=this.addInputPin("Render State",[],VVVV.PinTypes.WebGlRenderState),e=this.addInputPin("Mesh",[],VVVV.PinTypes.WebGlResource),f=this.addInputPin("Transform",[],VVVV.PinTypes.Transform),d=this.addInputPin("Technique",[""],VVVV.PinTypes.Enum);d.enumOptions=[""];this.addOutputPin("Layer",
[],VVVV.PinTypes.WebGlResource);var c=[],h=null,q,n=!1,k=[],r=this;this.initialize=function(){var a=["Render State","Mesh","Transform","Technique"];_(r.inputPins).each(function(c){0>a.indexOf(c.pinname)&&(c.unvalidated=!0,k.push(c))});void 0==VVVV.ShaderCodeResources[r.shaderFile]?(VVVV.ShaderCodeResources[r.shaderFile]=new VVVV.Types.ShaderCodeResource,VVVV.ShaderCodeResources[r.shaderFile].addRelatedNode(r),$.ajax({url:VVVV.Helpers.prepareFilePath(r.shaderFile,r.parentPatch),async:!1,dataType:"text",
success:function(a){VVVV.ShaderCodeResources[r.shaderFile].setSourceCode(a)},error:function(){console.log("ERROR: Could not load shader file "+r.shaderFile.replace("%VVVV%",VVVV.Root));VVVV.onNotImplemented("Could not load shader file "+r.shaderFile.replace("%VVVV%",VVVV.Root))}})):VVVV.ShaderCodeResources[r.shaderFile].addRelatedNode(r)};this.shaderSourceUpdated=function(a){q=a;h||(h=new VVVV.Types.ShaderProgram);r.addUniformPins();r.setupShader();_(r.inputPins).each(function(a){a.markPinAsChanged()});
n=!0;this.parentPatch.afterUpdate()};this.addUniformPins=function(){h.extractSemantics(q);for(var a=[],c=0;c<k.length;c++)h.uniformSpecs[k[c].pinname.replace(/ /g,"_")]||(r.removeInputPin(k[c].pinname),a.push(c));for(c=0;c<a.length;c++)k.splice(a[c],1);_(h.uniformSpecs).each(function(a){if("VIEW"!=a.semantic&&"PROJECTION"!=a.semantic&&"WORLD"!=a.semantic){var c=VVVV.PinTypes.Value,b=[];switch(a.type){case "mat":c=VVVV.PinTypes.Transform;break;case "samplerCube":case "sampler":c=VVVV.PinTypes.WebGlTexture;
break;default:"COLOR"==a.semantic?(c=VVVV.PinTypes.Color,b=["1.0, 1.0, 1.0, 1.0"]):b=[0],a.defaultValue&&(b="COLOR"!=a.semantic?_(a.defaultValue.split(",")).map(function(a){return parseFloat(a)}):[a.defaultValue])}for(var d=0;d<k.length;d++)if(k[d].pinname==a.varname.replace(/_/g," ")){k[d].dimensions=a.dimension;k[d].unvalidated&&!k[d].isConnected()&&(k[d].values=r.defaultPinValues[k[d].pinname]?r.defaultPinValues[k[d].pinname].slice():b);k[d].typeName!=c.typeName&&(a=k[d].values.slice(),k[d].setType(c),
k[d].unvalidated&&(c.primitive||k[d].isConnected())&&(k[d].values=a),k[d].isConnected()&&!k[d].unvalidated&&(k[d].connectionChanged(),k[d].links[0].destroy()));k[d].unvalidated=!1;return}c=r.addInputPin(a.varname.replace(/_/g," "),b,c);c.dimensions=a.dimension;k.push(c)}})};this.setupShader=function(){var a=d.getValue(0),a=a.replace(/^\s*/,"").replace(/\s*$/,""),c=RegExp(/(vertex_shader|fragment_shader)\{([^\}]+)\}/g);d.enumOptions=[];for(var b;null!=(b=c.exec(q));)d.enumOptions=d.enumOptions.concat(b[2].replace(/\s/g,
"").split(","));d.enumOptions=d.enumOptions.filter(function(a,c,b){return b.indexOf(a)===c});0==d.enumOptions.length&&d.enumOptions.push("");if(""==a||0>d.enumOptions.indexOf(a))a=d.enumOptions[0],d.setValue(0,a);var f=RegExp("vertex_shader(\\{([a-zA-Z0-9]+,\\s*)*"+a+"(,\\s*[a-zA-Z0-9]+)*\\})?:([\\s\\S]*?)(vertex_shader|fragment_shader)"),c=RegExp("fragment_shader(\\{([a-zA-Z0-9]+,\\s*)*"+a+"(,\\s*[a-zA-Z0-9]+)*\\})?:([\\s\\S]*?)(vertex_shader|fragment_shader)");b=/STARTOFSTRING((\r?\n|.)*?)(vertex_shader|fragment_shader)/.exec("STARTOFSTRING"+
q);var e=b[1];void 0==(b=f.exec(q+"\nfragment_shader"))?console.log("ERROR: No vertex shader code for technique "+a+" found"):(f=b[4],void 0==(b=c.exec(q+"\nfragment_shader"))?console.log("ERROR: No fragment shader code for technique "+a+" found"):(h.setFragmentShader(e+b[4]),h.setVertexShader(e+f)))};this.evaluate=function(){if(this.renderContexts){var a=this.renderContexts[0];if(a&&h){if(!h.isSetup||this.contextChanged||d.pinIsChanged())this.setupShader(),h.setup(a)?VVVV.ShaderCodeResources[r.shaderFile].definingNode&&
VVVV.ShaderCodeResources[r.shaderFile].definingNode.showStatus("success","Successfully compiled"):VVVV.ShaderCodeResources[r.shaderFile].definingNode&&VVVV.ShaderCodeResources[r.shaderFile].definingNode.showStatus("error",h.log);var b=0;_(this.inputPins).each(function(a){var c=a.getSliceCount();a=a.pinname.replace(/ /g,"_");h.uniformSpecs[a]&&("vec"==h.uniformSpecs[a].type&&"COLOR"!=h.uniformSpecs[a].semantic)&&(c=parseInt(c/h.uniformSpecs[a].dimension));c>b&&(b=c)});e.isConnected()&&void 0!=e.getValue(0)||
(b=0);var q=c.length;if(this.contextChanged||n)q=0;b<q&&c.splice(b,q-b);for(var u=q;u<b;u++)c[u]=new VVVV.Types.Layer,c[u].mesh=e.getValue(0),c[u].shader=h,_(h.uniformSpecs).each(function(a){c[u].uniformNames.push(a.varname);c[u].uniforms[a.varname]={uniformSpec:a,value:void 0}});if(e.pinIsChanged())for(u=0;u<b;u++)c[u].mesh=e.getValue(0);for(u=0;u<b;u++)c[u].shader=h;for(a=0;a<k.length;a++){var v=k[a].pinname.replace(/ /g,"_");if(k[a].pinIsChanged()||q<b)for(u=0;u<b;u++)if("vec"==h.uniformSpecs[v].type){var t=
"COLOR"==h.uniformSpecs[v].semantic?_(k[a].getValue(u).split(",")).map(function(a){return parseFloat(a)}):k[a].getValue(u,k[a].dimensions);c[u].uniforms[v].value=new Float32Array(t)}else t=k[a].getValue(u),c[u].uniforms[v].value=t}if(g.pinIsChanged()||q<b)for(a=0;a<b;a++)g.isConnected()?c[a].renderState=g.getValue(a):c[a].renderState=VVVV.DefaultRenderState;if(f.pinIsChanged()||q<b)for(a=0;a<b;a++)q=this.inputPins.Transform.getValue(a),c[a].uniforms[c[a].shader.uniformSemanticMap.WORLD].value=q;this.outputPins.Layer.setSliceCount(b);
for(a=0;a<b;a++)this.outputPins.Layer.setValue(a,c[a]);n=this.contextChanged=!1}}};this.openUIWindow=function(){VVVV.ShaderCodeResources[r.shaderFile].definingNode&&VVVV.ShaderCodeResources[r.shaderFile].definingNode.openUIWindow()}};VVVV.Nodes.GenericShader.prototype=new VVVV.Core.Node;
VVVV.Nodes.Quad=function(a,b){this.constructor(a,"Quad (DX9)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["No Sampler States","No texture coord mapping","No enable pin","Transprent pixels are discarded by default"]};this.auto_evaluate=!1;var g=this.addInputPin("Render State",[],VVVV.PinTypes.WebGlRenderState);this.addInputPin("Transform",[],VVVV.PinTypes.Transform);this.addInputPin("Texture",[],VVVV.PinTypes.WebGlTexture);
this.addInputPin("Texture Transform",[],VVVV.PinTypes.Transform);this.addInputPin("Color",["1.0, 1.0, 1.0, 1.0"],VVVV.PinTypes.Color);this.addOutputPin("Layer",[],VVVV.PinTypes.WebGlResource);var e=[],f=null,d=null;this.evaluate=function(){if(this.renderContexts){var a=this.renderContexts[0];if(a){if(this.contextChanged){var b=new VVVV.Types.VertexBuffer(a,[0.5,0.5,0,-0.5,0.5,0,0.5,-0.5,0,-0.5,-0.5,0]);b.setSubBuffer("TEXCOORD0",2,[1,0,0,0,1,1,0,1]);b.create();f=new VVVV.Types.Mesh(a,b,[0,1,2,1,3,
2]);b="#ifdef GL_ES\nprecision highp float;\n#endif\n";b+="uniform vec4 col : COLOR = {1.0, 1.0, 1.0, 1.0}; varying vec2 vs2psTexCd; uniform sampler2D Samp0; void main(void) { gl_FragColor = col*texture2D(Samp0, vs2psTexCd); if (gl_FragColor.a==0.0) discard; }";d=new VVVV.Types.ShaderProgram;d.extractSemantics(b+"attribute vec3 PosO : POSITION; attribute vec2 TexCd : TEXCOORD0; uniform mat4 tW : WORLD; uniform mat4 tV : VIEW; uniform mat4 tP : PROJECTION; uniform mat4 tTex; varying vec2 vs2psTexCd; void main(void) { gl_Position = tP * tV * tW * vec4(PosO, 1.0); vs2psTexCd = (tTex * vec4(TexCd.xy-.5, 0.0, 1.0)).xy+.5; }");
d.setFragmentShader(b);d.setVertexShader("attribute vec3 PosO : POSITION; attribute vec2 TexCd : TEXCOORD0; uniform mat4 tW : WORLD; uniform mat4 tV : VIEW; uniform mat4 tP : PROJECTION; uniform mat4 tTex; varying vec2 vs2psTexCd; void main(void) { gl_Position = tP * tV * tW * vec4(PosO, 1.0); vs2psTexCd = (tTex * vec4(TexCd.xy-.5, 0.0, 1.0)).xy+.5; }");d.setup(a)}a=this.getMaxInputSliceCount();b=e.length;this.contextChanged&&(b=0);a<b&&e.splice(a,b-a);for(var q=b;q<a;q++)e[q]=new VVVV.Types.Layer,
e[q].mesh=f,e[q].shader=d,_(d.uniformSpecs).each(function(a){e[q].uniformNames.push(a.varname);e[q].uniforms[a.varname]={uniformSpec:a,value:void 0}});var n=this.inputPins.Color.pinIsChanged(),k=this.inputPins.Transform.pinIsChanged(),r=this.inputPins.Texture.pinIsChanged(),m=this.inputPins["Texture Transform"].pinIsChanged();if(n||b<a)for(n=0;n<a;n++){var p=this.inputPins.Color.getValue(n),p=_(p.split(",")).map(function(a){return parseFloat(a)});e[n].uniforms.col.value=new Float32Array(p)}if(g.pinIsChanged()||
b<a)for(n=0;n<a;n++)g.isConnected()?e[n].renderState=g.getValue(n):e[n].renderState=VVVV.DefaultRenderState;if(k||b<a)for(n=0;n<a;n++)k=this.inputPins.Transform.getValue(n),e[n].uniforms[e[n].shader.uniformSemanticMap.WORLD].value=k;if(r||b<a)for(n=0;n<a;n++)e[n].uniforms.Samp0.value=this.inputPins.Texture.getValue(n);if(m||b<a)for(n=0;n<a;n++)k=this.inputPins["Texture Transform"].getValue(n),e[n].uniforms.tTex.value=k;this.outputPins.Layer.setSliceCount(a);for(n=0;n<a;n++)this.outputPins.Layer.setValue(n,
e[n]);this.contextChanged=!1}}}};VVVV.Nodes.Quad.prototype=new VVVV.Core.Node;
VVVV.Nodes.Group=function(a,b){this.constructor(a,"Group (EX9)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:[]};var g=[],e=this.addInputPin("Enabled",[1],VVVV.PinTypes.Value),f=this.addInvisiblePin("Layer Template Count",[2],VVVV.PinTypes.Value),d=this.addOutputPin("Layer",[],VVVV.PinTypes.WebGlResource);this.initialize=function(){for(var a=f.getValue(0),d=g.length;d<a;d++)g[d]=this.addInputPin("Layer "+(d+1),[],VVVV.PinTypes.WebGlResource);
for(d=a;d<g.length;d++)this.removeInputPin(g[d].pinname);g.length=a;b.afterUpdate()};this.evaluate=function(){f.pinIsChanged()&&this.initialize();var a=0;if(0.5<e.getValue(0))for(var b=0;b<g.length;b++)for(var q=0;q<g[b].getSliceCount();q++)d.setValue(a++,g[b].getValue(q));d.setSliceCount(a)}};VVVV.Nodes.Group.prototype=new VVVV.Core.Node;
VVVV.Nodes.RendererWebGL=function(a,b){function g(){$(t).detach("mousemove");$(t).detach("mousedown");$(t).detach("mouseup");VVVV.MousePositions[t.id]={x:0,y:0,wheel:0,lb:0,mb:0,rb:0};$(t).mousemove(function(a){var b=2*(a.pageX-$(this).offset().left)/$(this).width()-1;a=-(2*(a.pageY-$(this).offset().top)/$(this).height()-1);VVVV.MousePositions._all.x=b;VVVV.MousePositions._all.y=a;VVVV.MousePositions[t.id].x=b;VVVV.MousePositions[t.id].y=a});$(t).bind("mousewheel",function(a){a=a.originalEvent.wheelDelta/
120;VVVV.MousePositions[t.id].wheel+=a;VVVV.MousePositions._all.wheel+=a});$(t).bind("DOMMouseScroll",function(a){a=-a.originalEvent.detail/3;VVVV.MousePositions[t.id].wheel+=a;VVVV.MousePositions._all.wheel+=a});$(t).mousedown(function(a){switch(a.which){case 1:VVVV.MousePositions._all.lb=1;VVVV.MousePositions[t.id].lb=1;break;case 2:VVVV.MousePositions._all.mb=1;VVVV.MousePositions[t.id].mb=1;break;case 3:VVVV.MousePositions._all.rb=1,VVVV.MousePositions[t.id].rb=1}});$(t).mouseup(function(a){switch(a.which){case 1:VVVV.MousePositions._all.lb=
0;VVVV.MousePositions[t.id].lb=0;break;case 2:VVVV.MousePositions._all.mb=0;VVVV.MousePositions[t.id].mb=0;break;case 3:VVVV.MousePositions._all.rb=0,VVVV.MousePositions[t.id].rb=0}})}this.constructor(a,"Renderer (EX9)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["Disabling Clear doesn't work in Chrome","No Fullscreen","No Enable Pin","No Aspect Ration and Viewport transform","No mouse output"]};this.addInputPin("Layers",
[],VVVV.PinTypes.WebGlResource);var e=this.addInputPin("Clear",[1],VVVV.PinTypes.Value),f=this.addInputPin("Background Color",["0.0, 0.0, 0.0, 1.0"],VVVV.PinTypes.Color),d=this.addInputPin("Backbuffer Width",[0],VVVV.PinTypes.Value),c=this.addInputPin("Backbuffer Height",[0],VVVV.PinTypes.Value),h=this.addInputPin("View",[],VVVV.PinTypes.Transform),q=this.addInputPin("Projection",[],VVVV.PinTypes.Transform),n=this.addInvisiblePin("Windowed Depthbuffer Format",["NONE"],VVVV.PinTypes.Enum);n.enumOptions=
["NONE","DX16"];var k=this.addOutputPin("Actual Backbuffer Width",[0],VVVV.PinTypes.Value),r=this.addOutputPin("Actual Backbuffer Height",[0],VVVV.PinTypes.Value),m=this.addOutputPin("EX9 Out",[],VVVV.PinTypes.WebGlResource),p=0,s=0,u,v,t,w=this.ctxt=void 0,l,A,y;this.getContexts=function(){if(this.invisiblePins["Descriptive Name"]){var a=this.invisiblePins["Descriptive Name"].getValue(0);if((a=$(a).get(0))&&"CANVAS"==a.nodeName)t=$(a);else{var b=parseInt(d.getValue(0)),k=parseInt(c.getValue(0));
t=$('<canvas width="'+(0<b?b:512)+'" height="'+(0<k?k:512)+'" id="vvvv-js-generated-renderer-'+(new Date).getTime()+'" class="vvvv-js-generated-renderer"></canvas>');a||(a="body");$(a).append(t)}if(t){g();try{w=t.get(0).getContext("experimental-webgl",{preserveDrawingBuffer:!0}),w.viewportWidth=parseInt(t.get(0).width),w.viewportHeight=parseInt(t.get(0).height)}catch(n){console.log(n)}this.ctxt=w;m.isConnected()&&this.renderContexts&&this.renderContexts[0]?(l=this.ctxt=this.renderContexts[0],A=l.createFramebuffer(),
l.bindFramebuffer(l.FRAMEBUFFER,A),A.width=t.get(0).width,A.height=t.get(0).height,y=l.createTexture(),l.bindTexture(l.TEXTURE_2D,y),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,!0),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.LINEAR),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.LINEAR_MIPMAP_NEAREST),l.texImage2D(l.TEXTURE_2D,0,l.RGBA,A.width,A.height,0,l.RGBA,l.UNSIGNED_BYTE,null),l.generateMipmap(l.TEXTURE_2D),a=l.createRenderbuffer(),l.bindRenderbuffer(l.RENDERBUFFER,a),l.renderbufferStorage(l.RENDERBUFFER,
l.DEPTH_COMPONENT16,A.width,A.height),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,l.TEXTURE_2D,y,0),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a),l.bindTexture(l.TEXTURE_2D,null),l.bindRenderbuffer(l.RENDERBUFFER,null),l.bindFramebuffer(l.FRAMEBUFFER,null)):this.renderContexts&&this.renderContexts[0]&&(this.renderContexts[0].deleteTexture(y),y=void 0);this.ctxt&&(p=parseInt(t.get(0).width),s=parseInt(t.get(0).height),l=this.ctxt,a=new Uint8Array([255,255,
255]),l.DefaultTexture={},l.DefaultTexture["2D"]=l.createTexture(),l.bindTexture(l.TEXTURE_2D,l.DefaultTexture["2D"]),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,l.NEAREST),l.pixelStorei(l.UNPACK_ALIGNMENT,1),l.texImage2D(l.TEXTURE_2D,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.bindTexture(l.TEXTURE_2D,null),l.DefaultTexture.CUBE=
l.createTexture(),l.bindTexture(l.TEXTURE_CUBE_MAP,l.DefaultTexture.CUBE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,l.NEAREST),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,l.NEAREST),l.pixelStorei(l.UNPACK_ALIGNMENT,1),l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.texImage2D(l.TEXTURE_CUBE_MAP_NEGATIVE_X,
0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_Y,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.texImage2D(l.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_Z,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.texImage2D(l.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,l.RGB,1,1,0,l.RGB,l.UNSIGNED_BYTE,a),l.bindTexture(l.TEXTURE_CUBE_MAP,null),this.inputPins.Layers.markPinAsChanged(),e.markPinAsChanged(),f.markPinAsChanged(),h.markPinAsChanged(),
q.markPinAsChanged())}}};this.destroy=function(){$(t).remove()};var z=!1;this.evaluate=function(){l=this.ctxt;if(this.invisiblePins["Descriptive Name"].pinIsChanged()||this.contextChanged)w&&$(w.canvas).hasClass("vvvv-js-generated-renderer")&&$(w.canvas).remove(),this.getContexts(),this.inputPins.Layers.isConnected()&&this.inputPins.Layers.links[0].fromPin.connectionChanged();z||(k.setValue(0,p),r.setValue(0,s),z=!0);if(void 0!=l){if(d.pinIsChanged()&&(!this.renderContexts||!this.renderContexts[0])){var a=
parseInt(d.getValue(0));0<a&&(p=a,$(w.canvas).attr("width",p),k.setValue(0,p))}!c.pinIsChanged()||this.renderContexts&&this.renderContexts[0]||(a=parseInt(c.getValue(0)),0<a&&(s=a,$(w.canvas).attr("height",s),r.setValue(0,s)));this.renderContexts&&this.renderContexts[0]&&l==this.renderContexts[0]?l.bindFramebuffer(l.FRAMEBUFFER,A):l.bindFramebuffer(l.FRAMEBUFFER,null);a=_(f.getValue(0).split(",")).map(function(a){return parseFloat(a)});l.clearColor(a[0],a[1],a[2],a[3]);l.clear(l.COLOR_BUFFER_BIT|
l.DEPTH_BUFFER_BIT);"NONE"==n.getValue(0)?l.disable(l.DEPTH_TEST):l.enable(l.DEPTH_TEST);q.pinIsChanged()&&(q.isConnected()?(u=mat4.create(),mat4.set(q.getValue(0),u)):(u=mat4.create(),mat4.ortho(-1,1,-1,1,-100,100,u)),mat4.scale(u,[1,1,-1]),this.renderContexts&&this.renderContexts[0]&&mat4.scale(u,[1,-1,1]));h.pinIsChanged()&&(v=h.getValue(0));if(this.contextChanged)this.contextChanged=!1;else{l.viewport(0,0,p,s);var b=a=null,e=null;if(this.inputPins.Layers.isConnected()){for(var g=this.inputPins.Layers.values,
t=0;t<g.length;t++)if(layer=g[t],void 0!=layer.shader){a!=layer.shader.shaderProgram&&(l.useProgram(layer.shader.shaderProgram),l.uniformMatrix4fv(layer.shader.uniformSpecs[layer.shader.uniformSemanticMap.PROJECTION].position,!1,u),l.uniformMatrix4fv(layer.shader.uniformSpecs[layer.shader.uniformSemanticMap.VIEW].position,!1,v));var E=layer.renderState;E||(E=defaultWebGlRenderState);E!=b&&E.apply(l);if(layer.mesh!=e||layer.shader.shaderProgram!=a)l.bindBuffer(l.ARRAY_BUFFER,layer.mesh.vertexBuffer.vbo),
_(layer.mesh.vertexBuffer.subBuffers).each(function(a){layer.shader.attributeSpecs[layer.shader.attribSemanticMap[a.usage]]&&-1!=layer.shader.attributeSpecs[layer.shader.attribSemanticMap[a.usage]].position&&(l.enableVertexAttribArray(layer.shader.attributeSpecs[layer.shader.attribSemanticMap[a.usage]].position),l.vertexAttribPointer(layer.shader.attributeSpecs[layer.shader.attribSemanticMap[a.usage]].position,a.size,l.FLOAT,!1,0,a.offset))}),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,layer.mesh.indexBuffer);
for(var b=layer.uniformNames.length,G=e=0;G<b;G++){var B=layer.uniforms[layer.uniformNames[G]];if(void 0!=B.value&&!(0<t&&layer.shader.shaderProgram==a&&g[t-1].uniforms[layer.uniformNames[G]]&&B.value==g[t-1].uniforms[layer.uniformNames[G]].value)){start=(new Date).getTime();switch(B.uniformSpec.type){case "mat":l["uniformMatrix"+B.uniformSpec.dimension+"fv"](B.uniformSpec.position,!1,B.value);break;case "vec":l["uniform"+B.uniformSpec.dimension+"fv"](B.uniformSpec.position,B.value);break;case "int":l["uniform"+
B.uniformSpec.dimension+"i"](B.uniformSpec.position,B.value);break;case "float":l["uniform"+B.uniformSpec.dimension+"f"](B.uniformSpec.position,B.value);break;case "sampler":var D=B.value;D==VVVV.DefaultTexture&&(D=l.DefaultTexture["2D"]);l.activeTexture(l["TEXTURE"+e]);l.bindTexture(l["TEXTURE_"+B.uniformSpec.dimension],D);l.uniform1i(B.uniformSpec.position,e);e++;break;case "samplerCube":D=B.value,D==VVVV.DefaultTexture&&(D=l.DefaultTexture.CUBE),l.activeTexture(l["TEXTURE"+e]),l.bindTexture(l.TEXTURE_CUBE_MAP,
D),l.uniform1i(B.uniformSpec.position,e),e++}loopstart=(new Date).getTime()}}l.drawElements(l[E.polygonDrawMode],layer.mesh.numIndices,l.UNSIGNED_SHORT,0);a=layer.shader.shaderProgram;b=E;e=layer.mesh}l.bindTexture(l.TEXTURE_2D,null);l.bindTexture(l.TEXTURE_CUBE_MAP,null)}this.renderContexts&&this.renderContexts[0]&&(l.bindTexture(l.TEXTURE_2D,y),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(this.renderContexts[0].TEXTURE_2D,null));m.setValue(0,y)}}}};VVVV.Nodes.RendererWebGL.prototype=new VVVV.Core.Node;
VVVV.Nodes.DefineEffect=function(a,b){this.constructor(a,"DefineEffect (DX9)",b);this.auto_nil=!1;this.meta={authors:["Matthias Zauner"],original_authors:["Matthias Zauner"],credits:[],compatibility_issues:["Not available in classic VVVV"]};this.auto_evaluate=!1;var g=this.addInputPin("Effect Descriptor",[""],VVVV.PinTypes.String),e=this.addInvisiblePin("Source Code",["#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform mat4 tW : WORLD;\nuniform mat4 tV : VIEW;\nuniform mat4 tP : PROJECTION;\n\nuniform vec4 Color : COLOR = {1.0, 1.0, 1.0, 1.0};\nuniform sampler2D Texture;\nuniform mat4 Texture_Transform;\nuniform float Alpha = 1.0;\n\nvarying vec2 vs2psTexCd;\n\nvertex_shader:\n\nattribute vec3 PosO : POSITION;\nattribute vec2 TexCd : TEXCOORD0;\n\nvoid main(void) {\n gl_Position = tP * tV * tW * vec4(PosO, 1.0);\n vs2psTexCd = (Texture_Transform * vec4(TexCd, 0, 1)).xy;\n}\n\n\nfragment_shader:\n\nvoid main(void) {\n gl_FragColor = Color * texture2D(Texture, vs2psTexCd) * vec4(1.0, 1.0, 1.0, Alpha);\n}"],
VVVV.PinTypes.String),f="",d;this.evaluate=function(){if(""!=g.getValue(0)){if(g.pinIsChanged()){var a=g.getValue(0);if(""==a)return;""==f?void 0==VVVV.ShaderCodeResources["./"+a+".vvvvjs.fx"]&&(VVVV.ShaderCodeResources["./"+a+".vvvvjs.fx"]=new VVVV.Types.ShaderCodeResource):VVVV.ShaderCodeResources["./"+a+".vvvvjs.fx"]=VVVV.ShaderCodeResources[f];f="./"+a+".vvvvjs.fx";VVVV.ShaderCodeResources[f].definingNode=this;VVVV.ShaderCodeResources[f].setSourceCode(e.getValue(0));d&&$("#path",d.document).text((this.parentPatch.nodename||
"root")+" / "+(""!=f?f:"Untitled"))}e.pinIsChanged()&&VVVV.ShaderCodeResources[f]&&VVVV.ShaderCodeResources[f].setSourceCode(e.getValue(0))}};this.openUIWindow=function(){d=window.open("code_editor.html",f+" / VVVV.js Effect Editor","location=no, width=800, height=800, toolbar=no");var a=this;window.setTimeout(function(){d.document.title=f+" / VVVV.js Effect Editor";var b=a.parentPatch.nodename||"root",g=""!=f?f:"Untitled";$("#path",d.document).text(b+" / "+g);$("textarea",d.document).text(e.getValue(0));
$("#compile_button",d.document).click(function(){""==f?a.showStatus("error","Please provide a name for this shader first"):(e.setValue(0,$("textarea",d.document).val()),0<VVVV.ShaderCodeResources[f].relatedNodes.length?a.showStatus("notice","Compiling ..."):a.showStatus("notice","No instance of this shader found. Create a node (./"+f+") and connect it to a Renderer (EX9) to compile."))});d.focus()},500)};this.showStatus=function(a,b){d&&($("#status",d.document).text(b),$("#status",d.document).attr("class",
a))}};VVVV.Nodes.DefineEffect.prototype=new VVVV.Core.Node;VVVV.Nodes.XPathXML=function(a,b){this.constructor(a,"XPath (XML)",b);this.meta={authors:["Matthias Zauner"],original_authors:["VVVV Group"],credits:[],compatibility_issues:["XML Index Output Pin not implemented","Query Index Output Pin not implemented"]};this.auto_evaluate=!1;var g=this.addInputPin("XML Input",["text"],VVVV.PinTypes.String),e=this.addInputPin("XPath Query",["text"],VVVV.PinTypes.String),f=this.addInputPin("Base Element",["text"],VVVV.PinTypes.String),d=this.addOutputPin("Output",
["text"],VVVV.PinTypes.String),c=this.addOutputPin("XML Index",[0],VVVV.PinTypes.Value),h=this.addOutputPin("Query Index",[0],VVVV.PinTypes.Value),q;this.evaluate=function(){var a=g.getValue(0),b=e.getValue(0);f.getValue(0);g.pinIsChanged()&&(q=(new DOMParser).parseFromString(a,"text/xml"));for(var a=q.evaluate(b,q,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),b=0,r;r=a.iterateNext();)r.value?d.setValue(b,r.value):r.data?d.setValue(b,r.data):d.setValue(b,""),b++;c.setValue(b,0);h.setValue(b,0);
d.setSliceCount(b);c.setSliceCount(1);h.setSliceCount(1)}};VVVV.Nodes.XPathXML.prototype=new VVVV.Core.Node;var UIState={Idle:0,Connecting:1,Moving:2,Creating:3,Changing:4,AreaSelecting:5};
VVVV.PinTypes.Value.makeLabel=VVVV.PinTypes.String.makeLabel=function(a,b){var g=b.IOBoxRows();b.IOBoxInputPin().getSliceCount();d3.select(a).selectAll(".vvvv-node-label").remove();for(var e=0;e<g;e++)d3.select(a).append("svg:text").text(b.IOBoxInputPin().getValue(e)).attr("class","vvvv-node-label").attr("shape-rendering","crispEdges").attr("dy",function(a){return 12*e+12}).attr("dx",4).attr("font-size",10).attr("font-family","Lucida Sans Unicode")};
VVVV.PinTypes.Value.openInputBox=VVVV.PinTypes.String.openInputBox=function(a,b,g,e){$inputbox=$("<input type='text' value='"+g.getValue(e)+"' class='pininputbox value resettable'/>");$inputbox.css("position",b.css("position"));$inputbox.css("width",b.css("width"));$inputbox.css("height",b.css("height"));$inputbox.css("left",b.css("left"));$inputbox.css("top",b.css("top"));b.replaceWith($inputbox);$inputbox.get(0).select();$inputbox.change(function(){g.setValue(e,$(this).val());g.node.parentPatch.editor.update(g.node.parentPatch,
"<PATCH><NODE id='"+g.node.id+"'><PIN pinname='"+g.pinname+"' values='"+_(g.values).map(function(a){return"|"+a+"|"}).join(",")+"'/></NODE>")});$inputbox.keydown(function(a){13==a.which&&($(this).change(),$(this).remove())});if("Value"==this.typeName){var f=function(a,b,f){var e=$(a).val()%1;if(!isNaN(e)){var g;g=1;if(f.altKey||0!==e)g=0.01;b*=g;$(a).val(parseFloat($(a).val())+b);$(a).change()}};$inputbox.bind("mousewheel",function(a){f(this,a.originalEvent.wheelDelta/120,a);a.preventDefault();return!1});
$inputbox.bind("DOMMouseScroll",function(a){f(this,-a.originalEvent.detail/3,a);a.preventDefault();return!1})}$inputbox.bind("paste",function(a){a.stopPropagation()});$inputbox.bind("copy",function(a){a.stopPropagation()})};
VVVV.PinTypes.Enum.openInputBox=function(a,b,g,e){$inputbox=$("<select class='pininputbox value resettable'>");for(a=0;a<g.enumOptions.length;a++)$opt=$('<option value="'+g.enumOptions[a]+'">'+g.enumOptions[a]+"</option>"),g.getValue(e)==g.enumOptions[a]&&$opt.attr("selected",!0),$inputbox.append($opt);$inputbox.css("position",b.css("position"));$inputbox.css("width",b.css("width"));$inputbox.css("height",b.css("height"));$inputbox.css("left",b.css("left"));$inputbox.css("top",b.css("top"));b.replaceWith($inputbox);
$inputbox.change(function(){g.setValue(e,$(this).val());g.node.parentPatch.editor.update(g.node.parentPatch,"<PATCH><NODE id='"+g.node.id+"'><PIN pinname='"+g.pinname+"' values='"+_(g.values).map(function(a){return"|"+a+"|"}).join(",")+"'/></NODE>")})};
VVVV.PinTypes.Color.makeLabel=function(a,b){var g=b.IOBoxRows();b.IOBoxInputPin().getSliceCount();d3.select(a).selectAll(".vvvv-node-label").remove();for(var e=0;e<g;e++)d3.select(a).append("svg:rect").attr("class","vvvv-node-label").attr("height",b.getHeight()/g-8).attr("width",b.getWidth()).attr("y",12*e+4).attr("fill",function(a){a=b.IOBoxInputPin().getValue(e).split(",");for(var d=0;d<a.length;d++)a[d]=parseInt(256*a[d]);return"rgba("+a.join(",")+")"})};
VVVV.PinTypes.Color.openInputBox=function(a,b,g,e){function f(a){c=a.altKey&&a.shiftKey?3:a.altKey?1:a.shiftKey?2:0}function d(a){var b=g.getValue(e).split(","),d=VVVV.PinTypes.Color.rgbToHsv(b[0],b[1],b[2]);d[3]=parseFloat(b[3]);d[c]+=0.01*a;0!=c&&(d[c]=Math.min(1,Math.max(0,d[c])));b=VVVV.PinTypes.Color.hsvToRgb(d[0],d[1],d[2]);b[3]=d[3];$inputbox.css("background-color","rgba("+_(b).map(function(a){return parseInt(255*a)}).join(",")+")");ibx=$inputbox;b.join(",");g.setValue(e,b.join(","));g.node.parentPatch.editor.update(g.node.parentPatch,
"<PATCH><NODE id='"+g.node.id+"'><PIN pinname='"+g.pinname+"' values='"+_(g.values).map(function(a){return"|"+a+"|"}).join(",")+"'/></NODE>")}var c=0;$(a.window.document).keydown(f).keyup(f);$inputbox=$('<div class="pininputbox color resettable"></div>');$inputbox.css("position",b.css("position"));$inputbox.css("width",b.css("width"));$inputbox.css("height",b.css("height"));$inputbox.css("left",b.css("left"));$inputbox.css("top",b.offset().top-8+"px");a=g.getValue(e).split(",");for(var h=0;h<a.length;h++)a[h]=
parseInt(256*a[h]);$inputbox.css("background-color","rgba("+a.join(",")+")");b.replaceWith($inputbox);$inputbox.on("mousewheel",function(a){d(a.originalEvent.wheelDelta/120);a.preventDefault();return!1});$inputbox.bind("DOMMouseScroll",function(a){d(-a.originalEvent.detail/3);a.preventDefault();return!1})};VVVV.Editors.BrowserEditor={};
VVVV.Editors.BrowserEditor.PatchWindow=function(a,b,g){function e(){c.selectAll(".vvvv-node.selected").attr("class",function(a){return a.isIOBox?"vvvv-node vvvv-iobox":"vvvv-node"});m=[]}this.state=UIState.Idle;var f=0,d=0,c,h,q,n,k,r=void 0,m=[],p=a,s=0,u=VVVV.Root+"/patch.html",v=!1,t=0,w=0,l=0,A=0;a.isSubpatch&&(u="patch.html");this.window=g?window:window.open(u,a.nodename,"location=no, width="+a.windowWidth+", height="+a.windowHeight+", toolbar=no");var y=this;window.setTimeout(function(){for(var k=
0;k<p.nodeList.length;k++)s=Math.max(s,p.nodeList[k].id);g?root=d3.select($(g).get(0)):(y.window.document.title=a.nodename,root=d3.select(y.window.document.body));if(!g){$("body",y.window.document).on("copy",function(a){for(var b=$("<PATCH>"),c=[],d=_(m).map(function(a){return a.id}),f=0;f<m.length;f++)b.append(m[f].serialize()),_(m[f].inputPins).each(function(a){for(var b=0;b<a.links.length;b++)0<=d.indexOf(a.links[b].fromPin.node.id)&&c.push(a.links[b])});for(f=0;f<c.length;f++)b.append(c[f].serialize());
b='<!DOCTYPE PATCH SYSTEM "http://vvvv.org/versions/vvvv45beta28.1.dtd" >\r\n'+b.wrapAll("<d></d>").parent().html();b=b.replace(/<patch/g,"<PATCH");b=b.replace(/<\/patch>/g,"\n </PATCH>");b=b.replace(/<node/g,"\n <NODE");b=b.replace(/<\/node>/g,"\n </NODE>");b=b.replace(/<bounds/g,"\n <BOUNDS");b=b.replace(/<\/bounds>/g,"\n </BOUNDS>");b=b.replace(/<pin/g,"\n <PIN");b=b.replace(/<\/pin>/g,"\n </PIN>");b=b.replace(/<lonk/g,"\n <LINK");b=b.replace(/<\/lonk>/g,"\n </LINK>");a.originalEvent.clipboardData.setData("text/plain",
b);a.preventDefault();return!1});var n=0,q=0;$("body",y.window.document).mousemove(function(a){n=a.pageX;q=a.pageY});$("body",y.window.document).on("paste",function(a){a=a.originalEvent.clipboardData.getData("text/plain");if(!a.match(/^<!DOCTYPE PATCH/))return!1;$patch=$(a);var d=void 0,f=void 0;$patch.find("node bounds").each(function(){var a=parseInt($(this).attr("left")),b=parseInt($(this).attr("top"));if(!d||a<d)d=a;if(!f||b<f)f=b});var g={};$patch.find("node").each(function(){s++;g[$(this).attr("id")]=
s;$(this).attr("createme","pronto");$(this).attr("id",s);var a=parseInt($(this).find("bounds").attr("left"))-d+15*n,b=parseInt($(this).find("bounds").attr("top"))-f+15*q;$(this).find("bounds").attr("left",a);$(this).find("bounds").attr("top",b)});$patch.find("link").each(function(){$(this).attr("createme","pronto");var a=$(this).attr("srcnodeid"),b=$(this).attr("dstnodeid");$(this).attr("srcnodeid",g[a]);$(this).attr("dstnodeid",g[b])});a=$patch.wrapAll("<d></d>").parent().html();b.update(p,a);e();
var h=_(g).map(function(a){return a});c.selectAll(".vvvv-node").each(function(a){0<=h.indexOf(parseInt(a.id))&&(m.push(a),d3.select(this).attr("class","vvvv-node selected"))})})}c=root.append("svg:svg").attr("class","chart").attr("width",Math.max(p.windowWidth,p.boundingBox.width)).attr("height",Math.max(p.windowHeight,p.boundingBox.height));k=c.append("svg:rect").attr("class","background").attr("width",Math.max(p.windowWidth,p.boundingBox.width)).attr("height",Math.max(p.windowHeight,p.boundingBox.height));
g||(c.on("mousemove",function(){if(y.state==UIState.Connecting)c.select(".vvvv-link.current-link").attr("x2",function(a){return d3.event.pageX+(d3.select(this).attr("x1")<d3.event.pageX?-1:1)}).attr("y2",function(a){return d3.event.pageY+(d3.select(this).attr("y1")<d3.event.pageY?-1:1)});else if(y.state==UIState.Moving){var a=d3.event.pageX-f,b=d3.event.pageY-d;c.selectAll(".vvvv-node.selected").attr("transform",function(c){return"translate("+(c.x+a)+","+(c.y+b)+")"});for(var g=0;g<m.length;g++){var h=
m[g];c.selectAll(".vvvv-link line").filter(function(a){return a.fromPin.node.id==h.id}).attr("x1",function(b){return b.fromPin.x+b.fromPin.node.x+a}).attr("y1",function(a){return a.fromPin.y+a.fromPin.node.y+b});c.selectAll(".vvvv-link line").filter(function(a){return a.toPin.node.id==h.id}).attr("x2",function(b){return b.toPin.x+b.toPin.node.x+a}).attr("y2",function(a){return a.toPin.y+a.toPin.node.y+b})}}else y.state==UIState.AreaSelecting&&(l=d3.event.pageX,A=d3.event.pageY,c.select(".selection-area").attr("transform",
"translate("+Math.min(t,l)+", "+Math.min(w,A)+")").attr("width",Math.abs(l-t)).attr("height",Math.abs(A-w)),e(),c.selectAll(".vvvv-node").each(function(a){for(var b=[a.x,a.x+a.getWidth()],c=[a.y,a.y+a.getHeight()],d=!1,f=0;2>f;f++)for(var e=0;2>e;e++)b[f]>=Math.min(t,l)&&(b[f]<=Math.max(t,l)&&c[e]>=Math.min(w,A)&&c[e]<=Math.max(w,A))&&(d=!0);d&&(d3.select(this).attr("class","vvvv-node selected"),m.push(a))}))}).on("contextmenu",function(){y.state==UIState.Connecting&&(c.select(".vvvv-link.current-link").remove(),
y.state=UIState.Idle);d3.event.stopPropagation();d3.event.preventDefault();return!1}).on("mouseup",function(){if(y.state==UIState.Moving){y.state=UIState.Idle;for(var a=d3.event.pageX-f,e=d3.event.pageY-d,g="<PATCH>",h=0;h<m.length;h++)var k=m[h],g=g+("<NODE componentmode='Node' id='"+k.id+"'><BOUNDS type='Node' left='"+15*(a+k.x)+"' top='"+15*(e+k.y)+"' width='"+k.width+"' height='"+k.height+"'/></NODE>");b.update(p,g+"</PATCH>")}y.state==UIState.AreaSelecting&&(c.select(".selection-area").remove(),
y.state=UIState.Idle)}).on("dblclick",function(){function a(b){g.empty();var c=e.find("#node_filter").val().toLowerCase();b=VVVV.NodeNames.concat(_(VVVV.ShaderCodeResources).map(function(a,b){return b.replace("%VVVV%/effects/","")}));b=_(_(b).filter(function(a){return 0<=VVVV.Helpers.translateOperators(a).toLowerCase().indexOf(c)})).sortBy(function(a){return a.toLowerCase().indexOf(c)});for(var d=0;d<b.length;d++)g.append($("<option>"+b[d]+"</option>"));g.find("option").first().attr("selected",!0)}
function c(){var a=e.find("#node_filter").val(),g=e.find("#new_node option:selected").val(),h="";g||!a.match(/\.fx$/)&&!a.match(/\.v4p$/)||(g=a);if(g){var k;(k=g.match(/^(.*\/([^\.]+))(\.vvvvjs)?\.fx$/))?(g=k[2]+" (EX9.Effect)",h=k[1]+".fx"):(k=g.match("([^.]+)(.vvvvjs)?.fx$"))?(g=k[1]+" (EX9.Effect)",h="%VVVV%/effects/"+k[1]+".fx"):g.match("[^/].v4p$")&&(h=g=a);s++;g="<PATCH>"+("<NODE componentmode='Hidden' id='"+s+"' nodename='"+g+"' systemname='"+g+"' "+(""!=h?"filename='"+h+"'":"")+">");g+="<BOUNDS type='Node' left='"+
15*d+"' top='"+15*f+"' width='100' height='100'/>"}else s++,g="<PATCH>"+("<NODE componentmode='Hidden' id='"+s+"' nodename='IOBox (String)' systemname='IOBox (String)'>"),g+="<BOUNDS type='Node' left='"+15*d+"' top='"+15*f+"' width='100' height='100'/>",g+="<PIN pinname='Input String' values='|"+a+"|'/>";b.update(p,g+"</NODE>");e.remove()}$("#node_selection",y.window.document).remove();var d=d3.event.pageX,f=d3.event.pageY,e=$('<div id="node_selection"><input type="text" id="node_filter"/></div>'),
g=$('<select id="new_node" size="8">');e.append(g);e.css("left",d);e.css("top",f);$("body",y.window.document).append(e);e.find("input").bind("paste",function(a){a.stopPropagation()});e.find("#node_filter").get(0).focus();a();e.find("#node_filter").keyup(function(b){if(13==b.which)c();else{if(40==b.which)return g.find("option:selected").first().next().attr("selected",!0),!1;if(38==b.which)return g.find("option:selected").first().prev().attr("selected",!0),!1;a()}});e.find("#new_node").click(c)}).on("mousedown",
function(){y.state==UIState.Idle&&(y.state=UIState.AreaSelecting,t=l=d3.event.pageX+1,w=A=d3.event.pageY+1,c.append("svg:rect").attr("class","selection-area").attr("stroke","#000").attr("stroke-dasharray","2,2").attr("stroke-width",1).attr("fill","rgba(0,0,0,0)").attr("transform","translate("+t+", "+w+")").attr("width",0).attr("height",0),e())}),k.on("click",function(){y.state=UIState.Idle;$(".resettable",y.window.document).remove();$("#node_selection",y.window.document).remove();e();r=void 0}),k=
function(a){v=a.shiftKey},$(y.window.document).keydown(k),$(y.window.document).keyup(k),$(y.window.document).keydown(function(a){if(46==a.which&&0<m.length){var d="<PATCH>";for(a=0;a<m.length;a++){var f=m[a],d=d+("<NODE id='"+m[a].id+"' deleteme='pronto'/>");_(f.inputPins).each(function(a){_(a.links).each(function(a){d+="<LINK deleteme='pronto' srcnodeid='"+a.fromPin.node.id+"' srcpinname='"+a.fromPin.pinname+"' dstnodeid='"+a.toPin.node.id+"' dstpinname='"+a.toPin.pinname+"'/>"})});_(f.outputPins).each(function(a){_(a.links).each(function(a){d+=
"<LINK deleteme='pronto' srcnodeid='"+a.fromPin.node.id+"' srcpinname='"+a.fromPin.pinname+"' dstnodeid='"+a.toPin.node.id+"' dstpinname='"+a.toPin.pinname+"'/>"})})}d+="</PATCH>";b.update(p,d);m=[]}else if(115!=a.which&&83!=a.which||!a.ctrlKey){if(73==a.which&&a.ctrlKey)return b.inspector?b.inspector.win.focus():b.openInspector("."),a.preventDefault(),!1;if(65==a.which&&a.ctrlKey)return e(),c.selectAll(".vvvv-node").each(function(a){m.push(a);d3.select(this).attr("class","vvvv-node selected")}),
a.preventDefault(),!1}else return b.save(p.nodename,p.toXML()),a.preventDefault(),!1}),$(y.window).resize(function(){p.windowWidth=$(this).width();p.windowHeight=$(this).height();p.boundingBox.width=Math.max(p.windowWidth,p.boundingBox.width);p.boundingBox.height=Math.max(p.windowHeight,p.boundingBox.height);p.afterUpdate()}));y.drawComplete();p.afterUpdate=function(){y.drawComplete();b.inspector&&window.setTimeout(b.inspector.update,100)};p.afterEvaluate=function(){h.filter(function(a){return a.isIOBox&&
VVVV.PinTypes[a.IOBoxInputPin().typeName].makeLabel}).each(function(a){VVVV.PinTypes[a.IOBoxInputPin().typeName].makeLabel(this,a)})}},1E3);this.close=function(){this.window.close()};this.drawComplete=function(){h&&h.remove();k&&k.remove();g||p.windowWidth==$(y.window).width()&&p.windowHeight==$(y.window).height()||y.window.resizeTo(p.windowWidth,p.windowHeight);c.attr("width",Math.max(p.windowWidth,p.boundingBox.width)).attr("height",Math.max(p.windowHeight,p.boundingBox.height));c.selectAll(".background").attr("width",
Math.max(p.windowWidth,p.boundingBox.width)).attr("height",Math.max(p.windowHeight,p.boundingBox.height));var a=c.append("svg:g").attr("class","link-group");h=c.selectAll("g.vvvv-node").data(p.nodeList).enter().append("svg:g").attr("class",function(a){var b="vvvv-node";a.isIOBox&&(b+=" vvvv-iobox");0<=m.indexOf(a)&&(b+=" selected");return b}).attr("id",function(a){return"vvvv-node-"+a.id}).attr("transform",function(a){return"translate("+a.x+","+a.y+")"});h.append("svg:rect").attr("class","vvvv-node-background").attr("height",
function(a){return a.getHeight()}).attr("width",function(a){return a.getWidth()}).attr("fill",function(a){return a.isComment()?"rgba(0,0,0,0)":a.not_implemented?"rgba(255,0,0,1)":"#cdcdcd"});h.append("svg:rect").attr("class","vvvv-node-pinbar").attr("height",function(a){return a.isIOBox?2:4}).attr("fill",function(a){return a.isIOBox?"#dddddd":"#9a9a9a"}).attr("width",function(a){return a.getWidth()});h.append("svg:rect").attr("class","vvvv-node-pinbar").attr("y",function(a){return a.isIOBox?a.getHeight()-
2:a.getHeight()-4}).attr("height",function(a){return a.isIOBox?2:4}).attr("fill",function(a){return a.isIOBox?"#dddddd":"#9a9a9a"}).attr("width",function(a){return a.getWidth()});h.append("svg:g").attr("class","descriptive-name-bg");h.append("svg:text").text(function(a){return a.invisiblePins["Descriptive Name"]?a.invisiblePins["Descriptive Name"].getValue(0):null}).attr("class","vvvv-node-descriptive-name").attr("shape-rendering","crispEdges").attr("dy",function(a){return a.getHeight()+12}).attr("dx",
2).attr("font-size",10).attr("font-family","Lucida Sans Unicode").attr("fill","white");h.selectAll("g.descriptive-name-bg").append("svg:rect").attr("fill",function(a){return void 0==a.invisiblePins["Descriptive Name"]||""==a.invisiblePins["Descriptive Name"].getValue(0)?"rgba(0,0,0,0)":"rgba(0,0,0,1)"}).attr("y",function(a){return a.getHeight()}).attr("width",5).attr("height",14);h.each(function(a){if(a.isIOBox&&VVVV.PinTypes[a.IOBoxInputPin().typeName].makeLabel){VVVV.PinTypes[a.IOBoxInputPin().typeName].makeLabel(this,
a);for(var b=a.IOBoxRows(),c=a.IOBoxInputPin().getSliceCount(),d=this,f=0;f<b;f++)(function(f){var e=d3.select(d).append("svg:rect").attr("width",a.getWidth()+2).attr("height",a.getHeight()/b-4).attr("y",12*f+2).attr("fill","rgba(0,0,0,0)");if(!g)e.on("contextmenu",function(a){if(void 0!=a.IOBoxInputPin().getValue(0)&&!a.IOBoxInputPin().isConnected()){$(".resettable",y.window.document).remove();var d=$("<input type='text'/>");$("body",y.window.document).append(d);d.css("position","absolute");d.css("left",
$(this).offset().left);d.css("top",$(this).offset().top+2);d.css("width",a.getWidth());d.css("height",a.getHeight()/b-4);VVVV.PinTypes[a.IOBoxInputPin().typeName].openInputBox(y.window,d,a.IOBoxInputPin(),f%c)}d3.event.stopPropagation();d3.event.preventDefault();return!1})})(f)}else d3.select(this).append("svg:text").text(function(a){return a.label()}).attr("class","vvvv-node-label").attr("shape-rendering","crispEdges").attr("dy",function(a,b){return 12*b+12}).attr("dx",4).attr("font-size",10).attr("font-family",
"Lucida Sans Unicode")});q=h.selectAll("g.vvvv-input-pin").data(function(a){return a.isSubpatch?_(a.inputPins).sortBy(function(a){return a.slavePin?a.slavePin.node.x:1}).map(function(a,b){return a}):_(a.inputPins).map(function(a,b){return a})}).enter().append("svg:g").attr("class","vvvv-input-pin").attr("transform",function(a,b){pinOffset=0;1<_(a.node.inputPins).size()&&(pinOffset=(a.node.getWidth()-4)/(_(a.node.inputPins).size()-1));a.y=0;a.x=b*pinOffset;return"translate("+a.x+", 0)"});q.append("svg:rect").attr("width",
4).attr("height",4).attr("fill",function(a){return a.node.isComment()?"rgba(0,0,0,0)":"#666666"}).on("mouseover",function(a,b){c.selectAll("#vvvv-node-"+a.node.id+" g.vvvv-input-pin").filter(function(a,c){return c==b}).each(function(){d3.select(this).append("svg:rect").attr("class","vvvv-input-pin-highlight").attr("width",4).attr("height",4).attr("fill","rgba(0,0,0,1)").attr("y",-4);d3.select(this).append("svg:text").text(function(a){return 1<a.getSliceCount()?a.pinname+"("+a.getSliceCount()+"): "+
a.getValue(0):a.pinname+": "+a.getValue(0)}).attr("dy",30).attr("font-size",10).attr("font-family","Lucida Sans Unicode").attr("fill","rgba(0,0,0,1)")})}).on("mouseout",function(a,b){c.selectAll("#vvvv-node-"+a.node.id+" g.vvvv-input-pin text").remove();c.selectAll("#vvvv-node-"+a.node.id+" g.vvvv-input-pin rect.vvvv-input-pin-highlight").remove()});n=h.selectAll("g.vvvv-output-pin").data(function(a){return _(a.outputPins).map(function(a,b){return a})}).enter().append("svg:g").attr("class","vvvv-output-pin").attr("transform",
function(a,b){pinOffset=0;1<_(a.node.outputPins).size()&&(pinOffset=(a.node.getWidth()-4)/(_(a.node.outputPins).size()-1));a.y=a.node.getHeight()-4;a.x=b*pinOffset;return"translate("+a.x+", "+a.y+")"});n.append("svg:rect").attr("width",4).attr("height",4).attr("fill",function(a){return a.node.isComment()?"rgba(0,0,0,0)":"#666666"}).on("mouseover",function(a,b){c.selectAll("#vvvv-node-"+a.node.id+" g.vvvv-output-pin").filter(function(a,c){return c==b}).each(function(){d3.select(this).append("svg:rect").attr("class",
"vvvv-output-pin-highlight").attr("width",4).attr("height",4).attr("fill","rgba(0,0,0,1)").attr("y",-4);d3.select(this).append("svg:text").text(function(a){return 1<a.getSliceCount()?a.pinname+"("+a.getSliceCount()+"): "+a.getValue(0):a.pinname+": "+a.getValue(0)}).attr("dy",30).attr("font-size",10).attr("font-family","Lucida Sans Unicode").attr("fill","rgba(0,0,0,1)")})}).on("mouseout",function(a,b){c.selectAll("#vvvv-node-"+a.node.id+" g.vvvv-output-pin text").remove();c.selectAll("#vvvv-node-"+
a.node.id+" g.vvvv-output-pin rect.vvvv-output-pin-highlight").remove()});k=a.selectAll("g.vvvv-link").data(p.linkList).enter().append("svg:g").attr("class","vvvv-link");k.append("svg:line").attr("stroke","rgba(0, 0, 0, 0)").attr("stroke-width",4).attr("x1",function(a){return a.fromPin.x+a.fromPin.node.x+2+0.5}).attr("y1",function(a){return a.fromPin.y+a.fromPin.node.y+4+0.5}).attr("x2",function(a){return a.toPin.x+a.toPin.node.x+2+0.5}).attr("y2",function(a){return a.toPin.y+a.toPin.node.y+0.5});
k.append("svg:line").attr("stroke","#000").attr("stroke-width",1).attr("x1",function(a){return a.fromPin.x+a.fromPin.node.x+2+0.5}).attr("y1",function(a){return a.fromPin.y+a.fromPin.node.y+4+0.5}).attr("x2",function(a){return a.toPin.x+a.toPin.node.x+2+0.5}).attr("y2",function(a){return a.toPin.y+a.toPin.node.y+0.5});$(".descriptive-name-bg rect",y.window.document).each(function(){$(this,y.window.document).attr("width",$(this,y.window.document).parent().next().get(0).getBBox().width+4)});g||(c.selectAll("g.vvvv-input-pin").on("contextmenu",
function(a,b){if(VVVV.PinTypes[a.typeName].openInputBox&&void 0!=a.getValue(0)){$(".resettable",y.window.document).remove();var c=$("<input type='text'/>");$("body",y.window.document).append(c);c.css("position","absolute");c.css("left",$(this).offset().left);c.css("top",$(this).offset().top-3);c.css("width",50);c.css("height",14);VVVV.PinTypes[a.typeName].openInputBox(y,c,a,0)}d3.event.stopPropagation();d3.event.preventDefault();return!1}),c.selectAll("g.vvvv-input-pin, g.vvvv-output-pin").on("click",
function(a,d){if(y.state!=UIState.Connecting){r=a;y.state=UIState.Connecting;c.append("svg:line").attr("class","vvvv-link current-link resettable").attr("stroke","#000").attr("stroke-width",1).attr("x1",a.x+a.node.x+2+0.5).attr("y1",a.y+a.node.y+2+0.5).attr("x2",a.x+a.node.x+2+0.5).attr("y2",a.y+a.node.y+2+0.5);var f=r.direction==PinDirection.Output?"input":"output",e=r.node.getUpstreamNodes();c.selectAll("g.vvvv-"+f+"-pin").filter(function(a){return a.typeName!=r.typeName&&("Node"!=r.typeName||VVVV.PinTypes[a.typeName].primitive&&
("Node"!=a.typeName||VVVV.PinTypes[r.typeName].primitive))||0<=e.indexOf(a.node)||a.node==r.node?!1:!0}).append("svg:rect").attr("class","vvvv-connection-highlight").attr("width",4).attr("height",3).attr("fill","rgba(0,0,0,1)").attr("y",function(a){return a.direction==PinDirection.Input?-3:3})}else{if(r.direction==PinDirection.Input)var f=a,g=r;else f=r,g=a;if(f.typeName==g.typeName||"Node"==f.typeName&&!VVVV.PinTypes[g.typeName].primitive||"Node"==g.typeName&&!VVVV.PinTypes[f.typeName].primitive){var h=
"<PATCH>";_(g.links).each(function(a){h+="<LINK deleteme='pronto' srcnodeid='"+a.fromPin.node.id+"' srcpinname='"+a.fromPin.pinname+"' dstnodeid='"+a.toPin.node.id+"' dstpinname='"+a.toPin.pinname+"'/>"});h+="<LINK createme='pronto' srcnodeid='"+f.node.id+"' srcpinname='"+f.pinname+"' dstnodeid='"+g.node.id+"' dstpinname='"+g.pinname+"'/>";h+="</PATCH>";b.update(p,h);c.select(".vvvv-link.current-link").remove();c.select(".vvvv-connection-highlight").remove();y.state=UIState.Idle}p.afterUpdate()}d3.event.stopPropagation()}).on("mousedown",
function(){d3.event.stopPropagation()}),c.selectAll("g.vvvv-link").on("contextmenu",function(a){b.update(p,"<PATCH><LINK deleteme='pronto' srcnodeid='"+a.fromPin.node.id+"' srcpinname='"+a.fromPin.pinname+"' dstnodeid='"+a.toPin.node.id+"' dstpinname='"+a.toPin.pinname+"'/></PATCH>");d3.event.preventDefault()}),h.on("mousedown",function(a){$(".resettable",y.window.document).remove();y.state=UIState.Moving;0>m.indexOf(a)&&(v||e(),d3.select(this).attr("class","vvvv-node selected"),m.push(a));f=d3.event.pageX;
d=d3.event.pageY;b.inspector&&b.inspector.setNode(a);d3.event.preventDefault();d3.event.stopPropagation();return!1}).on("contextmenu",function(a){a.isSubpatch?b.openPatch(a):a.openUIWindow&&a.openUIWindow();d3.event.preventDefault();d3.event.stopPropagation();return!1}))}};
VVVV.Editors.BrowserEditor.Inspector=function(a){function b(){d=void 0;$(c.win.document).find("#pins, #values").empty();$(c.win.document).find("#pins").append('<div class="row heading">Configuration</div>');$(c.win.document).find("#values").append('<div class="row heading"></div>');_(f.invisiblePins).each(function(a){g(a)});$(c.win.document).find("#pins").append('<div class="row heading">Input Pins</div>');$(c.win.document).find("#values").append('<div class="row heading"></div>');_(f.inputPins).each(function(a){g(a)});
$(c.win.document).find("#pins").append('<div class="row heading">Output Pins</div>');$(c.win.document).find("#values").append('<div class="row heading"></div>');_(f.outputPins).each(function(a){g(a)})}function g(a){var b=$('<a class="row pin" href="#">'+a.pinname+"</a>");$(c.win.document).find("#pins").append(b);b.click(function(b){$(c.win.document).find("a.pin.active").removeClass("active");$(this).addClass("active");VVVV.PinTypes[a.typeName].openInputBox&&e(a);b.preventDefault();return!1});VVVV.PinTypes[a.typeName].openInputBox&&
a.direction!=PinDirection.Output&&!a.isConnected()&&void 0!=a.getValue(0)?(b=$('<div class="row value"><div style="height:100%">'+a.getValue(0)+"</div></div>"),b.find("div").click(function(){VVVV.PinTypes[a.typeName].openInputBox(c.win,$(this),a,0)})):b=$('<div class="row value readonlyvalue"><div style="height:100%">'+a.getValue(0)+"</div></div>");"Color"==a.typeName&&b.find("div").css("background-color","rgba("+_(a.getValue(0).split(",")).map(function(a){return parseInt(255*a)}).join(",")+")");
$(c.win.document).find("#values").append(b)}function e(a){var b=d!=a;d=a;var f=a.getSliceCount(),e=$('<div class="row heading"><input type="text" value="'+f+'"/ size="3"/> Slices</div>');a.direction!=PinDirection.Input&&e.find("input").attr("disabled",!0);var g=$(c.win.document).find("#values .row").first();0<g.length?g.replaceWith(e):$(c.win.document).find("#values").append(e);e.find("input").change(function(a){for(var b=Math.max(1,parseInt($(this).val())),c=d.getSliceCount();c<b;c++)d.setValue(c,
VVVV.PinTypes[d.typeName].defaultValue());d.setSliceCount(b);d.node.parentPatch.afterUpdate();a.preventDefault();return!1});for(e=e=0;e<f;e++)if(g=$(c.win.document).find("#values .row").eq(e+1),b||!g.children().first().hasClass("pininputbox")){if(VVVV.PinTypes[a.typeName].openInputBox&&a.direction!=PinDirection.Output&&!a.isConnected()&&void 0!=a.getValue(0)){var m=$('<div class="row value"><div style="height:100%">'+a.getValue(e)+"</div></div>");(function(b){m.find("div").click(function(){VVVV.PinTypes[a.typeName].openInputBox(c.win,
$(this),a,b)})})(e)}else m=$('<div class="row value readonlyvalue"><div style="height:100%">'+a.getValue(e)+"</div></div>");0<g.length?g.replaceWith(m):$(c.win.document).find("#values").append(m);"Color"==a.typeName&&m.find("div").css("background-color","rgba("+_(a.getValue(e).split(",")).map(function(a){return parseInt(255*a)}).join(",")+")")}e++;for(g=$(c.win.document).find("#values .row");e<g.length;e++)g.eq(e).remove()}this.win=window.open(a+"/inspektor.html","inspektor","location=no, width=250, height=600, toolbar=no");
var f,d;insw=this.win;var c=this;this.update=function(){f&&(d?e(d):b())};this.setNode=function(a){f=a;b()};this.close=function(){this.win.close()}};
VVVV.Editors.BrowserEditor.Interface=function(){function a(){return"Are you sure you want to leave? Unsaved changes in your patches will be lost."}var b=[],g={};this.inspector=void 0;this.enable=function(f,d){d=d||{};this.addPatch(f);this.openPatch(f,d.selector);if(!d.selector){var c=this;$(window).bind("beforeunload",a);$(window).unload(function(){c.disable()});this.openInspector(VVVV.Root);b[0].window?d&&d.success&&d.success():d&&d.error&&d.error()}};this.openInspector=function(a,b){if(!this.inspector){this.inspector=
new VVVV.Editors.BrowserEditor.Inspector(a);var c=this;$(this.inspector.win).bind("beforeunload",function(){console.log("closing inspektor");c.inspector=void 0})}};var e=[];this.addPatch=function(a){for(var b=a.id,c=a;void 0!=(c=c.parentPatch);)b+="-"+c.id;if(!(0<=e.indexOf(b)))for(e.push(b),a.editor=this,b=VVVV.Helpers.prepareFilePath(a.nodename,a.parentPatch),void 0==g[b]&&(g[b]=[]),g[b].push(a),a=a.getSubPatches(),b=0;b<a.length;b++)this.addPatch(a[b])};this.removePatch=function(a){for(var b=a.getSubPatches(),
c=0;c<b.length;c++)this.removePatch(b[c]);b=VVVV.Helpers.prepareFilePath(a.nodename,a.parentPatch);g[b].splice(g[b].indexOf(a),1);0==g[b].length&&delete g[b];console.log(g)};this.openPatch=function(a,d){b.push(new VVVV.Editors.BrowserEditor.PatchWindow(a,this,d))};this.update=function(a,b){for(var c=VVVV.Helpers.prepareFilePath(a.nodename,a.parentPatch),e=g[c].length,q=0;q<e;q++)g[c][q].doLoad(b),g[c][q].afterUpdate()};this.disable=function(){for(var e=0;e<b.length;e++)b[e].close();this.inspector&&
this.inspector.close();$(window).unbind("beforeunload",a)};this.save=function(a,b){var c=$("<a>save</a>");$("body").append(c);c.attr("href","data:application/octet-stream;charset=utf-8,"+encodeURIComponent(b));c.attr("download",a);c[0].click();c.remove()};this.sendUndo=function(){}};VVVV.VVVViewer=function(a,b){(new VVVV.Editors.BrowserEditor.Interface).enable(a,{selector:b})};VVVV.Editors.edit=VVVV.Editors.BrowserEditor.Interface;