Blender  V3.3
COM_GlareBaseOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 
6 namespace blender::compositor {
7 
9 {
12  settings_ = nullptr;
14  is_output_rendered_ = false;
15 }
17 {
19  input_program_ = get_input_socket_reader(0);
20 }
21 
23 {
24  input_program_ = nullptr;
26 }
27 
29 {
30  MemoryBuffer *tile = (MemoryBuffer *)input_program_->initialize_tile_data(rect2);
31  rcti rect;
32  rect.xmin = 0;
33  rect.ymin = 0;
34  rect.xmax = get_width();
35  rect.ymax = get_height();
37  float *data = result->get_buffer();
38  this->generate_glare(data, tile, settings_);
39  return result;
40 }
41 
43  ReadBufferOperation *read_operation,
44  rcti *output)
45 {
46  if (is_cached()) {
47  return false;
48  }
49 
50  rcti new_input;
51  new_input.xmax = this->get_width();
52  new_input.xmin = 0;
53  new_input.ymax = this->get_height();
54  new_input.ymin = 0;
55  return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output);
56 }
57 
59  const rcti &UNUSED(output_area),
60  rcti &r_input_area)
61 {
62  BLI_assert(input_idx == 0);
63  UNUSED_VARS_NDEBUG(input_idx);
64  r_input_area.xmin = 0;
65  r_input_area.xmax = this->get_width();
66  r_input_area.ymin = 0;
67  r_input_area.ymax = this->get_height();
68 }
69 
71  const rcti &UNUSED(area),
73 {
74  if (!is_output_rendered_) {
76  const bool is_input_inflated = input->is_a_single_elem();
77  if (is_input_inflated) {
78  input = input->inflate();
79  }
80 
81  this->generate_glare(output->get_buffer(), input, settings_);
82  is_output_rendered_ = true;
83 
84  if (is_input_inflated) {
85  delete input;
86  }
87  }
88 }
89 
90 } // namespace blender::compositor
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define UNUSED_VARS_NDEBUG(...)
#define UNUSED(x)
virtual void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings)=0
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final
Get input operation area being read by this operation on rendering given output area.
void update_memory_buffer(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) final
MemoryBuffer * create_memory_buffer(rcti *rect) override
a MemoryBuffer contains access to the data of a chunk
float * get_buffer()
get the data of this MemoryBuffer
void add_output_socket(DataType datatype)
SocketReader * get_input_socket_reader(unsigned int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
virtual void * initialize_tile_data(rcti *)
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global const KernelWorkTile * tile
ccl_global KernelShaderEvalInput * input
static void area(int d1, int d2, int e1, int e2, float weights[2])
static bNodeSocketTemplate inputs[]
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63