Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (24 sloc) 569 Bytes
'use strict';
function fiddle(node, type = 'texture') {
const nodeType = nodeTypes[type][node[0]];
if (Math.random() < 0.1) {
return generateNode(5, type);
} else {
if (typeof node === 'number') {
return node;
} else {
return [node[0]].concat(nodeType.params.map((each, index) => fiddle(node[index + 1], each)));
}
}
}
function makeGrid(node) {
const shaders = [];
for (let y = 0; y < 5; y++) {
const row = [];
for (let x = 0; x < 5; x++) {
row.push(y === 2 && x === 2 ? node : fiddle(node));
}
shaders.push(row);
}
return shaders;
}