21 .default_value({0.5f, 0.5f})
24 .description(
"Line position where the image should be split");
26 .default_value(std::numbers::pi_v<float> / 4.0f)
28 .description(
"Line angle where the image should be split");
30 b.add_input<
decl::Color>(
"Image"_ustr).structure_type(StructureType::Dynamic);
31 b.add_input<
decl::Color>(
"Image"_ustr,
"Image_001"_ustr).structure_type(StructureType::Dynamic);
33 b.add_output<
decl::Color>(
"Image"_ustr).structure_type(StructureType::Dynamic);
44 if (this->
context().use_gpu()) {
69 shader,
"second_image_tx");
97 const float2 direction_to_line_point = line_point - float2(texel);
98 const float projection = math::dot(normal, direction_to_line_point);
99 const bool is_below_line = projection <= 0;
100 output_image.store_pixel(texel,
101 is_below_line ? first_image.load_pixel<Color, true>(texel) :
102 second_image.load_pixel<Color, true>(texel));
108 const float2 relative_position =
131 "Combine two images for side-by-side display. Typically used in combination with a Viewer "
#define NODE_CLASS_CONVERTER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
NodeOperation(Context &context, const bNode &node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
virtual Domain compute_domain()
void unbind_as_texture_or_single_value(gpu::Texture *single_value_texture) const
void allocate_texture(const Domain domain, const bool from_pool=true, const std::optional< ResultStorageType > storage_type=std::nullopt)
T get_single_value_default() const
void unbind_as_image() const
void bind_as_image(gpu::Shader *shader, const char *image_name, bool read=false) const
gpu::Texture * bind_as_texture_or_single_value(gpu::Shader *shader, const char *texture_name) const
NodeOperation(Context &context, const bNode &node)
math::AngleRadian get_rotation()
float2 get_position(const Domain &domain)
void node_register_type(bNodeType &ntype)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
void parallel_for(const int2 range, const Function &function)
AngleRadianBase< float > AngleRadian
T cos(const AngleRadianBase< T > &a)
T sin(const AngleRadianBase< T > &a)
static void node_register()
static void node_declare(NodeDeclarationBuilder &b)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_2fv(gpu::Shader *sh, const char *name, const float data[2])
void cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
const char * enum_name_legacy
NodeDeclareFunction declare