forked from blender/blender
MaterialX: add support for Vector nodes #27
@ -71,6 +71,30 @@ static int gpu_shader_bump(GPUMaterial *mat,
|
||||
return GPU_stack_link(mat, node, "node_bump", in, out, dheight, GPU_constant(&invert));
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
{
|
||||
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||
NodeItem distance = get_input_value("Distance", NodeItem::Type::Float);
|
||||
NodeItem height = get_input_link("Height", NodeItem::Type::Float);
|
||||
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
|
||||
|
||||
if (node_->custom1) {
|
||||
distance = distance * val(-1.0f);
|
||||
}
|
||||
|
||||
NodeItem height_normal = create_node("heighttonormal", NodeItem::Type::Vector3);
|
||||
height_normal.set_input("in", height);
|
||||
height_normal.set_input("scale", strength);
|
||||
|
||||
NodeItem res = create_node("normalmap", NodeItem::Type::Vector3);
|
||||
res.set_input("in", height_normal);
|
||||
res.set_input("scale", distance);
|
||||
res.set_input("normal", normal);
|
||||
|
||||
return res;
|
||||
}
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_bump_cc
|
||||
|
||||
/* node type definition */
|
||||
@ -84,6 +108,7 @@ void register_node_type_sh_bump()
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_bump;
|
||||
ntype.gpu_fn = file_ns::gpu_shader_bump;
|
||||
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user