From c5951047814015d2567a72a7d8a0395f865384fd Mon Sep 17 00:00:00 2001 From: Kristofer Date: Sun, 3 Dec 2017 16:22:44 +0100 Subject: [PATCH] Fixed global missing LGraphTexture --- build/litegraph.js | 3 +- build/litegraph.min.js | 162 ++++++++++++++++++++-------------------- npm-debug.log | 34 +++++++++ src/nodes/gltextures.js | 3 +- 4 files changed, 120 insertions(+), 82 deletions(-) create mode 100644 npm-debug.log diff --git a/build/litegraph.js b/build/litegraph.js index 76986ebd49..03d7c72fde 100644 --- a/build/litegraph.js +++ b/build/litegraph.js @@ -9264,9 +9264,10 @@ LiteGraph.registerNodeType("graphics/webcam", ImageWebcam ); })(); //Works with Litegl.js to create WebGL nodes +var LGraphTexture if(typeof(LiteGraph) != "undefined") { - function LGraphTexture() + LGraphTexture = function() { this.addOutput("Texture","Texture"); this.properties = { name:"", filter: true }; diff --git a/build/litegraph.min.js b/build/litegraph.min.js index 859e210a89..2d654c505e 100755 --- a/build/litegraph.min.js +++ b/build/litegraph.min.js @@ -4386,15 +4386,16 @@ LiteGraph.registerNodeType("logic/selector", Selector); }; LiteGraph.registerNodeType("graphics/webcam", a); })(); +var LGraphTexture; if ("undefined" != typeof LiteGraph) { var LGraphCubemap = function() { this.addOutput("Cubemap", "Cubemap"); this.properties = {name:""}; - this.size = [LGraphTexture$0.image_preview_size, LGraphTexture$0.image_preview_size]; + this.size = [LGraphTexture.image_preview_size, LGraphTexture.image_preview_size]; }, LGraphTextureMatte = function() { this.addInput("in", "Texture"); this.addOutput("out", "Texture"); - this.properties = {key_color:vec3.fromValues(0., 1., 0.), threshold:0.8, slope:0.2, precision:LGraphTexture$0.DEFAULT}; + this.properties = {key_color:vec3.fromValues(0., 1., 0.), threshold:0.8, slope:0.2, precision:LGraphTexture.DEFAULT}; LGraphTextureMatte._shader || (LGraphTextureMatte._shader = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, LGraphTextureMatte.pixel_shader)); }, LGraphTextureWebcam = function() { this.addOutput("Webcam", "Texture"); @@ -4418,14 +4419,14 @@ if ("undefined" != typeof LiteGraph) { }, LGraphTextureEdges = function() { this.addInput("Tex.", "Texture"); this.addOutput("Edges", "Texture"); - this.properties = {invert:!0, factor:1, precision:LGraphTexture$0.DEFAULT}; + this.properties = {invert:!0, factor:1, precision:LGraphTexture.DEFAULT}; LGraphTextureEdges._shader || (LGraphTextureEdges._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, LGraphTextureEdges.pixel_shader)); }, LGraphTextureMix = function() { this.addInput("A", "Texture"); this.addInput("B", "Texture"); this.addInput("Mixer", "Texture"); this.addOutput("Texture", "Texture"); - this.properties = {precision:LGraphTexture$0.DEFAULT}; + this.properties = {precision:LGraphTexture.DEFAULT}; LGraphTextureMix._shader || (LGraphTextureMix._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, LGraphTextureMix.pixel_shader)); }, LGraphTextureGradient = function() { this.addInput("A", "color"); @@ -4455,7 +4456,7 @@ if ("undefined" != typeof LiteGraph) { this.addInput("LUT", "Texture"); this.addInput("Intensity", "number"); this.addOutput("", "Texture"); - this.properties = {intensity:1, precision:LGraphTexture$0.DEFAULT, texture:null}; + this.properties = {intensity:1, precision:LGraphTexture.DEFAULT, texture:null}; LGraphTextureLUT._shader || (LGraphTextureLUT._shader = new GL.Shader(Shader.SCREEN_VERTEX_SHADER, LGraphTextureLUT.pixel_shader)); }, LGraphImageToTexture = function() { this.addInput("Image", "image"); @@ -4469,11 +4470,11 @@ if ("undefined" != typeof LiteGraph) { }, LGraphTextureDownsample = function() { this.addInput("Texture", "Texture"); this.addOutput("", "Texture"); - this.properties = {iterations:1, generate_mipmaps:!1, precision:LGraphTexture$0.DEFAULT}; + this.properties = {iterations:1, generate_mipmaps:!1, precision:LGraphTexture.DEFAULT}; }, LGraphTextureCopy = function() { this.addInput("Texture", "Texture"); this.addOutput("", "Texture"); - this.properties = {size:0, generate_mipmaps:!1, precision:LGraphTexture$0.DEFAULT}; + this.properties = {size:0, generate_mipmaps:!1, precision:LGraphTexture.DEFAULT}; }, LGraphTextureToViewport = function() { this.addInput("Texture", "Texture"); this.properties = {additive:!1, antialiasing:!1, filter:!0, disable_alpha:!1, gamma:1.0}; @@ -4483,13 +4484,13 @@ if ("undefined" != typeof LiteGraph) { this.addInput("warp", "Texture"); this.addInput("factor", "number"); this.addOutput("out", "Texture"); - this.properties = {factor:0.01, precision:LGraphTexture$0.DEFAULT}; + this.properties = {factor:0.01, precision:LGraphTexture.DEFAULT}; }, LGraphTextureScaleOffset = function() { this.addInput("in", "Texture"); this.addInput("scale", "vec2"); this.addInput("offset", "vec2"); this.addOutput("out", "Texture"); - this.properties = {offset:vec2.fromValues(0, 0), scale:vec2.fromValues(1, 1), precision:LGraphTexture$0.DEFAULT}; + this.properties = {offset:vec2.fromValues(0, 0), scale:vec2.fromValues(1, 1), precision:LGraphTexture.DEFAULT}; }, LGraphTextureShader = function() { this.addOutput("Texture", "Texture"); this.properties = {code:"", width:512, height:512}; @@ -4500,7 +4501,7 @@ if ("undefined" != typeof LiteGraph) { this.addInput("value", "number"); this.addOutput("Texture", "Texture"); this.help = "

