From 8ce1090d4e8160165281be4b0827dbc1ba28dc8a Mon Sep 17 00:00:00 2001 From: Karsten Schwenk Date: Sun, 8 Jun 2014 12:16:28 +0200 Subject: Cycles: Ashikhmin-Shirley anisotropic BSDF * Ashikhmin-Shirley anisotropic BSDF was added as closure * Anisotropic BSDF node now has two distributions Reviewers: brecht, dingto Differential Revision: https://developer.blender.org/D549 --- source/blender/editors/space_node/drawnode.c | 8 ++++++++ source/blender/makesdna/DNA_node_types.h | 4 ++++ source/blender/makesrna/intern/rna_nodetree.c | 17 +++++++++++++++++ source/blender/nodes/NOD_static_types.h | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 953777ff329..4e709046f45 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -930,6 +930,11 @@ static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), Point uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE); } +static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "distribution", 0, "", ICON_NONE); +} + static void node_shader_buts_subsurface(uiLayout *layout, bContext *C, PointerRNA *ptr) { /* SSS does not work on GPU yet */ @@ -1096,6 +1101,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_BSDF_REFRACTION: ntype->draw_buttons = node_shader_buts_glossy; break; + case SH_NODE_BSDF_ANISOTROPIC: + ntype->draw_buttons = node_shader_buts_anisotropic; + break; case SH_NODE_SUBSURFACE_SCATTERING: ntype->draw_buttons = node_shader_buts_subsurface; break; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index e13d53934cb..2241803610c 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -873,6 +873,10 @@ typedef struct NodeShaderUVMap { #define CMP_NODE_CHANNEL_MATTE_CS_YUV 3 #define CMP_NODE_CHANNEL_MATTE_CS_YCC 4 +/* anisotropic distributions */ +#define SHD_ANISOTROPIC_WARD 0 +#define SHD_ANISOTROPIC_ASHIKHMIN_SHIRLEY 1 + /* glossy distributions */ #define SHD_GLOSSY_BECKMANN 0 #define SHD_GLOSSY_SHARP 1 diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index c39d3826d8b..b1a2f12d781 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -2952,6 +2952,12 @@ static EnumPropertyItem node_glossy_items[] = { {0, NULL, 0, NULL, NULL} }; +static EnumPropertyItem node_anisotropic_items[] = { + {SHD_ANISOTROPIC_WARD, "WARD", 0, "Ward", ""}, + {SHD_ANISOTROPIC_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""}, + {0, NULL, 0, NULL, NULL} +}; + static EnumPropertyItem node_toon_items[] = { {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""}, {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""}, @@ -3699,6 +3705,17 @@ static void def_glossy(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_anisotropic(StructRNA *srna) +{ + PropertyRNA *prop; + + prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "custom1"); + RNA_def_property_enum_items(prop, node_anisotropic_items); + RNA_def_property_ui_text(prop, "Distribution", ""); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + static void def_toon(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 3e5de09ff6c..08dffd0ac92 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -77,7 +77,7 @@ DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "AT DefNode( ShaderNode, SH_NODE_AMBIENT_OCCLUSION, 0, "AMBIENT_OCCLUSION", AmbientOcclusion, "Ambient Occlusion", "" ) DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BACKGROUND", Background, "Background", "" ) DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" ) -DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, 0, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" ) +DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" ) DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" ) DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" ) DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" ) -- cgit v1.2.3