forked from blender/blender
Support group nodes #22
@ -13,6 +13,9 @@ NodeItem::NodeItem(MaterialX::GraphElement *graph) : graph_(graph) {}
|
|||||||
|
|
||||||
NodeItem::Type NodeItem::type(const std::string &type_str)
|
NodeItem::Type NodeItem::type(const std::string &type_str)
|
||||||
{
|
{
|
||||||
|
if (type_str == "multioutput") {
|
||||||
|
return Type::Multioutput;
|
||||||
|
}
|
||||||
if (type_str == "string") {
|
if (type_str == "string") {
|
||||||
return Type::String;
|
return Type::String;
|
||||||
}
|
}
|
||||||
@ -64,6 +67,8 @@ std::string NodeItem::type(Type type)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case Type::Any:
|
case Type::Any:
|
||||||
return "any";
|
return "any";
|
||||||
|
case Type::Multioutput:
|
||||||
|
return "multioutput";
|
||||||
case Type::String:
|
case Type::String:
|
||||||
return "string";
|
return "string";
|
||||||
case Type::Filename:
|
case Type::Filename:
|
||||||
|
@ -16,7 +16,7 @@ class NodeItem {
|
|||||||
enum class Type {
|
enum class Type {
|
||||||
Any = 0,
|
Any = 0,
|
||||||
Empty,
|
Empty,
|
||||||
|
Multioutput,
|
||||||
/* Value types */
|
/* Value types */
|
||||||
String,
|
String,
|
||||||
Filename,
|
Filename,
|
||||||
|
@ -37,20 +37,18 @@ NodeItem NodeParser::compute_full()
|
|||||||
|
|
||||||
/* Checking if node was already computed */
|
/* Checking if node was already computed */
|
||||||
res.node = graph_->getNode(node_name());
|
res.node = graph_->getNode(node_name());
|
||||||
if (res.node) {
|
if (!res.node) {
|
||||||
return res;
|
CLOG_INFO(LOG_MATERIALX_SHADER,
|
||||||
}
|
1,
|
||||||
|
"%s [%d] => %s",
|
||||||
|
node_->name,
|
||||||
|
node_->typeinfo->type,
|
||||||
|
NodeItem::type(to_type_).c_str());
|
||||||
|
|
||||||
CLOG_INFO(LOG_MATERIALX_SHADER,
|
res = compute();
|
||||||
1,
|
if (res.node) {
|
||||||
"%s [%d] => %s",
|
res.node->setName(node_name());
|
||||||
node_->name,
|
}
|
||||||
node_->typeinfo->type,
|
|
||||||
NodeItem::type(to_type_).c_str());
|
|
||||||
|
|
||||||
res = compute();
|
|
||||||
if (res.node) {
|
|
||||||
res.node->setName(node_name());
|
|
||||||
}
|
}
|
||||||
if (NodeItem::is_arithmetic(to_type_)) {
|
if (NodeItem::is_arithmetic(to_type_)) {
|
||||||
res = res.convert(to_type_);
|
res = res.convert(to_type_);
|
||||||
@ -98,12 +96,12 @@ NodeItem NodeParser::create_output(const std::string &name, const NodeItem &item
|
|||||||
|
|
||||||
NodeItem NodeParser::get_input_default(const std::string &name, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_default(const std::string &name, NodeItem::Type to_type)
|
||||||
{
|
{
|
||||||
return get_input_default(node_->input_by_identifier(name), to_type);
|
return get_default(node_->input_by_identifier(name), to_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_default(int index, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_default(int index, NodeItem::Type to_type)
|
||||||
{
|
{
|
||||||
return get_input_default(node_->input_socket(index), to_type);
|
return get_default(node_->input_socket(index), to_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_link(const std::string &name, NodeItem::Type to_type)
|
NodeItem NodeParser::get_input_link(const std::string &name, NodeItem::Type to_type)
|
||||||
@ -126,6 +124,16 @@ NodeItem NodeParser::get_input_value(int index, NodeItem::Type to_type)
|
|||||||
return get_input_value(node_->input_socket(index), to_type);
|
return get_input_value(node_->input_socket(index), to_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_output_default(const std::string &name, NodeItem::Type to_type)
|
||||||
|
{
|
||||||
|
return get_default(node_->output_by_identifier(name), to_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem NodeParser::get_output_default(int index, NodeItem::Type to_type)
|
||||||
|
{
|
||||||
|
return get_default(node_->output_socket(index), to_type);
|
||||||
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::empty() const
|
NodeItem NodeParser::empty() const
|
||||||
{
|
{
|
||||||
return NodeItem(graph_);
|
return NodeItem(graph_);
|
||||||
@ -142,7 +150,7 @@ NodeItem NodeParser::texcoord_node()
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeItem NodeParser::get_input_default(const bNodeSocket &socket, NodeItem::Type to_type)
|
NodeItem NodeParser::get_default(const bNodeSocket &socket, NodeItem::Type to_type)
|
||||||
{
|
{
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
switch (socket.type) {
|
switch (socket.type) {
|
||||||
@ -219,7 +227,7 @@ NodeItem NodeParser::get_input_value(const bNodeSocket &socket, NodeItem::Type t
|
|||||||
{
|
{
|
||||||
NodeItem res = get_input_link(socket, to_type);
|
NodeItem res = get_input_link(socket, to_type);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
res = get_input_default(socket, to_type);
|
res = get_default(socket, to_type);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ class NodeParser {
|
|||||||
NodeItem create_output(const std::string &name, const NodeItem &item);
|
NodeItem create_output(const std::string &name, const NodeItem &item);
|
||||||
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_default(const std::string &name, NodeItem::Type to_type);
|
||||||
NodeItem get_input_default(int index, NodeItem::Type to_type);
|
NodeItem get_input_default(int index, NodeItem::Type to_type);
|
||||||
|
NodeItem get_output_default(const std::string &name, NodeItem::Type to_type);
|
||||||
|
NodeItem get_output_default(int index, NodeItem::Type to_type);
|
||||||
NodeItem get_input_link(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_link(const std::string &name, NodeItem::Type to_type);
|
||||||
NodeItem get_input_link(int index, NodeItem::Type to_type);
|
NodeItem get_input_link(int index, NodeItem::Type to_type);
|
||||||
NodeItem get_input_value(const std::string &name, NodeItem::Type to_type);
|
NodeItem get_input_value(const std::string &name, NodeItem::Type to_type);
|
||||||
@ -57,7 +59,7 @@ class NodeParser {
|
|||||||
NodeItem texcoord_node();
|
NodeItem texcoord_node();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NodeItem get_input_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_default(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
NodeItem get_input_link(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_link(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
NodeItem get_input_value(const bNodeSocket &socket, NodeItem::Type to_type);
|
||||||
};
|
};
|
||||||
|
@ -55,6 +55,21 @@ static void node_shader_init_ambient_occlusion(bNodeTree * /*ntree*/, bNode *nod
|
|||||||
node->custom2 = 0;
|
node->custom2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: observed crash while rendering MaterialX_v1_38_6::ExceptionShaderGenError */
|
||||||
|
/*
|
||||||
|
* NodeItem maxdistance = get_input_value("Distance", NodeItem::Type::Float);
|
||||||
|
* NodeItem res = create_node("ambientocclusion", NodeItem::Type::Float);
|
||||||
|
* res.set_input("coneangle", val(90.0f));
|
||||||
|
* res.set_input("maxdistance", maxdistance);
|
||||||
|
*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_ambient_occlusion_cc
|
} // namespace blender::nodes::node_shader_ambient_occlusion_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -69,6 +84,7 @@ void register_node_type_sh_ambient_occlusion()
|
|||||||
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
|
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
|
||||||
ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
|
ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
|
ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,16 @@ static int node_shader_gpu_attribute(GPUMaterial *mat,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: some outputs expected be implemented within the next iteration (see nodedef
|
||||||
|
* <geompropvalue>) */
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_attribute_cc
|
} // namespace blender::nodes::node_shader_attribute_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -93,6 +103,7 @@ void register_node_type_sh_attribute()
|
|||||||
node_type_storage(
|
node_type_storage(
|
||||||
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_attribute;
|
ntype.gpu_fn = file_ns::node_shader_gpu_attribute;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,15 @@ static int gpu_shader_bevel(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_bevel", in, out);
|
return GPU_stack_link(mat, node, "node_bevel", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_input_link("Normal", NodeItem::Type::Vector3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bevel_cc
|
} // namespace blender::nodes::node_shader_bevel_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -53,6 +62,7 @@ void register_node_type_sh_bevel()
|
|||||||
ntype.draw_buttons = file_ns::node_shader_buts_bevel;
|
ntype.draw_buttons = file_ns::node_shader_buts_bevel;
|
||||||
ntype.initfunc = file_ns::node_shader_init_bevel;
|
ntype.initfunc = file_ns::node_shader_init_bevel;
|
||||||
ntype.gpu_fn = file_ns::gpu_shader_bevel;
|
ntype.gpu_fn = file_ns::gpu_shader_bevel;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,51 @@ static int node_shader_gpu_bsdf_glass(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_bsdf_glass", in, out, GPU_constant(&use_multi_scatter));
|
return GPU_stack_link(mat, node, "node_bsdf_glass", in, out, GPU_constant(&use_multi_scatter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
if (to_type_ != NodeItem::Type::BSDF) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
|
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Vector2);
|
||||||
|
NodeItem ior = get_input_value("IOR", NodeItem::Type::Float);
|
||||||
|
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
|
||||||
|
|
||||||
|
NodeItem dielectric = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
|
||||||
|
if (normal) {
|
||||||
|
dielectric.set_input("normal", normal);
|
||||||
|
}
|
||||||
|
dielectric.set_input("tint", color);
|
||||||
|
dielectric.set_input("roughness", roughness);
|
||||||
|
dielectric.set_input("ior", ior);
|
||||||
|
dielectric.set_input("scatter_mode", val(std::string("RT")));
|
||||||
|
|
||||||
|
NodeItem artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
|
||||||
|
artistic_ior.add_output("ior", NodeItem::Type::Color3);
|
||||||
|
artistic_ior.add_output("extinction", NodeItem::Type::Color3);
|
||||||
|
artistic_ior.set_input("reflectivity", color);
|
||||||
|
artistic_ior.set_input("edge_color", color);
|
||||||
|
|
||||||
|
NodeItem conductor = create_node("conductor_bsdf", NodeItem::Type::BSDF);
|
||||||
|
if (normal) {
|
||||||
|
conductor.set_input("normal", normal);
|
||||||
|
}
|
||||||
|
conductor.set_input_output("ior", artistic_ior, "ior");
|
||||||
|
conductor.set_input_output("extinction", artistic_ior, "extinction");
|
||||||
|
conductor.set_input("roughness", roughness);
|
||||||
|
|
||||||
|
NodeItem res = create_node("mix", NodeItem::Type::BSDF);
|
||||||
|
res.set_input("fg", dielectric);
|
||||||
|
res.set_input("bg", conductor);
|
||||||
|
res.set_input("mix", val(0.5f));
|
||||||
|
|
||||||
|
return res ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_glass_cc
|
} // namespace blender::nodes::node_shader_bsdf_glass_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -57,6 +102,7 @@ void register_node_type_sh_bsdf_glass()
|
|||||||
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
||||||
ntype.initfunc = file_ns::node_shader_init_glass;
|
ntype.initfunc = file_ns::node_shader_init_glass;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glass;
|
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glass;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,41 @@ static int node_shader_gpu_bsdf_glossy(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_bsdf_glossy", in, out, GPU_constant(&use_multi_scatter));
|
return GPU_stack_link(mat, node, "node_bsdf_glossy", in, out, GPU_constant(&use_multi_scatter));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
if (to_type_ != NodeItem::Type::BSDF) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
|
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Vector2);
|
||||||
|
NodeItem anisotropy = get_input_value("Anisotropy", NodeItem::Type::Color3);
|
||||||
|
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
|
||||||
|
NodeItem tangent = get_input_link("Tangent", NodeItem::Type::Vector3);
|
||||||
|
|
||||||
|
NodeItem artistic_ior = create_node("artistic_ior", NodeItem::Type::Multioutput);
|
||||||
|
artistic_ior.add_output("ior", NodeItem::Type::Color3);
|
||||||
|
artistic_ior.add_output("extinction", NodeItem::Type::Color3);
|
||||||
|
artistic_ior.set_input("reflectivity", color);
|
||||||
|
artistic_ior.set_input("edge_color", color);
|
||||||
|
|
||||||
|
NodeItem res = create_node("conductor_bsdf", NodeItem::Type::BSDF);
|
||||||
|
if (normal) {
|
||||||
|
res.set_input("normal", normal);
|
||||||
|
}
|
||||||
|
if (tangent) {
|
||||||
|
res.set_input("tangent", tangent);
|
||||||
|
}
|
||||||
|
res.set_input_output("ior", artistic_ior, "ior");
|
||||||
|
res.set_input_output("extinction", artistic_ior, "extinction");
|
||||||
|
res.set_input("roughness", roughness);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_glossy_cc
|
} // namespace blender::nodes::node_shader_bsdf_glossy_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -72,6 +107,7 @@ void register_node_type_sh_bsdf_glossy()
|
|||||||
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
||||||
ntype.initfunc = file_ns::node_shader_init_glossy;
|
ntype.initfunc = file_ns::node_shader_init_glossy;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glossy;
|
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_glossy;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
|
|
||||||
|
@ -40,6 +40,32 @@ static int node_shader_gpu_bsdf_refraction(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out);
|
return GPU_stack_link(mat, node, "node_bsdf_refraction", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
if (to_type_ != NodeItem::Type::BSDF) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
|
NodeItem roughness = get_input_value("Roughness", NodeItem::Type::Vector2);
|
||||||
|
NodeItem ior = get_input_value("IOR", NodeItem::Type::Float);
|
||||||
|
NodeItem normal = get_input_link("Normal", NodeItem::Type::Vector3);
|
||||||
|
|
||||||
|
NodeItem res = create_node("dielectric_bsdf", NodeItem::Type::BSDF);
|
||||||
|
if (normal) {
|
||||||
|
res.set_input("normal", normal);
|
||||||
|
}
|
||||||
|
res.set_input("tint", color);
|
||||||
|
res.set_input("roughness", roughness);
|
||||||
|
res.set_input("ior", ior);
|
||||||
|
res.set_input("scatter_mode", val(std::string("T")));
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_refraction_cc
|
} // namespace blender::nodes::node_shader_bsdf_refraction_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -55,6 +81,7 @@ void register_node_type_sh_bsdf_refraction()
|
|||||||
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
blender::bke::node_type_size_preset(&ntype, blender::bke::eNodeSizePreset::MIDDLE);
|
||||||
ntype.initfunc = file_ns::node_shader_init_refraction;
|
ntype.initfunc = file_ns::node_shader_init_refraction;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_refraction;
|
ntype.gpu_fn = file_ns::node_shader_gpu_bsdf_refraction;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,15 @@ static int gpu_shader_camera(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "camera", in, out);
|
return GPU_stack_link(mat, node, "camera", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_camera_cc
|
} // namespace blender::nodes::node_shader_camera_cc
|
||||||
|
|
||||||
void register_node_type_sh_camera()
|
void register_node_type_sh_camera()
|
||||||
@ -37,6 +46,7 @@ void register_node_type_sh_camera()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_CAMERA, "Camera Data", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::gpu_shader_camera;
|
ntype.gpu_fn = file_ns::gpu_shader_camera;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,16 @@ static int node_shader_gpu_fresnel(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_fresnel", in, out);
|
return GPU_stack_link(mat, node, "node_fresnel", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: some outputs expected be implemented within the next iteration (see nodedef
|
||||||
|
* <artistic_ior>) */
|
||||||
|
return get_input_value("IOR", NodeItem::Type::Float);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_fresnel_cc
|
} // namespace blender::nodes::node_shader_fresnel_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -38,6 +48,7 @@ void register_node_type_sh_fresnel()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_fresnel;
|
ntype.gpu_fn = file_ns::node_shader_gpu_fresnel;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,33 @@ static int node_shader_gpu_geometry(GPUMaterial *mat,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: Some outputs don't have an implementation in MaterialX.*/
|
||||||
|
NodeItem res = empty();
|
||||||
|
std::string name = socket_out_->name;
|
||||||
|
|
||||||
|
if (name == "Position") {
|
||||||
|
res = create_node("position", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
else if (name == "Normal") {
|
||||||
|
res = create_node("normal", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
else if (ELEM(name, "Tangent", "True Normal")) {
|
||||||
|
res = create_node("tangent", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res = get_output_default(name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_geometry_cc
|
} // namespace blender::nodes::node_shader_geometry_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* 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);
|
sh_node_type_base(&ntype, SH_NODE_NEW_GEOMETRY, "Geometry", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_geometry;
|
ntype.gpu_fn = file_ns::node_shader_gpu_geometry;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,15 @@ static int node_shader_gpu_hair_info(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link);
|
return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_hair_info_cc
|
} // namespace blender::nodes::node_shader_hair_info_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -41,6 +50,7 @@ void register_node_type_sh_hair_info()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Curves Info", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Curves Info", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_hair_info;
|
ntype.gpu_fn = file_ns::node_shader_gpu_hair_info;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,16 @@ static int node_shader_gpu_layer_weight(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_layer_weight", in, out);
|
return GPU_stack_link(mat, node, "node_layer_weight", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: some outputs expected be implemented partially within the next iteration (see nodedef
|
||||||
|
* <artistic_ior>) */
|
||||||
|
return get_input_link("Blend", NodeItem::Type::Float);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_layer_weight_cc
|
} // namespace blender::nodes::node_shader_layer_weight_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -39,6 +49,7 @@ void register_node_type_sh_layer_weight()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_layer_weight;
|
ntype.gpu_fn = file_ns::node_shader_gpu_layer_weight;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,34 @@ static int node_shader_gpu_object_info(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_object_info", in, out, GPU_constant(&index));
|
return GPU_stack_link(mat, node, "node_object_info", in, out, GPU_constant(&index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: Some outputs don't have an implementation in MaterialX.*/
|
||||||
|
NodeItem res = empty();
|
||||||
|
std::string name = socket_out_->name;
|
||||||
|
|
||||||
|
if (name == "Location") {
|
||||||
|
res = create_node("position", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
/* TODO: This node doesn't have an implementation in MaterialX.
|
||||||
|
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
|
||||||
|
* if (name=="Random") {
|
||||||
|
* res = create_node("randomfloat", NodeItem::Type::Float);
|
||||||
|
* res.set_input("in", val(0.0));
|
||||||
|
* res.set_input("min", val(0.0));
|
||||||
|
* res.set_input("max", val(1.0));
|
||||||
|
* res.set_input("seed", val(0));
|
||||||
|
*}*/
|
||||||
|
else {
|
||||||
|
res = get_output_default(name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_object_info_cc
|
} // namespace blender::nodes::node_shader_object_info_cc
|
||||||
|
|
||||||
void register_node_type_sh_object_info()
|
void register_node_type_sh_object_info()
|
||||||
@ -41,6 +69,7 @@ void register_node_type_sh_object_info()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_OBJECT_INFO, "Object Info", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_object_info;
|
ntype.gpu_fn = file_ns::node_shader_gpu_object_info;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,15 @@ static int gpu_shader_particle_info(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "particle_info", in, out);
|
return GPU_stack_link(mat, node, "particle_info", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_particle_info_cc
|
} // namespace blender::nodes::node_shader_particle_info_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -46,6 +55,7 @@ void register_node_type_sh_particle_info()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::gpu_shader_particle_info;
|
ntype.gpu_fn = file_ns::gpu_shader_particle_info;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,15 @@ static int node_shader_gpu_point_info(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_point_info", in, out);
|
return GPU_stack_link(mat, node, "node_point_info", in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_point_info_cc
|
} // namespace blender::nodes::node_shader_point_info_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -34,6 +43,7 @@ void register_node_type_sh_point_info()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_POINT_INFO, "Point Info", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_POINT_INFO, "Point Info", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_point_info;
|
ntype.gpu_fn = file_ns::node_shader_gpu_point_info;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,17 @@ static int gpu_shader_rgb(GPUMaterial *mat,
|
|||||||
return GPU_link(mat, "set_rgba", GPU_uniform(value), &out->link);
|
return GPU_link(mat, "set_rgba", GPU_uniform(value), &out->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
NodeItem color = get_output_default("Color", NodeItem::Type::Color4);
|
||||||
|
NodeItem res = create_node("constant", NodeItem::Type::Color4);
|
||||||
|
res.set_input("value", color);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_rgb_cc
|
} // namespace blender::nodes::node_shader_rgb_cc
|
||||||
|
|
||||||
void register_node_type_sh_rgb()
|
void register_node_type_sh_rgb()
|
||||||
@ -37,6 +48,7 @@ void register_node_type_sh_rgb()
|
|||||||
sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT);
|
sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT);
|
||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.gpu_fn = file_ns::gpu_shader_rgb;
|
ntype.gpu_fn = file_ns::gpu_shader_rgb;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,15 @@ static int node_shader_gpu_tangent(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_tangent", in, out, orco);
|
return GPU_stack_link(mat, node, "node_tangent", in, out, orco);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Vector3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tangent_cc
|
} // namespace blender::nodes::node_shader_tangent_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -103,6 +112,7 @@ void register_node_type_sh_tangent()
|
|||||||
ntype.gpu_fn = file_ns::node_shader_gpu_tangent;
|
ntype.gpu_fn = file_ns::node_shader_gpu_tangent;
|
||||||
node_type_storage(
|
node_type_storage(
|
||||||
&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage);
|
&ntype, "NodeShaderTangent", node_free_standard_storage, node_copy_standard_storage);
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,33 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: Some outputs don't have an implementation in MaterialX.*/
|
||||||
|
NodeItem res = empty();
|
||||||
|
std::string name = socket_out_->name;
|
||||||
|
|
||||||
|
if (ELEM(name, "Generated", "UV")) {
|
||||||
|
res = texcoord_node();
|
||||||
|
}
|
||||||
|
else if (name == "Normal") {
|
||||||
|
res = create_node("normal", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
else if (name == "Object") {
|
||||||
|
res = create_node("position", NodeItem::Type::Vector3);
|
||||||
|
res.set_input("space", val(std::string("world")));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res = get_output_default(name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tex_coord_cc
|
} // namespace blender::nodes::node_shader_tex_coord_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -84,6 +111,7 @@ void register_node_type_sh_tex_coord()
|
|||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_coord;
|
ntype.draw_buttons = file_ns::node_shader_buts_tex_coord;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_tex_coord;
|
ntype.gpu_fn = file_ns::node_shader_gpu_tex_coord;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,17 @@ static int node_shader_gpu_uvmap(GPUMaterial *mat,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NODE: "From Instances" not implemented
|
||||||
|
* UV selection not implemented
|
||||||
|
*/
|
||||||
|
return texcoord_node();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_uvmap_cc
|
} // namespace blender::nodes::node_shader_uvmap_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -84,6 +95,7 @@ void register_node_type_sh_uvmap()
|
|||||||
node_type_storage(
|
node_type_storage(
|
||||||
&ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage);
|
&ntype, "NodeShaderUVMap", node_free_standard_storage, node_copy_standard_storage);
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_uvmap;
|
ntype.gpu_fn = file_ns::node_shader_gpu_uvmap;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,17 @@ static void sh_node_value_build_multi_function(NodeMultiFunctionBuilder &builder
|
|||||||
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<float>>(value->value);
|
builder.construct_and_set_matching_fn<mf::CustomMF_Constant<float>>(value->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
NodeItem value = get_output_default("Value", NodeItem::Type::Float);
|
||||||
|
NodeItem res = create_node("constant", NodeItem::Type::Float);
|
||||||
|
res.set_input("value", value);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_value_cc
|
} // namespace blender::nodes::node_shader_value_cc
|
||||||
|
|
||||||
void register_node_type_sh_value()
|
void register_node_type_sh_value()
|
||||||
@ -50,6 +61,7 @@ void register_node_type_sh_value()
|
|||||||
ntype.declare = file_ns::sh_node_value_declare;
|
ntype.declare = file_ns::sh_node_value_declare;
|
||||||
ntype.gpu_fn = file_ns::gpu_shader_value;
|
ntype.gpu_fn = file_ns::gpu_shader_value;
|
||||||
ntype.build_multi_function = file_ns::sh_node_value_build_multi_function;
|
ntype.build_multi_function = file_ns::sh_node_value_build_multi_function;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,16 @@ static int node_shader_gpu_vertex_color(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_vertex_color", in, out, vertexColorLink);
|
return GPU_stack_link(mat, node, "node_vertex_color", in, out, vertexColorLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* TODO: some output expected be implemented within the next iteration (see nodedef
|
||||||
|
* <geomcolor>)*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Any);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_vertex_color_cc
|
} // namespace blender::nodes::node_shader_vertex_color_cc
|
||||||
|
|
||||||
void register_node_type_sh_vertex_color()
|
void register_node_type_sh_vertex_color()
|
||||||
@ -82,6 +92,7 @@ void register_node_type_sh_vertex_color()
|
|||||||
node_type_storage(
|
node_type_storage(
|
||||||
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
|
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_vertex_color;
|
ntype.gpu_fn = file_ns::node_shader_gpu_vertex_color;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,15 @@ static int node_shader_gpu_wireframe(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
|
/* NOTE: This node doesn't have an implementation in MaterialX.*/
|
||||||
|
return get_output_default(socket_out_->name, NodeItem::Type::Float);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_wireframe_cc
|
} // namespace blender::nodes::node_shader_wireframe_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -53,6 +62,7 @@ void register_node_type_sh_wireframe()
|
|||||||
ntype.declare = file_ns::node_declare;
|
ntype.declare = file_ns::node_declare;
|
||||||
ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
|
ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
|
ntype.gpu_fn = file_ns::node_shader_gpu_wireframe;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user