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
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/kernel/svm/closure.h')
-rw-r--r--intern/cycles/kernel/svm/closure.h45
1 files changed, 24 insertions, 21 deletions
diff --git a/intern/cycles/kernel/svm/closure.h b/intern/cycles/kernel/svm/closure.h
index 5e8ef69fd15..2d91b014f60 100644
--- a/intern/cycles/kernel/svm/closure.h
+++ b/intern/cycles/kernel/svm/closure.h
@@ -3,6 +3,11 @@
#pragma once
+#include "kernel/closure/alloc.h"
+#include "kernel/closure/bsdf.h"
+#include "kernel/closure/bsdf_util.h"
+#include "kernel/closure/emissive.h"
+
#include "kernel/util/color.h"
CCL_NAMESPACE_BEGIN
@@ -106,7 +111,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
__uint_as_float(node.w);
switch (type) {
-#ifdef __PRINCIPLED__
case CLOSURE_BSDF_PRINCIPLED_ID: {
uint specular_offset, roughness_offset, specular_tint_offset, anisotropic_offset,
sheen_offset, sheen_tint_offset, clearcoat_offset, clearcoat_roughness_offset,
@@ -202,7 +206,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
Spectrum weight = sd->svm_closure_weight * mix_weight;
-# ifdef __SUBSURFACE__
+#ifdef __SUBSURFACE__
float3 mixed_ss_base_color = subsurface_color * subsurface +
base_color * (1.0f - subsurface);
Spectrum subsurf_weight = weight * rgb_to_spectrum(mixed_ss_base_color) * diffuse_weight;
@@ -253,7 +257,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
}
}
}
-# else
+#else
/* diffuse */
if (diffuse_weight > CLOSURE_WEIGHT_CUTOFF) {
Spectrum diff_weight = weight * rgb_to_spectrum(base_color) * diffuse_weight;
@@ -269,7 +273,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
sd->flag |= bsdf_principled_diffuse_setup(bsdf, PRINCIPLED_DIFFUSE_FULL);
}
}
-# endif
+#endif
/* sheen */
if (diffuse_weight > CLOSURE_WEIGHT_CUTOFF && sheen > CLOSURE_WEIGHT_CUTOFF) {
@@ -294,9 +298,9 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
}
/* specular reflection */
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective || (path_flag & PATH_RAY_DIFFUSE) == 0) {
-# endif
+#endif
if (specular_weight > CLOSURE_WEIGHT_CUTOFF &&
(specular > CLOSURE_WEIGHT_CUTOFF || metallic > CLOSURE_WEIGHT_CUTOFF)) {
Spectrum spec_weight = weight * specular_weight;
@@ -339,15 +343,15 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
sd->flag |= bsdf_microfacet_multi_ggx_fresnel_setup(bsdf, sd);
}
}
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
}
-# endif
+#endif
/* BSDF */
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective ||
kernel_data.integrator.caustics_refractive || (path_flag & PATH_RAY_DIFFUSE) == 0) {
-# endif
+#endif
if (final_transmission > CLOSURE_WEIGHT_CUTOFF) {
Spectrum glass_weight = weight * final_transmission;
float3 cspec0 = base_color * specular_tint + make_float3(1.0f - specular_tint);
@@ -357,9 +361,9 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
float refl_roughness = roughness;
/* reflection */
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective || (path_flag & PATH_RAY_DIFFUSE) == 0)
-# endif
+#endif
{
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), glass_weight * fresnel);
@@ -387,9 +391,9 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
}
/* refraction */
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_refractive || (path_flag & PATH_RAY_DIFFUSE) == 0)
-# endif
+#endif
{
/* This is to prevent MNEE from receiving a null BSDF. */
float refraction_fresnel = fmaxf(0.0001f, 1.0f - fresnel);
@@ -443,14 +447,14 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
}
}
}
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
}
-# endif
+#endif
/* clearcoat */
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
if (kernel_data.integrator.caustics_reflective || (path_flag & PATH_RAY_DIFFUSE) == 0) {
-# endif
+#endif
if (clearcoat > CLOSURE_WEIGHT_CUTOFF) {
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), weight);
@@ -476,13 +480,12 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
sd->flag |= bsdf_microfacet_ggx_clearcoat_setup(bsdf, sd);
}
}
-# ifdef __CAUSTICS_TRICKS__
+#ifdef __CAUSTICS_TRICKS__
}
-# endif
+#endif
break;
}
-#endif /* __PRINCIPLED__ */
case CLOSURE_BSDF_DIFFUSE_ID: {
Spectrum weight = sd->svm_closure_weight * mix_weight;
ccl_private OrenNayarBsdf *bsdf = (ccl_private OrenNayarBsdf *)bsdf_alloc(