Blender V5.0
node_shader_volume_absorption.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_input<decl::Color>("Color").default_value({0.8f, 0.8f, 0.8f, 1.0f});
12#define SOCK_COLOR_ID 0
13 b.add_input<decl::Float>("Density").default_value(1.0f).min(0.0f).max(1000.0f);
14#define SOCK_DENSITY_ID 1
15 b.add_input<decl::Float>("Weight").available(false);
16 b.add_output<decl::Shader>("Volume").translation_context(BLT_I18NCONTEXT_ID_ID);
17}
18
20 bNode *node,
21 bNodeExecData * /*execdata*/,
24{
27 }
28 return GPU_stack_link(mat, node, "node_volume_absorption", in, out);
29}
30
31#undef SOCK_COLOR_ID
32#undef SOCK_DENSITY_ID
33
34} // namespace blender::nodes::node_shader_volume_absorption_cc
35
36/* node type definition */
38{
40
41 static blender::bke::bNodeType ntype;
42
43 sh_node_type_base(&ntype, "ShaderNodeVolumeAbsorption", SH_NODE_VOLUME_ABSORPTION);
44 ntype.ui_name = "Volume Absorption";
45 ntype.ui_description = "Absorb light as it passes through the volume";
46 ntype.enum_name_legacy = "VOLUME_ABSORPTION";
48 ntype.declare = file_ns::node_declare;
49 ntype.gpu_fn = file_ns::node_shader_gpu_volume_absorption;
50
52}
#define NODE_CLASS_SHADER
Definition BKE_node.hh:460
#define SH_NODE_VOLUME_ABSORPTION
#define BLT_I18NCONTEXT_ID_ID
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
@ GPU_MATFLAG_VOLUME_ABSORPTION
void GPU_material_flag_set(GPUMaterial *mat, eGPUMaterialFlag flag)
#define in
#define out
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
static int node_shader_gpu_volume_absorption(GPUMaterial *mat, bNode *node, bNodeExecData *, GPUNodeStack *in, GPUNodeStack *out)
void sh_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
bool node_socket_not_white(const GPUNodeStack &socket)
bool node_socket_not_zero(const GPUNodeStack &socket)
#define SOCK_DENSITY_ID
void register_node_type_sh_volume_absorption()
#define SOCK_COLOR_ID
Defines a node type.
Definition BKE_node.hh:238
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