pixelcode must be vec3

\r\n\t\t\t

uvcode must be vec2, is optional

\r\n\t\t\t

uv: tex. coords

color: texture

colorB: textureB

time: scene time

value: input value

"; - this.properties = {value:1, uvcode:"", pixelcode:"color + colorB * value", precision:LGraphTexture$0.DEFAULT}; + this.properties = {value:1, uvcode:"", pixelcode:"color + colorB * value", precision:LGraphTexture.DEFAULT}; }, LGraphTextureSave = function() { this.addInput("Texture", "Texture"); this.addOutput("", "Texture"); @@ -4508,34 +4509,35 @@ if ("undefined" != typeof LiteGraph) { }, LGraphTexturePreview = function() { this.addInput("Texture", "Texture"); this.properties = {flipY:!1}; - this.size = [LGraphTexture$0.image_preview_size, LGraphTexture$0.image_preview_size]; - }, LGraphTexture$0 = function() { + this.size = [LGraphTexture.image_preview_size, LGraphTexture.image_preview_size]; + }; + LGraphTexture = function() { this.addOutput("Texture", "Texture"); this.properties = {name:"", filter:!0}; - this.size = [LGraphTexture$0.image_preview_size, LGraphTexture$0.image_preview_size]; + this.size = [LGraphTexture.image_preview_size, LGraphTexture.image_preview_size]; }; - LGraphTexture$0.title = "Texture"; - LGraphTexture$0.desc = "Texture"; - LGraphTexture$0.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}; - LGraphTexture$0.loadTextureCallback = null; - LGraphTexture$0.image_preview_size = 256; - LGraphTexture$0.PASS_THROUGH = 1; - LGraphTexture$0.COPY = 2; - LGraphTexture$0.LOW = 3; - LGraphTexture$0.HIGH = 4; - LGraphTexture$0.REUSE = 5; - LGraphTexture$0.DEFAULT = 2; - LGraphTexture$0.MODE_VALUES = {"pass through":LGraphTexture$0.PASS_THROUGH, copy:LGraphTexture$0.COPY, low:LGraphTexture$0.LOW, high:LGraphTexture$0.HIGH, reuse:LGraphTexture$0.REUSE, "default":LGraphTexture$0.DEFAULT}; - LGraphTexture$0.getTexturesContainer = function() { + LGraphTexture.title = "Texture"; + LGraphTexture.desc = "Texture"; + LGraphTexture.widgets_info = {name:{widget:"texture"}, filter:{widget:"checkbox"}}; + LGraphTexture.loadTextureCallback = null; + LGraphTexture.image_preview_size = 256; + LGraphTexture.PASS_THROUGH = 1; + LGraphTexture.COPY = 2; + LGraphTexture.LOW = 3; + LGraphTexture.HIGH = 4; + LGraphTexture.REUSE = 5; + LGraphTexture.DEFAULT = 2; + LGraphTexture.MODE_VALUES = {"pass through":LGraphTexture.PASS_THROUGH, copy:LGraphTexture.COPY, low:LGraphTexture.LOW, high:LGraphTexture.HIGH, reuse:LGraphTexture.REUSE, "default":LGraphTexture.DEFAULT}; + LGraphTexture.getTexturesContainer = function() { return gl.textures; }; - LGraphTexture$0.loadTexture = function(c, e) { + LGraphTexture.loadTexture = function(c, e) { e = e || {}; var f = c; "http://" == f.substr(0, 7) && LiteGraph.proxy && (f = LiteGraph.proxy + f.substr(7)); - return LGraphTexture$0.getTexturesContainer()[c] = GL.Texture.fromURL(f, e); + return LGraphTexture.getTexturesContainer()[c] = GL.Texture.fromURL(f, e); }; - LGraphTexture$0.getTexture = function(c) { + LGraphTexture.getTexture = function(c) { var e = this.getTexturesContainer(); if (!e) { throw "Cannot load texture, container of textures not found"; @@ -4543,18 +4545,18 @@ if ("undefined" != typeof LiteGraph) { e = e[c]; return !e && c && ":" != c[0] ? this.loadTexture(c) : e; }; - LGraphTexture$0.getTargetTexture = function(c, e, f) { + LGraphTexture.getTargetTexture = function(c, e, f) { if (!c) { throw "LGraphTexture.getTargetTexture expects a reference texture"; } switch(f) { - case LGraphTexture$0.LOW: + case LGraphTexture.LOW: f = gl.UNSIGNED_BYTE; break; - case LGraphTexture$0.HIGH: + case LGraphTexture.HIGH: f = gl.HIGH_PRECISION_FORMAT; break; - case LGraphTexture$0.REUSE: + case LGraphTexture.REUSE: return c; default: f = c ? c.type : gl.UNSIGNED_BYTE; @@ -4562,7 +4564,7 @@ if ("undefined" != typeof LiteGraph) { e && e.width == c.width && e.height == c.height && e.type == f || (e = new GL.Texture(c.width, c.height, {type:f, format:gl.RGBA, filter:gl.LINEAR})); return e; }; - LGraphTexture$0.getNoiseTexture = function() { + LGraphTexture.getNoiseTexture = function() { if (this._noise_texture) { return this._noise_texture; } @@ -4571,10 +4573,10 @@ if ("undefined" != typeof LiteGraph) { } return this._noise_texture = c = GL.Texture.fromMemory(512, 512, c, {format:gl.RGBA, wrap:gl.REPEAT, filter:gl.NEAREST}); }; - LGraphTexture$0.prototype.onDropFile = function(c, e, f) { + LGraphTexture.prototype.onDropFile = function(c, e, f) { c ? ("string" == typeof c ? c = GL.Texture.fromURL(c) : -1 != e.toLowerCase().indexOf(".dds") ? c = GL.Texture.fromDDSInMemory(c) : (c = new Blob([f]), c = URL.createObjectURL(c), c = GL.Texture.fromURL(c)), this._drop_texture = c, this.properties.name = e) : (this._drop_texture = null, this.properties.name = ""); }; - LGraphTexture$0.prototype.getExtraMenuOptions = function(c) { + LGraphTexture.prototype.getExtraMenuOptions = function(c) { var e = this; if (this._drop_texture) { return [{content:"Clear", callback:function() { @@ -4583,11 +4585,11 @@ if ("undefined" != typeof LiteGraph) { }}]; } }; - LGraphTexture$0.prototype.onExecute = function() { + LGraphTexture.prototype.onExecute = function() { var c = null; this.isOutputConnected(1) && (c = this.getInputData(0)); !c && this._drop_texture && (c = this._drop_texture); - !c && this.properties.name && (c = LGraphTexture$0.getTexture(this.properties.name)); + !c && this.properties.name && (c = LGraphTexture.getTexture(this.properties.name)); if (c) { this._last_tex = c; !1 === this.properties.filter ? c.setParameter(gl.TEXTURE_MAG_FILTER, gl.NEAREST) : c.setParameter(gl.TEXTURE_MAG_FILTER, gl.LINEAR); @@ -4602,10 +4604,10 @@ if ("undefined" != typeof LiteGraph) { } } }; - LGraphTexture$0.prototype.onResourceRenamed = function(c, e) { + LGraphTexture.prototype.onResourceRenamed = function(c, e) { this.properties.name == c && (this.properties.name = e); }; - LGraphTexture$0.prototype.onDrawBackground = function(c) { + LGraphTexture.prototype.onDrawBackground = function(c) { if (!(this.flags.collapsed || 20 >= this.size[1])) { if (this._drop_texture && c.webgl) { c.drawImage(this._drop_texture, 0, 0, this.size[0], this.size[1]); @@ -4614,7 +4616,7 @@ if ("undefined" != typeof LiteGraph) { if (c.webgl) { this._canvas = this._last_tex; } else { - var e = LGraphTexture$0.generateLowResTexturePreview(this._last_tex); + var e = LGraphTexture.generateLowResTexturePreview(this._last_tex); if (!e) { return; } @@ -4626,11 +4628,11 @@ if ("undefined" != typeof LiteGraph) { } } }; - LGraphTexture$0.generateLowResTexturePreview = function(c) { + LGraphTexture.generateLowResTexturePreview = function(c) { if (!c) { return null; } - var e = LGraphTexture$0.image_preview_size, f = c; + var e = LGraphTexture.image_preview_size, f = c; if (c.format == gl.DEPTH_COMPONENT) { return null; } @@ -4642,24 +4644,24 @@ if ("undefined" != typeof LiteGraph) { f && f.toCanvas(c); return c; }; - LGraphTexture$0.prototype.getResources = function(c) { + LGraphTexture.prototype.getResources = function(c) { c[this.properties.name] = GL.Texture; return c; }; - LGraphTexture$0.prototype.onGetInputs = function() { + LGraphTexture.prototype.onGetInputs = function() { return [["in", "Texture"]]; }; - LGraphTexture$0.prototype.onGetOutputs = function() { + LGraphTexture.prototype.onGetOutputs = function() { return [["width", "number"], ["height", "number"], ["aspect", "number"]]; }; - LiteGraph.registerNodeType("texture/texture", LGraphTexture$0); + LiteGraph.registerNodeType("texture/texture", LGraphTexture); LGraphTexturePreview.title = "Preview"; LGraphTexturePreview.desc = "Show a texture in the graph canvas"; LGraphTexturePreview.allow_preview = !1; LGraphTexturePreview.prototype.onDrawBackground = function(c) { if (!this.flags.collapsed && (c.webgl || LGraphTexturePreview.allow_preview)) { var e = this.getInputData(0); - e && (e = !e.handle && c.webgl ? e : LGraphTexture$0.generateLowResTexturePreview(e), c.save(), this.properties.flipY && (c.translate(0, this.size[1]), c.scale(1, -1)), c.drawImage(e, 0, 0, this.size[0], this.size[1]), c.restore()); + e && (e = !e.handle && c.webgl ? e : LGraphTexture.generateLowResTexturePreview(e), c.save(), this.properties.flipY && (c.translate(0, this.size[1]), c.scale(1, -1)), c.drawImage(e, 0, 0, this.size[0], this.size[1]), c.restore()); } }; LiteGraph.registerNodeType("texture/preview", LGraphTexturePreview); @@ -4667,10 +4669,10 @@ if ("undefined" != typeof LiteGraph) { LGraphTextureSave.desc = "Save a texture in the repository"; LGraphTextureSave.prototype.onExecute = function() { var c = this.getInputData(0); - c && (this.properties.name && (LGraphTexture$0.storeTexture ? LGraphTexture$0.storeTexture(this.properties.name, c) : LGraphTexture$0.getTexturesContainer()[this.properties.name] = c), this.setOutputData(0, c)); + c && (this.properties.name && (LGraphTexture.storeTexture ? LGraphTexture.storeTexture(this.properties.name, c) : LGraphTexture.getTexturesContainer()[this.properties.name] = c), this.setOutputData(0, c)); }; LiteGraph.registerNodeType("texture/save", LGraphTextureSave); - LGraphTextureOperation.widgets_info = {uvcode:{widget:"textarea", height:100}, pixelcode:{widget:"textarea", height:100}, precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureOperation.widgets_info = {uvcode:{widget:"textarea", height:100}, pixelcode:{widget:"textarea", height:100}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureOperation.title = "Operation"; LGraphTextureOperation.desc = "Texture shader operation"; LGraphTextureOperation.prototype.getExtraMenuOptions = function(c) { @@ -4685,14 +4687,14 @@ if ("undefined" != typeof LiteGraph) { LGraphTextureOperation.prototype.onExecute = function() { var c = this.getInputData(0); if (this.isOutputConnected(0)) { - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { var e = this.getInputData(1); if (this.properties.uvcode || this.properties.pixelcode) { var f = 512, g = 512; c ? (f = c.width, g = c.height) : e && (f = e.width, g = e.height); - this._tex = c || this._tex ? LGraphTexture$0.getTargetTexture(c || this._tex, this._tex, this.properties.precision) : new GL.Texture(f, g, {type:this.precision === LGraphTexture$0.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT, format:gl.RGBA, filter:gl.LINEAR}); + this._tex = c || this._tex ? LGraphTexture.getTargetTexture(c || this._tex, this._tex, this.properties.precision) : new GL.Texture(f, g, {type:this.precision === LGraphTexture.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT, format:gl.RGBA, filter:gl.LINEAR}); var l = ""; this.properties.uvcode && (l = "uv = " + this.properties.uvcode, -1 != this.properties.uvcode.indexOf(";") && (l = this.properties.uvcode)); var k = ""; @@ -4736,7 +4738,7 @@ if ("undefined" != typeof LiteGraph) { LiteGraph.registerNodeType("texture/operation", LGraphTextureOperation); LGraphTextureShader.title = "Shader"; LGraphTextureShader.desc = "Texture shader"; - LGraphTextureShader.widgets_info = {code:{type:"code"}, precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureShader.widgets_info = {code:{type:"code"}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureShader.prototype.onPropertyChanged = function(c, e) { if ("code" == c && (c = this.getShader())) { e = c.uniformInfo; @@ -4813,17 +4815,17 @@ if ("undefined" != typeof LiteGraph) { }; LGraphTextureShader.pixel_shader = "precision highp float;\n\r\n\t\t\t\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform float time;\n\r\n\t\t\t"; LiteGraph.registerNodeType("texture/shader", LGraphTextureShader); - LGraphTextureScaleOffset.widgets_info = {precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureScaleOffset.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureScaleOffset.title = "Scale/Offset"; LGraphTextureScaleOffset.desc = "Applies an scaling and offseting"; LGraphTextureScaleOffset.prototype.onExecute = function() { var c = this.getInputData(0); if (this.isOutputConnected(0) && c) { - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { - var e = c.width, f = c.height, g = this.precision === LGraphTexture$0.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT; - this.precision === LGraphTexture$0.DEFAULT && (g = c.type); + var e = c.width, f = c.height, g = this.precision === LGraphTexture.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT; + this.precision === LGraphTexture.DEFAULT && (g = c.type); this._tex && this._tex.width == e && this._tex.height == f && this._tex.type == g || (this._tex = new GL.Texture(e, f, {type:g, format:gl.RGBA, filter:gl.LINEAR})); var l = this._shader; l || (l = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, LGraphTextureScaleOffset.pixel_shader)); @@ -4845,18 +4847,18 @@ if ("undefined" != typeof LiteGraph) { }; LGraphTextureScaleOffset.pixel_shader = "precision highp float;\n\r\n\t\t\t\n\r\n\t\t\tuniform sampler2D u_texture;\n\r\n\t\t\tuniform sampler2D u_textureB;\n\r\n\t\t\tvarying vec2 v_coord;\n\r\n\t\t\tuniform vec2 u_scale;\n\r\n\t\t\tuniform vec2 u_offset;\n\r\n\t\t\t\n\r\n\t\t\tvoid main() {\n\r\n\t\t\t\tvec2 uv = v_coord;\n\r\n\t\t\t\tuv = uv / u_scale - u_offset;\n\r\n\t\t\t\tgl_FragColor = texture2D(u_texture, uv);\n\r\n\t\t\t}\n\r\n\t\t\t"; LiteGraph.registerNodeType("texture/scaleOffset", LGraphTextureScaleOffset); - LGraphTextureWarp.widgets_info = {precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureWarp.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureWarp.title = "Warp"; LGraphTextureWarp.desc = "Texture warp operation"; LGraphTextureWarp.prototype.onExecute = function() { var c = this.getInputData(0); if (this.isOutputConnected(0)) { - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { var e = this.getInputData(1), f = 512, g = 512; c ? (f = c.width, g = c.height) : e && (f = e.width, g = e.height); - this._tex = c || this._tex ? LGraphTexture$0.getTargetTexture(c || this._tex, this._tex, this.properties.precision) : new GL.Texture(f, g, {type:this.precision === LGraphTexture$0.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT, format:gl.RGBA, filter:gl.LINEAR}); + this._tex = c || this._tex ? LGraphTexture.getTargetTexture(c || this._tex, this._tex, this.properties.precision) : new GL.Texture(f, g, {type:this.precision === LGraphTexture.LOW ? gl.UNSIGNED_BYTE : gl.HIGH_PRECISION_FORMAT, format:gl.RGBA, filter:gl.LINEAR}); var l = this._shader; l || (l = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, LGraphTextureWarp.pixel_shader)); var k = this.getInputData(2); @@ -4905,7 +4907,7 @@ if ("undefined" != typeof LiteGraph) { LiteGraph.registerNodeType("texture/toviewport", LGraphTextureToViewport); LGraphTextureCopy.title = "Copy"; LGraphTextureCopy.desc = "Copy Texture"; - LGraphTextureCopy.widgets_info = {size:{widget:"combo", values:[0, 32, 64, 128, 256, 512, 1024, 2048]}, precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureCopy.widgets_info = {size:{widget:"combo", values:[0, 32, 64, 128, 256, 512, 1024, 2048]}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureCopy.prototype.onExecute = function() { var c = this.getInputData(0); if ((c || this._temp_texture) && this.isOutputConnected(0)) { @@ -4913,7 +4915,7 @@ if ("undefined" != typeof LiteGraph) { var e = c.width, f = c.height; 0 != this.properties.size && (f = e = this.properties.size); var g = this._temp_texture, l = c.type; - this.properties.precision === LGraphTexture$0.LOW ? l = gl.UNSIGNED_BYTE : this.properties.precision === LGraphTexture$0.HIGH && (l = gl.HIGH_PRECISION_FORMAT); + this.properties.precision === LGraphTexture.LOW ? l = gl.UNSIGNED_BYTE : this.properties.precision === LGraphTexture.HIGH && (l = gl.HIGH_PRECISION_FORMAT); g && g.width == e && g.height == f && g.type == l || (g = gl.LINEAR, this.properties.generate_mipmaps && isPowerOfTwo(e) && isPowerOfTwo(f) && (g = gl.LINEAR_MIPMAP_LINEAR), this._temp_texture = new GL.Texture(e, f, {type:l, format:gl.RGBA, minFilter:g, magFilter:gl.LINEAR})); c.copyTo(this._temp_texture); this.properties.generate_mipmaps && (this._temp_texture.bind(0), gl.generateMipmap(this._temp_texture.texture_type), this._temp_texture.unbind(0)); @@ -4924,14 +4926,14 @@ if ("undefined" != typeof LiteGraph) { LiteGraph.registerNodeType("texture/copy", LGraphTextureCopy); LGraphTextureDownsample.title = "Downsample"; LGraphTextureDownsample.desc = "Downsample Texture"; - LGraphTextureDownsample.widgets_info = {iterations:{type:"number", step:1, precision:0, min:1}, precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureDownsample.widgets_info = {iterations:{type:"number", step:1, precision:0, min:1}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureDownsample.prototype.onExecute = function() { var c = this.getInputData(0); if ((c || this._temp_texture) && this.isOutputConnected(0) && c && c.texture_type === GL.TEXTURE_2D) { var e = LGraphTextureDownsample._shader; e || (LGraphTextureDownsample._shader = e = new GL.Shader(GL.Shader.SCREEN_VERTEX_SHADER, LGraphTextureDownsample.pixel_shader)); var f = c.width | 0, g = c.height | 0, l = c.type; - this.properties.precision === LGraphTexture$0.LOW ? l = gl.UNSIGNED_BYTE : this.properties.precision === LGraphTexture$0.HIGH && (l = gl.HIGH_PRECISION_FORMAT); + this.properties.precision === LGraphTexture.LOW ? l = gl.UNSIGNED_BYTE : this.properties.precision === LGraphTexture.HIGH && (l = gl.HIGH_PRECISION_FORMAT); var k = this.properties.iterations || 1, a = c, b = []; l = {type:l, format:c.format}; var d = vec2.create(), h = {u_offset:d}; @@ -5007,19 +5009,19 @@ if ("undefined" != typeof LiteGraph) { } }; LiteGraph.registerNodeType("texture/imageToTexture", LGraphImageToTexture); - LGraphTextureLUT.widgets_info = {precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureLUT.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureLUT.title = "LUT"; LGraphTextureLUT.desc = "Apply LUT to Texture"; LGraphTextureLUT.widgets_info = {texture:{widget:"texture"}}; LGraphTextureLUT.prototype.onExecute = function() { if (this.isOutputConnected(0)) { var c = this.getInputData(0); - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { if (c) { var e = this.getInputData(1); - e || (e = LGraphTexture$0.getTexture(this.properties.texture)); + e || (e = LGraphTexture.getTexture(this.properties.texture)); if (e) { e.bind(0); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); @@ -5028,7 +5030,7 @@ if ("undefined" != typeof LiteGraph) { gl.bindTexture(gl.TEXTURE_2D, null); var f = this.properties.intensity; this.isInputConnected(2) && (this.properties.intensity = f = this.getInputData(2)); - this._tex = LGraphTexture$0.getTargetTexture(c, this._tex, this.properties.precision); + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); this._tex.drawTo(function() { e.bind(1); c.toViewport(LGraphTextureLUT._shader, {u_texture:0, u_textureB:1, u_amount:f}); @@ -5075,7 +5077,7 @@ if ("undefined" != typeof LiteGraph) { gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); var e = Mesh.getScreenQuad(), f = LGraphChannelsTexture._shader; - this._tex = LGraphTexture$0.getTargetTexture(c[0], this._tex); + this._tex = LGraphTexture.getTargetTexture(c[0], this._tex); this._tex.drawTo(function() { c[0].bind(0); c[1].bind(1); @@ -5123,16 +5125,16 @@ if ("undefined" != typeof LiteGraph) { LiteGraph.registerNodeType("texture/gradient", LGraphTextureGradient); LGraphTextureMix.title = "Mix"; LGraphTextureMix.desc = "Generates a texture mixing two textures"; - LGraphTextureMix.widgets_info = {precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureMix.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureMix.prototype.onExecute = function() { var c = this.getInputData(0); if (this.isOutputConnected(0)) { - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { var e = this.getInputData(1), f = this.getInputData(2); if (c && e && f) { - this._tex = LGraphTexture$0.getTargetTexture(c, this._tex, this.properties.precision); + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); var g = Mesh.getScreenQuad(), l = LGraphTextureMix._shader; @@ -5151,15 +5153,15 @@ if ("undefined" != typeof LiteGraph) { LiteGraph.registerNodeType("texture/mix", LGraphTextureMix); LGraphTextureEdges.title = "Edges"; LGraphTextureEdges.desc = "Detects edges"; - LGraphTextureEdges.widgets_info = {precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureEdges.widgets_info = {precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureEdges.prototype.onExecute = function() { if (this.isOutputConnected(0)) { var c = this.getInputData(0); - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { if (c) { - this._tex = LGraphTexture$0.getTargetTexture(c, this._tex, this.properties.precision); + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); var e = Mesh.getScreenQuad(), f = LGraphTextureEdges._shader, g = this.properties.invert, l = this.properties.factor; @@ -5295,22 +5297,22 @@ if ("undefined" != typeof LiteGraph) { var c = this._video.videoWidth, e = this._video.videoHeight, f = this._temp_texture; f && f.width == c && f.height == e || (this._temp_texture = new GL.Texture(c, e, {format:gl.RGB, filter:gl.LINEAR})); this._temp_texture.uploadImage(this._video); - this.properties.texture_name && (LGraphTexture$0.getTexturesContainer()[this.properties.texture_name] = this._temp_texture); + this.properties.texture_name && (LGraphTexture.getTexturesContainer()[this.properties.texture_name] = this._temp_texture); this.setOutputData(0, this._temp_texture); } }; LiteGraph.registerNodeType("texture/webcam", LGraphTextureWebcam); LGraphTextureMatte.title = "Matte"; LGraphTextureMatte.desc = "Extracts background"; - LGraphTextureMatte.widgets_info = {key_color:{widget:"color"}, precision:{widget:"combo", values:LGraphTexture$0.MODE_VALUES}}; + LGraphTextureMatte.widgets_info = {key_color:{widget:"color"}, precision:{widget:"combo", values:LGraphTexture.MODE_VALUES}}; LGraphTextureMatte.prototype.onExecute = function() { if (this.isOutputConnected(0)) { var c = this.getInputData(0); - if (this.properties.precision === LGraphTexture$0.PASS_THROUGH) { + if (this.properties.precision === LGraphTexture.PASS_THROUGH) { this.setOutputData(0, c); } else { if (c) { - this._tex = LGraphTexture$0.getTargetTexture(c, this._tex, this.properties.precision); + this._tex = LGraphTexture.getTargetTexture(c, this._tex, this.properties.precision); gl.disable(gl.BLEND); gl.disable(gl.DEPTH_TEST); this._uniforms || (this._uniforms = {u_texture:0, u_key_color:this.properties.key_color, u_threshold:1, u_slope:1}); @@ -5338,7 +5340,7 @@ if ("undefined" != typeof LiteGraph) { this.setOutputData(0, this._drop_texture); } else { if (this.properties.name) { - var c = LGraphTexture$0.getTexture(this.properties.name); + var c = LGraphTexture.getTexture(this.properties.name); c && (this._last_tex = c, this.setOutputData(0, c)); } } diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000000..ce17187df0 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,34 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', +1 verbose cli 'C:\\Users\\kriffe\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js', +1 verbose cli 'version', +1 verbose cli 'patch' ] +2 info using npm@3.10.10 +3 info using node@v4.8.4 +4 info git [ 'status', '--porcelain' ] +5 verbose stack Error: Git working directory not clean. +5 verbose stack M build/litegraph.js +5 verbose stack M build/litegraph.min.js +5 verbose stack M src/nodes/gltextures.js +5 verbose stack at C:\Users\kriffe\AppData\Roaming\npm\node_modules\npm\lib\version.js:247:19 +5 verbose stack at C:\Users\kriffe\AppData\Roaming\npm\node_modules\npm\lib\utils\no-progress-while-running.js:21:8 +5 verbose stack at ChildProcess.exithandler (child_process.js:191:7) +5 verbose stack at emitTwo (events.js:87:13) +5 verbose stack at ChildProcess.emit (events.js:172:7) +5 verbose stack at maybeClose (internal/child_process.js:862:16) +5 verbose stack at Socket. (internal/child_process.js:338:11) +5 verbose stack at emitOne (events.js:77:13) +5 verbose stack at Socket.emit (events.js:169:7) +5 verbose stack at Pipe._onclose (net.js:490:12) +6 verbose cwd C:\Users\kriffe\Documents\GitHub\litegraph.js +7 error Windows_NT 10.0.16299 +8 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kriffe\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "version" "patch" +9 error node v4.8.4 +10 error npm v3.10.10 +11 error Git working directory not clean. +11 error M build/litegraph.js +11 error M build/litegraph.min.js +11 error M src/nodes/gltextures.js +12 error If you need help, you may report this error at: +12 error +13 verbose exit [ 1, true ] diff --git a/src/nodes/gltextures.js b/src/nodes/gltextures.js index 0e58df3227..d41dd21f21 100755 --- a/src/nodes/gltextures.js +++ b/src/nodes/gltextures.js @@ -1,7 +1,8 @@ //Works with Litegl.js to create WebGL nodes +var LGraphTexture if(typeof(LiteGraph) != "undefined") { - function LGraphTexture() + LGraphTexture = function() { this.addOutput("Texture","Texture"); this.properties = { name:"", filter: true };