Blender V5.3
node_shader_volume_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::Color>("Color"_ustr);
18 b.add_output<decl::Float>("Density"_ustr);
19 b.add_output<decl::Float>("Flame"_ustr);
20 b.add_output<decl::Float>("Temperature"_ustr);
21}
22
24 bNode * /*node*/,
25 bNodeExecData * /*execdata*/,
26 GPUNodeStack * /*in*/,
28{
29 if (out[0].hasoutput) {
30 out[0].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "color");
31 GPU_link(mat, "node_attribute_color", GPU_kernel_globals(), out[0].link, &out[0].link);
32 }
33 if (out[1].hasoutput) {
34 out[1].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "density");
35 GPU_link(mat, "node_attribute_density", out[1].link, &out[1].link);
36 }
37 if (out[2].hasoutput) {
38 out[2].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "flame");
39 GPU_link(mat, "node_attribute_flame", out[2].link, &out[2].link);
40 }
41 if (out[3].hasoutput) {
42 out[3].link = GPU_attribute(mat, CD_AUTO_FROM_NAME, "temperature");
43 GPU_link(mat, "node_attribute_temperature", GPU_kernel_globals(), out[3].link, &out[3].link);
44 }
45
46 return true;
47}
48
49} // namespace nodes::node_shader_volume_info_cc
50
52{
53 namespace file_ns = nodes::node_shader_volume_info_cc;
54
55 static bke::bNodeType ntype;
56
57 sh_node_type_base(&ntype, "ShaderNodeVolumeInfo"_ustr, SH_NODE_VOLUME_INFO);
58 ntype.ui_name = "Volume Info";
59 ntype.ui_description = "Read volume data attributes from volume grids";
60 ntype.enum_name_legacy = "VOLUME_INFO";
62 ntype.declare = file_ns::node_declare;
63 ntype.gpu_fn = file_ns::node_shader_gpu_volume_info;
64
66}
67
68} // namespace blender
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define SH_NODE_VOLUME_INFO
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static void node_declare(NodeDeclarationBuilder &b)
static int node_shader_gpu_volume_info(GPUMaterial *mat, bNode *, bNodeExecData *, GPUNodeStack *, GPUNodeStack *out)
BMesh Iterators.
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bool GPU_link(GPUMaterial *mat, const char *name,...)
void register_node_type_sh_volume_info()
GPUNodeLink * GPU_attribute(GPUMaterial *mat, eCustomDataType type, const char *name)
GPUNodeLink * GPU_kernel_globals()
Defines a node type.
Definition BKE_node.hh:265
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