forked from blender/blender
MaterialX: add support for nodes #11
@ -147,6 +147,7 @@ set(LIB
|
||||
if(WITH_MATERIALX)
|
||||
list(APPEND SRC
|
||||
materialx/material.cc
|
||||
materialx/nodes/brightness.cc
|
||||
materialx/nodes/bsdf_principled.cc
|
||||
DagerD marked this conversation as resolved
Outdated
|
||||
materialx/nodes/huesatval.cc
|
||||
materialx/nodes/invert.cc
|
||||
|
18
source/blender/nodes/shader/materialx/nodes/brightness.cc
Normal file
18
source/blender/nodes/shader/materialx/nodes/brightness.cc
Normal 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
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user
hue_sat_val.cc