Blender  V3.3
COM_MathBaseOperation.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
4 #pragma once
5 
7 
8 namespace blender::compositor {
9 
15  protected:
22 
23  bool use_clamp_;
24 
25  protected:
30 
31  /* TODO(manzanilla): to be removed with tiled implementation. */
32  void clamp_if_needed(float color[4]);
33 
34  float clamp_when_enabled(float value)
35  {
36  if (use_clamp_) {
37  return CLAMPIS(value, 0.0f, 1.0f);
38  }
39  return value;
40  }
41 
42  void clamp_when_enabled(float *out)
43  {
44  if (use_clamp_) {
45  CLAMP(*out, 0.0f, 1.0f);
46  }
47  }
48 
49  public:
53  void init_execution() override;
54 
58  void deinit_execution() override;
59 
63  void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
64 
65  void set_use_clamp(bool value)
66  {
67  use_clamp_ = value;
68  }
69 
71  const rcti &area,
73 
74  protected:
76 };
77 
78 template<template<typename> typename TFunctor>
80  void update_memory_buffer_partial(BuffersIterator<float> &it) final
81  {
82  TFunctor functor;
83  for (; !it.is_end(); ++it) {
84  *it.out = functor(*it.in(0), *it.in(1));
85  clamp_when_enabled(it.out);
86  }
87  }
88 };
89 
90 class MathAddOperation : public MathFunctor2Operation<std::plus> {
91  public:
92  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
93 };
94 class MathSubtractOperation : public MathFunctor2Operation<std::minus> {
95  public:
96  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
97 };
98 class MathMultiplyOperation : public MathFunctor2Operation<std::multiplies> {
99  public:
100  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
101 };
103  public:
104  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
105 
106  protected:
108 };
110  public:
111  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
112 
113  protected:
115 };
117  public:
118  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
119 
120  protected:
122 };
124  public:
125  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
126 
127  protected:
129 };
130 
132  public:
133  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
134 
135  protected:
137 };
139  public:
140  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
141 
142  protected:
144 };
146  public:
147  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
148 
149  protected:
151 };
152 
154  public:
155  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
156 
157  protected:
159 };
161  public:
162  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
163 
164  protected:
166 };
168  public:
169  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
170 
171  protected:
173 };
175  public:
176  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
177 
178  protected:
180 };
182  public:
183  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
184 
185  protected:
187 };
189  public:
190  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
191 
192  protected:
194 };
196  public:
197  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
198 
199  protected:
201 };
203  public:
204  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
205 
206  protected:
208 };
209 class MathLessThanOperation : public MathFunctor2Operation<std::less> {
210  public:
211  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
212 };
213 class MathGreaterThanOperation : public MathFunctor2Operation<std::greater> {
214  public:
215  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
216 };
217 
219  public:
220  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
221 
222  protected:
224 };
225 
227  public:
228  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
229 
230  protected:
232 };
233 
235  public:
236  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
237 
238  protected:
240 };
241 
243  public:
244  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
245 
246  protected:
248 };
249 
251  public:
252  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
253 
254  protected:
256 };
257 
259  public:
260  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
261 
262  protected:
264 };
265 
267  public:
268  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
269 
270  protected:
272 };
273 
275  public:
276  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
277 
278  protected:
280 };
281 
283  public:
284  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
285 
286  protected:
288 };
289 
291  public:
292  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
293 
294  protected:
296 };
297 
299  public:
300  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
301 
302  protected:
304 };
305 
307  public:
308  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
309 
310  protected:
312 };
313 
315  public:
316  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
317 
318  protected:
320 };
321 
323  public:
324  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
325 
326  protected:
328 };
329 
331  public:
332  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
333 
334  protected:
336 };
337 
339  public:
340  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
341 
342  protected:
344 };
345 
347  public:
348  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
349 
350  protected:
352 };
353 
355  public:
356  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
357 
358  protected:
360 };
361 
363  public:
364  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
365 
366  protected:
368 };
369 
371  public:
372  void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
373 
374  protected:
376 };
377 
378 } // namespace blender::compositor
#define CLAMPIS(a, b, c)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
virtual void update_memory_buffer_partial(BuffersIterator< float > &it)=0
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) final
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(BuffersIterator< float > &it) override
a MemoryBuffer contains access to the data of a chunk
NodeOperation contains calculation logic.
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
ccl_global KernelShaderEvalInput ccl_global float * output
static void area(int d1, int d2, int e1, int e2, float weights[2])
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static bNodeSocketTemplate inputs[]