29 b.add_input<
decl::Int>(
"LightIndex"_ustr).available(is_gpu_internal);
63 float attr_hash = 0.0f;
85 else if (
STREQ(attr->
name,
"cutoff_distance")) {
87 "node_attribute_light_cutoff_distance",
94 const bool use_dupli =
false;
98 attr_hash = *
reinterpret_cast<float *
>(&hash_code);
100 "node_attribute_light",
114 else if (
STREQ(attr->
name,
"temperature")) {
128 reinterpret_cast<uint32_t *
>(&attr_hash));
131 "node_attribute_uniform",
141 GPU_link(mat,
"node_attribute", cd_attr, &
out[0].link, &
out[1].link, &
out[2].link, &
out[3].link);
144 for (
const auto [i, sock] :
node->outputs.enumerate()) {
157 return get_output_default(socket_out_->identifier, NodeItem::Type::Any);
173 ntype.
ui_description =
"Retrieve attributes attached to objects or geometry";
176 ntype.
declare = file_ns::node_declare;
177 ntype.
draw_buttons = file_ns::node_shader_buts_attribute;
178 ntype.
initfunc = file_ns::node_shader_init_attribute;
182 ntype.
gpu_fn = file_ns::node_shader_gpu_attribute;
#define SH_NODE_ATTRIBUTE
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static int node_shader_gpu_attribute(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
static void node_shader_init_attribute(bNodeTree *, bNode *node)
static void node_shader_buts_attribute(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
GPUNodeLink * GPU_uniform_attribute(GPUMaterial *mat, const char *name, bool use_dupli, uint32_t *r_hash)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
@ SHD_ATTRIBUTE_INSTANCER
@ SHD_ATTRIBUTE_VIEW_LAYER
void register_node_type_sh_attribute()
@ GPU_MATFLAG_LIGHT_ATTRIBUTE
GPUNodeLink * GPU_layer_attribute(GPUMaterial *mat, const char *name)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
GPUNodeLink * GPU_uniform(const float *num)
GPUNodeLink * GPU_constant(const float *num)
bool GPU_link(GPUMaterial *mat, const char *name,...)
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()
@ NTREE_IS_GPU_SHADER_INTERNAL
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_kernel_globals()
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
void search_link_ops_for_shader_material_lighting_node(nodes::GatherLinkSearchOpParams ¶ms)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
NodeMaterialXFunction materialx_fn
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGPUExecFunction gpu_fn
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)