Files
test/source/blender/compositor/operations/COM_MapUVOperation.h
Brecht Van Lommel 7a395e2e7f Revert changes from main commits that were merged into blender-v4.1-release
The last good commit was f57e4c5b98.

After this one more fix was committed, this one is preserved as well:
67bd678887.
2024-03-18 15:04:12 +01:00

55 lines
1.4 KiB
C++

/* SPDX-FileCopyrightText: 2011 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "COM_MultiThreadedOperation.h"
namespace blender::compositor {
class MapUVOperation : public MultiThreadedOperation {
private:
static constexpr int IMAGE_INPUT_INDEX = 0;
static constexpr int UV_INPUT_INDEX = 1;
int uv_width_;
int uv_height_;
int image_width_;
int image_height_;
float alpha_;
bool nearest_neighbour_;
std::function<void(float x, float y, float *out)> uv_input_read_fn_;
public:
MapUVOperation();
void pixel_transform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha);
void init_data() override;
void set_alpha(float alpha)
{
alpha_ = alpha;
}
void set_nearest_neighbour(bool nearest_neighbour)
{
nearest_neighbour_ = nearest_neighbour;
}
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override;
void update_memory_buffer_started(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
private:
bool read_uv(float x, float y, float &r_u, float &r_v, float &r_alpha);
};
} // namespace blender::compositor