Blender V5.3
node_shader_util.hh
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#pragma once
10
11#include <cfloat>
12#include <optional>
13
14#include "BLI_listbase.hh" // IWYU pragma: export
15#include "BLI_math_constants.hh" // IWYU pragma: export
16
17#include "BKE_node.hh"
18#include "BKE_node_legacy_types.hh" // IWYU pragma: export
19
20#include "DNA_node_types.h"
21
22#include "GPU_material.hh"
23
24#include "NOD_socket_declarations.hh" // IWYU pragma: export
25
26#include "node_shader_register.hh" // IWYU pragma: export
27
28#ifdef WITH_MATERIALX
29# include "materialx/node_parser.h" // IWYU pragma: export
30#else
31# define NODE_SHADER_MATERIALX_BEGIN bke::NodeMaterialXFunction node_shader_materialx = nullptr;
32# define NODE_SHADER_MATERIALX_END
33#endif
34
35namespace blender {
36
37struct bContext;
38struct bNodeExecContext;
39struct bNodeTreeExec;
40struct GPUNodeLink;
41struct GPUNodeStack;
42struct GPUMaterial;
43
44bool sh_node_poll_default(const bke::bNodeType *ntype,
45 const bNodeTree *ntree,
46 const char **r_disabled_hint);
47void sh_node_type_base(bke::bNodeType *ntype,
48 UString idname,
49 std::optional<int16_t> legacy_type = std::nullopt);
50void sh_geo_node_type_base(bke::bNodeType *ntype,
51 UString idname,
52 std::optional<int16_t> legacy_type = std::nullopt);
53void common_node_type_base(bke::bNodeType *ntype,
54 UString idname,
55 std::optional<int16_t> legacy_type = std::nullopt);
56bool line_style_shader_nodes_poll(const bContext *C);
57bool world_shader_nodes_poll(const bContext *C);
58bool object_shader_nodes_poll(const bContext *C);
59bool object_cycles_shader_nodes_poll(const bContext *C);
60bool object_eevee_shader_nodes_poll(const bContext *C);
61
62/* ********* exec data struct, remains internal *********** */
63
64struct XYZ_to_RGB /* Transposed #imbuf_xyz_to_rgb, passed as 3x vec3. */
65{
66 float r[3], g[3], b[3];
67};
68
74 bNode *node,
77
79 bNodeTree *ntree,
80 bNodeInstanceKey parent_key);
82
83/* If depth_level is not null, only nodes where `node->runtime->tmp_flag == depth_level` will be
84 * executed. This allows finer control over node execution order without modifying the tree
85 * topology. */
87 GPUMaterial *mat,
88 bNode *output_node,
89 const int *depth_level = nullptr);
90
92
93/* Link search callback that ignores the "Weight" socket in shader nodes.
94 * These sockets are never available and must be ignored to avoid invalid link operations. */
96
97/* Link search callback that ignores the "LightIndex", "ShaderZoneIO", and "Weight" socket in
98 * shader nodes. These sockets are never available and must be ignored to avoid invalid link
99 * operations. */
101
102} // namespace blender
#define C
Definition RandGen.cpp:29
BMesh Iterators.
void node_gpu_stack_from_data(GPUNodeStack *gs, bNodeSocket *socket, bNodeStack *ns)
bool object_shader_nodes_poll(const bContext *C)
bool sh_node_poll_default(const bke::bNodeType *, const bNodeTree *ntree, const char **r_disabled_hint)
bool object_cycles_shader_nodes_poll(const bContext *C)
void sh_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void node_data_from_gpu_stack(bNodeStack *ns, GPUNodeStack *gs)
bool line_style_shader_nodes_poll(const bContext *C)
void sh_geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *)
BMesh const char void * data
void node_shader_gpu_default_tex_coord(GPUMaterial *mat, bNode *node, GPUNodeLink **link)
void search_link_ops_for_shader_bsdf_node(nodes::GatherLinkSearchOpParams &params)
bool world_shader_nodes_poll(const bContext *C)
bool object_eevee_shader_nodes_poll(const bContext *C)
void get_XYZ_to_RGB_for_gpu(XYZ_to_RGB *data)
void ntreeShaderEndExecTree_internal(bNodeTreeExec *exec)
void node_shader_gpu_bump_tex_coord(GPUMaterial *mat, bNode *, GPUNodeLink **link)
bNodeTreeExec * ntreeShaderBeginExecTree_internal(bNodeExecContext *context, bNodeTree *ntree, bNodeInstanceKey parent_key)
void search_link_ops_for_shader_material_lighting_node(nodes::GatherLinkSearchOpParams &params)
void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, bNode *output_node, const int *depth_level)
void common_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)