forked from blender/blender
MaterialX: fix review comments #19
@ -225,7 +225,7 @@ typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
|
||||
struct bNodeExecData *execdata,
|
||||
struct GPUNodeStack *in,
|
||||
struct GPUNodeStack *out);
|
||||
typedef void (*NodeMaterialXExecFunction)(void *data,
|
||||
typedef void (*NodeMaterialXFunction)(void *data,
|
||||
struct bNode *node,
|
||||
struct bNodeSocket *out);
|
||||
|
||||
@ -343,7 +343,7 @@ typedef struct bNodeType {
|
||||
/* gpu */
|
||||
NodeGPUExecFunction gpu_fn;
|
||||
/* MaterialX */
|
||||
NodeMaterialXExecFunction materialx_fn;
|
||||
NodeMaterialXFunction materialx_fn;
|
||||
|
||||
/* Get an instance of this node's compositor operation. Freeing the instance is the
|
||||
* responsibility of the caller. */
|
||||
|
@ -210,6 +210,7 @@ if(WITH_OPENVDB)
|
||||
endif()
|
||||
|
||||
if(WITH_MATERIALX)
|
||||
add_definitions(-DWITH_MATERIALX)
|
||||
list(APPEND LIB MaterialXCore)
|
||||
endif()
|
||||
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include <pxr/imaging/hd/tokens.h>
|
||||
#include <pxr/usdImaging/usdImaging/materialParamUtils.h>
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
# include <pxr/usd/usdMtlx/reader.h>
|
||||
# include <pxr/usd/usdMtlx/utils.h>
|
||||
#endif
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
@ -33,8 +35,9 @@
|
||||
|
||||
#include "intern/usd_exporter_context.h"
|
||||
#include "intern/usd_writer_material.h"
|
||||
#ifdef WITH_MATERIALX
|
||||
# include "shader/materialx/material.h"
|
||||
|
||||
#endif
|
||||
namespace blender::io::hydra {
|
||||
|
||||
MaterialData::MaterialData(HydraSceneDelegate *scene_delegate,
|
||||
@ -73,6 +76,7 @@ void MaterialData::init()
|
||||
image_cache_file_path()};
|
||||
/* Create USD material. */
|
||||
pxr::UsdShadeMaterial usd_material;
|
||||
#ifdef WITH_MATERIALX
|
||||
if (scene_delegate_->use_materialx) {
|
||||
MaterialX::DocumentPtr doc = blender::nodes::materialx::export_to_materialx(
|
||||
scene_delegate_->depsgraph, (Material *)id);
|
||||
@ -84,7 +88,9 @@ void MaterialData::init()
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
usd_material = usd::create_usd_material(export_context, material_path, (Material *)id, "st");
|
||||
}
|
||||
|
||||
BogdanNagirniak marked this conversation as resolved
|
||||
|
@ -16,6 +16,7 @@ set(INC
|
||||
../../makesrna
|
||||
../../render
|
||||
../../windowmanager
|
||||
../../../../intern/clog
|
||||
../../../../intern/sky/include
|
||||
# RNA_prototypes.h
|
||||
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
||||
@ -24,7 +25,6 @@ set(INC
|
||||
if(WITH_HYDRA)
|
||||
list(APPEND INC
|
||||
../../io/usd
|
||||
../../../../intern/clog
|
||||
)
|
||||
add_definitions(-DWITH_HYDRA)
|
||||
endif()
|
||||
@ -145,6 +145,7 @@ set(LIB
|
||||
)
|
||||
|
||||
if(WITH_MATERIALX)
|
||||
add_definitions(-DWITH_MATERIALX)
|
||||
list(APPEND SRC
|
||||
materialx/material.cc
|
||||
materialx/node_item.cc
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
namespace blender::nodes::materialx {
|
||||
|
||||
/* This class serves as abstraction from MateralX API. It implements arithmetic operations,
|
||||
* convertions between different types, adding new nodes, setting inputs, etc.
|
||||
* All work should be done via this class instead of using MaterialX API directly. */
|
||||
class NodeItem {
|
||||
public:
|
||||
enum class Type {
|
||||
|
@ -22,7 +22,12 @@
|
||||
|
||||
#include "node_shader_register.hh"
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
# include "materialx/node_parser.h"
|
||||
#else
|
||||
# define NODE_SHADER_MATERIALX_BEGIN NodeMaterialXFunction node_shader_materialx = nullptr;
|
||||
# define NODE_SHADER_MATERIALX_END
|
||||
#endif
|
||||
BogdanNagirniak marked this conversation as resolved
Bogdan Nagirniak
commented
Seems could be simpliifed to:
Export code would be:
Seems could be simpliifed to:
```
# define NODE_SHADER_MATERIALX_BEGIN \
void *node_shader_materialx = nullptr;
# define NODE_SHADER_MATERIALX_END
```
Export code would be:
```
NODE_SHADER_MATERIALX_BEGIN
#ifdef WITH_MATERIALX
{
....
}
#endif
NODE_SHADER_MATERIALX_END
```
|
||||
|
||||
struct bContext;
|
||||
typedef struct bContext bContext;
|
||||
|
@ -23,6 +23,7 @@ static int node_shader_gpu_add_shader(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem res = empty();
|
||||
switch (to_type_) {
|
||||
@ -55,6 +56,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_add_shader_cc
|
||||
@ -69,6 +71,7 @@ void register_node_type_sh_add_shader()
|
||||
sh_node_type_base(&ntype, SH_NODE_ADD_SHADER, "Add Shader", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.gpu_fn = file_ns::node_shader_gpu_add_shader;
|
||||
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: This node doesn't have an implementation in MaterialX 1.38.6.
|
||||
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
|
||||
@ -43,6 +44,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
* return res; */
|
||||
return empty();
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_blackbody_cc
|
||||
|
@ -24,6 +24,7 @@ static int gpu_shader_brightcontrast(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||
NodeItem bright = get_input_value("Bright", NodeItem::Type::Float);
|
||||
@ -32,6 +33,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
/* This formula was given from OSL shader code in Cycles. */
|
||||
return (bright + color * (contrast + val(1.0f)) - contrast * val(0.5f)).max(val(0.0f));
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_brightness_cc
|
||||
|
@ -35,6 +35,7 @@ static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
if (to_type_ != NodeItem::Type::BSDF) {
|
||||
return empty();
|
||||
@ -52,6 +53,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_bsdf_diffuse_cc
|
||||
|
@ -254,6 +254,7 @@ static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
if (to_type_ != NodeItem::Type::SurfaceShader) {
|
||||
/* TODO: implement for BSDF and EDF */
|
||||
@ -344,6 +345,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_bsdf_principled_cc
|
||||
|
@ -71,6 +71,7 @@ static void sh_node_clamp_build_multi_function(NodeMultiFunctionBuilder &builder
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
auto type = node_->custom1;
|
||||
NodeItem value = get_input_value("Value", NodeItem::Type::Float);
|
||||
@ -87,6 +88,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_clamp_cc
|
||||
|
@ -137,10 +137,12 @@ static void sh_node_valtorgb_build_multi_function(nodes::NodeMultiFunctionBuilde
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: Implement */
|
||||
return empty();
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_color_ramp_cc
|
||||
|
@ -110,10 +110,12 @@ static void sh_node_curve_vec_build_multi_function(NodeMultiFunctionBuilder &bui
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: implement */
|
||||
return get_input_value("Value", NodeItem::Type::Vector3);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_curves_cc::vec
|
||||
@ -260,10 +262,12 @@ static void sh_node_curve_rgb_build_multi_function(NodeMultiFunctionBuilder &bui
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: implement */
|
||||
return get_input_value("Color", NodeItem::Type::Color4);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_curves_cc::rgb
|
||||
@ -386,10 +390,12 @@ static void sh_node_curve_float_build_multi_function(NodeMultiFunctionBuilder &b
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: implement */
|
||||
return get_input_value("Value", NodeItem::Type::Float);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_curves_cc::flt
|
||||
|
@ -25,6 +25,7 @@ static int node_shader_gpu_emission(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
if (to_type_ != NodeItem::Type::EDF) {
|
||||
return empty();
|
||||
@ -37,6 +38,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("color", color * strength);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_emission_cc
|
||||
|
@ -23,11 +23,13 @@ static int node_shader_gpu_gamma(GPUMaterial *mat,
|
||||
return GPU_stack_link(mat, node, "node_gamma", in, out);
|
||||
}
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
||||
NodeItem gamma = get_input_value("Gamma", NodeItem::Type::Float);
|
||||
return color ^ gamma;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_gamma_cc
|
||||
|
@ -31,6 +31,7 @@ static int gpu_shader_hue_sat(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: implement fac */
|
||||
NodeItem hue = get_input_value("Hue", NodeItem::Type::Float);
|
||||
@ -52,6 +53,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("amount", combine);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_hueSatVal_cc
|
||||
|
@ -27,11 +27,13 @@ static int gpu_shader_invert(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem fac = get_input_value("Fac", NodeItem::Type::Float);
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||
return fac.blend(color, fac.val(1.0f) - color);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_invert_cc
|
||||
|
@ -25,6 +25,7 @@ static int node_shader_gpu_light_falloff(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||
NodeItem smooth = get_input_value("Smooth", NodeItem::Type::Float);
|
||||
@ -33,6 +34,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
* node_light_falloff.osl. Considered ray_length=1.0f. */
|
||||
return strength * val(1.0f) / (smooth + val(1.0f));
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_light_falloff_cc
|
||||
|
@ -33,6 +33,7 @@ static int node_shader_gpu_light_path(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* This node isn't supported by MaterialX. Only default values returned. */
|
||||
if (STREQ(socket_out_->name, "Is Camera Ray")) {
|
||||
@ -43,6 +44,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return val(0.0f);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_light_path_cc
|
||||
|
@ -443,6 +443,7 @@ static void sh_node_map_range_build_multi_function(NodeMultiFunctionBuilder &bui
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: Implement steps */
|
||||
|
||||
@ -483,6 +484,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("doclamp", val(bool(map_range->clamp)));
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_map_range_cc
|
||||
|
@ -178,6 +178,7 @@ static void sh_node_math_build_multi_function(NodeMultiFunctionBuilder &builder)
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
||||
|
||||
@ -339,6 +340,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_math_cc
|
||||
|
@ -151,10 +151,12 @@ static void sh_node_mix_rgb_build_multi_function(NodeMultiFunctionBuilder &build
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: Implement */
|
||||
return empty();
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_mix_rgb_cc
|
||||
|
@ -24,6 +24,7 @@ static int node_shader_gpu_mix_shader(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem res = empty();
|
||||
switch (to_type_) {
|
||||
@ -60,6 +61,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_mix_shader_cc
|
||||
|
@ -123,6 +123,7 @@ static int gpu_shader_normal_map(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeShaderNormalMap *normal_map_node = static_cast<NodeShaderNormalMap *>(node_->storage);
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||
@ -152,6 +153,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("space", val(space));
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_normal_map_cc
|
||||
|
@ -44,6 +44,7 @@ static int node_shader_gpu_output_material(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem bsdf = get_input_link("Surface", NodeItem::Type::BSDF);
|
||||
NodeItem edf = get_input_link("Surface", NodeItem::Type::EDF);
|
||||
@ -64,6 +65,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("surfaceshader", surface);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_output_material_cc
|
||||
|
@ -28,6 +28,7 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
||||
|
||||
@ -35,6 +36,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("in", color);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_rgb_to_bw_cc
|
||||
|
@ -69,6 +69,7 @@ static int gpu_shader_sepcolor(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||
@ -91,6 +92,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
int index = STREQ(socket_out_->name, "Red") ? 0 : STREQ(socket_out_->name, "Green") ? 1 : 2;
|
||||
return convert.extract(index);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_separate_color_cc
|
||||
@ -163,6 +165,7 @@ static int gpu_shader_combcolor(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
||||
NodeItem red = get_input_value("Red", NodeItem::Type::Float);
|
||||
@ -190,6 +193,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_combine_color_cc
|
||||
|
@ -91,11 +91,13 @@ static void sh_node_sepxyz_build_multi_function(NodeMultiFunctionBuilder &builde
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
|
||||
int index = STREQ(socket_out_->name, "X") ? 0 : STREQ(socket_out_->name, "Y") ? 1 : 2;
|
||||
return vector.extract(index);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::sep
|
||||
@ -145,6 +147,7 @@ static void sh_node_combxyz_build_multi_function(NodeMultiFunctionBuilder &build
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem x = get_input_value("X", NodeItem::Type::Float);
|
||||
NodeItem y = get_input_value("Y", NodeItem::Type::Float);
|
||||
@ -156,6 +159,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("in3", z);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::comb
|
||||
|
@ -103,6 +103,7 @@ static void sh_node_tex_checker_build_multi_function(NodeMultiFunctionBuilder &b
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2);
|
||||
if (!vector) {
|
||||
@ -120,6 +121,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
return (vector.extract(0).floor() + vector.extract(1).floor())
|
||||
.if_else(NodeItem::CompareOp::Eq, val(1.0f), value1, value2);
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_tex_checker_cc
|
||||
|
@ -128,10 +128,12 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
/* TODO: Implement */
|
||||
return empty();
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_tex_environment_cc
|
||||
|
@ -177,6 +177,7 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
|
||||
|
||||
@ -243,6 +244,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_tex_image_cc
|
||||
|
@ -258,6 +258,7 @@ static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
|
||||
NodeItem detail = get_input_value("Detail", NodeItem::Type::Float);
|
||||
@ -274,6 +275,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
res.set_input("lacunarity", lacunarity);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_tex_noise_cc
|
||||
|
@ -317,6 +317,7 @@ static void sh_node_vector_math_build_multi_function(NodeMultiFunctionBuilder &b
|
||||
}
|
||||
|
||||
NODE_SHADER_MATERIALX_BEGIN
|
||||
#ifdef WITH_MATERIALX
|
||||
{
|
||||
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
||||
|
||||
@ -429,6 +430,7 @@ NODE_SHADER_MATERIALX_BEGIN
|
||||
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
NODE_SHADER_MATERIALX_END
|
||||
|
||||
} // namespace blender::nodes::node_shader_vector_math_cc
|
||||
|
Loading…
Reference in New Issue
Block a user
simplify to: