Blender  V2.93
COM_GlareBaseOperation.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2011, Blender Foundation.
17  */
18 
19 #include "COM_GlareBaseOperation.h"
20 #include "BLI_math.h"
21 
22 namespace blender::compositor {
23 
25 {
28  this->m_settings = nullptr;
29 }
31 {
33  this->m_inputProgram = getInputSocketReader(0);
34 }
35 
37 {
38  this->m_inputProgram = nullptr;
40 }
41 
43 {
44  MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(rect2);
45  rcti rect;
46  rect.xmin = 0;
47  rect.ymin = 0;
48  rect.xmax = getWidth();
49  rect.ymax = getHeight();
51  float *data = result->getBuffer();
52  this->generateGlare(data, tile, this->m_settings);
53  return result;
54 }
55 
57  ReadBufferOperation *readOperation,
58  rcti *output)
59 {
60  if (isCached()) {
61  return false;
62  }
63 
64  rcti newInput;
65  newInput.xmax = this->getWidth();
66  newInput.xmin = 0;
67  newInput.ymax = this->getHeight();
68  newInput.ymin = 0;
69  return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
70 }
71 
72 } // namespace blender::compositor
#define output
virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)=0
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
MemoryBuffer * createMemoryBuffer(rcti *rect) override
a MemoryBuffer contains access to the data of a chunk
virtual void * initializeTileData(rcti *)
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void addOutputSocket(DataType datatype)
SocketReader * getInputSocketReader(unsigned int inputSocketindex)
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
int ymin
Definition: DNA_vec_types.h:80
int ymax
Definition: DNA_vec_types.h:80
int xmin
Definition: DNA_vec_types.h:79
int xmax
Definition: DNA_vec_types.h:79