diff options
Diffstat (limited to 'intern/cycles/render/nodes.h')
-rw-r--r-- | intern/cycles/render/nodes.h | 72 |
1 files changed, 55 insertions, 17 deletions
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index eb0f7977dd1..4ec485d521b 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -17,10 +17,10 @@ #ifndef __NODES_H__ #define __NODES_H__ -#include "graph.h" -#include "node.h" +#include "render/graph.h" +#include "graph/node.h" -#include "util_string.h" +#include "util/util_string.h" CCL_NAMESPACE_BEGIN @@ -252,6 +252,7 @@ public: class PointDensityTextureNode : public ShaderNode { public: SHADER_NODE_NO_CLONE_CLASS(PointDensityTextureNode) + virtual int get_group() { return NODE_GROUP_LEVEL_3; } ~PointDensityTextureNode(); ShaderNode *clone() const; @@ -321,25 +322,33 @@ private: static bool initialized; }; -class BsdfNode : public ShaderNode { +class BsdfBaseNode : public ShaderNode { public: - explicit BsdfNode(const NodeType *node_type); - SHADER_NODE_BASE_CLASS(BsdfNode); + BsdfBaseNode(const NodeType *node_type); bool has_spatial_varying() { return true; } - void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL); virtual ClosureType get_closure_type() { return closure; } - - float3 color; - float3 normal; - float surface_mix_weight; - ClosureType closure; + virtual bool has_bump(); virtual bool equals(const ShaderNode& /*other*/) { /* TODO(sergey): With some care BSDF nodes can be de-duplicated. */ return false; } + + ClosureType closure; +}; + +class BsdfNode : public BsdfBaseNode { +public: + explicit BsdfNode(const NodeType *node_type); + SHADER_NODE_BASE_CLASS(BsdfNode) + + void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL); + + float3 color; + float3 normal; + float surface_mix_weight; }; class AnisotropicBsdfNode : public BsdfNode { @@ -361,6 +370,31 @@ public: float roughness; }; +/* Disney principled BRDF */ +class PrincipledBsdfNode : public BsdfBaseNode { +public: + SHADER_NODE_CLASS(PrincipledBsdfNode) + + bool has_surface_bssrdf(); + bool has_bssrdf_bump(); + void compile(SVMCompiler& compiler, ShaderInput *metallic, ShaderInput *subsurface, ShaderInput *subsurface_radius, + ShaderInput *specular, ShaderInput *roughness, ShaderInput *specular_tint, ShaderInput *anisotropic, + ShaderInput *sheen, ShaderInput *sheen_tint, ShaderInput *clearcoat, ShaderInput *clearcoat_roughness, + ShaderInput *ior, ShaderInput *transmission, ShaderInput *anisotropic_rotation, ShaderInput *transmission_roughness); + + float3 base_color; + float3 subsurface_color, subsurface_radius; + float metallic, subsurface, specular, roughness, specular_tint, anisotropic, + sheen, sheen_tint, clearcoat, clearcoat_roughness, ior, transmission, + anisotropic_rotation, transmission_roughness; + float3 normal, clearcoat_normal, tangent; + float surface_mix_weight; + ClosureType distribution, distribution_orig; + + bool has_integrator_dependency(); + void attributes(Shader *shader, AttributeRequestSet *attributes); +}; + class TranslucentBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(TranslucentBsdfNode) @@ -388,7 +422,7 @@ public: bool has_integrator_dependency(); ClosureType get_closure_type() { return distribution; } - float roughness; + float roughness, roughness_orig; ClosureType distribution, distribution_orig; }; @@ -400,7 +434,7 @@ public: bool has_integrator_dependency(); ClosureType get_closure_type() { return distribution; } - float roughness, IOR; + float roughness, roughness_orig, IOR; ClosureType distribution, distribution_orig; }; @@ -412,7 +446,7 @@ public: bool has_integrator_dependency(); ClosureType get_closure_type() { return distribution; } - float roughness, IOR; + float roughness, roughness_orig, IOR; ClosureType distribution, distribution_orig; }; @@ -445,6 +479,7 @@ public: virtual ClosureType get_closure_type() { return CLOSURE_EMISSION_ID; } bool has_surface_emission() { return true; } + bool has_volume_support() { return true; } float3 color; float strength; @@ -496,6 +531,7 @@ public: return ShaderNode::get_feature() | NODE_FEATURE_VOLUME; } virtual ClosureType get_closure_type() { return closure; } + virtual bool has_volume_support() { return true; } float3 color; float density; @@ -641,7 +677,7 @@ public: class MixClosureWeightNode : public ShaderNode { public: - SHADER_NODE_CLASS(MixClosureWeightNode); + SHADER_NODE_CLASS(MixClosureWeightNode) float weight; float fac; @@ -887,7 +923,7 @@ public: class CurvesNode : public ShaderNode { public: explicit CurvesNode(const NodeType *node_type); - SHADER_NODE_BASE_CLASS(CurvesNode); + SHADER_NODE_BASE_CLASS(CurvesNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } @@ -946,6 +982,8 @@ public: /* ideally we could beter detect this, but we can't query this now */ bool has_spatial_varying() { return true; } + bool has_volume_support() { return true; } + virtual bool equals(const ShaderNode& /*other*/) { return false; } string filepath; |