forked from blender/blender
Export to MatX various Texture nodes #5
@ -24,9 +24,12 @@ NodeItem TexCheckerNodeParser::get_input_default(const bNodeSocket &socket)
|
||||
|
||||
NodeItem TexCheckerNodeParser::compute()
|
||||
{
|
||||
NodeItem scale = get_input_value("Scale");
|
||||
NodeItem color1 = get_input_value("Color1");
|
||||
NodeItem color2 = get_input_value("Color2");
|
||||
|
||||
NodeItem texcoord = create_node("texcoord", "vector2", true);
|
||||
NodeItem frequency = create_node("constant", "vector2", true);
|
||||
NodeItem scale = get_input_value("Scale");
|
||||
|
||||
/* Modifier to follow Cycles result. */
|
||||
NodeItem scale_fitter(graph);
|
||||
@ -34,7 +37,7 @@ NodeItem TexCheckerNodeParser::compute()
|
||||
frequency.set_input("value", scale * scale_fitter);
|
||||
|
||||
NodeItem offset = create_node("constant", "vector2", true);
|
||||
offset.set_input("value", MaterialX::Value::createValue<MaterialX::Vector2>({0.0f, 0.0f}));
|
||||
offset.set_input("value", empty().val(MaterialX::Vector2({0.0f, 0.0f})));
|
||||
|
||||
NodeItem place2d = create_node("place2d", "vector2", true);
|
||||
place2d.set_input("texcoord", texcoord * frequency);
|
||||
@ -47,24 +50,21 @@ NodeItem TexCheckerNodeParser::compute()
|
||||
|
||||
NodeItem modulo_x = create_node("modulo", "float", true);
|
||||
modulo_x.set_input("in1", separate);
|
||||
modulo_x.set_input("in2", MaterialX::Value::createValue<float>(2.0f));
|
||||
modulo_x.set_input("in2", empty().val(2.0f));
|
||||
modulo_x.node->setConnectedOutput("in1", separate.node->getOutput("outx"));
|
||||
|
||||
NodeItem modulo_y = create_node("modulo", "float", true);
|
||||
modulo_y.set_input("in1", separate);
|
||||
modulo_y.set_input("in2", MaterialX::Value::createValue<float>(2.0f));
|
||||
modulo_y.set_input("in2", empty().val(2.0f));
|
||||
modulo_y.node->setConnectedOutput("in1", separate.node->getOutput("outy"));
|
||||
|
||||
NodeItem ifequal = (modulo_x.floor() + modulo_y.floor())
|
||||
.if_else("==", empty().val(1.0f), empty().val(0.0f), empty().val(1.0f));
|
||||
|
||||
NodeItem res = create_node("mix", "color3", true);
|
||||
NodeItem color1 = get_input_value("Color1");
|
||||
NodeItem color2 = get_input_value("Color2");
|
||||
res.set_input("fg", color1.to_color3());
|
||||
res.set_input("bg", color2.to_color3());
|
||||
res.set_input("mix", ifequal);
|
||||
|
||||
return res;
|
||||
}
|
||||
DagerD marked this conversation as resolved
Outdated
|
||||
|
||||
|
@ -24,14 +24,14 @@ NodeItem TexNoiseNodeParser::get_input_default(const bNodeSocket &socket)
|
||||
|
||||
NodeItem TexNoiseNodeParser::compute()
|
||||
{
|
||||
NodeItem texcoord = create_node("position", "vector3", true);
|
||||
NodeItem scale = get_input_value("Scale");
|
||||
NodeItem position = texcoord * scale;
|
||||
NodeItem detail = get_input_value("Detail");
|
||||
NodeItem lacunarity = get_input_value("Lacunarity");
|
||||
|
||||
NodeItem texcoord = create_node("position", "vector3", true);
|
||||
|
||||
NodeItem res = create_node("fractal3d", "color3", true);
|
||||
res.set_input("position", position);
|
||||
res.set_input("position", texcoord * scale);
|
||||
res.set_input("octaves", detail);
|
||||
res.set_input("lacunarity", lacunarity);
|
||||
return res;
|
||||
|
Loading…
Reference in New Issue
Block a user
Rewrite this using new math functions