Implement export of Shader BSDF nodes #13

Merged
Bogdan Nagirniak merged 13 commits from BogdanNagirniak/blender:matx-shader-bsdf-nodes into matx-export-material 2023-09-07 11:22:44 +02:00
Showing only changes of commit 89633acfc4 - Show all commits

View File

@ -16,28 +16,13 @@ NodeItem TexCheckerNodeParser::compute()
if (!vector) {
vector = create_node("texcoord", "vector2");
}
vector = vector * scale;
NodeItem separate = create_node("separate2", "multioutput");
separate.set_input("in", vector, NodeItem::Type::Vector2);
separate.add_output("outx", NodeItem::Type::Float);
separate.add_output("outy", NodeItem::Type::Float);
NodeItem modulo_x = create_node("modulo", "float");
modulo_x.set_input("in1", separate, "outx");
modulo_x.set_input("in2", value(2.0f));
NodeItem modulo_y = create_node("modulo", "float");
modulo_y.set_input("in1", separate, "outy");
modulo_y.set_input("in2", value(2.0f));
NodeItem ifequal = (modulo_x.floor() + modulo_y.floor())
.if_else(NodeItem::CompareOp::Eq, value(1.0f), value(0.0f), value(1.0f));
vector = (vector * scale) % value(2.0f);
NodeItem mix = (vector.extract(0).floor() + vector.extract(1).floor())
.if_else(NodeItem::CompareOp::Eq, value(1.0f), value(1.0f), value(0.0f));
NodeItem res = create_node("mix", "color3");
res.set_input("bg", color1, NodeItem::Type::Color3);
res.set_input("fg", color2, NodeItem::Type::Color3);
res.set_input("mix", ifequal);
res.set_input("fg", color1, NodeItem::Type::Color3);
res.set_input("bg", color2, NodeItem::Type::Color3);
res.set_input("mix", mix);
return res;
}