fix on onConnectInput to have more info

This commit is contained in:
tamat
2020-05-05 12:57:59 +02:00
parent 3087acad00
commit a1c312fab9
4 changed files with 45 additions and 55 deletions

View File

@@ -3589,10 +3589,7 @@
//allows nodes to block connection
if (target_node.onConnectInput) {
if (
target_node.onConnectInput(target_slot, output.type, output) ===
false
) {
if ( target_node.onConnectInput(target_slot, output.type, output, this, slot) === false ) {
return null;
}
}

View File

@@ -3050,8 +3050,8 @@ void main() {\n\
};
this._uniforms = {
u_texture: 0,
u_near: 0.1,
u_far: 10000
u_camera_planes: null, //filled later
u_ires: vec2.create()
};
}
@@ -3083,9 +3083,6 @@ void main() {\n\
}
var uniforms = this._uniforms;
uniforms.u_near = tex.near_far_planes[0];
uniforms.u_far = tex.near_far_planes[1];
uniforms.u_invert = this.properties.invert ? 1 : 0;
gl.disable(gl.BLEND);
@@ -3105,6 +3102,8 @@ void main() {\n\
planes = [0.1, 1000];
} //hardcoded
uniforms.u_camera_planes = planes;
//uniforms.u_ires.set([1/tex.width, 1/tex.height]);
uniforms.u_ires.set([0,0]);
this._temp_texture.drawTo(function() {
tex.bind(0);
@@ -3120,15 +3119,14 @@ void main() {\n\
precision highp float;\n\
varying vec2 v_coord;\n\
uniform sampler2D u_texture;\n\
uniform float u_near;\n\
uniform float u_far;\n\
uniform vec2 u_camera_planes;\n\
uniform int u_invert;\n\
uniform vec2 u_ires;\n\
\n\
void main() {\n\
float zNear = u_near;\n\
float zFar = u_far;\n\
float depth = texture2D(u_texture, v_coord).x;\n\
depth = depth * 2.0 - 1.0;\n\
float zNear = u_camera_planes.x;\n\
float zFar = u_camera_planes.y;\n\
float depth = texture2D(u_texture, v_coord + u_ires*0.5).x * 2.0 - 1.0;\n\
float f = zNear * (depth + 1.0) / (zFar + zNear - depth * (zFar - zNear));\n\
if( u_invert == 1 )\n\
f = 1.0 - f;\n\