Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-21 13:50:04 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-04-21 15:36:56 +0300
commitb6da2a6a86fb948f11f9147c5ed722a064673e6d (patch)
tree0a93da437c4189cb76483ba09d4f245c81da937e /intern
parente4ab70da862b5852a6e3f7bab489bed8c3b18193 (diff)
Cycles: Make it a generic base class for all types of closure nodes
The idea is to have osme geenric BSDF node which is subclassed by "regular" BSDF nodes and uber shaders. This way we can access special type and closure type for making decisions somewhere else.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/nodes.cpp14
-rw-r--r--intern/cycles/render/nodes.h14
2 files changed, 20 insertions, 8 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 3f56690d0c1..f9679d52235 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -1791,12 +1791,19 @@ void ConvertNode::compile(OSLCompiler& compiler)
assert(0);
}
+/* Base type for all closure-type nodes */
+
+BsdfBaseNode::BsdfBaseNode(const NodeType *node_type)
+ : ShaderNode(node_type)
+{
+ special_type = SHADER_SPECIAL_TYPE_CLOSURE;
+}
+
/* BSDF Closure */
BsdfNode::BsdfNode(const NodeType *node_type)
-: ShaderNode(node_type)
+: BsdfBaseNode(node_type)
{
- special_type = SHADER_SPECIAL_TYPE_CLOSURE;
}
void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3, ShaderInput *param4)
@@ -2323,9 +2330,8 @@ NODE_DEFINE(PrincipledBsdfNode)
}
PrincipledBsdfNode::PrincipledBsdfNode()
- : ShaderNode(node_type)
+ : BsdfBaseNode(node_type)
{
- special_type = SHADER_SPECIAL_TYPE_CLOSURE;
closure = CLOSURE_BSDF_PRINCIPLED_ID;
distribution = CLOSURE_BSDF_MICROFACET_MULTI_GGX_GLASS_ID;
distribution_orig = NBUILTIN_CLOSURES;
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index bc488161e3b..a56313bd5d4 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -321,7 +321,14 @@ private:
static bool initialized;
};
-class BsdfNode : public ShaderNode {
+class BsdfBaseNode : public ShaderNode {
+public:
+ BsdfBaseNode(const NodeType *node_type);
+
+ ClosureType closure;
+};
+
+class BsdfNode : public BsdfBaseNode {
public:
explicit BsdfNode(const NodeType *node_type);
SHADER_NODE_BASE_CLASS(BsdfNode)
@@ -333,7 +340,6 @@ public:
float3 color;
float3 normal;
float surface_mix_weight;
- ClosureType closure;
virtual bool equals(const ShaderNode& /*other*/)
{
@@ -362,7 +368,7 @@ public:
};
/* Disney principled BRDF */
-class PrincipledBsdfNode : public ShaderNode {
+class PrincipledBsdfNode : public BsdfBaseNode {
public:
SHADER_NODE_CLASS(PrincipledBsdfNode)
@@ -381,7 +387,7 @@ public:
anisotropic_rotation, refraction_roughness;
float3 normal, clearcoat_normal, tangent;
float surface_mix_weight;
- ClosureType closure, distribution, distribution_orig;
+ ClosureType distribution, distribution_orig;
virtual bool equals(const ShaderNode * /*other*/)
{