Blender V5.3
node_shader_particle_info.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2005 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "node_shader_util.hh"
10
11namespace blender {
12
14
16{
17 b.add_output<decl::Float>("Index"_ustr);
18 b.add_output<decl::Float>("Random"_ustr);
19 b.add_output<decl::Float>("Age"_ustr);
20 b.add_output<decl::Float>("Lifetime"_ustr);
21 b.add_output<decl::Vector>("Location"_ustr);
22#if 0 /* quaternion sockets not yet supported */
23 b.add_output<decl::Quaternion>("Rotation"_ustr);
24#endif
25 b.add_output<decl::Float>("Size"_ustr);
26 b.add_output<decl::Vector>("Velocity"_ustr);
27 b.add_output<decl::Vector>("Angular Velocity"_ustr);
28}
29
31 bNode *node,
32 bNodeExecData * /*execdata*/,
35{
37 /* TODO(fclem) Pass particle data in obinfo. */
38 return GPU_stack_link(mat, node, "particle_info", in, out);
39}
40
42#ifdef WITH_MATERIALX
43{
44 /* NOTE: This node isn't supported by MaterialX. */
45 return get_output_default(socket_out_->identifier, NodeItem::Type::Any);
46}
47#endif
49
50} // namespace nodes::node_shader_particle_info_cc
51
52/* node type definition */
54{
55 namespace file_ns = nodes::node_shader_particle_info_cc;
56
57 static bke::bNodeType ntype;
58
59 sh_node_type_base(&ntype, "ShaderNodeParticleInfo"_ustr, SH_NODE_PARTICLE_INFO);
60 ntype.ui_name = "Particle Info";
61 ntype.ui_description =
62 "Retrieve the data of the particle that spawned the object instance, for example to give "
63 "variation to multiple instances of an object";
64 ntype.enum_name_legacy = "PARTICLE_INFO";
66 ntype.declare = file_ns::node_declare;
67 ntype.gpu_fn = file_ns::gpu_shader_particle_info;
68 ntype.materialx_fn = file_ns::node_shader_materialx;
69
71}
72
73} // namespace blender
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define SH_NODE_PARTICLE_INFO
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_particle_info(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
BMesh Iterators.
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_OBJECT_INFO
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
void register_node_type_sh_particle_info()
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
Defines a node type.
Definition BKE_node.hh:265
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:375
std::string ui_description
Definition BKE_node.hh:271
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:373
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393