Blender  V2.93
COM_ViewerOperation.h
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 #pragma once
20 
21 #include "BKE_global.h"
22 #include "BLI_rect.h"
23 #include "COM_NodeOperation.h"
24 #include "DNA_image_types.h"
25 
26 namespace blender::compositor {
27 
29  private:
30  float *m_outputBuffer;
31  float *m_depthBuffer;
32  Image *m_image;
33  ImageUser *m_imageUser;
34  bool m_active;
35  float m_centerX;
36  float m_centerY;
37  ChunkOrdering m_chunkOrder;
38  bool m_doDepthBuffer;
39  ImBuf *m_ibuf;
40  bool m_useAlphaInput;
41  const RenderData *m_rd;
42  const char *m_viewName;
43 
44  const ColorManagedViewSettings *m_viewSettings;
45  const ColorManagedDisplaySettings *m_displaySettings;
46 
47  SocketReader *m_imageInput;
48  SocketReader *m_alphaInput;
49  SocketReader *m_depthInput;
50 
51  public:
53  void initExecution() override;
54  void deinitExecution() override;
55  void executeRegion(rcti *rect, unsigned int tileNumber) override;
56  void determineResolution(unsigned int resolution[2],
57  unsigned int preferredResolution[2]) override;
58  bool isOutputOperation(bool /*rendering*/) const override
59  {
60  if (G.background) {
61  return false;
62  }
63  return isActiveViewerOutput();
64  }
65  void setImage(Image *image)
66  {
67  this->m_image = image;
68  }
69  void setImageUser(ImageUser *imageUser)
70  {
71  this->m_imageUser = imageUser;
72  }
73  bool isActiveViewerOutput() const override
74  {
75  return this->m_active;
76  }
77  void setActive(bool active)
78  {
79  this->m_active = active;
80  }
81  void setCenterX(float centerX)
82  {
83  this->m_centerX = centerX;
84  }
85  void setCenterY(float centerY)
86  {
87  this->m_centerY = centerY;
88  }
89  void setChunkOrder(ChunkOrdering tileOrder)
90  {
91  this->m_chunkOrder = tileOrder;
92  }
93  float getCenterX() const
94  {
95  return this->m_centerX;
96  }
97  float getCenterY() const
98  {
99  return this->m_centerY;
100  }
102  {
103  return this->m_chunkOrder;
104  }
105  eCompositorPriority getRenderPriority() const override;
106  void setUseAlphaInput(bool value)
107  {
108  this->m_useAlphaInput = value;
109  }
110  void setRenderData(const RenderData *rd)
111  {
112  this->m_rd = rd;
113  }
114  void setViewName(const char *viewName)
115  {
116  this->m_viewName = viewName;
117  }
118 
119  void setViewSettings(const ColorManagedViewSettings *viewSettings)
120  {
121  this->m_viewSettings = viewSettings;
122  }
123  void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
124  {
125  this->m_displaySettings = displaySettings;
126  }
127 
128  private:
129  void updateImage(rcti *rect);
130  void initImage();
131 };
132 
133 } // namespace blender::compositor
NodeOperation contains calculation logic.
void setViewSettings(const ColorManagedViewSettings *viewSettings)
void setChunkOrder(ChunkOrdering tileOrder)
void setRenderData(const RenderData *rd)
bool isActiveViewerOutput() const override
is this operation the active viewer output user can select an ViewerNode to be active (the result of ...
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
void executeRegion(rcti *rect, unsigned int tileNumber) override
when a chunk is executed by a CPUDevice, this method is called
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) override
determine the resolution of this node
void setImageUser(ImageUser *imageUser)
bool isOutputOperation(bool) const override
isOutputOperation determines whether this operation is an output of the ExecutionSystem during render...
void setViewName(const char *viewName)
eCompositorPriority getRenderPriority() const override
get the render priority of this node.
eCompositorPriority
Possible priority settings.
Definition: COM_Enums.h:45
ChunkOrdering
The order of chunks to be scheduled.
Definition: COM_defines.h:65
bool active
all scheduled work for the GPU.
#define G(x, y, z)