Files
test2/intern/cycles/kernel/osl/shaders/node_attribute.osl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
954 B
Plaintext
Raw Normal View History

/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "stdcycles.h"
shader node_attribute(string bump_offset = "center",
string name = "",
output point Vector = point(0.0, 0.0, 0.0),
output color Color = 0.0,
output float Fac = 0.0,
output float Alpha = 0.0)
{
float data[4] = {0.0, 0.0, 0.0, 0.0};
getattribute(name, data);
Color = color(data[0], data[1], data[2]);
Vector = point(Color);
getattribute(name, Fac);
Alpha = data[3];
if (bump_offset == "dx") {
Color += Dx(Color) * BUMP_DX;
Vector += Dx(Vector) * BUMP_DX;
Fac += Dx(Fac) * BUMP_DX;
Alpha += Dx(Alpha) * BUMP_DX;
}
else if (bump_offset == "dy") {
Color += Dy(Color) * BUMP_DY;
Vector += Dy(Vector) * BUMP_DY;
Fac += Dy(Fac) * BUMP_DY;
Alpha += Dy(Alpha) * BUMP_DY;
}
}