forked from blender/blender
MaterialX: Implement export of Input nodes #20
@ -55,6 +55,23 @@ static void node_shader_init_ambient_occlusion(bNodeTree * /*ntree*/, bNode *nod
|
|||||||
node->custom2 = 0;
|
node->custom2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NODE_SHADER_MATERIALX_BEGIN
|
||||||
|
{
|
||||||
|
/* TODO: observed crash while rendering MaterialX_v1_38_6::ExceptionShaderGenError */
|
||||||
|
/*
|
||||||
|
* NodeItem maxdistance = get_input_value("Distance", NodeItem::Type::Float);
|
||||||
|
* NodeItem res = create_node("ambientocclusion", NodeItem::Type::Float);
|
||||||
|
* res.set_input("coneangle", val(90.0f));
|
||||||
|
* res.set_input("maxdistance", maxdistance);
|
||||||
|
*/
|
||||||
|
NodeItem res = val(MaterialX::Color4(1.0f, 0.0f, 1.0f, 1.0f));
|
||||||
BogdanNagirniak marked this conversation as resolved
Bogdan Nagirniak
commented
Review
```
NodeItem color = get_input_value("Color", NodeItem::Type::Color4);
NodeItem res = color;
```
|
|||||||
|
if (STREQ(socket_out_->name, "AO")) {
|
||||||
|
res = res.extract(3);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
NODE_SHADER_MATERIALX_END
|
||||||
|
|
||||||
} // namespace blender::nodes::node_shader_ambient_occlusion_cc
|
} // namespace blender::nodes::node_shader_ambient_occlusion_cc
|
||||||
|
|
||||||
/* node type definition */
|
/* node type definition */
|
||||||
@ -69,6 +86,7 @@ void register_node_type_sh_ambient_occlusion()
|
|||||||
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
|
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
|
||||||
ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
|
ntype.initfunc = file_ns::node_shader_init_ambient_occlusion;
|
||||||
ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
|
ntype.gpu_fn = file_ns::node_shader_gpu_ambient_occlusion;
|
||||||
|
ntype.materialx_fn = file_ns::node_shader_materialx;
|
||||||
|
|
||||||
nodeRegisterType(&ntype);
|
nodeRegisterType(&ntype);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user