Blender  V3.3
COM_ScaleOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
4 #include "COM_ScaleOperation.h"
6 
7 namespace blender::compositor {
8 
9 #define USE_FORCE_BILINEAR
10 /* XXX(campbell): ignore input and use default from old compositor,
11  * could become an option like the transform node.
12  *
13  * NOTE: use bilinear because bicubic makes fuzzy even when not scaling at all (1:1)
14  */
15 
17 {
18 #ifdef USE_FORCE_BILINEAR
20 #else
21  sampler_ = -1;
22 #endif
23  variable_size_ = false;
24 }
25 
27 {
29 }
30 
32 {
33 }
34 
36 {
37  this->add_input_socket(data_type, ResizeMode::None);
40  this->add_output_socket(data_type);
41  input_operation_ = nullptr;
42  input_xoperation_ = nullptr;
43  input_yoperation_ = nullptr;
44 }
45 
46 float ScaleOperation::get_constant_scale(const int input_op_idx, const float factor)
47 {
48  const bool is_constant = get_input_operation(input_op_idx)->get_flags().is_constant_operation;
49  if (is_constant) {
50  return ((ConstantOperation *)get_input_operation(input_op_idx))->get_constant_elem()[0] *
51  factor;
52  }
53 
54  return 1.0f;
55 }
56 
57 float ScaleOperation::get_constant_scale_x(const float width)
58 {
59  return get_constant_scale(X_INPUT_INDEX, get_relative_scale_x_factor(width));
60 }
61 
62 float ScaleOperation::get_constant_scale_y(const float height)
63 {
64  return get_constant_scale(Y_INPUT_INDEX, get_relative_scale_y_factor(height));
65 }
66 
67 bool ScaleOperation::is_scaling_variable()
68 {
71 }
72 
73 void ScaleOperation::scale_area(rcti &area, float relative_scale_x, float relative_scale_y)
74 {
75  const rcti src_area = area;
76  const float center_x = BLI_rcti_size_x(&area) / 2.0f;
77  const float center_y = BLI_rcti_size_y(&area) / 2.0f;
78  area.xmin = floorf(scale_coord(area.xmin, center_x, relative_scale_x));
79  area.xmax = ceilf(scale_coord(area.xmax, center_x, relative_scale_x));
80  area.ymin = floorf(scale_coord(area.ymin, center_y, relative_scale_y));
81  area.ymax = ceilf(scale_coord(area.ymax, center_y, relative_scale_y));
82 
83  float scale_offset_x, scale_offset_y;
84  ScaleOperation::get_scale_offset(src_area, area, scale_offset_x, scale_offset_y);
85  BLI_rcti_translate(&area, -scale_offset_x, -scale_offset_y);
86 }
87 
89 {
90 
91  if (BLI_rcti_size_x(&area) > max_size.x) {
92  area.xmax = area.xmin + max_size.x;
93  }
94  if (BLI_rcti_size_y(&area) > max_size.y) {
95  area.ymax = area.ymin + max_size.y;
96  }
97 }
98 
100 {
101  canvas_center_x_ = canvas_.xmin + get_width() / 2.0f;
103 }
104 
106 {
110 }
111 
113 {
114  input_operation_ = nullptr;
115  input_xoperation_ = nullptr;
116  input_yoperation_ = nullptr;
117 }
118 
119 void ScaleOperation::get_scale_offset(const rcti &input_canvas,
120  const rcti &scale_canvas,
121  float &r_scale_offset_x,
122  float &r_scale_offset_y)
123 {
124  r_scale_offset_x = (BLI_rcti_size_x(&input_canvas) - BLI_rcti_size_x(&scale_canvas)) / 2.0f;
125  r_scale_offset_y = (BLI_rcti_size_y(&input_canvas) - BLI_rcti_size_y(&scale_canvas)) / 2.0f;
126 }
127 
129  const rcti &scale_canvas,
130  const float relative_scale_x,
131  const float relative_scale_y,
132  const rcti &output_area,
133  rcti &r_input_area)
134 {
135  const float scale_center_x = BLI_rcti_size_x(&input_canvas) / 2.0f;
136  const float scale_center_y = BLI_rcti_size_y(&input_canvas) / 2.0f;
137  float scale_offset_x, scale_offset_y;
138  ScaleOperation::get_scale_offset(input_canvas, scale_canvas, scale_offset_x, scale_offset_y);
139 
140  r_input_area.xmin = floorf(
141  scale_coord_inverted(output_area.xmin + scale_offset_x, scale_center_x, relative_scale_x));
142  r_input_area.xmax = ceilf(
143  scale_coord_inverted(output_area.xmax + scale_offset_x, scale_center_x, relative_scale_x));
144  r_input_area.ymin = floorf(
145  scale_coord_inverted(output_area.ymin + scale_offset_y, scale_center_y, relative_scale_y));
146  r_input_area.ymax = ceilf(
147  scale_coord_inverted(output_area.ymax + scale_offset_y, scale_center_y, relative_scale_y));
148 }
149 
150 void ScaleOperation::get_area_of_interest(const int input_idx,
151  const rcti &output_area,
152  rcti &r_input_area)
153 {
154  r_input_area = output_area;
155  if (input_idx != 0 || is_scaling_variable()) {
156  return;
157  }
158 
160  const float scale_x = get_constant_scale_x(image_op->get_width());
161  const float scale_y = get_constant_scale_y(image_op->get_height());
162 
164  image_op->get_canvas(), this->get_canvas(), scale_x, scale_y, output_area, r_input_area);
166 }
167 
169  const rcti &area,
171 {
173  const int input_image_width = input_image_op->get_width();
174  const int input_image_height = input_image_op->get_height();
175  const float scale_x_factor = get_relative_scale_x_factor(input_image_width);
176  const float scale_y_factor = get_relative_scale_y_factor(input_image_height);
177  const float scale_center_x = input_image_width / 2.0f;
178  const float scale_center_y = input_image_height / 2.0f;
179  float from_scale_offset_x, from_scale_offset_y;
181  input_image_op->get_canvas(), this->get_canvas(), from_scale_offset_x, from_scale_offset_y);
182 
183  const MemoryBuffer *input_image = inputs[IMAGE_INPUT_INDEX];
184  MemoryBuffer *input_x = inputs[X_INPUT_INDEX];
185  MemoryBuffer *input_y = inputs[Y_INPUT_INDEX];
186  BuffersIterator<float> it = output->iterate_with({input_x, input_y}, area);
187  for (; !it.is_end(); ++it) {
188  const float rel_scale_x = *it.in(0) * scale_x_factor;
189  const float rel_scale_y = *it.in(1) * scale_y_factor;
190  const float scaled_x = scale_coord_inverted(
191  from_scale_offset_x + canvas_.xmin + it.x, scale_center_x, rel_scale_x);
192  const float scaled_y = scale_coord_inverted(
193  from_scale_offset_y + canvas_.ymin + it.y, scale_center_y, rel_scale_y);
194 
195  input_image->read_elem_sampled(
196  scaled_x - canvas_.xmin, scaled_y - canvas_.ymin, (PixelSampler)sampler_, it.out);
197  }
198 }
199 
200 void ScaleOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
201 {
203  NodeOperation::determine_canvas(preferred_area, r_area);
204  return;
205  }
206 
207  const bool image_determined =
208  get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area);
209  if (image_determined) {
210  rcti image_canvas = r_area;
211  rcti unused = COM_AREA_NONE;
214  x_socket->determine_canvas(image_canvas, unused);
215  y_socket->determine_canvas(image_canvas, unused);
216  if (is_scaling_variable()) {
217  /* Do not scale canvas. */
218  return;
219  }
220 
221  /* Determine scaled canvas. */
222  const float input_width = BLI_rcti_size_x(&r_area);
223  const float input_height = BLI_rcti_size_y(&r_area);
224  const float scale_x = get_constant_scale_x(input_width);
225  const float scale_y = get_constant_scale_y(input_height);
226  scale_area(r_area, scale_x, scale_y);
227  const Size2f max_scale_size = {MAX2(input_width, max_scale_canvas_size_.x),
228  MAX2(input_height, max_scale_canvas_size_.y)};
229  clamp_area_size_max(r_area, max_scale_size);
230 
231  /* Re-determine canvases of x and y constant inputs with scaled canvas as preferred. */
234  x_socket->determine_canvas(r_area, unused);
235  y_socket->determine_canvas(r_area, unused);
236  }
237 }
238 
240 {
241 }
242 
244 {
245 }
246 
248  float x,
249  float y,
251 {
252  PixelSampler effective_sampler = get_effective_sampler(sampler);
253 
254  float scaleX[4];
255  float scaleY[4];
256 
257  input_xoperation_->read_sampled(scaleX, x, y, effective_sampler);
258  input_yoperation_->read_sampled(scaleY, x, y, effective_sampler);
259 
260  const float scx = scaleX[0];
261  const float scy = scaleY[0];
262 
263  float nx = this->canvas_center_x_ + (x - this->canvas_center_x_) / scx;
264  float ny = this->canvas_center_y_ + (y - this->canvas_center_y_) / scy;
265  input_operation_->read_sampled(output, nx, ny, effective_sampler);
266 }
267 
269  rcti *input, ReadBufferOperation *read_operation, rcti *output)
270 {
271  rcti new_input;
272  if (!variable_size_) {
273  float scaleX[4];
274  float scaleY[4];
275 
278 
279  const float scx = scaleX[0];
280  const float scy = scaleY[0];
281 
282  new_input.xmax = this->canvas_center_x_ + (input->xmax - this->canvas_center_x_) / scx + 1;
283  new_input.xmin = this->canvas_center_x_ + (input->xmin - this->canvas_center_x_) / scx - 1;
284  new_input.ymax = this->canvas_center_y_ + (input->ymax - this->canvas_center_y_) / scy + 1;
285  new_input.ymin = this->canvas_center_y_ + (input->ymin - this->canvas_center_y_) / scy - 1;
286  }
287  else {
288  new_input.xmax = this->get_width();
289  new_input.xmin = 0;
290  new_input.ymax = this->get_height();
291  new_input.ymin = 0;
292  }
294  &new_input, read_operation, output);
295 }
296 
298  float x,
299  float y,
301 {
302  PixelSampler effective_sampler = get_effective_sampler(sampler);
303 
304  float scaleX[4];
305  float scaleY[4];
306 
307  input_xoperation_->read_sampled(scaleX, x, y, effective_sampler);
308  input_yoperation_->read_sampled(scaleY, x, y, effective_sampler);
309 
310  const float scx = scaleX[0]; /* Target absolute scale. */
311  const float scy = scaleY[0]; /* Target absolute scale. */
312 
313  const float width = this->get_width();
314  const float height = this->get_height();
315  /* Divide. */
316  float relative_xscale = scx / width;
317  float relative_yscale = scy / height;
318 
319  float nx = this->canvas_center_x_ + (x - this->canvas_center_x_) / relative_xscale;
320  float ny = this->canvas_center_y_ + (y - this->canvas_center_y_) / relative_yscale;
321 
322  input_operation_->read_sampled(output, nx, ny, effective_sampler);
323 }
324 
326  rcti *input, ReadBufferOperation *read_operation, rcti *output)
327 {
328  rcti new_input;
329  if (!variable_size_) {
330  float scaleX[4];
331  float scaleY[4];
332 
335 
336  const float scx = scaleX[0];
337  const float scy = scaleY[0];
338  const float width = this->get_width();
339  const float height = this->get_height();
340  /* Divide. */
341  float relateve_xscale = scx / width;
342  float relateve_yscale = scy / height;
343 
344  new_input.xmax = this->canvas_center_x_ +
345  (input->xmax - this->canvas_center_x_) / relateve_xscale;
346  new_input.xmin = this->canvas_center_x_ +
347  (input->xmin - this->canvas_center_x_) / relateve_xscale;
348  new_input.ymax = this->canvas_center_y_ +
349  (input->ymax - this->canvas_center_y_) / relateve_yscale;
350  new_input.ymin = this->canvas_center_y_ +
351  (input->ymin - this->canvas_center_y_) / relateve_yscale;
352  }
353  else {
354  new_input.xmax = this->get_width();
355  new_input.xmin = 0;
356  new_input.ymax = this->get_height();
357  new_input.ymin = 0;
358  }
359  return ScaleOperation::determine_depending_area_of_interest(&new_input, read_operation, output);
360 }
361 
363 {
366  this->set_canvas_input_index(0);
367  input_operation_ = nullptr;
368  is_offset_ = false;
369 }
370 
371 void ScaleFixedSizeOperation::init_data(const rcti &input_canvas)
372 {
373  const int input_width = BLI_rcti_size_x(&input_canvas);
374  const int input_height = BLI_rcti_size_y(&input_canvas);
375  rel_x_ = input_width / (float)new_width_;
376  rel_y_ = input_height / (float)new_height_;
377 
378  /* *** all the options below are for a fairly special case - camera framing *** */
379  if (offset_x_ != 0.0f || offset_y_ != 0.0f) {
380  is_offset_ = true;
381 
382  if (new_width_ > new_height_) {
383  offset_x_ *= new_width_;
384  offset_y_ *= new_width_;
385  }
386  else {
387  offset_x_ *= new_height_;
388  offset_y_ *= new_height_;
389  }
390  }
391 
392  if (is_aspect_) {
393  /* apply aspect from clip */
394  const float w_src = input_width;
395  const float h_src = input_height;
396 
397  /* destination aspect is already applied from the camera frame */
398  const float w_dst = new_width_;
399  const float h_dst = new_height_;
400 
401  const float asp_src = w_src / h_src;
402  const float asp_dst = w_dst / h_dst;
403 
404  if (fabsf(asp_src - asp_dst) >= FLT_EPSILON) {
405  if ((asp_src > asp_dst) == (is_crop_ == true)) {
406  /* fit X */
407  const float div = asp_src / asp_dst;
408  rel_x_ /= div;
409  offset_x_ += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f;
410  if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) {
411  int fit_width = new_width_ * div;
412  if (fit_width > max_scale_canvas_size_.x) {
413  fit_width = max_scale_canvas_size_.x;
414  }
415 
416  const int added_width = fit_width - new_width_;
417  new_width_ += added_width;
418  offset_x_ += added_width / 2.0f;
419  }
420  }
421  else {
422  /* fit Y */
423  const float div = asp_dst / asp_src;
424  rel_y_ /= div;
425  offset_y_ += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f;
426  if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) {
427  int fit_height = new_height_ * div;
428  if (fit_height > max_scale_canvas_size_.y) {
429  fit_height = max_scale_canvas_size_.y;
430  }
431 
432  const int added_height = fit_height - new_height_;
433  new_height_ += added_height;
434  offset_y_ += added_height / 2.0f;
435  }
436  }
437 
438  is_offset_ = true;
439  }
440  }
441  /* *** end framing options *** */
442 }
443 
445 {
446  input_operation_ = this->get_input_socket_reader(0);
447 }
448 
450 {
451  input_operation_ = nullptr;
452 }
453 
455  float x,
456  float y,
458 {
459  PixelSampler effective_sampler = get_effective_sampler(sampler);
460 
461  if (is_offset_) {
462  float nx = ((x - offset_x_) * rel_x_);
463  float ny = ((y - offset_y_) * rel_y_);
464  input_operation_->read_sampled(output, nx, ny, effective_sampler);
465  }
466  else {
467  input_operation_->read_sampled(output, x * rel_x_, y * rel_y_, effective_sampler);
468  }
469 }
470 
472  rcti *input, ReadBufferOperation *read_operation, rcti *output)
473 {
474  rcti new_input;
475 
476  new_input.xmax = (input->xmax - offset_x_) * rel_x_ + 1;
477  new_input.xmin = (input->xmin - offset_x_) * rel_x_;
478  new_input.ymax = (input->ymax - offset_y_) * rel_y_ + 1;
479  new_input.ymin = (input->ymin - offset_y_) * rel_y_;
480 
482  &new_input, read_operation, output);
483 }
484 
485 void ScaleFixedSizeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
486 {
487  rcti local_preferred = preferred_area;
488  local_preferred.xmax = local_preferred.xmin + new_width_;
489  local_preferred.ymax = local_preferred.ymin + new_height_;
490  rcti input_canvas = COM_AREA_NONE;
491  const bool input_determined = get_input_socket(0)->determine_canvas(local_preferred,
492  input_canvas);
493  if (input_determined) {
494  init_data(input_canvas);
495  r_area = input_canvas;
497  r_area.xmin /= rel_x_;
498  r_area.ymin /= rel_y_;
499  r_area.xmin += offset_x_;
500  r_area.ymin += offset_y_;
501  }
502 
503  r_area.xmax = r_area.xmin + new_width_;
504  r_area.ymax = r_area.ymin + new_height_;
505  }
506 }
507 
509  const rcti &output_area,
510  rcti &r_input_area)
511 {
512  BLI_assert(input_idx == 0);
513  UNUSED_VARS_NDEBUG(input_idx);
514 
515  r_input_area.xmax = ceilf((output_area.xmax - offset_x_) * rel_x_);
516  r_input_area.xmin = floorf((output_area.xmin - offset_x_) * rel_x_);
517  r_input_area.ymax = ceilf((output_area.ymax - offset_y_) * rel_y_);
518  r_input_area.ymin = floorf((output_area.ymin - offset_y_) * rel_y_);
520 }
521 
523  const rcti &area,
525 {
526  const MemoryBuffer *input_img = inputs[0];
528  BuffersIterator<float> it = output->iterate_with({}, area);
529  if (is_offset_) {
530  for (; !it.is_end(); ++it) {
531  const float nx = (canvas_.xmin + it.x - offset_x_) * rel_x_;
532  const float ny = (canvas_.ymin + it.y - offset_y_) * rel_y_;
533  input_img->read_elem_sampled(nx - canvas_.xmin, ny - canvas_.ymin, sampler, it.out);
534  }
535  }
536  else {
537  for (; !it.is_end(); ++it) {
538  input_img->read_elem_sampled((canvas_.xmin + it.x) * rel_x_ - canvas_.xmin,
539  (canvas_.ymin + it.y) * rel_y_ - canvas_.ymin,
540  sampler,
541  it.out);
542  }
543  }
544 }
545 
546 } // namespace blender::compositor
typedef float(TangentPoint)[2]
#define BLI_assert(a)
Definition: BLI_assert.h:46
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
void BLI_rcti_translate(struct rcti *rect, int x, int y)
Definition: rct.c:559
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
#define UNUSED_VARS_NDEBUG(...)
#define MAX2(a, b)
_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 GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble ny
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_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
_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 GLsizei width
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Return a random value or color based on an input seed Float Map an input float to a curve and outputs a float value Separate Color
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
PixelSampler get_effective_sampler(PixelSampler sampler)
a MemoryBuffer contains access to the data of a chunk
void read_elem_sampled(float x, float y, PixelSampler sampler, float *out) const
bool determine_canvas(const rcti &preferred_area, rcti &r_area)
NodeOperation contains calculation logic.
void add_output_socket(DataType datatype)
const NodeOperationFlags get_flags() const
SocketReader * get_input_socket_reader(unsigned int index)
NodeOperation * get_input_operation(int index)
NodeOperationInput * get_input_socket(unsigned int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
virtual void determine_canvas(const rcti &preferred_area, rcti &r_area)
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
static void get_scale_offset(const rcti &input_canvas, const rcti &scale_canvas, float &r_scale_offset_x, float &r_scale_offset_y)
static void get_scale_area_of_interest(const rcti &input_canvas, const rcti &scale_canvas, float relative_scale_x, float relative_scale_y, const rcti &output_area, rcti &r_input_area)
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
virtual float get_relative_scale_x_factor(float width)=0
static void scale_area(rcti &area, float relative_scale_x, float relative_scale_y)
static float scale_coord_inverted(const float coord, const float center, const float relative_scale)
virtual float get_relative_scale_y_factor(float height)=0
void determine_canvas(const rcti &preferred_area, rcti &r_area) override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
static void clamp_area_size_max(rcti &area, Size2f max_size)
static float scale_coord(const float coord, const float center, const float relative_scale)
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
DataType
possible data types for sockets
Definition: COM_defines.h:30
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
#define ceilf(x)
Definition: metal/compat.h:225
#define floorf(x)
Definition: metal/compat.h:224
#define fabsf(x)
Definition: metal/compat.h:219
static void area(int d1, int d2, int e1, int e2, float weights[2])
void expand_area_for_sampler(rcti &area, PixelSampler sampler)
Definition: COM_Enums.cc:8
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
constexpr rcti COM_AREA_NONE
Definition: COM_defines.h:112
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