diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2020-08-04 17:56:39 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2020-11-03 16:35:43 +0300 |
commit | 9bc177d8ded4ba498762813a0d5106005fef0e67 (patch) | |
tree | ae01a917ed8bea16f6e2cc5e25fb482c19800a02 /source/blender/nodes | |
parent | da93da45eefd2288f6bdb5ff18fa46f3e80cac75 (diff) |
Materials: support true float4 attributes in the Attribute node.
Add a new Alpha socket to the Attribute node that outputs the
fourth component of the attribute. Currently the only such
attribute is vertex color, but there may be more in the future.
If the attribute has no alpha channel, the expected value is 1.
The Cycles code is already refactored and committed by Brecht.
Ref D2057
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_attribute.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c index 4fd0ce4f1ef..37472aeec2e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.c +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c @@ -25,6 +25,7 @@ static bNodeSocketTemplate sh_node_attribute_out[] = { {SOCK_RGBA, N_("Color")}, {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, + {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, {-1, ""}, }; @@ -52,6 +53,10 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, if (out[2].hasoutput) { out[2].link = GPU_volume_grid(mat, attr->name, GPU_VOLUME_DEFAULT_0); } + if (out[3].hasoutput) { + static const float default_alpha = 1.0f; + out[3].link = GPU_constant(&default_alpha); + } return 1; } |