forked from blender/blender
MaterialX: Implement Gradient Texture node. #28
@ -157,7 +157,6 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
vector = texcoord_node();
|
||||
}
|
||||
NodeItem res = empty();
|
||||
NodeItem res_1 = empty();
|
||||
|
||||
switch (gradient_type) {
|
||||
case SHD_BLEND_LINEAR:
|
||||
@ -169,8 +168,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
break;
|
||||
case SHD_BLEND_EASING:
|
||||
res = vector.extract(0).clamp(val(0.0f), val(1.0f));
|
||||
res_1 = res * res;
|
||||
res = (val(3.0f) * res_1 - val(2.0f) * res_1 * res);
|
||||
res = res * res * (val(3.0f) - val(2.0f) * res);
|
||||
break;
|
||||
case SHD_BLEND_DIAGONAL:
|
||||
Vasyl-Pidhirskyi marked this conversation as resolved
|
||||
res = (vector.extract(0) + vector.extract(1)) * val(0.5f);
|
||||
@ -187,6 +185,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res = create_node("dotproduct", NodeItem::Type::Float, {{"in1", vector}, {"in2", vector}}).sqrt();
|
||||
res = (val(0.999999f) - res).max(val(0.0f));
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
}
|
||||
Vasyl-Pidhirskyi marked this conversation as resolved
Outdated
Bogdan Nagirniak
commented
add add `default: BLI_assert_unreachable()`
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
seems can be simplified to
res = res * res * (val(3.0f) - val(2.0f) * res)