diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/cycles/kernel/osl/osl_closures.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/cycles/kernel/osl/osl_closures.h')
-rw-r--r-- | intern/cycles/kernel/osl/osl_closures.h | 86 |
1 files changed, 48 insertions, 38 deletions
diff --git a/intern/cycles/kernel/osl/osl_closures.h b/intern/cycles/kernel/osl/osl_closures.h index 2a50704b569..d3db6b71f5c 100644 --- a/intern/cycles/kernel/osl/osl_closures.h +++ b/intern/cycles/kernel/osl/osl_closures.h @@ -74,24 +74,34 @@ void closure_bsdf_microfacet_multi_ggx_prepare(OSL::RendererServices *, int id, void closure_bsdf_microfacet_multi_ggx_glass_prepare(OSL::RendererServices *, int id, void *data); void closure_bsdf_microfacet_multi_ggx_aniso_prepare(OSL::RendererServices *, int id, void *data); void closure_bsdf_microfacet_ggx_fresnel_prepare(OSL::RendererServices *, int id, void *data); -void closure_bsdf_microfacet_ggx_aniso_fresnel_prepare(OSL::RendererServices *, int id, void *data); -void closure_bsdf_microfacet_multi_ggx_fresnel_prepare(OSL::RendererServices *, int id, void *data); -void closure_bsdf_microfacet_multi_ggx_glass_fresnel_prepare(OSL::RendererServices *, int id, void *data); -void closure_bsdf_microfacet_multi_ggx_aniso_fresnel_prepare(OSL::RendererServices *, int id, void *data); +void closure_bsdf_microfacet_ggx_aniso_fresnel_prepare(OSL::RendererServices *, + int id, + void *data); +void closure_bsdf_microfacet_multi_ggx_fresnel_prepare(OSL::RendererServices *, + int id, + void *data); +void closure_bsdf_microfacet_multi_ggx_glass_fresnel_prepare(OSL::RendererServices *, + int id, + void *data); +void closure_bsdf_microfacet_multi_ggx_aniso_fresnel_prepare(OSL::RendererServices *, + int id, + void *data); void closure_bsdf_principled_clearcoat_prepare(OSL::RendererServices *, int id, void *data); void closure_bsdf_principled_hair_prepare(OSL::RendererServices *, int id, void *data); -#define CCLOSURE_PREPARE(name, classname) \ -void name(RendererServices *, int id, void *data) \ -{ \ - memset(data, 0, sizeof(classname)); \ - new (data) classname(); \ -} +#define CCLOSURE_PREPARE(name, classname) \ + void name(RendererServices *, int id, void *data) \ + { \ + memset(data, 0, sizeof(classname)); \ + new (data) classname(); \ + } #define CCLOSURE_PREPARE_STATIC(name, classname) static CCLOSURE_PREPARE(name, classname) #define CLOSURE_FLOAT3_PARAM(st, fld) \ - { TypeDesc::TypeVector, (int)reckless_offsetof(st, fld), NULL, sizeof(OSL::Vec3) } + { \ + TypeDesc::TypeVector, (int)reckless_offsetof(st, fld), NULL, sizeof(OSL::Vec3) \ + } #define TO_VEC3(v) OSL::Vec3(v.x, v.y, v.z) #define TO_COLOR3(v) OSL::Color3(v.x, v.y, v.z) @@ -100,50 +110,50 @@ void name(RendererServices *, int id, void *data) \ /* Closure */ class CClosurePrimitive { -public: - virtual void setup(ShaderData *sd, int path_flag, float3 weight) = 0; + public: + virtual void setup(ShaderData *sd, int path_flag, float3 weight) = 0; - OSL::ustring label; + OSL::ustring label; }; /* BSDF */ class CBSDFClosure : public CClosurePrimitive { -public: - bool skip(const ShaderData *sd, int path_flag, int scattering); + public: + bool skip(const ShaderData *sd, int path_flag, int scattering); }; #define BSDF_CLOSURE_CLASS_BEGIN(Upper, lower, structname, TYPE) \ \ -class Upper##Closure : public CBSDFClosure { \ -public: \ - structname params; \ - float3 unused; \ + class Upper##Closure : public CBSDFClosure { \ + public: \ + structname params; \ + float3 unused; \ \ - void setup(ShaderData *sd, int path_flag, float3 weight) \ - { \ - if(!skip(sd, path_flag, TYPE)) { \ - structname *bsdf = (structname*)bsdf_alloc_osl(sd, sizeof(structname), weight, ¶ms); \ - sd->flag |= (bsdf) ? bsdf_##lower##_setup(bsdf) : 0; \ - } \ - } \ -}; \ + void setup(ShaderData *sd, int path_flag, float3 weight) \ + { \ + if (!skip(sd, path_flag, TYPE)) { \ + structname *bsdf = (structname *)bsdf_alloc_osl(sd, sizeof(structname), weight, ¶ms); \ + sd->flag |= (bsdf) ? bsdf_##lower##_setup(bsdf) : 0; \ + } \ + } \ + }; \ \ -static ClosureParam *bsdf_##lower##_params() \ -{ \ - static ClosureParam params[] = { + static ClosureParam *bsdf_##lower##_params() \ + { \ + static ClosureParam params[] = { /* parameters */ #define BSDF_CLOSURE_CLASS_END(Upper, lower) \ - CLOSURE_STRING_KEYPARAM(Upper##Closure, label, "label"), \ - CLOSURE_FINISH_PARAM(Upper##Closure) \ - }; \ - return params; \ -} \ + CLOSURE_STRING_KEYPARAM(Upper##Closure, label, "label"), CLOSURE_FINISH_PARAM(Upper##Closure) \ + } \ + ; \ + return params; \ + } \ \ -CCLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure) + CCLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure) CCL_NAMESPACE_END -#endif /* __OSL_CLOSURES_H__ */ +#endif /* __OSL_CLOSURES_H__ */ |