Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-08-04 17:56:39 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2020-11-03 16:35:43 +0300
commit9bc177d8ded4ba498762813a0d5106005fef0e67 (patch)
treeae01a917ed8bea16f6e2cc5e25fb482c19800a02 /source/blender/gpu/shaders/material
parentda93da45eefd2288f6bdb5ff18fa46f3e80cac75 (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/gpu/shaders/material')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl9
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
index 10e1b4563bc..631d91c89d6 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_attribute.glsl
@@ -1,6 +1,7 @@
-void node_attribute(vec3 attr, out vec4 outcol, out vec3 outvec, out float outf)
+void node_attribute(vec4 attr, out vec4 outcol, out vec3 outvec, out float outf, out float outalpha)
{
- outcol = vec4(attr, 1.0);
- outvec = attr;
- outf = avg(attr);
+ outcol = vec4(attr.xyz, 1.0);
+ outvec = attr.xyz;
+ outf = avg(attr.xyz);
+ outalpha = attr.w;
}