diff --git a/package-lock.json b/package-lock.json index e3ac7f5..ee6e550 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "shadergraph", - "version": "2.1.1", + "version": "2.1.2", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 189c0ae..1940013 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shadergraph", - "version": "2.1.1", + "version": "2.1.2", "description": "GLSL linker", "repository": { "type": "git", diff --git a/src/factory/factory.js b/src/factory/factory.js index b5f7ebe..ef4698b 100644 --- a/src/factory/factory.js +++ b/src/factory/factory.js @@ -219,7 +219,7 @@ export class Factory { } // Make subgraph and connect to tail - _isolate(sub, main) { + _isolate(sub, _main) { if (sub.nodes.length) { let block; const subgraph = this._subgraph(sub); @@ -239,7 +239,7 @@ export class Factory { } // Convert to callback and connect to tail - _callback(sub, main) { + _callback(sub, _main) { if (sub.nodes.length) { let block; const subgraph = this._subgraph(sub); diff --git a/src/glsl/compile.js b/src/glsl/compile.js index abd6957..25a638a 100644 --- a/src/glsl/compile.js +++ b/src/glsl/compile.js @@ -10,7 +10,7 @@ */ export const compile = function (program) { - const { ast, code, signatures } = program; + const { code, signatures } = program; // Prepare list of placeholders const placeholders = replaced(signatures); @@ -21,17 +21,6 @@ export const compile = function (program) { return [signatures, assembler]; }; -// ##### - -const tick = function () { - const now = +new Date(); - return function (label) { - const delta = +new Date() - now; - console.log(label, delta + " ms"); - return delta; - }; -}; - var replaced = function (signatures) { const out = {}; const s = (sig) => (out[sig.name] = true); @@ -70,7 +59,7 @@ var string_compiler = function (code, placeholders) { // Strip comments code = code.replace(/\/\/[^\n]*/g, ""); - code = code.replace(/\/\*([^*]|\*[^\/])*\*\//g, ""); + code = code.replace(/\/\*([^*]|\*[^/])*\*\//g, ""); // Strip all preprocessor commands (lazy) //code = code.replace /^#[^\n]*/mg, '' diff --git a/src/glsl/decl.js b/src/glsl/decl.js index 9c18184..f4e6c63 100644 --- a/src/glsl/decl.js +++ b/src/glsl/decl.js @@ -9,7 +9,7 @@ import { Vector2 } from "three/src/math/Vector2.js"; import { Vector3 } from "three/src/math/Vector3.js"; -import { Vector4 } from "three/src/math/Vector3.js"; +import { Vector4 } from "three/src/math/Vector4.js"; import { Matrix3 } from "three/src/math/Matrix3.js"; import { Matrix4 } from "three/src/math/Matrix4.js"; @@ -37,7 +37,6 @@ decl.external = function (node) { let c = node.children; let storage = get(c[1]); - const struct = get(c[3]); const type = get(c[4]); const list = c[5]; @@ -74,7 +73,6 @@ decl.function = function (node) { // console.log 'function', node const storage = get(c[1]); - const struct = get(c[3]); const type = get(c[4]); const func = c[5]; const ident = get(func.children[0]); @@ -229,8 +227,7 @@ class Definition { } copy(name, meta) { - let def; - return (def = new Definition( + return new Definition( name != null ? name : this.name, this.type, this.spec, @@ -238,6 +235,6 @@ class Definition { this.value, this.inout, meta - )); + ); } } diff --git a/src/glsl/generate.js b/src/glsl/generate.js index db37a1f..cd78154 100644 --- a/src/glsl/generate.js +++ b/src/glsl/generate.js @@ -89,7 +89,6 @@ export function same(a, b) { export function call(lookup, dangling, entry, signature, body) { const args = []; let ret = ""; - const rets = 1; for (let arg of Array.from(signature)) { var id, shadow; @@ -99,7 +98,6 @@ export function call(lookup, dangling, entry, signature, body) { let other = null; let meta = null; let omit = false; - const { inout } = arg; const isReturn = name === $.RETURN_ARG; @@ -178,7 +176,6 @@ export function build(body, calls) { // Check if we're only calling one snippet with identical signature // and not building void main(); if (calls && calls.length === 1 && entry !== "main") { - const a = body; const b = calls[0].module; if (same(body.signature, b.main.signature)) { @@ -304,7 +301,8 @@ export const link = (link, out) => { // Build wrapper function for the calling side const outer = body(); - const wrapper = call(_lookup, _dangling, entry, external.signature, outer); + call(_lookup, _dangling, entry, external.signature, outer); + outer.calls = inner.calls; outer.entry = name; @@ -317,7 +315,7 @@ export function defuse(code) { // Don't try this at home kids const re = /([A-Za-z0-9_]+\s+)?[A-Za-z0-9_]+\s+[A-Za-z0-9_]+\s*\([^)]*\)\s*;\s*/gm; - const strip = (code) => code.replace(re, (m) => ""); + const strip = (code) => code.replace(re, (_m) => ""); // Split into scopes by braces const blocks = code.split(/(?=[{}])/g); @@ -366,7 +364,7 @@ export function dedupe(code) { const map = {}; const re = /((attribute|uniform|varying)\s+)[A-Za-z0-9_]+\s+([A-Za-z0-9_]+)\s*(\[[^\]]*\]\s*)?;\s*/gm; - return code.replace(re, function (m, qual, type, name, struct) { + return code.replace(re, function (m, qual, type, name, _struct) { if (map[name]) { return ""; } diff --git a/src/graph/node.js b/src/graph/node.js index 7013bb8..417546a 100644 --- a/src/graph/node.js +++ b/src/graph/node.js @@ -16,7 +16,7 @@ export class Node { static initClass() { this.index = 0; } - static id(name) { + static id(_name) { return ++Node.index; } @@ -176,7 +176,7 @@ export class Node { } // Disconnect entire node - disconnect(node) { + disconnect(_node) { let outlet; for (outlet of Array.from(this.inputs)) { outlet.disconnect(); @@ -233,7 +233,6 @@ export class Node { // Remove outlet object from node. _remove(outlet) { const key = this._key(outlet); - const { inout } = outlet; // Sanity checks if (outlet.node !== this) { diff --git a/src/visualize/markup.js b/src/visualize/markup.js index d5fe4a5..91f4e32 100644 --- a/src/visualize/markup.js +++ b/src/visualize/markup.js @@ -60,7 +60,7 @@ var _activate = function (el) { popup.parentNode.classList.add("shadergraph-has-code"); return popup.parentNode.addEventListener( "click", - (event) => + (_event) => (popup.style.display = { block: "none", none: "block", diff --git a/src/visualize/serialize.js b/src/visualize/serialize.js index a404e39..8f96c51 100644 --- a/src/visualize/serialize.js +++ b/src/visualize/serialize.js @@ -8,8 +8,6 @@ // Dump graph for debug/visualization purposes import * as Block from "../block"; -const isCallback = (outlet) => outlet.type[0] === "("; - export var serialize = function (graph) { const nodes = []; const links = [];