forked from blender/blender
MaterialX: Implement Gradient Texture node. #28
@ -157,7 +157,6 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
vector = texcoord_node();
|
vector = texcoord_node();
|
||||||
}
|
}
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
NodeItem res_1 = empty();
|
|
||||||
|
|
||||||
switch (gradient_type) {
|
switch (gradient_type) {
|
||||||
case SHD_BLEND_LINEAR:
|
case SHD_BLEND_LINEAR:
|
||||||
@ -169,8 +168,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
break;
|
break;
|
||||||
case SHD_BLEND_EASING:
|
case SHD_BLEND_EASING:
|
||||||
res = vector.extract(0).clamp(val(0.0f), val(1.0f));
|
res = vector.extract(0).clamp(val(0.0f), val(1.0f));
|
||||||
res_1 = res * res;
|
res = res * res * (val(3.0f) - val(2.0f) * res);
|
||||||
res = (val(3.0f) * res_1 - val(2.0f) * res_1 * res);
|
|
||||||
break;
|
break;
|
||||||
case SHD_BLEND_DIAGONAL:
|
case SHD_BLEND_DIAGONAL:
|
||||||
Vasyl-Pidhirskyi marked this conversation as resolved
|
|||||||
res = (vector.extract(0) + vector.extract(1)) * val(0.5f);
|
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 = create_node("dotproduct", NodeItem::Type::Float, {{"in1", vector}, {"in2", vector}}).sqrt();
|
||||||
res = (val(0.999999f) - res).max(val(0.0f));
|
res = (val(0.999999f) - res).max(val(0.0f));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
BLI_assert_unreachable();
|
||||||
}
|
}
|
||||||
Vasyl-Pidhirskyi marked this conversation as resolved
Outdated
Bogdan Nagirniak
commented
add add `default: BLI_assert_unreachable()`
|
|||||||
return res;
|
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)