forked from blender/blender
MaterialX: fix review comments #19
@ -90,10 +90,9 @@ void MaterialData::init()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
usd_material = usd::create_usd_material(export_context, material_path, (Material *)id, "st");
|
usd_material = usd::create_usd_material(export_context, material_path, (Material *)id, "st");
|
||||||
#ifdef WITH_MATERIALX
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
BogdanNagirniak marked this conversation as resolved
|
|||||||
/* Convert USD material to Hydra material network map, adapted for render delegate. */
|
/* Convert USD material to Hydra material network map, adapted for render delegate. */
|
||||||
const pxr::HdRenderDelegate *render_delegate =
|
const pxr::HdRenderDelegate *render_delegate =
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
# include "materialx/node_parser.h"
|
# include "materialx/node_parser.h"
|
||||||
#else
|
#else
|
||||||
# define NODE_SHADER_MATERIALX_BEGIN \
|
# define NODE_SHADER_MATERIALX_BEGIN NodeMaterialXExecFunction node_shader_materialx = nullptr;
|
||||||
void node_shader_materialx(void *data, struct bNode *node, struct bNodeSocket *out)
|
|
||||||
# define NODE_SHADER_MATERIALX_END
|
# define NODE_SHADER_MATERIALX_END
|
||||||
#endif
|
#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
```
|
|||||||
|
|
||||||
|
@ -23,8 +23,8 @@ static int node_shader_gpu_add_shader(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
switch (to_type_) {
|
switch (to_type_) {
|
||||||
case NodeItem::Type::BSDF:
|
case NodeItem::Type::BSDF:
|
||||||
@ -55,8 +55,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
BLI_assert_unreachable();
|
BLI_assert_unreachable();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_add_shader_cc
|
} // namespace blender::nodes::node_shader_add_shader_cc
|
||||||
|
@ -32,8 +32,8 @@ static int node_shader_gpu_blackbody(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: This node doesn't have an implementation in MaterialX 1.38.6.
|
/* 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.
|
* It's added in MaterialX 1.38.8. Uncomment this code after switching to 1.38.8.
|
||||||
*
|
*
|
||||||
@ -43,8 +43,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
* res.set_input("temperature", temperature);
|
* res.set_input("temperature", temperature);
|
||||||
* return res; */
|
* return res; */
|
||||||
return empty();
|
return empty();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_blackbody_cc
|
} // namespace blender::nodes::node_shader_blackbody_cc
|
||||||
|
@ -24,16 +24,16 @@ static int gpu_shader_brightcontrast(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
NodeItem bright = get_input_value("Bright", NodeItem::Type::Float);
|
NodeItem bright = get_input_value("Bright", NodeItem::Type::Float);
|
||||||
NodeItem contrast = get_input_value("Contrast", NodeItem::Type::Float);
|
NodeItem contrast = get_input_value("Contrast", NodeItem::Type::Float);
|
||||||
|
|
||||||
/* This formula was given from OSL shader code in Cycles. */
|
/* 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));
|
return (bright + color * (contrast + val(1.0f)) - contrast * val(0.5f)).max(val(0.0f));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_brightness_cc
|
} // namespace blender::nodes::node_shader_brightness_cc
|
||||||
|
@ -35,8 +35,8 @@ static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
if (to_type_ != NodeItem::Type::BSDF) {
|
if (to_type_ != NodeItem::Type::BSDF) {
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
@ -52,8 +52,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("normal", normal);
|
res.set_input("normal", normal);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_diffuse_cc
|
} // namespace blender::nodes::node_shader_bsdf_diffuse_cc
|
||||||
|
@ -254,8 +254,8 @@ static void node_shader_update_principled(bNodeTree *ntree, bNode *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
if (to_type_ != NodeItem::Type::SurfaceShader) {
|
if (to_type_ != NodeItem::Type::SurfaceShader) {
|
||||||
/* TODO: implement for BSDF and EDF */
|
/* TODO: implement for BSDF and EDF */
|
||||||
return empty();
|
return empty();
|
||||||
@ -344,8 +344,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("emission_color", emission);
|
res.set_input("emission_color", emission);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_bsdf_principled_cc
|
} // namespace blender::nodes::node_shader_bsdf_principled_cc
|
||||||
|
@ -71,8 +71,8 @@ static void sh_node_clamp_build_multi_function(NodeMultiFunctionBuilder &builder
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
auto type = node_->custom1;
|
auto type = node_->custom1;
|
||||||
NodeItem value = get_input_value("Value", NodeItem::Type::Float);
|
NodeItem value = get_input_value("Value", NodeItem::Type::Float);
|
||||||
NodeItem min = get_input_value("Min", NodeItem::Type::Float);
|
NodeItem min = get_input_value("Min", NodeItem::Type::Float);
|
||||||
@ -87,8 +87,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res = value.clamp(min, max);
|
res = value.clamp(min, max);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_clamp_cc
|
} // namespace blender::nodes::node_shader_clamp_cc
|
||||||
|
@ -137,13 +137,12 @@ static void sh_node_valtorgb_build_multi_function(nodes::NodeMultiFunctionBuilde
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: Implement */
|
/* TODO: Implement */
|
||||||
return empty();
|
return empty();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_color_ramp_cc
|
} // namespace blender::nodes::node_shader_color_ramp_cc
|
||||||
|
@ -110,12 +110,12 @@ static void sh_node_curve_vec_build_multi_function(NodeMultiFunctionBuilder &bui
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: implement */
|
/* TODO: implement */
|
||||||
return get_input_value("Value", NodeItem::Type::Vector3);
|
return get_input_value("Value", NodeItem::Type::Vector3);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_curves_cc::vec
|
} // namespace blender::nodes::node_shader_curves_cc::vec
|
||||||
@ -262,12 +262,12 @@ static void sh_node_curve_rgb_build_multi_function(NodeMultiFunctionBuilder &bui
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: implement */
|
/* TODO: implement */
|
||||||
return get_input_value("Color", NodeItem::Type::Color4);
|
return get_input_value("Color", NodeItem::Type::Color4);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_curves_cc::rgb
|
} // namespace blender::nodes::node_shader_curves_cc::rgb
|
||||||
@ -390,12 +390,12 @@ static void sh_node_curve_float_build_multi_function(NodeMultiFunctionBuilder &b
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: implement */
|
/* TODO: implement */
|
||||||
return get_input_value("Value", NodeItem::Type::Float);
|
return get_input_value("Value", NodeItem::Type::Float);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_curves_cc::flt
|
} // namespace blender::nodes::node_shader_curves_cc::flt
|
||||||
|
@ -25,8 +25,8 @@ static int node_shader_gpu_emission(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
if (to_type_ != NodeItem::Type::EDF) {
|
if (to_type_ != NodeItem::Type::EDF) {
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
@ -37,8 +37,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
NodeItem res = create_node("uniform_edf", NodeItem::Type::EDF);
|
NodeItem res = create_node("uniform_edf", NodeItem::Type::EDF);
|
||||||
res.set_input("color", color * strength);
|
res.set_input("color", color * strength);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_emission_cc
|
} // namespace blender::nodes::node_shader_emission_cc
|
||||||
|
@ -23,13 +23,13 @@ static int node_shader_gpu_gamma(GPUMaterial *mat,
|
|||||||
return GPU_stack_link(mat, node, "node_gamma", in, out);
|
return GPU_stack_link(mat, node, "node_gamma", in, out);
|
||||||
}
|
}
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
||||||
NodeItem gamma = get_input_value("Gamma", NodeItem::Type::Float);
|
NodeItem gamma = get_input_value("Gamma", NodeItem::Type::Float);
|
||||||
return color ^ gamma;
|
return color ^ gamma;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_gamma_cc
|
} // namespace blender::nodes::node_shader_gamma_cc
|
||||||
|
@ -31,8 +31,8 @@ static int gpu_shader_hue_sat(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: implement fac */
|
/* TODO: implement fac */
|
||||||
NodeItem hue = get_input_value("Hue", NodeItem::Type::Float);
|
NodeItem hue = get_input_value("Hue", NodeItem::Type::Float);
|
||||||
NodeItem saturation = get_input_value("Saturation", NodeItem::Type::Float);
|
NodeItem saturation = get_input_value("Saturation", NodeItem::Type::Float);
|
||||||
@ -52,8 +52,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("in", color);
|
res.set_input("in", color);
|
||||||
res.set_input("amount", combine);
|
res.set_input("amount", combine);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_hueSatVal_cc
|
} // namespace blender::nodes::node_shader_hueSatVal_cc
|
||||||
|
@ -27,13 +27,13 @@ static int gpu_shader_invert(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem fac = get_input_value("Fac", NodeItem::Type::Float);
|
NodeItem fac = get_input_value("Fac", NodeItem::Type::Float);
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
return fac.blend(color, fac.val(1.0f) - color);
|
return fac.blend(color, fac.val(1.0f) - color);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_invert_cc
|
} // namespace blender::nodes::node_shader_invert_cc
|
||||||
|
@ -25,16 +25,16 @@ static int node_shader_gpu_light_falloff(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||||
NodeItem smooth = get_input_value("Smooth", 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
|
/* 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. */
|
* node_light_falloff.osl. Considered ray_length=1.0f. */
|
||||||
return strength * val(1.0f) / (smooth + val(1.0f));
|
return strength * val(1.0f) / (smooth + val(1.0f));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_light_falloff_cc
|
} // namespace blender::nodes::node_shader_light_falloff_cc
|
||||||
|
@ -33,8 +33,8 @@ static int node_shader_gpu_light_path(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* This node isn't supported by MaterialX. Only default values returned. */
|
/* This node isn't supported by MaterialX. Only default values returned. */
|
||||||
if (STREQ(socket_out_->name, "Is Camera Ray")) {
|
if (STREQ(socket_out_->name, "Is Camera Ray")) {
|
||||||
return val(1.0f);
|
return val(1.0f);
|
||||||
@ -43,8 +43,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
return val(1.0f);
|
return val(1.0f);
|
||||||
}
|
}
|
||||||
return val(0.0f);
|
return val(0.0f);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_light_path_cc
|
} // namespace blender::nodes::node_shader_light_path_cc
|
||||||
|
@ -443,8 +443,8 @@ static void sh_node_map_range_build_multi_function(NodeMultiFunctionBuilder &bui
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: Implement steps */
|
/* TODO: Implement steps */
|
||||||
|
|
||||||
const NodeMapRange *map_range = static_cast<NodeMapRange *>(node_->storage);
|
const NodeMapRange *map_range = static_cast<NodeMapRange *>(node_->storage);
|
||||||
@ -483,8 +483,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("outhigh", to_max);
|
res.set_input("outhigh", to_max);
|
||||||
res.set_input("doclamp", val(bool(map_range->clamp)));
|
res.set_input("doclamp", val(bool(map_range->clamp)));
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_map_range_cc
|
} // namespace blender::nodes::node_shader_map_range_cc
|
||||||
|
@ -178,8 +178,8 @@ static void sh_node_math_build_multi_function(NodeMultiFunctionBuilder &builder)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
||||||
|
|
||||||
/* TODO: finish some math operations */
|
/* TODO: finish some math operations */
|
||||||
@ -339,8 +339,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_math_cc
|
} // namespace blender::nodes::node_shader_math_cc
|
||||||
|
@ -151,12 +151,12 @@ static void sh_node_mix_rgb_build_multi_function(NodeMultiFunctionBuilder &build
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: Implement */
|
/* TODO: Implement */
|
||||||
return empty();
|
return empty();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_mix_rgb_cc
|
} // namespace blender::nodes::node_shader_mix_rgb_cc
|
||||||
|
@ -24,8 +24,8 @@ static int node_shader_gpu_mix_shader(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem res = empty();
|
NodeItem res = empty();
|
||||||
switch (to_type_) {
|
switch (to_type_) {
|
||||||
case NodeItem::Type::BSDF:
|
case NodeItem::Type::BSDF:
|
||||||
@ -60,8 +60,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
BLI_assert_unreachable();
|
BLI_assert_unreachable();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_mix_shader_cc
|
} // namespace blender::nodes::node_shader_mix_shader_cc
|
||||||
|
@ -123,8 +123,8 @@ static int gpu_shader_normal_map(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeShaderNormalMap *normal_map_node = static_cast<NodeShaderNormalMap *>(node_->storage);
|
NodeShaderNormalMap *normal_map_node = static_cast<NodeShaderNormalMap *>(node_->storage);
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
NodeItem strength = get_input_value("Strength", NodeItem::Type::Float);
|
||||||
@ -152,8 +152,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("scale", strength);
|
res.set_input("scale", strength);
|
||||||
res.set_input("space", val(space));
|
res.set_input("space", val(space));
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_normal_map_cc
|
} // namespace blender::nodes::node_shader_normal_map_cc
|
||||||
|
@ -44,8 +44,8 @@ static int node_shader_gpu_output_material(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem bsdf = get_input_link("Surface", NodeItem::Type::BSDF);
|
NodeItem bsdf = get_input_link("Surface", NodeItem::Type::BSDF);
|
||||||
NodeItem edf = get_input_link("Surface", NodeItem::Type::EDF);
|
NodeItem edf = get_input_link("Surface", NodeItem::Type::EDF);
|
||||||
NodeItem surface = empty();
|
NodeItem surface = empty();
|
||||||
@ -64,8 +64,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
NodeItem res = create_node("surfacematerial", NodeItem::Type::Material);
|
NodeItem res = create_node("surfacematerial", NodeItem::Type::Material);
|
||||||
res.set_input("surfaceshader", surface);
|
res.set_input("surfaceshader", surface);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_output_material_cc
|
} // namespace blender::nodes::node_shader_output_material_cc
|
||||||
|
@ -28,15 +28,15 @@ static int gpu_shader_rgbtobw(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
|
||||||
|
|
||||||
NodeItem res = create_node("luminance", NodeItem::Type::Color4);
|
NodeItem res = create_node("luminance", NodeItem::Type::Color4);
|
||||||
res.set_input("in", color);
|
res.set_input("in", color);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_rgb_to_bw_cc
|
} // namespace blender::nodes::node_shader_rgb_to_bw_cc
|
||||||
|
@ -69,8 +69,8 @@ static int gpu_shader_sepcolor(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
||||||
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
NodeItem color = get_input_value("Color", NodeItem::Type::Color3);
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
|
|
||||||
int index = STREQ(socket_out_->name, "Red") ? 0 : STREQ(socket_out_->name, "Green") ? 1 : 2;
|
int index = STREQ(socket_out_->name, "Red") ? 0 : STREQ(socket_out_->name, "Green") ? 1 : 2;
|
||||||
return convert.extract(index);
|
return convert.extract(index);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_separate_color_cc
|
} // namespace blender::nodes::node_shader_separate_color_cc
|
||||||
@ -165,8 +165,8 @@ static int gpu_shader_combcolor(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
int mode = static_cast<NodeCombSepColor *>(node_->storage)->mode;
|
||||||
NodeItem red = get_input_value("Red", NodeItem::Type::Float);
|
NodeItem red = get_input_value("Red", NodeItem::Type::Float);
|
||||||
NodeItem green = get_input_value("Green", NodeItem::Type::Float);
|
NodeItem green = get_input_value("Green", NodeItem::Type::Float);
|
||||||
@ -192,8 +192,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
BLI_assert_unreachable();
|
BLI_assert_unreachable();
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_combine_color_cc
|
} // namespace blender::nodes::node_shader_combine_color_cc
|
||||||
|
@ -91,13 +91,13 @@ static void sh_node_sepxyz_build_multi_function(NodeMultiFunctionBuilder &builde
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
|
NodeItem vector = get_input_value("Vector", NodeItem::Type::Vector3);
|
||||||
int index = STREQ(socket_out_->name, "X") ? 0 : STREQ(socket_out_->name, "Y") ? 1 : 2;
|
int index = STREQ(socket_out_->name, "X") ? 0 : STREQ(socket_out_->name, "Y") ? 1 : 2;
|
||||||
return vector.extract(index);
|
return vector.extract(index);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::sep
|
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::sep
|
||||||
@ -147,8 +147,8 @@ static void sh_node_combxyz_build_multi_function(NodeMultiFunctionBuilder &build
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem x = get_input_value("X", NodeItem::Type::Float);
|
NodeItem x = get_input_value("X", NodeItem::Type::Float);
|
||||||
NodeItem y = get_input_value("Y", NodeItem::Type::Float);
|
NodeItem y = get_input_value("Y", NodeItem::Type::Float);
|
||||||
NodeItem z = get_input_value("Z", NodeItem::Type::Float);
|
NodeItem z = get_input_value("Z", NodeItem::Type::Float);
|
||||||
@ -158,8 +158,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res.set_input("in2", y);
|
res.set_input("in2", y);
|
||||||
res.set_input("in3", z);
|
res.set_input("in3", z);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::comb
|
} // namespace blender::nodes::node_shader_sepcomb_xyz_cc::comb
|
||||||
|
@ -103,8 +103,8 @@ static void sh_node_tex_checker_build_multi_function(NodeMultiFunctionBuilder &b
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2);
|
NodeItem vector = get_input_link("Vector", NodeItem::Type::Vector2);
|
||||||
if (!vector) {
|
if (!vector) {
|
||||||
vector = texcoord_node();
|
vector = texcoord_node();
|
||||||
@ -120,8 +120,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
vector = (vector * scale) % val(2.0f);
|
vector = (vector * scale) % val(2.0f);
|
||||||
return (vector.extract(0).floor() + vector.extract(1).floor())
|
return (vector.extract(0).floor() + vector.extract(1).floor())
|
||||||
.if_else(NodeItem::CompareOp::Eq, val(1.0f), value1, value2);
|
.if_else(NodeItem::CompareOp::Eq, val(1.0f), value1, value2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tex_checker_cc
|
} // namespace blender::nodes::node_shader_tex_checker_cc
|
||||||
|
@ -128,12 +128,12 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
/* TODO: Implement */
|
/* TODO: Implement */
|
||||||
return empty();
|
return empty();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tex_environment_cc
|
} // namespace blender::nodes::node_shader_tex_environment_cc
|
||||||
|
@ -177,8 +177,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
|
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
Image *image = (Image *)node_->id;
|
Image *image = (Image *)node_->id;
|
||||||
@ -243,8 +243,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
res = res.extract(3);
|
res = res.extract(3);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tex_image_cc
|
} // namespace blender::nodes::node_shader_tex_image_cc
|
||||||
|
@ -258,8 +258,8 @@ static void sh_node_noise_build_multi_function(NodeMultiFunctionBuilder &builder
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
|
NodeItem scale = get_input_value("Scale", NodeItem::Type::Float);
|
||||||
NodeItem detail = get_input_value("Detail", NodeItem::Type::Float);
|
NodeItem detail = get_input_value("Detail", NodeItem::Type::Float);
|
||||||
NodeItem lacunarity = get_input_value("Lacunarity", NodeItem::Type::Float);
|
NodeItem lacunarity = get_input_value("Lacunarity", NodeItem::Type::Float);
|
||||||
@ -274,8 +274,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
}
|
}
|
||||||
res.set_input("lacunarity", lacunarity);
|
res.set_input("lacunarity", lacunarity);
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_tex_noise_cc
|
} // namespace blender::nodes::node_shader_tex_noise_cc
|
||||||
|
@ -317,8 +317,8 @@ static void sh_node_vector_math_build_multi_function(NodeMultiFunctionBuilder &b
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_SHADER_MATERIALX_BEGIN
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
{
|
|
||||||
#ifdef WITH_MATERIALX
|
#ifdef WITH_MATERIALX
|
||||||
|
{
|
||||||
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
CLG_LogRef *LOG_MATERIALX_SHADER = materialx::LOG_MATERIALX_SHADER;
|
||||||
|
|
||||||
/* TODO: finish some math operations */
|
/* TODO: finish some math operations */
|
||||||
@ -429,8 +429,8 @@ NODE_SHADER_MATERIALX_BEGIN
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
NODE_SHADER_MATERIALX_END
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_vector_math_cc
|
} // namespace blender::nodes::node_shader_vector_math_cc
|
||||||
|
Loading…
Reference in New Issue
Block a user
simplify to: