32 mask_func = [](
const bool is_inside,
const float *
mask,
const float *value) {
33 return is_inside ? std::max(mask[0], value[0]) : mask[0];
37 mask_func = [](
const bool is_inside,
const float *
mask,
const float *value) {
38 return is_inside ? std::clamp(mask[0] - value[0], 0.0f, 1.0f) : mask[0];
42 mask_func = [](
const bool is_inside,
const float *
mask,
const float *value) {
43 return is_inside ? mask[0] * value[0] : 0;
47 mask_func = [](
const bool is_inside,
const float *
mask,
const float *value) {
49 return mask[0] > 0.0f ? 0.0f : value[0];
55 apply_mask(output, area, inputs, mask_func);
63 const float op_last_x = std::max(this->
get_width() - 1.0f, FLT_EPSILON);
64 const float op_last_y = std::max(this->
get_height() - 1.0f, FLT_EPSILON);
65 const float half_w = data_->
width / 2.0f + FLT_EPSILON;
66 const float half_h = data_->
height / 2.0f + FLT_EPSILON;
68 const float op_ry = it.y / op_last_y;
69 const float dy = (op_ry - data_->
y) / aspect_ratio_;
70 const float op_rx = it.x / op_last_x;
71 const float dx = op_rx - data_->
x;
72 const float rx = data_->
x + (cosine_ * dx + sine_ * dy);
73 const float ry = data_->
y + (-sine_ * dx + cosine_ * dy);
75 const bool inside = (rx >= data_->
x - half_w && rx <= data_->
x + half_w &&
76 ry >= data_->
y - half_h && ry <= data_->
y + half_h);
77 const float *mask = it.in(0);
78 const float *value = it.in(1);
79 *it.out = mask_func(inside, mask, value);
typedef double(DMatrix)[4][4]
@ CMP_NODE_MASKTYPE_SUBTRACT
@ CMP_NODE_MASKTYPE_MULTIPLY
void init_execution() override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
a MemoryBuffer contains access to the data
unsigned int get_height() const
void add_output_socket(DataType datatype)
unsigned int get_width() const
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
draw_view in_light_buf[] float
static bool is_inside(int x, int y, int cols, int rows)
ccl_device_inline float3 cos(float3 v)
ccl_device_inline float4 mask(const int4 mask, const float4 a)
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator