|
Blender V4.3
|
#include <shader_graph.h>
Inherits NodeOwner.
Public Member Functions | |
| ShaderGraph () | |
| ~ShaderGraph () | |
| ShaderNode * | add (ShaderNode *node) |
| OutputNode * | output () |
| void | connect (ShaderOutput *from, ShaderInput *to) |
| void | disconnect (ShaderOutput *from) |
| void | disconnect (ShaderInput *to) |
| void | relink (ShaderInput *from, ShaderInput *to) |
| void | relink (ShaderOutput *from, ShaderOutput *to) |
| void | relink (ShaderNode *node, ShaderOutput *from, ShaderOutput *to) |
| void | remove_proxy_nodes () |
| void | compute_displacement_hash () |
| void | simplify (Scene *scene) |
| void | finalize (Scene *scene, bool do_bump=false, bool bump_in_object_space=false) |
| int | get_num_closures () |
| void | dump_graph (const char *filename) |
| template<typename T , typename... Args> | |
| T * | create_node (Args &&...args) |
| template<typename T > | |
| void | delete_node (T *node) |
Public Member Functions inherited from NodeOwner | |
| virtual | ~NodeOwner () |
Public Attributes | |
| list< ShaderNode * > | nodes |
| size_t | num_node_ids |
| bool | finalized |
| bool | simplified |
| string | displacement_hash |
Protected Types | |
| typedef pair< ShaderNode *const, ShaderNode * > | NodePair |
Protected Member Functions | |
| void | find_dependencies (ShaderNodeSet &dependencies, ShaderInput *input) |
| void | clear_nodes () |
| void | copy_nodes (ShaderNodeSet &nodes, ShaderNodeMap &nnodemap) |
| void | break_cycles (ShaderNode *node, vector< bool > &visited, vector< bool > &on_stack) |
| void | bump_from_displacement (bool use_object_space) |
| void | refine_bump_nodes () |
| void | expand () |
| void | default_inputs (bool do_osl) |
| void | transform_multi_closure (ShaderNode *node, ShaderOutput *weight_out, bool volume) |
| void | clean (Scene *scene) |
| void | constant_fold (Scene *scene) |
| void | simplify_settings (Scene *scene) |
| void | deduplicate_nodes () |
| void | verify_volume_output () |
Definition at line 294 of file shader_graph.h.
|
protected |
Definition at line 343 of file shader_graph.h.
| ShaderGraph::ShaderGraph | ( | ) |
Definition at line 214 of file shader_graph.cpp.
References add(), create_node(), finalized, num_node_ids, and simplified.
| ShaderGraph::~ShaderGraph | ( | ) |
Definition at line 222 of file shader_graph.cpp.
References clear_nodes().
| ShaderNode * ShaderGraph::add | ( | ShaderNode * | node | ) |
Definition at line 227 of file shader_graph.cpp.
References finalized, node, num_node_ids, and simplified.
Referenced by bump_from_displacement(), connect(), BumpNode::constant_fold(), constant_fold(), default_inputs(), refine_bump_nodes(), ShaderGraph(), and transform_multi_closure().
|
protected |
Definition at line 725 of file shader_graph.cpp.
References break_cycles(), disconnect(), ShaderNode::id, and visited.
Referenced by break_cycles(), and clean().
|
protected |
Definition at line 990 of file shader_graph.cpp.
References add(), connect(), copy_nodes(), create_node(), find_dependencies(), ShaderNode::input(), ShaderInput::link, NODE_VECTOR_MATH_DOT_PRODUCT, output(), ShaderNode::output(), SHADER_BUMP_CENTER, SHADER_BUMP_DX, and SHADER_BUMP_DY.
Referenced by finalize().
|
protected |
Definition at line 783 of file shader_graph.cpp.
References break_cycles(), constant_fold(), deduplicate_nodes(), delete_node(), ShaderOutput::links, NULL, num_node_ids, output(), SHADER_SPECIAL_TYPE_OUTPUT_AOV, simplify_settings(), verify_volume_output(), and visited.
Referenced by simplify().
|
protected |
Definition at line 415 of file shader_graph.cpp.
References delete_node().
Referenced by ~ShaderGraph().
| void ShaderGraph::compute_displacement_hash | ( | ) |
Definition at line 749 of file shader_graph.cpp.
References MD5Hash::append(), OSLNode::bytecode_hash, displacement_hash, find_dependencies(), MD5Hash::get_hex(), ShaderNode::input(), ShaderInput::link, node, output(), and SHADER_SPECIAL_TYPE_OSL.
Referenced by Shader::set_graph().
| void ShaderGraph::connect | ( | ShaderOutput * | from, |
| ShaderInput * | to ) |
Definition at line 242 of file shader_graph.cpp.
References add(), SocketType::CLOSURE, connect(), create_node(), finalized, SocketType::FLOAT, from, and one_float3().
Referenced by bump_from_displacement(), connect(), constant_fold(), copy_nodes(), default_inputs(), refine_bump_nodes(), relink(), relink(), relink(), and transform_multi_closure().
|
protected |
Definition at line 542 of file shader_graph.cpp.
References add(), connect(), create_node(), ShaderNode::input(), ShaderInput::link, NULL, output(), and Node::set_value().
Referenced by clean().
|
protected |
Definition at line 423 of file shader_graph.cpp.
References ShaderNode::clone(), connect(), ShaderNode::create_inputs_outputs(), ShaderNode::input(), ShaderNode::inputs, node, ShaderNode::output(), ShaderNode::outputs, and Node::type.
Referenced by bump_from_displacement(), and refine_bump_nodes().
Definition at line 327 of file shader_graph.h.
Referenced by bump_from_displacement(), connect(), BumpNode::constant_fold(), constant_fold(), default_inputs(), ShaderGraph(), and transform_multi_closure().
|
protected |
Definition at line 608 of file shader_graph.cpp.
References ShaderNode::equals(), NULL, ShaderNode::outputs, relink(), and VLOG_DEBUG.
Referenced by clean().
|
protected |
Definition at line 845 of file shader_graph.cpp.
References add(), connect(), create_node(), ShaderNode::input(), SocketType::LINK_INCOMING, SocketType::LINK_NORMAL, SocketType::LINK_POSITION, SocketType::LINK_TANGENT, SocketType::LINK_TEXTURE_GENERATED, SocketType::LINK_TEXTURE_INCOMING, SocketType::LINK_TEXTURE_NORMAL, SocketType::LINK_TEXTURE_UV, NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT, NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD, NODE_VECTOR_TRANSFORM_TYPE_NORMAL, NULL, SocketType::OSL_INTERNAL, and ShaderNode::output().
Referenced by simplify().
Definition at line 336 of file shader_graph.h.
References node.
Referenced by clean(), clear_nodes(), and remove_proxy_nodes().
| void ShaderGraph::disconnect | ( | ShaderInput * | to | ) |
Definition at line 306 of file shader_graph.cpp.
References finalized, and simplified.
| void ShaderGraph::disconnect | ( | ShaderOutput * | from | ) |
Definition at line 298 of file shader_graph.cpp.
References finalized, and simplified.
Referenced by break_cycles(), refine_bump_nodes(), relink(), relink(), relink(), remove_proxy_nodes(), transform_multi_closure(), and verify_volume_output().
| void ShaderGraph::dump_graph | ( | const char * | filename | ) |
Definition at line 1217 of file shader_graph.cpp.
References ShaderInput::name(), ShaderOutput::name(), NULL, printf, SHADER_BUMP_CENTER, SHADER_BUMP_DX, and SHADER_BUMP_DY.
|
protected |
Definition at line 837 of file shader_graph.cpp.
Referenced by simplify().
| void ShaderGraph::finalize | ( | Scene * | scene, |
| bool | do_bump = false, | ||
| bool | bump_in_object_space = false ) |
Definition at line 372 of file shader_graph.cpp.
References bump_from_displacement(), finalized, ShaderNode::input(), ShaderInput::link, NULL, output(), ShaderOutput::parent, simplify(), and transform_multi_closure().
|
protected |
Definition at line 402 of file shader_graph.cpp.
References find_dependencies(), and NULL.
Referenced by bump_from_displacement(), compute_displacement_hash(), find_dependencies(), and refine_bump_nodes().
| int ShaderGraph::get_num_closures | ( | ) |
Definition at line 1179 of file shader_graph.cpp.
References CLOSURE_BSDF_F82_CONDUCTOR, CLOSURE_BSDF_HAIR_CHIANG_ID, CLOSURE_BSDF_HAIR_HUANG_ID, CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID, CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID, CLOSURE_BSDF_PHYSICAL_CONDUCTOR, CLOSURE_IS_BSDF_MULTISCATTER, CLOSURE_IS_BSSRDF, CLOSURE_IS_PRINCIPLED, CLOSURE_IS_VOLUME, CLOSURE_NONE_ID, and MAX_VOLUME_STACK_SIZE.
Referenced by Scene::get_max_closure_count().
| OutputNode * ShaderGraph::output | ( | ) |
Definition at line 237 of file shader_graph.cpp.
Referenced by bump_from_displacement(), clean(), compute_displacement_hash(), constant_fold(), finalize(), and verify_volume_output().
|
protected |
Definition at line 935 of file shader_graph.cpp.
References add(), connect(), copy_nodes(), disconnect(), find_dependencies(), ShaderInput::link, SHADER_BUMP_CENTER, SHADER_BUMP_DX, SHADER_BUMP_DY, and SHADER_SPECIAL_TYPE_BUMP.
Referenced by simplify().
| void ShaderGraph::relink | ( | ShaderInput * | from, |
| ShaderInput * | to ) |
Definition at line 315 of file shader_graph.cpp.
References connect(), and disconnect().
Referenced by deduplicate_nodes(), and remove_proxy_nodes().
| void ShaderGraph::relink | ( | ShaderNode * | node, |
| ShaderOutput * | from, | ||
| ShaderOutput * | to ) |
Definition at line 338 of file shader_graph.cpp.
References connect(), disconnect(), ShaderInput::link, and simplified.
| void ShaderGraph::relink | ( | ShaderOutput * | from, |
| ShaderOutput * | to ) |
Definition at line 325 of file shader_graph.cpp.
References connect(), and disconnect().
| void ShaderGraph::remove_proxy_nodes | ( | ) |
Definition at line 466 of file shader_graph.cpp.
References Node::copy_value(), SocketType::DEFAULT_LINK_MASK, delete_node(), disconnect(), ShaderInput::flags(), ShaderNode::id, ShaderNode::inputs, node, num_node_ids, ShaderNode::outputs, relink(), SHADER_SPECIAL_TYPE_AUTOCONVERT, SHADER_SPECIAL_TYPE_PROXY, and ShaderNode::special_type.
Referenced by Shader::set_graph().
| void ShaderGraph::simplify | ( | Scene * | scene | ) |
Definition at line 360 of file shader_graph.cpp.
References clean(), default_inputs(), expand(), refine_bump_nodes(), and simplified.
Referenced by finalize().
|
protected |
Definition at line 600 of file shader_graph.cpp.
Referenced by clean().
|
protected |
Definition at line 1088 of file shader_graph.cpp.
References add(), connect(), create_node(), disconnect(), ShaderNode::input(), ShaderInput::link, ShaderNode::output(), ShaderOutput::parent, SHADER_SPECIAL_TYPE_COMBINE_CLOSURE, ShaderInput::socket_type, and transform_multi_closure().
Referenced by finalize(), and transform_multi_closure().
|
protected |
Definition at line 686 of file shader_graph.cpp.
References disconnect(), ShaderNode::input(), ShaderInput::link, NULL, output(), ShaderOutput::parent, and VLOG_DEBUG.
Referenced by clean().
| string ShaderGraph::displacement_hash |
Definition at line 300 of file shader_graph.h.
Referenced by compute_displacement_hash(), and Shader::set_graph().
| bool ShaderGraph::finalized |
Definition at line 298 of file shader_graph.h.
Referenced by add(), connect(), disconnect(), disconnect(), finalize(), and ShaderGraph().
| list<ShaderNode *> ShaderGraph::nodes |
Definition at line 296 of file shader_graph.h.
| size_t ShaderGraph::num_node_ids |
Definition at line 297 of file shader_graph.h.
Referenced by add(), clean(), remove_proxy_nodes(), and ShaderGraph().
| bool ShaderGraph::simplified |
Definition at line 299 of file shader_graph.h.
Referenced by add(), disconnect(), disconnect(), relink(), ShaderGraph(), and simplify().