forked from blender/blender
MaterialX: add support for Vector nodes #27
@ -35,6 +35,23 @@ static int gpu_shader_normal(GPUMaterial *mat,
|
||||
return GPU_stack_link(mat, node, "normal_new_shading", in, out, vec);
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
std::string name = socket_out_->name;
|
||||
NodeItem in1 = get_output_default("Normal", NodeItem::Type::Vector3);
|
||||
NodeItem in2 = get_input_value("Normal", NodeItem::Type::Vector3);
|
||||
if (name == "Dot") {
|
||||
NodeItem res = create_node("dotproduct", NodeItem::Type::Float);
|
||||
res.set_input("in1", in1);
|
||||
res.set_input("in2", in2);
|
||||
return res;
|
||||
}
|
||||
return in1;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_normal_cc
|
||||
|
||||
void register_node_type_sh_normal()
|
||||
@ -46,6 +63,7 @@ void register_node_type_sh_normal()
|
||||
sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.gpu_fn = file_ns::gpu_shader_normal;
|
||||
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user