36 .default_value({0.5f, 0.5f})
39 .compositor_expects_single_value();
43 .default_value({0.2f, 0.1f})
46 .compositor_expects_single_value();
59template<CMPNodeMaskType MaskType>
64 const int2 &domain_size,
67 const float cos_angle,
68 const float sin_angle)
72 uv.y *= float(domain_size.y) / float(domain_size.x);
76 float base_mask_value = base_mask.
load_pixel<float,
true>(texel);
77 float value = value_mask.
load_pixel<float,
true>(texel);
79 float output_mask_value = 0.0f;
88 output_mask_value =
is_inside ? base_mask_value * value : 0.0f;
91 output_mask_value =
is_inside ? (base_mask_value > 0.0f ? 0.0f : value) : base_mask_value;
117 if (this->
context().use_gpu()) {
162 return "compositor_ellipse_mask_add";
164 return "compositor_ellipse_mask_subtract";
166 return "compositor_ellipse_mask_multiply";
168 return "compositor_ellipse_mask_not";
181 const int2 domain_size = domain.
size;
245 if (
get_input(
"Mask").is_single_value()) {
265 this->
get_input(
"Size").get_single_value_default(
float3(0.2f, 0.1f, 0.0f)).
xy());
288 ntype.
ui_name =
"Ellipse Mask";
290 "Create elliptical mask suitable for use as a simple matte or vignette mask";
293 ntype.
declare = file_ns::cmp_node_ellipsemask_declare;
294 ntype.
draw_buttons = file_ns::node_composit_buts_ellipsemask;
#define CMP_NODE_MASK_ELLIPSE
void GPU_shader_uniform_2fv(GPUShader *sh, const char *name, const float data[2])
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
void GPU_shader_bind(GPUShader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_shader_uniform_2iv(GPUShader *sh, const char *name, const int data[2])
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
GPUShader * get_shader(const char *info_name, ResultPrecision precision)
const bNode & bnode() const
NodeOperation(Context &context, DNode node)
Result & get_result(StringRef identifier)
Context & context() const
Result & get_input(StringRef identifier) const
void share_data(const Result &source)
T get_single_value_default(const T &default_value) const
void allocate_texture(Domain domain, bool from_pool=true)
void store_pixel(const int2 &texel, const T &pixel_value)
void unbind_as_texture() const
void bind_as_texture(GPUShader *shader, const char *texture_name) const
const Domain & domain() const
T load_pixel(const int2 &texel) const
void bind_as_image(GPUShader *shader, const char *image_name, bool read=false) const
void unbind_as_image() const
bool is_single_value() const
bool compositor_expects_single_value() const
CMPNodeMaskType get_mask_type()
Domain compute_domain() override
const char * get_shader_name()
NodeOperation(Context &context, DNode node)
#define CMP_NODE_MASKTYPE_MULTIPLY
#define CMP_NODE_MASKTYPE_ADD
#define CMP_NODE_MASKTYPE_NOT
#define CMP_NODE_MASKTYPE_SUBTRACT
static bool is_inside(int x, int y, int cols, int rows)
void node_register_type(bNodeType &ntype)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
void parallel_for(const int2 range, const Function &function)
T cos(const AngleRadianBase< T > &a)
T clamp(const T &a, const T &min, const T &max)
bool is_any_zero(const T &a)
T length(const VecBase< T, Size > &a)
T sin(const AngleRadianBase< T > &a)
T max(const T &a, const T &b)
static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *, PointerRNA *ptr)
static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void ellipse_mask(const Result &base_mask, const Result &value_mask, Result &output_mask, const int2 &texel, const int2 &domain_size, const float2 &location, const float2 &radius, const float cos_angle, const float sin_angle)
MatBase< float, 2, 2 > float2x2
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3
static void register_node_type_cmp_ellipsemask()
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
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)