forked from blender/blender
MaterialX: Implement export of Input nodes #20
@ -58,6 +58,33 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
|
||||
return success;
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
{
|
||||
/* TODO: Partially implemented, some nodes don't have an implementation in MaterialX 1.38.6.*/
|
||||
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
||||
|
||||
NodeItem res = empty();
|
||||
const char *output_name = socket_out_->name;
|
||||
BogdanNagirniak marked this conversation as resolved
|
||||
|
||||
if (STREQ(output_name, "Position")) {
|
||||
res = create_node("position", NodeItem::Type::Vector3);
|
||||
res.set_input("space", val(std::string("world")));
|
||||
}
|
||||
if (STREQ(output_name, "Normal")) {
|
||||
res = create_node("normal", NodeItem::Type::Vector3);
|
||||
res.set_input("space", val(std::string("world")));
|
||||
}
|
||||
if (STREQ(output_name, "Tangent")) {
|
||||
res = create_node("tangent", NodeItem::Type::Vector3);
|
||||
res.set_input("space", val(std::string("world")));
|
||||
}
|
||||
else {
|
||||
CLOG_WARN(LOG_MATERIALX_SHADER, "Unimplemented output %s", output_name);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_geometry_cc
|
||||
|
||||
/* node type definition */
|
||||
@ -70,6 +97,7 @@ void register_node_type_sh_geometry()
|
||||
sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.gpu_fn = file_ns::node_shader_gpu_geometry;
|
||||
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
maybe std::string name = socket_out_->name ?