forked from blender/blender
MaterialX: add convert nodes #15
@ -8,11 +8,15 @@ namespace blender::nodes::materialx {
|
||||
|
||||
NodeItem BlackbodyNodeParser::compute()
|
||||
{
|
||||
NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
|
||||
/* This node doesn't have an implementation in MaterialX 1.38.6.
|
||||
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
|
||||
BogdanNagirniak marked this conversation as resolved
Outdated
|
||||
*
|
||||
* NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
|
||||
|
||||
NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
|
||||
res.set_input("temperature", temperature);
|
||||
return res;
|
||||
* NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
|
||||
* res.set_input("temperature", temperature);
|
||||
* return res; */
|
||||
return empty();
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::materialx
|
||||
|
@ -13,11 +13,15 @@ NodeItem ClampNodeParser::compute()
|
||||
NodeItem min = get_input_value("Min", NodeItem::Type::Float);
|
||||
NodeItem max = get_input_value("Max", NodeItem::Type::Float);
|
||||
|
||||
if (type == NODE_CLAMP_MINMAX) {
|
||||
min = min.if_else(NodeItem::CompareOp::Greater, max, max, min);
|
||||
NodeItem res = empty();
|
||||
if (type == NODE_CLAMP_RANGE) {
|
||||
BogdanNagirniak marked this conversation as resolved
Outdated
Bogdan Nagirniak
commented
`min = min.min(max)`
|
||||
res = min.if_else(
|
||||
NodeItem::CompareOp::Less, max, value.clamp(min, max), value.clamp(max, min));
|
||||
BogdanNagirniak marked this conversation as resolved
Outdated
Bogdan Nagirniak
commented
does it correctly work with RANGE? do we need swap min max if min > max? does it correctly work with RANGE? do we need swap min max if min > max?
|
||||
}
|
||||
|
||||
return value.clamp(min, max);
|
||||
else {
|
||||
res = value.clamp(min, max);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::materialx
|
||||
|
Loading…
Reference in New Issue
Block a user
It is exists in pbrlib_def.mtlx, can be used here