forked from blender/blender
MaterialX: add color nodes #17
@ -164,6 +164,7 @@ if(WITH_MATERIALX)
|
|||||||
materialx/nodes/emission.cc
|
materialx/nodes/emission.cc
|
||||||
materialx/nodes/huesatval.cc
|
materialx/nodes/huesatval.cc
|
||||||
materialx/nodes/invert.cc
|
materialx/nodes/invert.cc
|
||||||
|
materialx/nodes/light_falloff.cc
|
||||||
materialx/nodes/map_range.cc
|
materialx/nodes/map_range.cc
|
||||||
materialx/nodes/math.cc
|
materialx/nodes/math.cc
|
||||||
materialx/nodes/mix_rgb.cc
|
materialx/nodes/mix_rgb.cc
|
||||||
|
20
source/blender/nodes/shader/materialx/nodes/light_falloff.cc
Normal file
20
source/blender/nodes/shader/materialx/nodes/light_falloff.cc
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||||
|
|
||||||
|
#include "node_parser.h"
|
||||||
|
|
||||||
|
namespace blender::nodes::materialx {
|
||||||
|
|
||||||
|
NodeItem LightFalloffNodeParser::compute()
|
||||||
|
{
|
||||||
|
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||||
|
NodeItem smooth = get_input_value("Smooth", NodeItem::Type::Float);
|
||||||
|
|
||||||
|
/* This node isn't supported by MaterialX. This formula was given from OSL shader code in Cycles node_light_falloff.osl. Considered ray_length=1.0f. */
|
||||||
|
strength = strength * val(1.0f) / (smooth + val(1.0f));
|
||||||
|
|
||||||
|
return strength;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace blender::nodes::materialx
|
@ -157,6 +157,7 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
CASE_NODE_TYPE(SH_NODE_COMBXYZ, CombineXYZNodeParser)
|
CASE_NODE_TYPE(SH_NODE_COMBXYZ, CombineXYZNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
CASE_NODE_TYPE(SH_NODE_HUE_SAT, HueSatValNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
CASE_NODE_TYPE(SH_NODE_INVERT, InvertNodeParser)
|
||||||
|
CASE_NODE_TYPE(SH_NODE_LIGHT_FALLOFF, LightFalloffNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MAP_RANGE, MapRangeNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MAP_RANGE, MapRangeNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MATH, MathNodeParser)
|
||||||
CASE_NODE_TYPE(SH_NODE_MIX_RGB_LEGACY, MixRGBNodeParser)
|
CASE_NODE_TYPE(SH_NODE_MIX_RGB_LEGACY, MixRGBNodeParser)
|
||||||
|
@ -99,6 +99,7 @@ DECLARE_NODE_PARSER(CombineXYZNodeParser)
|
|||||||
DECLARE_NODE_PARSER(GammaNodeParser)
|
DECLARE_NODE_PARSER(GammaNodeParser)
|
||||||
DECLARE_NODE_PARSER(HueSatValNodeParser)
|
DECLARE_NODE_PARSER(HueSatValNodeParser)
|
||||||
DECLARE_NODE_PARSER(InvertNodeParser)
|
DECLARE_NODE_PARSER(InvertNodeParser)
|
||||||
|
DECLARE_NODE_PARSER(LightFalloffNodeParser)
|
||||||
DECLARE_NODE_PARSER(MapRangeNodeParser)
|
DECLARE_NODE_PARSER(MapRangeNodeParser)
|
||||||
DECLARE_NODE_PARSER(MathNodeParser)
|
DECLARE_NODE_PARSER(MathNodeParser)
|
||||||
DECLARE_NODE_PARSER(MixRGBNodeParser)
|
DECLARE_NODE_PARSER(MixRGBNodeParser)
|
||||||
|
Loading…
Reference in New Issue
Block a user