36 if (
out[5].hasoutput) {
40 const float val[4] = {0.0f, 0.0f, 0.0f, 0.0f};
46 for (
const auto [i, sock] :
node->outputs.enumerate()) {
52 if (
ELEM(i, 1, 2, 4)) {
54 "vector_math_normalize",
71 NodeItem res = empty();
72 std::string name = socket_out_->identifier;
74 if (name ==
"Position") {
75 res = create_node(
"position", NodeItem::Type::Vector3, {{
"space", val(std::string(
"world"))}});
77 else if (name ==
"Normal") {
78 res = create_node(
"normal", NodeItem::Type::Vector3, {{
"space", val(std::string(
"world"))}});
80 else if (
ELEM(name,
"Tangent",
"True Normal")) {
81 res = create_node(
"tangent", NodeItem::Type::Vector3, {{
"space", val(std::string(
"world"))}});
84 res = get_output_default(name, NodeItem::Type::Any);
102 ntype.
ui_description =
"Retrieve geometric information about the current shading point";
105 ntype.
declare = file_ns::node_declare;
106 ntype.
gpu_fn = file_ns::node_shader_gpu_geometry;
#define SH_NODE_NEW_GEOMETRY
void node_register_type(bNodeType &ntype)
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_geometry(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_BARYCENTRIC
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
void register_node_type_sh_geometry()
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *, GPUNodeLink **link)
GPUNodeLink * GPU_shading_data()
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_kernel_globals()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
NodeMaterialXFunction materialx_fn
std::string ui_description
NodeGPUExecFunction gpu_fn
const char * enum_name_legacy
NodeDeclareFunction declare