forked from blender/blender
MaterialX: add convert nodes #15
@ -8,11 +8,15 @@ namespace blender::nodes::materialx {
|
|||||||
|
|
||||||
NodeItem BlackbodyNodeParser::compute()
|
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.
|
||||||
|
*
|
||||||
|
* NodeItem temperature = get_input_value("Temperature", NodeItem::Type::Float);
|
||||||
|
|
||||||
NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
|
* NodeItem res = create_node("blackbody", NodeItem::Type::Color3);
|
||||||
res.set_input("temperature", temperature);
|
* res.set_input("temperature", temperature);
|
||||||
return res;
|
* return res; */
|
||||||
|
return empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace blender::nodes::materialx
|
} // namespace blender::nodes::materialx
|
||||||
|
@ -13,11 +13,15 @@ NodeItem ClampNodeParser::compute()
|
|||||||
NodeItem min = get_input_value("Min", NodeItem::Type::Float);
|
NodeItem min = get_input_value("Min", NodeItem::Type::Float);
|
||||||
NodeItem max = get_input_value("Max", NodeItem::Type::Float);
|
NodeItem max = get_input_value("Max", NodeItem::Type::Float);
|
||||||
|
|
||||||
if (type == NODE_CLAMP_MINMAX) {
|
NodeItem res = empty();
|
||||||
min = min.if_else(NodeItem::CompareOp::Greater, max, max, min);
|
if (type == NODE_CLAMP_RANGE) {
|
||||||
|
res = min.if_else(
|
||||||
|
NodeItem::CompareOp::Less, max, value.clamp(min, max), value.clamp(max, min));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
return value.clamp(min, max);
|
res = value.clamp(min, max);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace blender::nodes::materialx
|
} // namespace blender::nodes::materialx
|
||||||
|
Loading…
Reference in New Issue
Block a user