Support reroute node in pipeline.

This commit is contained in:
Lubos Lenco 2016-04-18 10:46:55 +02:00
parent e1ae9c1658
commit e2bc96ecb5
2 changed files with 20 additions and 11 deletions

View file

@ -408,6 +408,10 @@ def make_set_target(stage, node_group, node, target_index=1, color_buffer_index=
make_set_target(stage, node_group, targetNode, target_index=0, color_buffer_index=cb_index)
return
elif targetNode.bl_idname == 'NodeReroute':
make_set_target(stage, node_group, targetNode, target_index=0, color_buffer_index=color_buffer_index)
return
else: # Framebuffer
if make_set_target.is_last_two_targets_pong == True:
make_set_target.pong = not make_set_target.pong
@ -438,6 +442,9 @@ def make_bind_target(stage, node_group, node, target_index=1, constant_index=2,
stage.command = 'bind_target'
targetNode = findNodeByLink(node_group, node, node.inputs[target_index])
if targetNode.bl_idname == 'NodeReroute': # Make recursive
targetNode = findNodeByLink(node_group, targetNode, targetNode.inputs[0])
if targetNode.bl_idname == 'ColorBufferNodeType': # Make recursive
color_buffer_index = targetNode.inputs[1].default_value
targetNode = findNodeByLink(node_group, targetNode, targetNode.inputs[0])
@ -459,6 +466,8 @@ def make_bind_target(stage, node_group, node, target_index=1, constant_index=2,
targetId = targetNode.inputs[0].default_value + cb_postfix + postfix
print(targetNode.bl_idname)
stage.params.append(targetId)
stage.params.append(node.inputs[constant_index].default_value)

View file

@ -155,17 +155,17 @@ void main() {
vec4 col = texture(tex, uv);
// Blur
float depth = texture(gbuffer0, texCoord).a;
float blur_amount = abs(depth - focus_depth);
if (depth < depth - focus_depth) {
blur_amount *= 10.0;
}
blur_amount = clamp(blur_amount, 0.0, 1.0);
vec4 baseColor = col;//texture(tex, texCoord);
vec4 blurredColor = vec4(0.0, 0.0, 0.0, 0.0);
float blurSize = 0.005 * blur_amount;
blurredColor = 0.75 * sampleBox(blurSize * 0.5) + 0.25 * sampleBox(blurSize * 1.0);
col = baseColor * (1.0 - blur_amount) + blurredColor * blur_amount;
// float depth = texture(gbuffer0, texCoord).a;
// float blur_amount = abs(depth - focus_depth);
// if (depth < depth - focus_depth) {
// blur_amount *= 10.0;
// }
// blur_amount = clamp(blur_amount, 0.0, 1.0);
// vec4 baseColor = col;//texture(tex, texCoord);
// vec4 blurredColor = vec4(0.0, 0.0, 0.0, 0.0);
// float blurSize = 0.005 * blur_amount;
// blurredColor = 0.75 * sampleBox(blurSize * 0.5) + 0.25 * sampleBox(blurSize * 1.0);
// col = baseColor * (1.0 - blur_amount) + blurredColor * blur_amount;
// Fog
// vec3 pos = texture(gbuffer1, texCoord).rgb;