MaterialX: add support for nodes #11

Merged
Bogdan Nagirniak merged 17 commits from matx-add-other-nodes into matx-export-material 2023-09-06 10:37:26 +02:00
4 changed files with 21 additions and 0 deletions
Showing only changes of commit 0324fc4b33 - Show all commits

View File

@ -147,6 +147,7 @@ set(LIB
if(WITH_MATERIALX)
list(APPEND SRC
materialx/material.cc
materialx/nodes/brightness.cc
materialx/nodes/bsdf_principled.cc
materialx/nodes/huesatval.cc
materialx/nodes/invert.cc

View File

@ -0,0 +1,18 @@
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "node_parser.h"
namespace blender::nodes::materialx {
NodeItem BrightContrastNodeParser::compute()
{
NodeItem color = get_input_value("Color");
NodeItem bright = get_input_value("Bright");
NodeItem contrast = get_input_value("Contrast");
return (bright + color * (contrast + value(1.0f)) - contrast * value(0.5f)).max(value(0.0f));
}
} // namespace blender::nodes::materialx

View File

@ -132,6 +132,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket)
break;
switch (from_node->typeinfo->type) {
CASE_NODE_TYPE(SH_NODE_BRIGHTCONTRAST, BrightContrastNodeParser)
CASE_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
CASE_NODE_TYPE(SH_NODE_COMBINE_COLOR, CombineColorNodeParser)
CASE_NODE_TYPE(SH_NODE_COMBXYZ, CombineXYZNodeParser)

View File

@ -61,6 +61,7 @@ template<class T> NodeItem NodeParser::value(const T &data) const
NodeItem compute() override; \
};
DECLARE_PARSER(BrightContrastNodeParser)
DECLARE_PARSER(BSDFPrincipledNodeParser)
DECLARE_PARSER(CombineColorNodeParser)
DECLARE_PARSER(CombineXYZNodeParser)