Blender V5.0
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
5#include "node_shader_util.hh"
6
8
10{
11 b.add_output<decl::Float>("Index");
12 b.add_output<decl::Float>("Random");
13 b.add_output<decl::Float>("Age");
14 b.add_output<decl::Float>("Lifetime");
15 b.add_output<decl::Vector>("Location");
16#if 0 /* quaternion sockets not yet supported */
17 b.add_output<decl::Quaternion>("Rotation");
18#endif
19 b.add_output<decl::Float>("Size");
20 b.add_output<decl::Vector>("Velocity");
21 b.add_output<decl::Vector>("Angular Velocity");
22}
23
25 bNode *node,
26 bNodeExecData * /*execdata*/,
29{
31 /* TODO(fclem) Pass particle data in obinfo. */
32 return GPU_stack_link(mat, node, "particle_info", in, out);
33}
34
36#ifdef WITH_MATERIALX
37{
38 /* NOTE: This node isn't supported by MaterialX. */
39 return get_output_default(socket_out_->identifier, NodeItem::Type::Any);
40}
41#endif
43
44} // namespace blender::nodes::node_shader_particle_info_cc
45
46/* node type definition */
48{
50
51 static blender::bke::bNodeType ntype;
52
53 sh_node_type_base(&ntype, "ShaderNodeParticleInfo", SH_NODE_PARTICLE_INFO);
54 ntype.ui_name = "Particle Info";
55 ntype.ui_description =
56 "Retrieve the data of the particle that spawned the object instance, for example to give "
57 "variation to multiple instances of an object";
58 ntype.enum_name_legacy = "PARTICLE_INFO";
60 ntype.declare = file_ns::node_declare;
61 ntype.gpu_fn = file_ns::gpu_shader_particle_info;
62 ntype.materialx_fn = file_ns::node_shader_materialx;
63
65}
#define NODE_CLASS_INPUT
Definition BKE_node.hh:447
#define SH_NODE_PARTICLE_INFO
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_OBJECT_INFO
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
static void node_declare(NodeDeclarationBuilder &b)
static int gpu_shader_particle_info(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
#define NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_END
void register_node_type_sh_particle_info()
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:238
NodeMaterialXFunction materialx_fn
Definition BKE_node.hh:344
std::string ui_description
Definition BKE_node.hh:244
NodeGPUExecFunction gpu_fn
Definition BKE_node.hh:342
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362