21 b.use_custom_socket_order();
22 b.allow_any_socket_order();
24 StructureType::Dynamic);
25 b.add_output<
decl::Float>(
"Value").structure_type(StructureType::Dynamic).align_with_previous();
37 constexpr static float range_ = 10000.0f;
53 const float scale = (maximum != minimum) ? (1.0f / (maximum - minimum)) : 0.0f;
95 const float value = image.load_pixel<float>(texel);
96 const float normalized_value = (value - minimum) * scale;
97 const float clamped_value = math::clamp(normalized_value, 0.0f, 1.0f);
98 output.store_pixel(texel, clamped_value);
119 "Map values to 0 to 1 range, based on the minimum and maximum pixel values";
122 ntype.
declare = file_ns::cmp_node_normalize_declare;
#define NODE_CLASS_OP_VECTOR
#define CMP_NODE_NORMALIZE
void GPU_shader_uniform_1f(blender::gpu::Shader *sh, const char *name, float value)
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
virtual Domain compute_domain()
void share_data(const Result &source)
void allocate_texture(const Domain domain, const bool from_pool=true, const std::optional< ResultStorageType > storage_type=std::nullopt)
void unbind_as_texture() const
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
void unbind_as_image() const
void bind_as_image(gpu::Shader *shader, const char *image_name, bool read=false) const
bool is_single_value() const
StructureType structure_type
void execute_cpu(const float minimum, const float scale)
void execute_gpu(const float minimum, const float scale)
NodeOperation(Context &context, DNode node)
void node_register_type(bNodeType &ntype)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
float minimum_float_in_range(Context &context, const Result &result, const float lower_bound, const float upper_bound)
float maximum_float_in_range(Context &context, const Result &result, const float lower_bound, const float upper_bound)
void parallel_for(const int2 range, const Function &function)
static void cmp_node_normalize_declare(NodeDeclarationBuilder &b)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
VecBase< int32_t, 2 > int2
static void register_node_type_cmp_normalize()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
const char * enum_name_legacy
NodeDeclareFunction declare