forked from blender/blender
Implement export of Shader BSDF nodes #13
@ -16,28 +16,13 @@ NodeItem TexCheckerNodeParser::compute()
|
|||||||
if (!vector) {
|
if (!vector) {
|
||||||
vector = create_node("texcoord", "vector2");
|
vector = create_node("texcoord", "vector2");
|
||||||
}
|
}
|
||||||
vector = vector * scale;
|
vector = (vector * scale) % value(2.0f);
|
||||||
|
NodeItem mix = (vector.extract(0).floor() + vector.extract(1).floor())
|
||||||
NodeItem separate = create_node("separate2", "multioutput");
|
.if_else(NodeItem::CompareOp::Eq, value(1.0f), value(1.0f), value(0.0f));
|
||||||
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));
|
|
||||||
|
|
||||||
NodeItem res = create_node("mix", "color3");
|
NodeItem res = create_node("mix", "color3");
|
||||||
res.set_input("bg", color1, NodeItem::Type::Color3);
|
res.set_input("fg", color1, NodeItem::Type::Color3);
|
||||||
res.set_input("fg", color2, NodeItem::Type::Color3);
|
res.set_input("bg", color2, NodeItem::Type::Color3);
|
||||||
res.set_input("mix", ifequal);
|
res.set_input("mix", mix);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user