This commit is contained in:
tamat
2015-07-31 15:42:50 +02:00
parent b96e0d6c66
commit 4a2fdc0cff
9 changed files with 349 additions and 175 deletions

View File

@@ -39,7 +39,7 @@ if(typeof(LiteGraph) != "undefined")
return gl.textures;
}
//process the loading of a texture (overwrite if you have a Resources Manager)
//process the loading of a texture (overwrite it if you have a Resources Manager)
LGraphTexture.loadTexture = function(name, options)
{
options = options || {};
@@ -882,7 +882,7 @@ if(typeof(LiteGraph) != "undefined")
this.addInput("LUT","Texture");
this.addInput("Intensity","number");
this.addOutput("","Texture");
this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT };
this.properties = { intensity: 1, precision: LGraphTexture.DEFAULT, texture: null };
if(!LGraphTextureLUT._shader)
LGraphTextureLUT._shader = new GL.Shader( Shader.SCREEN_VERTEX_SHADER, LGraphTextureLUT.pixel_shader );
@@ -894,6 +894,7 @@ if(typeof(LiteGraph) != "undefined")
LGraphTextureLUT.title = "LUT";
LGraphTextureLUT.desc = "Apply LUT to Texture";
LGraphTextureLUT.widgets_info = {"texture": { widget:"texture"} };
LGraphTextureLUT.prototype.onExecute = function()
{
@@ -908,11 +909,16 @@ if(typeof(LiteGraph) != "undefined")
if(!tex) return;
var lut_tex = this.getInputData(1);
if(!lut_tex)
lut_tex = LGraphTexture.getTexture( this.properties.texture );
if(!lut_tex)
{
this.setOutputData(0,tex);
return;
}
lut_tex.bind(0);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR );
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE );