Differential D13480 Diff 45667 source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2005 Blender Foundation. | * The Original Code is Copyright (C) 2005 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| /* **************** OUTPUT ******************** */ | /* **************** OUTPUT ******************** */ | ||||
| namespace blender::nodes::node_shader_subsurface_scattering_cc { | |||||
| static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { | static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { | ||||
| {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, | {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | {SOCK_FLOAT, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | ||||
| {SOCK_VECTOR, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f, PROP_NONE, SOCK_COMPACT}, | {SOCK_VECTOR, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f, PROP_NONE, SOCK_COMPACT}, | ||||
| {SOCK_FLOAT, N_("IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR}, | {SOCK_FLOAT, N_("IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR}, | ||||
| {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | ||||
| {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, | {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | static void node_shader_update_subsurface_scattering(bNodeTree *ntree, bNode *node) | ||||
| LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { | LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { | ||||
| if (STR_ELEM(sock->name, "IOR", "Anisotropy")) { | if (STR_ELEM(sock->name, "IOR", "Anisotropy")) { | ||||
| nodeSetSocketAvailability(ntree, sock, sss_method != SHD_SUBSURFACE_BURLEY); | nodeSetSocketAvailability(ntree, sock, sss_method != SHD_SUBSURFACE_BURLEY); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_subsurface_scattering_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_subsurface_scattering() | void register_node_type_sh_subsurface_scattering() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_subsurface_scattering_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base( | sh_node_type_base( | ||||
| &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER, 0); | &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER, 0); | ||||
| node_type_socket_templates( | node_type_socket_templates(&ntype, | ||||
| &ntype, sh_node_subsurface_scattering_in, sh_node_subsurface_scattering_out); | file_ns::sh_node_subsurface_scattering_in, | ||||
| file_ns::sh_node_subsurface_scattering_out); | |||||
| node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | ||||
| node_type_init(&ntype, node_shader_init_subsurface_scattering); | node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering); | ||||
| node_type_storage(&ntype, "", nullptr, nullptr); | node_type_storage(&ntype, "", nullptr, nullptr); | ||||
| node_type_gpu(&ntype, node_shader_gpu_subsurface_scattering); | node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering); | ||||
| node_type_update(&ntype, node_shader_update_subsurface_scattering); | node_type_update(&ntype, file_ns::node_shader_update_subsurface_scattering); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||