|
Blender V5.0
|
#include <shader_graph.h>
Inherits Node.
Inherited by AddClosureNode, AmbientOcclusionNode, AttributeNode, BackgroundNode, BevelNode, BlackbodyNode, BrightContrastNode, BsdfBaseNode, BumpNode, CameraNode, ClampNode, ColorNode, CombineColorNode, CombineXYZNode, ConvertNode, CurvesNode, DisplacementNode, EmissionNode, FloatCurveNode, FresnelNode, GammaNode, GeometryNode, HSVNode, HairInfoNode, HoldoutNode, InvertNode, LayerWeightNode, LightFalloffNode, LightPathNode, MapRangeNode, MappingNode, MathNode, MixClosureNode, MixClosureWeightNode, MixColorNode, MixFloatNode, MixNode, MixVectorNode, MixVectorNonUniformNode, NormalMapNode, NormalNode, OSLNode, ObjectInfoNode, OutputAOVNode, OutputNode, ParticleInfoNode, PointInfoNode, RGBRampNode, RGBToBWNode, RadialTilingNode, SeparateColorNode, SeparateXYZNode, SetNormalNode, TangentNode, TextureCoordinateNode, TextureNode, UVMapNode, ValueNode, VectorDisplacementNode, VectorMapRangeNode, VectorMathNode, VectorRotateNode, VectorTransformNode, VertexColorNode, VolumeInfoNode, VolumeNode, WavelengthNode, WhiteNoiseTextureNode, and WireframeNode.
Public Member Functions | |
| ShaderNode (const NodeType *type) | |
| ShaderNode (const ShaderNode &other) | |
| void | create_inputs_outputs (const NodeType *type) |
| void | remove_input (ShaderInput *input) |
| ShaderInput * | input (const char *name) |
| ShaderOutput * | output (const char *name) |
| ShaderInput * | input (ustring name) |
| ShaderOutput * | output (ustring name) |
| virtual ShaderNode * | clone (ShaderGraph *graph) const =0 |
| virtual void | attributes (Shader *shader, AttributeRequestSet *attributes) |
| virtual void | compile (SVMCompiler &compiler)=0 |
| virtual void | compile (OSLCompiler &compiler)=0 |
| virtual void | expand (ShaderGraph *) |
| virtual void | constant_fold (const ConstantFolder &) |
| virtual void | simplify_settings (Scene *) |
| virtual bool | has_surface_emission () |
| virtual bool | has_surface_transparent () |
| virtual bool | has_surface_bssrdf () |
| virtual bool | has_bump () |
| virtual bool | has_bssrdf_bump () |
| virtual bool | has_spatial_varying () |
| virtual bool | has_attribute_dependency () |
| virtual bool | has_volume_support () |
| virtual bool | is_linear_operation () |
| virtual uint | get_feature () |
| virtual ClosureType | get_closure_type () |
| virtual bool | equals (const ShaderNode &other) |
| Public Member Functions inherited from Node | |
| Node (const NodeType *type, ustring name=ustring()) | |
| virtual | ~Node ()=0 |
| void | set (const SocketType &input, bool value) |
| void | set (const SocketType &input, const int value) |
| void | set (const SocketType &input, const uint value) |
| void | set (const SocketType &input, const uint64_t value) |
| void | set (const SocketType &input, const float value) |
| void | set (const SocketType &input, const float2 value) |
| void | set (const SocketType &input, const float3 value) |
| void | set (const SocketType &input, const char *value) |
| void | set (const SocketType &input, ustring value) |
| void | set (const SocketType &input, const Transform &value) |
| void | set (const SocketType &input, Node *value) |
| template<class ValueType, std::enable_if_t< std::is_enum_v< ValueType >, bool > = true> | |
| void | set (const SocketType &input, const ValueType &value) |
| void | set (const SocketType &input, array< bool > &value) |
| void | set (const SocketType &input, array< int > &value) |
| void | set (const SocketType &input, array< float > &value) |
| void | set (const SocketType &input, array< float2 > &value) |
| void | set (const SocketType &input, array< float3 > &value) |
| void | set (const SocketType &input, array< ustring > &value) |
| void | set (const SocketType &input, array< Transform > &value) |
| void | set (const SocketType &input, array< Node * > &value) |
| bool | get_bool (const SocketType &input) const |
| int | get_int (const SocketType &input) const |
| uint | get_uint (const SocketType &input) const |
| uint64_t | get_uint64 (const SocketType &input) const |
| float | get_float (const SocketType &input) const |
| float2 | get_float2 (const SocketType &input) const |
| float3 | get_float3 (const SocketType &input) const |
| ustring | get_string (const SocketType &input) const |
| Transform | get_transform (const SocketType &input) const |
| Node * | get_node (const SocketType &input) const |
| const array< bool > & | get_bool_array (const SocketType &input) const |
| const array< int > & | get_int_array (const SocketType &input) const |
| const array< float > & | get_float_array (const SocketType &input) const |
| const array< float2 > & | get_float2_array (const SocketType &input) const |
| const array< float3 > & | get_float3_array (const SocketType &input) const |
| const array< ustring > & | get_string_array (const SocketType &input) const |
| const array< Transform > & | get_transform_array (const SocketType &input) const |
| const array< Node * > & | get_node_array (const SocketType &input) const |
| bool | has_default_value (const SocketType &input) const |
| void | set_default_value (const SocketType &input) |
| bool | equals_value (const Node &other, const SocketType &socket) const |
| void | copy_value (const SocketType &socket, const Node &other, const SocketType &other_socket) |
| void | set_value (const SocketType &socket, const Node &other, const SocketType &other_socket) |
| bool | equals (const Node &other) const |
| void | hash (MD5Hash &md5) |
| size_t | get_total_size_in_bytes () const |
| bool | is_a (const NodeType *type) |
| bool | socket_is_modified (const SocketType &input) const |
| bool | is_modified () const |
| void | tag_modified () |
| void | clear_modified () |
| void | print_modified_sockets () const |
| const NodeOwner * | get_owner () const |
| void | set_owner (const NodeOwner *owner_) |
| int | reference_count () const |
| void | reference () |
| void | dereference () |
| void | clear_reference_count () |
Public Attributes | |
| unique_ptr_vector< ShaderInput > | inputs |
| unique_ptr_vector< ShaderOutput > | outputs |
| int | id = -1 |
| ShaderBump | bump = SHADER_BUMP_NONE |
| float | bump_filter_width = 0.0f |
| ShaderNodeSpecialType | special_type = SHADER_SPECIAL_TYPE_NONE |
| Public Attributes inherited from Node | |
| ustring | name |
| const NodeType * | type |
| InternalNode | internal |
| LeafNode | leaf |
Protected Member Functions | |
| void | disconnect_unused_input (const char *name) |
| Protected Member Functions inherited from Node | |
| template<typename T> | |
| void | set_if_different (const SocketType &input, T value) |
| void | set_if_different (const SocketType &input, Node *value) |
| template<typename T> | |
| void | set_if_different (const SocketType &input, array< T > &value) |
| void | set_if_different (const SocketType &input, array< Node * > &value) |
| void | dereference_all_used_nodes () |
Additional Inherited Members | |
| Static Protected Member Functions inherited from Node | |
| template<typename T> | |
| static T & | get_socket_value (const Node *node, const SocketType &socket) |
| Protected Attributes inherited from Node | |
| const NodeOwner * | owner |
| int | ref_count {0} |
| SocketModifiedFlags | socket_modified |
Definition at line 147 of file shader_graph.h.
|
explicit |
Definition at line 67 of file shader_graph.cpp.
References create_inputs_outputs(), Node::Node(), and Node::type.
Referenced by BsdfBaseNode::BsdfBaseNode(), EnvironmentTextureNode::clone(), IESLightNode::clone(), ImageTextureNode::clone(), OSLNode::clone(), clone(), ConvertNode::constant_fold(), ConvertNode::ConvertNode(), ConvertNode::ConvertNode(), ImageTextureNode::cull_tiles(), CurvesNode::CurvesNode(), BsdfBaseNode::equals(), EnvironmentTextureNode::equals(), ImageSlotTextureNode::equals(), ImageTextureNode::equals(), OSLNode::equals(), OutputAOVNode::equals(), OutputNode::equals(), equals(), VolumeNode::equals(), ShaderNode(), TextureNode::TextureNode(), and VolumeNode::VolumeNode().
| ShaderNode::ShaderNode | ( | const ShaderNode & | other | ) |
Definition at line 72 of file shader_graph.cpp.
References bump, create_inputs_outputs(), Node::name, Node::Node(), ShaderNode(), special_type, and Node::type.
|
virtual |
Reimplemented in AttributeNode, EnvironmentTextureNode, GeometryNode, GlossyBsdfNode, HairInfoNode, ImageTextureNode, MetallicBsdfNode, NormalMapNode, OSLNode, ParticleInfoNode, PointInfoNode, PrincipledBsdfNode, PrincipledHairBsdfNode, PrincipledVolumeNode, TangentNode, TextureCoordinateNode, UVMapNode, VectorDisplacementNode, VertexColorNode, and VolumeInfoNode.
Definition at line 151 of file shader_graph.cpp.
References ATTR_STD_GENERATED, ATTR_STD_GENERATED_TRANSFORM, ATTR_STD_UV, attributes(), Shader::has_surface_link(), Shader::has_volume, input(), inputs, SocketType::LINK_TEXTURE_GENERATED, and SocketType::LINK_TEXTURE_UV.
Referenced by AttributeNode::attributes(), EnvironmentTextureNode::attributes(), GeometryNode::attributes(), GlossyBsdfNode::attributes(), HairInfoNode::attributes(), ImageTextureNode::attributes(), MetallicBsdfNode::attributes(), NormalMapNode::attributes(), OSLNode::attributes(), ParticleInfoNode::attributes(), PointInfoNode::attributes(), PrincipledBsdfNode::attributes(), PrincipledHairBsdfNode::attributes(), PrincipledVolumeNode::attributes(), attributes(), TangentNode::attributes(), TextureCoordinateNode::attributes(), UVMapNode::attributes(), VectorDisplacementNode::attributes(), VertexColorNode::attributes(), VolumeInfoNode::attributes(), clone(), and Shader::tag_update().
|
pure virtual |
Implemented in EnvironmentTextureNode, IESLightNode, ImageTextureNode, and OSLNode.
References attributes(), and ShaderNode().
Referenced by ShaderGraph::copy_nodes().
|
pure virtual |
|
pure virtual |
Referenced by SVMCompiler::generate_node().
|
inlinevirtual |
Reimplemented in AddClosureNode, BackgroundNode, BlackbodyNode, BrightContrastNode, BumpNode, ClampNode, ColorNode, CombineColorNode, CombineXYZNode, ConvertNode, CurvesNode, DisplacementNode, EmissionNode, FloatCurveNode, GammaNode, InvertNode, MappingNode, MathNode, MixClosureNode, MixColorNode, MixFloatNode, MixNode, MixVectorNode, MixVectorNonUniformNode, RGBCurvesNode, RGBRampNode, RGBToBWNode, SeparateColorNode, SeparateXYZNode, ValueNode, VectorCurvesNode, VectorDisplacementNode, and VectorMathNode.
Definition at line 170 of file shader_graph.h.
Referenced by ShaderGraph::constant_fold().
| void ShaderNode::create_inputs_outputs | ( | const NodeType * | type | ) |
Definition at line 80 of file shader_graph.cpp.
References SocketType::flags, inputs, SocketType::LINKABLE, outputs, and Node::type.
Referenced by ShaderNode(), and ShaderNode().
|
protected |
Definition at line 137 of file shader_graph.cpp.
References ShaderInput::disconnect(), input, ShaderInput::link, and Node::name.
Referenced by GlossyBsdfNode::simplify_settings(), MetallicBsdfNode::simplify_settings(), and PrincipledBsdfNode::simplify_settings().
|
virtual |
Reimplemented in BsdfBaseNode, EnvironmentTextureNode, ImageSlotTextureNode, ImageTextureNode, OSLNode, OutputAOVNode, OutputNode, and VolumeNode.
Definition at line 172 of file shader_graph.cpp.
References assert, bump, Node::equals_value(), SocketType::flags, i, inputs, ShaderInput::link, SocketType::LINKABLE, ShaderNode(), unique_ptr_vector< T >::size(), ShaderInput::socket_type, and Node::type.
Referenced by ShaderGraph::deduplicate_nodes().
|
inlinevirtual |
Reimplemented in MapRangeNode, MathNode, VectorMapRangeNode, and VolumeInfoNode.
Definition at line 166 of file shader_graph.h.
Referenced by ShaderGraph::expand().
|
inlinevirtual |
Reimplemented in BsdfBaseNode, GlassBsdfNode, GlossyBsdfNode, HairBsdfNode, HoldoutNode, MetallicBsdfNode, RefractionBsdfNode, SheenBsdfNode, SubsurfaceScatteringNode, and VolumeNode.
Definition at line 242 of file shader_graph.h.
References CLOSURE_NONE_ID.
|
inlinevirtual |
Reimplemented in AmbientOcclusionNode, BackgroundNode, BevelNode, BsdfBaseNode, BumpNode, DisplacementNode, EmissionNode, OSLNode, PrincipledHairBsdfNode, RayPortalBsdfNode, VectorDisplacementNode, VolumeNode, and VoronoiTextureNode.
Definition at line 236 of file shader_graph.h.
References bump, KERNEL_FEATURE_NODE_BUMP, and SHADER_BUMP_NONE.
Referenced by SVMCompiler::generate_closure_node(), SVMCompiler::generate_node(), BackgroundNode::get_feature(), BsdfBaseNode::get_feature(), EmissionNode::get_feature(), OSLNode::get_feature(), RayPortalBsdfNode::get_feature(), VolumeNode::get_feature(), VoronoiTextureNode::get_feature(), and ShaderManager::get_graph_kernel_features().
|
inlinevirtual |
Reimplemented in AttributeNode, EnvironmentTextureNode, GeometryNode, GlossyBsdfNode, HairInfoNode, ImageTextureNode, MetallicBsdfNode, NormalMapNode, ParticleInfoNode, PointInfoNode, PrincipledBsdfNode, PrincipledVolumeNode, TangentNode, TextureCoordinateNode, UVMapNode, VectorDisplacementNode, VertexColorNode, and VolumeInfoNode.
Definition at line 201 of file shader_graph.h.
Referenced by SVMCompiler::generate_node().
|
inlinevirtual |
Reimplemented in PrincipledBsdfNode, and SubsurfaceScatteringNode.
Definition at line 193 of file shader_graph.h.
Referenced by SVMCompiler::generate_closure_node().
|
inlinevirtual |
Reimplemented in BsdfBaseNode.
Definition at line 189 of file shader_graph.h.
Referenced by SVMCompiler::generate_closure_node().
|
inlinevirtual |
Reimplemented in AmbientOcclusionNode, AttributeNode, BevelNode, BsdfBaseNode, BumpNode, CameraNode, FresnelNode, GeometryNode, HairInfoNode, LayerWeightNode, LightFalloffNode, NormalMapNode, OSLNode, PointInfoNode, TangentNode, TextureCoordinateNode, UVMapNode, VertexColorNode, VolumeInfoNode, and WireframeNode.
Definition at line 197 of file shader_graph.h.
Referenced by SVMCompiler::generate_node().
|
inlinevirtual |
Reimplemented in PrincipledBsdfNode, and SubsurfaceScatteringNode.
Definition at line 185 of file shader_graph.h.
Referenced by SVMCompiler::generate_closure_node(), and ShaderManager::get_graph_kernel_features().
|
inlinevirtual |
Reimplemented in EmissionNode, OSLNode, and PrincipledBsdfNode.
Definition at line 177 of file shader_graph.h.
Referenced by output_estimate_emission().
|
inlinevirtual |
Reimplemented in PrincipledBsdfNode, PrincipledHairBsdfNode, RayPortalBsdfNode, and TransparentBsdfNode.
Definition at line 181 of file shader_graph.h.
Referenced by SVMCompiler::generate_closure_node(), ShaderManager::get_graph_kernel_features(), and Shader::has_surface_shadow_transparency().
|
inlinevirtual |
Reimplemented in EmissionNode, OSLNode, and VolumeNode.
Definition at line 205 of file shader_graph.h.
| ShaderInput * ShaderNode::input | ( | const char * | name | ) |
Definition at line 93 of file shader_graph.cpp.
References inputs, and Node::name.
Referenced by CCL_NAMESPACE_BEGIN::ShaderGraphBuilder::add_connection(), attributes(), ShaderGraph::bump_from_displacement(), ShaderGraph::compute_displacement_hash(), ShaderGraph::constant_fold(), ShaderGraph::copy_nodes(), ShaderGraph::default_inputs(), LightManager::device_update_background(), MapRangeNode::expand(), MathNode::expand(), ShaderGraph::finalize(), SVMCompiler::generate_closure_node(), SVMCompiler::generate_multi_closure(), ShaderManager::get_kernel_features(), MathNode::is_linear_operation(), VectorMathNode::is_linear_operation(), node_find_input_by_name(), ShaderGraph::optimize_volume_output(), output_estimate_emission(), ShaderGraph::refine_bump_nodes(), remove_input(), and ShaderGraph::transform_multi_closure().
| ShaderInput * ShaderNode::input | ( | ustring | name | ) |
Definition at line 115 of file shader_graph.cpp.
References inputs, and Node::name.
|
inlinevirtual |
Reimplemented in AddClosureNode, BackgroundNode, BsdfBaseNode, ColorNode, CombineColorNode, CombineXYZNode, ConvertNode, DiffuseBsdfNode, EmissionNode, HoldoutNode, InvertNode, MapRangeNode, MathNode, MixClosureNode, MixClosureWeightNode, MixColorNode, MixFloatNode, MixNode, MixVectorNode, MixVectorNonUniformNode, NormalNode, OutputAOVNode, OutputNode, RGBToBWNode, SeparateColorNode, SeparateXYZNode, ValueNode, VectorMapRangeNode, VectorMathNode, and VolumeNode.
Definition at line 210 of file shader_graph.h.
| ShaderOutput * ShaderNode::output | ( | const char * | name | ) |
Definition at line 104 of file shader_graph.cpp.
References Node::name, and outputs.
Referenced by CCL_NAMESPACE_BEGIN::ShaderGraphBuilder::add_connection(), ShaderManager::add_default(), VertexColorNode::attributes(), ShaderGraph::bump_from_displacement(), BumpNode::constant_fold(), RGBRampNode::constant_fold(), ShaderGraph::constant_fold(), VectorMathNode::constant_fold(), ShaderGraph::copy_nodes(), ImageTextureNode::cull_tiles(), ShaderGraph::default_inputs(), LightManager::device_update_background(), MapRangeNode::expand(), MathNode::expand(), VolumeInfoNode::expand(), node_find_output_by_name(), Shader::tag_update(), and ShaderGraph::transform_multi_closure().
| ShaderOutput * ShaderNode::output | ( | ustring | name | ) |
Definition at line 126 of file shader_graph.cpp.
References Node::name, and outputs.
| void ShaderNode::remove_input | ( | ShaderInput * | input | ) |
Definition at line 145 of file shader_graph.cpp.
|
inlinevirtual |
Reimplemented in GlossyBsdfNode, MetallicBsdfNode, OutputAOVNode, PrincipledBsdfNode, and SkyTextureNode.
Definition at line 175 of file shader_graph.h.
| ShaderBump ShaderNode::bump = SHADER_BUMP_NONE |
Definition at line 221 of file shader_graph.h.
Referenced by equals(), get_feature(), ShaderGraph::refine_bump_nodes(), and ShaderNode().
| float ShaderNode::bump_filter_width = 0.0f |
Definition at line 222 of file shader_graph.h.
Referenced by ShaderGraph::refine_bump_nodes().
| int ShaderNode::id = -1 |
Definition at line 219 of file shader_graph.h.
Referenced by ShaderGraph::break_cycles(), SVMCompiler::CompilerState::CompilerState(), SVMCompiler::generate_multi_closure(), ShaderNodeIDComparator::operator()(), and ShaderGraph::remove_proxy_nodes().
| unique_ptr_vector<ShaderInput> ShaderNode::inputs |
Definition at line 215 of file shader_graph.h.
Referenced by add_nodes_inlined(), OSLNode::attributes(), attributes(), ShaderGraph::break_cycles(), CCL_NAMESPACE_BEGIN::check_node_inputs_has_links(), CCL_NAMESPACE_BEGIN::check_node_inputs_traversed(), OSLNode::clone(), SVMCompiler::compile_type(), ConvertNode::constant_fold(), create_inputs_outputs(), ShaderGraph::default_inputs(), equals(), SVMCompiler::find_aov_nodes_and_dependencies(), ShaderGraph::find_dependencies(), SVMCompiler::find_dependencies(), SVMCompiler::generate_closure_node(), SVMCompiler::generate_multi_closure(), SVMCompiler::generated_shared_closure_nodes(), input(), input(), MathNode::is_linear_operation(), VectorMathNode::is_linear_operation(), output_estimate_emission(), ShaderGraph::relink(), remove_input(), ShaderGraph::remove_proxy_nodes(), SVMCompiler::stack_clear_temporary(), SVMCompiler::stack_clear_users(), Shader::tag_update(), and xml_read_shader_graph().
| unique_ptr_vector<ShaderOutput> ShaderNode::outputs |
Definition at line 216 of file shader_graph.h.
Referenced by add_nodes_inlined(), SVMCompiler::compile_type(), SeparateColorNode::constant_fold(), SeparateXYZNode::constant_fold(), ShaderGraph::constant_fold(), create_inputs_outputs(), ShaderGraph::deduplicate_nodes(), output(), output(), ShaderGraph::remove_proxy_nodes(), and xml_read_shader_graph().
| ShaderNodeSpecialType ShaderNode::special_type = SHADER_SPECIAL_TYPE_NONE |
Definition at line 224 of file shader_graph.h.
Referenced by BsdfBaseNode::BsdfBaseNode(), ConvertNode::constant_fold(), ConvertNode::ConvertNode(), GeometryManager::device_update_displacement_images(), ShaderManager::device_update_pre(), Shader::estimate_emission(), SVMCompiler::find_aov_nodes_and_dependencies(), SVMCompiler::generate_multi_closure(), ShaderManager::get_graph_kernel_features(), SubsurfaceScatteringNode::has_bssrdf_bump(), BsdfBaseNode::has_bump(), ImageSlotTextureNode::ImageSlotTextureNode(), node_use_modified_socket_name(), ShaderGraph::refine_bump_nodes(), ShaderGraph::remove_proxy_nodes(), ShaderNode(), Shader::tag_update(), and ShaderGraph::transform_multi_closure().