blob: 032f56fc31cb41e6b4d3af8bd39b24f918a1a87e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
#include "stdcycles.h"
shader node_vertex_color(string bump_offset = "center",
string layer_name = "",
output color Color = 0.0,
output float Alpha = 0.0)
{
float vertex_color[4];
string vertex_color_layer;
if (layer_name == "") {
vertex_color_layer = "geom:vertex_color";
}
else {
vertex_color_layer = layer_name;
}
if (getattribute(vertex_color_layer, vertex_color)) {
Color = color(vertex_color[0], vertex_color[1], vertex_color[2]);
Alpha = vertex_color[3];
if (bump_offset == "dx") {
Color += Dx(Color);
Alpha += Dx(Alpha);
}
else if (bump_offset == "dy") {
Color += Dy(Color);
Alpha += Dy(Alpha);
}
}
else {
warning("%s", "Invalid attribute.");
}
}
|