Blender V4.5
ShaderNode Class Referenceabstract

#include <shader_graph.h>

Inherits Node.

Inherited by AddClosureNode, AmbientOcclusionNode, AttributeNode, BackgroundNode, BevelNode, BlackbodyNode, BrightContrastNode, BsdfBaseNode, BumpNode, CameraNode, ClampNode, ColorNode, CombineColorNode, CombineHSVNode, CombineRGBNode, 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, PointDensityTextureNode, PointInfoNode, RGBRampNode, RGBToBWNode, SeparateColorNode, SeparateHSVNode, SeparateRGBNode, 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)
 
ShaderInputinput (const char *name)
 
ShaderOutputoutput (const char *name)
 
ShaderInputinput (ustring name)
 
ShaderOutputoutput (ustring name)
 
virtual ShaderNodeclone (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 int 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
 
Nodeget_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 NodeOwnerget_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< ShaderInputinputs
 
unique_ptr_vector< ShaderOutputoutputs
 
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 NodeTypetype
 
InternalNode internal
 
LeafNode leaf
 

Additional Inherited Members

- 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 ()
 
- Static Protected Member Functions inherited from Node
template<typename T >
static Tget_socket_value (const Node *node, const SocketType &socket)
 
- Protected Attributes inherited from Node
const NodeOwnerowner
 
int ref_count {0}
 
SocketModifiedFlags socket_modified
 

Detailed Description

Definition at line 146 of file shader_graph.h.

Constructor & Destructor Documentation

◆ ShaderNode() [1/2]

ShaderNode::ShaderNode ( const NodeType * type)
explicit

Definition at line 67 of file shader_graph.cpp.

References create_inputs_outputs(), and Node::type.

◆ ShaderNode() [2/2]

ShaderNode::ShaderNode ( const ShaderNode & other)

Definition at line 72 of file shader_graph.cpp.

References create_inputs_outputs(), Node::name, and Node::type.

Member Function Documentation

◆ attributes()

◆ clone()

virtual ShaderNode * ShaderNode::clone ( ShaderGraph * graph) const
pure virtual

◆ compile() [1/2]

virtual void ShaderNode::compile ( OSLCompiler & compiler)
pure virtual

◆ compile() [2/2]

virtual void ShaderNode::compile ( SVMCompiler & compiler)
pure virtual

◆ constant_fold()

◆ create_inputs_outputs()

void ShaderNode::create_inputs_outputs ( const NodeType * type)

◆ equals()

◆ expand()

virtual void ShaderNode::expand ( ShaderGraph * )
inlinevirtual

Reimplemented in MapRangeNode, MathNode, VectorMapRangeNode, and VolumeInfoNode.

Definition at line 165 of file shader_graph.h.

◆ get_closure_type()

virtual ClosureType ShaderNode::get_closure_type ( )
inlinevirtual

◆ get_feature()

◆ has_attribute_dependency()

◆ has_bssrdf_bump()

virtual bool ShaderNode::has_bssrdf_bump ( )
inlinevirtual

Reimplemented in PrincipledBsdfNode, and SubsurfaceScatteringNode.

Definition at line 192 of file shader_graph.h.

◆ has_bump()

virtual bool ShaderNode::has_bump ( )
inlinevirtual

Reimplemented in BsdfBaseNode.

Definition at line 188 of file shader_graph.h.

◆ has_spatial_varying()

◆ has_surface_bssrdf()

virtual bool ShaderNode::has_surface_bssrdf ( )
inlinevirtual

Reimplemented in PrincipledBsdfNode, and SubsurfaceScatteringNode.

Definition at line 184 of file shader_graph.h.

◆ has_surface_emission()

virtual bool ShaderNode::has_surface_emission ( )
inlinevirtual

Reimplemented in EmissionNode, OSLNode, and PrincipledBsdfNode.

Definition at line 176 of file shader_graph.h.

◆ has_surface_transparent()

virtual bool ShaderNode::has_surface_transparent ( )
inlinevirtual

◆ has_volume_support()

virtual bool ShaderNode::has_volume_support ( )
inlinevirtual

Reimplemented in EmissionNode, OSLNode, and VolumeNode.

Definition at line 204 of file shader_graph.h.

◆ input() [1/2]

◆ input() [2/2]

ShaderInput * ShaderNode::input ( ustring name)

Definition at line 115 of file shader_graph.cpp.

References inputs, and Node::name.

◆ output() [1/2]

◆ output() [2/2]

ShaderOutput * ShaderNode::output ( ustring name)

Definition at line 126 of file shader_graph.cpp.

References Node::name, and outputs.

◆ remove_input()

void ShaderNode::remove_input ( ShaderInput * input)

Definition at line 137 of file shader_graph.cpp.

References assert, unique_ptr_vector< T >::erase(), input, and inputs.

◆ simplify_settings()

virtual void ShaderNode::simplify_settings ( Scene * )
inlinevirtual

Reimplemented in GlossyBsdfNode, MetallicBsdfNode, OutputAOVNode, PrincipledBsdfNode, and SkyTextureNode.

Definition at line 174 of file shader_graph.h.

Member Data Documentation

◆ bump

◆ bump_filter_width

float ShaderNode::bump_filter_width = 0.0f

Definition at line 215 of file shader_graph.h.

◆ id

int ShaderNode::id = -1

◆ inputs

◆ outputs

◆ special_type


The documentation for this class was generated from the following files: