Blender
V5.3
source
blender
nodes
shader
nodes
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
11
namespace
blender
{
12
13
namespace
nodes::node_shader_particle_info_cc
{
14
15
static
void
node_declare
(
NodeDeclarationBuilder
&
b
)
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
30
static
int
gpu_shader_particle_info
(
GPUMaterial
*mat,
31
bNode
*
node
,
32
bNodeExecData
*
/*execdata*/
,
33
GPUNodeStack
*
in
,
34
GPUNodeStack
*
out
)
35
{
36
GPU_material_flag_set
(mat,
GPU_MATFLAG_OBJECT_INFO
);
37
/* TODO(fclem) Pass particle data in obinfo. */
38
return
GPU_stack_link
(mat,
node
,
"particle_info"
,
in
,
out
);
39
}
40
41
NODE_SHADER_MATERIALX_BEGIN
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
48
NODE_SHADER_MATERIALX_END
49
50
}
// namespace nodes::node_shader_particle_info_cc
51
52
/* node type definition */
53
void
register_node_type_sh_particle_info
()
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"
;
65
ntype.
nclass
=
NODE_CLASS_INPUT
;
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
70
bke::node_register_type
(ntype);
71
}
72
73
}
// namespace blender
NODE_CLASS_INPUT
#define NODE_CLASS_INPUT
Definition
BKE_node.hh:478
SH_NODE_PARTICLE_INFO
#define SH_NODE_PARTICLE_INFO
Definition
BKE_node_legacy_types.hh:87
blender::nodes::NodeDeclarationBuilder
Definition
NOD_node_declaration.hh:655
blender::nodes::decl::Float
Definition
NOD_socket_declarations.hh:35
blender::nodes::decl::Vector
Definition
NOD_socket_declarations.hh:95
b
b
Definition
compositor_morphological_distance_infos.hh:36
node
#define node
Definition
gpu_shader_cxx_attribute.hh:142
blender::bke::node_register_type
void node_register_type(bNodeType &ntype)
Definition
node.cc:2920
blender::gpu::shader::metadata::out
@ out
Definition
metadata.hh:66
blender::gpu::shader::metadata::in
@ in
Definition
metadata.hh:65
blender::nodes::node_shader_particle_info_cc
Definition
node_shader_particle_info.cc:13
blender::nodes::node_shader_particle_info_cc::node_declare
static void node_declare(NodeDeclarationBuilder &b)
Definition
node_shader_particle_info.cc:15
blender::nodes::node_shader_particle_info_cc::gpu_shader_particle_info
static int gpu_shader_particle_info(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
Definition
node_shader_particle_info.cc:30
blender
BMesh Iterators.
Definition
ANIM_action.hh:30
blender::GPU_stack_link
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
Definition
gpu_node_graph.cc:1065
blender::GPU_MATFLAG_OBJECT_INFO
@ GPU_MATFLAG_OBJECT_INFO
Definition
GPU_material.hh:93
blender::sh_node_type_base
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
Definition
node_shader_util.cc:66
blender::GPU_material_flag_set
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
Definition
gpu_material.cc:398
blender::register_node_type_sh_particle_info
void register_node_type_sh_particle_info()
Definition
node_shader_particle_info.cc:53
NODE_SHADER_MATERIALX_BEGIN
#define NODE_SHADER_MATERIALX_BEGIN
Definition
node_parser.h:102
NODE_SHADER_MATERIALX_END
#define NODE_SHADER_MATERIALX_END
Definition
node_parser.h:113
node_shader_util.hh
blender::GPUMaterial
Definition
gpu_material.cc:66
blender::GPUNodeStack
Definition
GPU_material.hh:465
blender::bNodeExecData
Definition
node_util.hh:24
blender::bNode
Definition
DNA_node_types.h:1641
blender::bke::bNodeType
Defines a node type.
Definition
BKE_node.hh:265
blender::bke::bNodeType::materialx_fn
NodeMaterialXFunction materialx_fn
Definition
BKE_node.hh:375
blender::bke::bNodeType::ui_description
std::string ui_description
Definition
BKE_node.hh:271
blender::bke::bNodeType::ui_name
std::string ui_name
Definition
BKE_node.hh:270
blender::bke::bNodeType::gpu_fn
NodeGPUExecFunction gpu_fn
Definition
BKE_node.hh:373
blender::bke::bNodeType::nclass
short nclass
Definition
BKE_node.hh:281
blender::bke::bNodeType::enum_name_legacy
const char * enum_name_legacy
Definition
BKE_node.hh:274
blender::bke::bNodeType::declare
NodeDeclareFunction declare
Definition
BKE_node.hh:393
Generated on
for Blender by
doxygen
1.18.0