Support Vertex Color in GLSL viewport for Cycles

The title says it all actually.

Added special custom data type, because we don't know in advance
whether we're referencing UV or Color layer. Also made it so vertex
attributes are normalized.

TODO: Border render in viewport ignores the normalization of the
attribute array for some reason, will be looked into still.

Reviewers: mont29, brecht, campbellbarton

Reviewed By: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D2022
This commit is contained in:
2016-05-22 18:24:53 +02:00
parent a2669b0cbf
commit a830280688
5 changed files with 65 additions and 25 deletions

View File

@@ -2573,11 +2573,11 @@ void node_gamma(vec4 col, float gamma, out vec4 outcol)
/* geometry */
void node_attribute(vec3 attr_uv, out vec4 outcol, out vec3 outvec, out float outf)
void node_attribute(vec3 attr, out vec4 outcol, out vec3 outvec, out float outf)
{
outcol = vec4(attr_uv, 1.0);
outvec = attr_uv;
outf = (attr_uv.x + attr_uv.y + attr_uv.z)/3.0;
outcol = vec4(attr, 1.0);
outvec = attr;
outf = (attr.x + attr.y + attr.z)/3.0;
}
void node_uvmap(vec3 attr_uv, out vec3 outvec)