Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_hair_info.cc
| Show All 13 Lines | |||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * 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" | ||||
| namespace blender::nodes::node_shader_hair_info_cc { | |||||
| static bNodeSocketTemplate outputs[] = { | static bNodeSocketTemplate outputs[] = { | ||||
| {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_("Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Random")}, | {SOCK_FLOAT, N_("Random")}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| static int node_shader_gpu_hair_info(GPUMaterial *mat, | static int node_shader_gpu_hair_info(GPUMaterial *mat, | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| GPUNodeStack *in, | GPUNodeStack *in, | ||||
| GPUNodeStack *out) | GPUNodeStack *out) | ||||
| { | { | ||||
| /* Length: don't request length if not needed. */ | /* Length: don't request length if not needed. */ | ||||
| static const float zero = 0; | static const float zero = 0; | ||||
| GPUNodeLink *length_link = (!out[2].hasoutput) ? GPU_constant(&zero) : | GPUNodeLink *length_link = (!out[2].hasoutput) ? GPU_constant(&zero) : | ||||
| GPU_attribute(mat, CD_HAIRLENGTH, ""); | GPU_attribute(mat, CD_HAIRLENGTH, ""); | ||||
| return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link); | return GPU_stack_link(mat, node, "node_hair_info", in, out, length_link); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_hair_info_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_hair_info() | void register_node_type_sh_hair_info() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_hair_info_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT, 0); | ||||
| node_type_socket_templates(&ntype, nullptr, outputs); | node_type_socket_templates(&ntype, nullptr, file_ns::outputs); | ||||
| node_type_init(&ntype, nullptr); | node_type_init(&ntype, nullptr); | ||||
| node_type_storage(&ntype, "", nullptr, nullptr); | node_type_storage(&ntype, "", nullptr, nullptr); | ||||
| node_type_gpu(&ntype, node_shader_gpu_hair_info); | node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||