forked from blender/blender
Implement export of Shader BSDF nodes #13
@ -15,7 +15,6 @@ NodeItem AddShaderNodeParser::compute()
|
|||||||
NodeItem shader1 = get_input_shader(0, shader_type_);
|
NodeItem shader1 = get_input_shader(0, shader_type_);
|
||||||
NodeItem shader2 = get_input_shader(1, shader_type_);
|
NodeItem shader2 = get_input_shader(1, shader_type_);
|
||||||
|
|
||||||
NodeItem res = empty();
|
|
||||||
if (shader1 && !shader2) {
|
if (shader1 && !shader2) {
|
||||||
res = shader1;
|
res = shader1;
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,11 @@ NodeItem MixShaderNodeParser::compute()
|
|||||||
NodeItem shader1 = get_input_shader(1, shader_type_);
|
NodeItem shader1 = get_input_shader(1, shader_type_);
|
||||||
NodeItem shader2 = get_input_shader(2, shader_type_);
|
NodeItem shader2 = get_input_shader(2, shader_type_);
|
||||||
|
|
||||||
NodeItem res = empty();
|
|
||||||
if (shader1 && !shader2) {
|
if (shader1 && !shader2) {
|
||||||
res = shader1 * fac;
|
res = shader1 * (value(1.0f) - fac);
|
||||||
}
|
}
|
||||||
else if (!shader1 && shader2) {
|
else if (!shader1 && shader2) {
|
||||||
res = shader2 * (value(1.0f) - fac);
|
res = shader2 * fac;
|
||||||
}
|
}
|
||||||
else if (shader1 && shader2) {
|
else if (shader1 && shader2) {
|
||||||
res = create_node("mix", NodeItem::type(shader_type_));
|
res = create_node("mix", NodeItem::type(shader_type_));
|
||||||
|
@ -160,6 +160,9 @@ NodeItem NodeParser::get_input_link(const bNodeSocket &socket, NodeItem::Type to
|
|||||||
from_node->name,
|
from_node->name,
|
||||||
from_node->typeinfo->type);
|
from_node->typeinfo->type);
|
||||||
}
|
}
|
||||||
|
if (!parser) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* Checking if node was already computed */
|
/* Checking if node was already computed */
|
||||||
res.node = graph_->getNode(parser->node_name());
|
res.node = graph_->getNode(parser->node_name());
|
||||||
@ -257,17 +260,17 @@ NodeItem ShaderNodeParser::get_input_shader(const bNodeSocket &socket, NodeItem:
|
|||||||
switch (from_node->typeinfo->type) {
|
switch (from_node->typeinfo->type) {
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_ADD_SHADER, AddShaderNodeParser)
|
CASE_SHADER_NODE_TYPE(SH_NODE_ADD_SHADER, AddShaderNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_DIFFUSE, BSDFDiffuseNodeParser)
|
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_DIFFUSE, BSDFDiffuseNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_GLASS, BSDFGlassNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_GLASS, BSDFGlassNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_GLOSSY, BSDFGlossyNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_GLOSSY, BSDFGlossyNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
|
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_PRINCIPLED, BSDFPrincipledNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_REFRACTION, BSDFRefractionNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_REFRACTION, BSDFRefractionNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_SHEEN, BSDFSheenNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_SHEEN, BSDFSheenNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TOON, BSDFToonNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TOON, BSDFToonNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TRANSLUCENT, BSDFTranslucentNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TRANSLUCENT, BSDFTranslucentNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TRANSPARENT, BSDFTransparentNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_BSDF_TRANSPARENT, BSDFTransparentNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_EMISSION, EmissionNodeParser)
|
CASE_SHADER_NODE_TYPE(SH_NODE_EMISSION, EmissionNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_MIX_SHADER, MixShaderNodeParser)
|
CASE_SHADER_NODE_TYPE(SH_NODE_MIX_SHADER, MixShaderNodeParser)
|
||||||
CASE_SHADER_NODE_TYPE(SH_NODE_SUBSURFACE_SCATTERING, SubsurfaceScatteringNodeParser)
|
//CASE_SHADER_NODE_TYPE(SH_NODE_SUBSURFACE_SCATTERING, SubsurfaceScatteringNodeParser)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
CLOG_WARN(LOG_MATERIALX_SHADER,
|
CLOG_WARN(LOG_MATERIALX_SHADER,
|
||||||
@ -275,6 +278,9 @@ NodeItem ShaderNodeParser::get_input_shader(const bNodeSocket &socket, NodeItem:
|
|||||||
from_node->name,
|
from_node->name,
|
||||||
from_node->typeinfo->type);
|
from_node->typeinfo->type);
|
||||||
}
|
}
|
||||||
|
if (!parser) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* Checking if node was already computed */
|
/* Checking if node was already computed */
|
||||||
res.node = graph_->getNode(parser->node_name());
|
res.node = graph_->getNode(parser->node_name());
|
||||||
|
Loading…
Reference in New Issue
Block a user