forked from blender/blender
MaterialX: add support for nodes #11
@ -19,12 +19,12 @@ NodeItem SeparateColorNodeParser::compute()
|
|||||||
break;
|
break;
|
||||||
case NODE_COMBSEP_COLOR_HSV:
|
case NODE_COMBSEP_COLOR_HSV:
|
||||||
convert = create_node("rgbtohsv", "color3");
|
convert = create_node("rgbtohsv", "color3");
|
||||||
convert.set_input("in", color, NodeItem::Type::Color3);
|
convert.set_input("in", color);
|
||||||
break;
|
break;
|
||||||
case NODE_COMBSEP_COLOR_HSL:
|
case NODE_COMBSEP_COLOR_HSL:
|
||||||
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported color model, using HSV instead: %d", mode);
|
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported color model, using HSV instead: %d", mode);
|
||||||
convert = create_node("rgbtohsv", "color3");
|
convert = create_node("rgbtohsv", "color3");
|
||||||
convert.set_input("in", color, NodeItem::Type::Color3);
|
convert.set_input("in", color);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BLI_assert_unreachable();
|
BLI_assert_unreachable();
|
||||||
@ -38,8 +38,35 @@ NodeItem SeparateColorNodeParser::compute()
|
|||||||
|
|
||||||
NodeItem CombineColorNodeParser::compute()
|
NodeItem CombineColorNodeParser::compute()
|
||||||
{
|
{
|
||||||
/* TODO: implement. */
|
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
||||||
return empty();
|
NodeItem red = get_input_value("Red");
|
||||||
|
NodeItem green = get_input_value("Green");
|
||||||
|
NodeItem blue = get_input_value("Blue");
|
||||||
|
|
||||||
|
NodeItem convert = empty();
|
||||||
|
NodeItem combine = create_node("combine3", "color3");
|
||||||
|
combine.set_input("in1", red);
|
||||||
|
combine.set_input("in2", green);
|
||||||
|
combine.set_input("in3", blue);
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case NODE_COMBSEP_COLOR_RGB:
|
||||||
|
break;
|
||||||
|
case NODE_COMBSEP_COLOR_HSV:
|
||||||
|
convert = create_node("hsvtorgb", "color3");
|
||||||
|
convert.set_input("in", combine);
|
||||||
|
break;
|
||||||
|
case NODE_COMBSEP_COLOR_HSL:
|
||||||
|
CLOG_WARN(LOG_MATERIALX_SHADER, "Unsupported color model, using HSV instead: %d", mode);
|
||||||
|
convert = create_node("hsvtorgb", "color3");
|
||||||
|
convert.set_input("in", combine);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
BLI_assert_unreachable();
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem res = convert ? convert : combine;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace blender::nodes::materialx
|
} // namespace blender::nodes::materialx
|
||||||
|
Loading…
Reference in New Issue
Block a user