Blender V4.3
node_composite_posterize.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2021 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include "GPU_material.hh"
10
11#include "COM_shader_node.hh"
12
14
15/* **************** Posterize ******************** */
16
18
20{
21 b.add_input<decl::Color>("Image")
22 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
23 .compositor_domain_priority(0);
24 b.add_input<decl::Float>("Steps")
25 .default_value(8.0f)
26 .min(2.0f)
27 .max(1024.0f)
29 b.add_output<decl::Color>("Image");
30}
31
32using namespace blender::realtime_compositor;
33
35 public:
37
38 void compile(GPUMaterial *material) override
39 {
42
43 GPU_stack_link(material, &bnode(), "node_composite_posterize", inputs, outputs);
44 }
45};
46
48{
49 return new PosterizeShaderNode(node);
50}
51
52} // namespace blender::nodes::node_composite_posterize_cc
53
55{
57
58 static blender::bke::bNodeType ntype;
59
60 cmp_node_type_base(&ntype, CMP_NODE_POSTERIZE, "Posterize", NODE_CLASS_OP_COLOR);
61 ntype.declare = file_ns::cmp_node_posterize_declare;
62 ntype.get_compositor_shader_node = file_ns::get_compositor_shader_node;
63
65}
#define NODE_CLASS_OP_COLOR
Definition BKE_node.hh:406
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
local_group_size(16, 16) .push_constant(Type b
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
static ShaderNode * get_compositor_shader_node(DNode node)
static void cmp_node_posterize_declare(NodeDeclarationBuilder &b)
void register_node_type_cmp_posterize()
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
Defines a node type.
Definition BKE_node.hh:218
NodeDeclareFunction declare
Definition BKE_node.hh:347
NodeGetCompositorShaderNodeFunction get_compositor_shader_node
Definition BKE_node.hh:328