38 {0,
nullptr, 0,
nullptr,
nullptr},
46 {0,
nullptr, 0,
nullptr,
nullptr},
51 b.use_custom_socket_order();
52 b.allow_any_socket_order();
55 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
58 .structure_type(StructureType::Dynamic);
59 b.add_output<
decl::Color>(
"Image").structure_type(StructureType::Dynamic).align_with_previous();
79 .description(
"How the image fits in the camera frame");
86 .description(
"Interpolation method");
91 .description(
"The extension mode applied to the X axis");
96 .description(
"The extension mode applied to the Y axis");
130 output.transform(transformation);
139 if (this->
context().use_gpu()) {
165 input.bind_as_texture(shader,
"input_tx");
175 output.allocate_texture(domain);
176 output.bind_as_image(shader,
"output_img");
180 input.unbind_as_texture();
199 output.allocate_texture(domain);
207 float2 scaled_coordinates = center +
212 input.sample(scaled_coordinates, interpolation, extension_mode_x, extension_mode_y));
219 return "compositor_scale_variable_bicubic";
221 return "compositor_scale_variable";
228 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
230 switch (interpolation) {
247 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
249 switch (extension_x) {
265 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
267 switch (extension_y) {
299 get_input(
"Y").get_single_value_default(1.0f));
307 get_input(
"Y").get_single_value_default(1.0f));
308 return absolute_size / input_size;
319 if (!
context().is_valid_compositing_region()) {
341 return render_size / input_size;
352 const float2 scale = render_size / input_size;
364 const float2 scale = render_size / input_size;
382 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
390 const MenuValue menu_value =
input.get_single_value_default(default_menu_value);
413 ntype.
declare = file_ns::cmp_node_scale_declare;
414 ntype.
initfunc = file_ns::node_composit_init_scale;
#define NODE_CLASS_DISTORT
@ CMP_NODE_INTERPOLATION_NEAREST
@ CMP_NODE_INTERPOLATION_BILINEAR
@ CMP_NODE_INTERPOLATION_BICUBIC
@ CMP_NODE_INTERPOLATION_ANISOTROPIC
@ CMP_NODE_EXTENSION_MODE_EXTEND
@ CMP_NODE_EXTENSION_MODE_CLIP
@ CMP_NODE_EXTENSION_MODE_REPEAT
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(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
void GPU_texture_extend_mode_y(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_extend_mode_x(blender::gpu::Texture *texture, GPUSamplerExtendMode extend_mode)
void GPU_texture_filter_mode(blender::gpu::Texture *texture, bool use_filter)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
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)
RealizationOptions & get_realization_options()
void unbind_as_texture() const
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
T load_pixel(const int2 &texel) const
bool is_single_value() const
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
StructureType structure_type
const CompositorInputRealizationMode & compositor_realization_mode() const
void execute_variable_size_cpu()
float2 get_scale_absolute()
float2 get_scale_render_size_fit()
ExtensionMode get_extension_mode_x() const
void execute_variable_size()
float2 get_scale_render_size_stretch()
float2 get_scale_render_size()
CMPNodeScaleRenderSizeMethod get_frame_type()
const char * get_shader_name() const
ExtensionMode get_extension_mode_y() const
CMPNodeScaleMethod get_type()
float2 get_scale_render_size_crop()
float2 get_scale_render_percent()
void execute_variable_size_gpu()
float2 get_scale_relative()
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_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(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
GPUSamplerExtendMode map_extension_mode_to_extend_mode(const ExtensionMode &mode)
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 const EnumPropertyItem type_items[]
static const EnumPropertyItem frame_type_items[]
static void cmp_node_scale_declare(NodeDeclarationBuilder &b)
static void node_composit_init_scale(bNodeTree *, bNode *node)
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)
const EnumPropertyItem rna_enum_node_compositor_extension_items[]
const EnumPropertyItem rna_enum_node_compositor_interpolation_items[]
std::string ui_description
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeDeclareFunction declare
ExtensionMode extension_x
ExtensionMode extension_y