Cycles Refactor: Replace fixed Tangent input with custom input #119042

Merged
Brecht Van Lommel merged 8 commits from Alaska/blender:tangent-to-param5 into main 2024-04-26 15:25:25 +02:00
1 changed files with 6 additions and 7 deletions
Showing only changes of commit 50110d22fc - Show all commits

View File

@ -2391,6 +2391,9 @@ void GlossyBsdfNode::compile(SVMCompiler &compiler)
{
closure = distribution;
ShaderInput *tangent = input("Tangent");
tangent = tangent->link || tangent->constant_folded_in ? tangent : NULL;

I'd prefer to add a SVMCompiler::is_linked to check these conditions, seems a bit cleaner than repeating them here.

If not, I'd suggest at least wrapping the condition in parentheses.

Also, nitpick, but I think this should be nullptr in new code.

I'd prefer to add a `SVMCompiler::is_linked` to check these conditions, seems a bit cleaner than repeating them here. If not, I'd suggest at least wrapping the condition in parentheses. Also, nitpick, but I think this should be `nullptr` in new code.
/* TODO: Just use weight for legacy MultiGGX? Would also simplify OSL. */
if (closure == CLOSURE_BSDF_MICROFACET_MULTI_GGX_ID) {
BsdfNode::compile(compiler,
@ -2398,15 +2401,11 @@ void GlossyBsdfNode::compile(SVMCompiler &compiler)
input("Anisotropy"),
input("Rotation"),
input("Color"),
input("Tangent"));
tangent);
}
else {
BsdfNode::compile(compiler,
input("Roughness"),
input("Anisotropy"),
input("Rotation"),
NULL,
input("Tangent"));
BsdfNode::compile(
compiler, input("Roughness"), input("Anisotropy"), input("Rotation"), NULL, tangent);
}
}