62 if (
STR_ELEM(sock->name,
"X",
"Y")) {
106 output.transform(transformation);
112 if (this->
context().use_gpu()) {
133 input.bind_as_texture(shader,
"input_tx");
143 output.allocate_texture(domain);
144 output.bind_as_image(shader,
"output_img");
148 input.unbind_as_texture();
165 output.allocate_texture(domain);
173 float2 scaled_coordinates = center +
175 switch (interpolation) {
177 output.store_pixel(texel,
input.sample_cubic_wrap(scaled_coordinates,
false,
false));
180 output.store_pixel(texel,
input.sample_bilinear_wrap(scaled_coordinates,
false,
false));
183 output.store_pixel(texel,
input.sample_nearest_wrap(scaled_coordinates,
false,
false));
192 return "compositor_scale_variable_bicubic";
194 return "compositor_scale_variable";
199 switch (node_storage(
bnode()).interpolation) {
233 get_input(
"Y").get_single_value_default(1.0f));
241 get_input(
"Y").get_single_value_default(1.0f));
242 return absolute_size / input_size;
253 if (!
context().is_valid_compositing_region()) {
276 return render_size / input_size;
287 const float2 scale = render_size / input_size;
299 const float2 scale = render_size / input_size;
342 ntype.
declare = file_ns::cmp_node_scale_declare;
344 ntype.
initfunc = file_ns::node_composit_init_scale;
345 ntype.
updatefunc = file_ns::node_composite_update_scale;
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_DISTORT
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
@ CMP_NODE_INTERPOLATION_NEAREST
@ CMP_NODE_INTERPOLATION_BILINEAR
@ CMP_NODE_INTERPOLATION_BICUBIC
CMPNodeScaleRenderSizeMethod
@ CMP_NODE_SCALE_RENDER_SIZE_STRETCH
@ CMP_NODE_SCALE_RENDER_SIZE_FIT
@ CMP_NODE_SCALE_RENDER_SIZE_CROP
@ CMP_NODE_SCALE_RENDER_SIZE
@ CMP_NODE_SCALE_RELATIVE
@ CMP_NODE_SCALE_ABSOLUTE
@ CMP_NODE_SCALE_RENDER_PERCENT
void GPU_shader_bind(GPUShader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
BMesh const char void * data
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
virtual Domain compute_domain()
void share_data(const Result &source)
void unbind_as_texture() const
void bind_as_texture(GPUShader *shader, const char *texture_name) const
T load_pixel(const int2 &texel) const
bool is_single_value() const
ColorGeometry4f default_value
CMPNodeScaleMethod get_scale_method()
void execute_variable_size_cpu()
float2 get_scale_absolute()
float2 get_scale_render_size_fit()
void execute_variable_size()
float2 get_scale_render_size_stretch()
float2 get_scale_render_size()
float2 get_scale_render_size_crop()
float2 get_scale_render_percent()
CMPNodeScaleRenderSizeMethod get_scale_render_size_method()
void execute_variable_size_gpu()
float2 get_scale_relative()
const char * get_realization_shader_name() const
void execute_constant_size()
NodeOperation(Context &context, DNode node)
Interpolation get_interpolation() const
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
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 min(const T &a, const T &b)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
T max(const T &a, const T &b)
static void cmp_node_scale_declare(NodeDeclarationBuilder &b)
static void node_composite_update_scale(bNodeTree *ntree, bNode *node)
static void node_composit_init_scale(bNodeTree *, bNode *node)
static void node_composit_buts_scale(uiLayout *layout, bContext *, PointerRNA *ptr)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
MatBase< float, 3, 3 > float3x3
static void register_node_type_cmp_scale()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
int RNA_enum_get(PointerRNA *ptr, const char *name)
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
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)