Blender  V3.3
COM_RotateOperation.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_RotateOperation.h"
5 
6 namespace blender::compositor {
7 
9 {
13  this->set_canvas_input_index(0);
14  image_socket_ = nullptr;
15  degree_socket_ = nullptr;
16  do_degree2_rad_conversion_ = false;
17  is_degree_set_ = false;
18  sampler_ = PixelSampler::Bilinear;
19 }
20 
21 void RotateOperation::get_rotation_center(const rcti &area, float &r_x, float &r_y)
22 {
23  r_x = (BLI_rcti_size_x(&area) - 1) / 2.0;
24  r_y = (BLI_rcti_size_y(&area) - 1) / 2.0;
25 }
26 
27 void RotateOperation::get_rotation_offset(const rcti &input_canvas,
28  const rcti &rotate_canvas,
29  float &r_offset_x,
30  float &r_offset_y)
31 {
32  r_offset_x = (BLI_rcti_size_x(&input_canvas) - BLI_rcti_size_x(&rotate_canvas)) / 2.0f;
33  r_offset_y = (BLI_rcti_size_y(&input_canvas) - BLI_rcti_size_y(&rotate_canvas)) / 2.0f;
34 }
35 
37  const float center_x,
38  const float center_y,
39  const float sine,
40  const float cosine,
41  rcti &r_bounds)
42 {
43  const float dxmin = area.xmin - center_x;
44  const float dymin = area.ymin - center_y;
45  const float dxmax = area.xmax - center_x;
46  const float dymax = area.ymax - center_y;
47 
48  const float x1 = center_x + (cosine * dxmin + (-sine) * dymin);
49  const float x2 = center_x + (cosine * dxmax + (-sine) * dymin);
50  const float x3 = center_x + (cosine * dxmin + (-sine) * dymax);
51  const float x4 = center_x + (cosine * dxmax + (-sine) * dymax);
52  const float y1 = center_y + (sine * dxmin + cosine * dymin);
53  const float y2 = center_y + (sine * dxmax + cosine * dymin);
54  const float y3 = center_y + (sine * dxmin + cosine * dymax);
55  const float y4 = center_y + (sine * dxmax + cosine * dymax);
56  const float minx = MIN2(x1, MIN2(x2, MIN2(x3, x4)));
57  const float maxx = MAX2(x1, MAX2(x2, MAX2(x3, x4)));
58  const float miny = MIN2(y1, MIN2(y2, MIN2(y3, y4)));
59  const float maxy = MAX2(y1, MAX2(y2, MAX2(y3, y4)));
60 
61  r_bounds.xmin = floor(minx);
62  r_bounds.xmax = ceil(maxx);
63  r_bounds.ymin = floor(miny);
64  r_bounds.ymax = ceil(maxy);
65 }
66 
68  const float center_x,
69  const float center_y,
70  const float sine,
71  const float cosine,
72  rcti &r_bounds)
73 {
74  get_area_rotation_bounds(area, center_x, center_y, -sine, cosine, r_bounds);
75 }
76 
78  const rcti &rotate_canvas,
79  const float sine,
80  const float cosine,
81  const rcti &output_area,
82  rcti &r_input_area)
83 {
84  float center_x, center_y;
85  get_rotation_center(input_canvas, center_x, center_y);
86 
87  float rotate_offset_x, rotate_offset_y;
88  get_rotation_offset(input_canvas, rotate_canvas, rotate_offset_x, rotate_offset_y);
89 
90  r_input_area = output_area;
91  BLI_rcti_translate(&r_input_area, rotate_offset_x, rotate_offset_y);
92  get_area_rotation_bounds_inverted(r_input_area, center_x, center_y, sine, cosine, r_input_area);
93 }
94 
95 void RotateOperation::get_rotation_canvas(const rcti &input_canvas,
96  const float sine,
97  const float cosine,
98  rcti &r_canvas)
99 {
100  float center_x, center_y;
101  get_rotation_center(input_canvas, center_x, center_y);
102 
103  rcti rot_bounds;
104  get_area_rotation_bounds(input_canvas, center_x, center_y, sine, cosine, rot_bounds);
105 
106  float offset_x, offset_y;
107  get_rotation_offset(input_canvas, rot_bounds, offset_x, offset_y);
108  r_canvas = rot_bounds;
109  BLI_rcti_translate(&r_canvas, -offset_x, -offset_y);
110 }
111 
113 {
115  get_rotation_center(get_canvas(), center_x_, center_y_);
116  }
117 }
118 
120 {
121  image_socket_ = this->get_input_socket_reader(0);
122  degree_socket_ = this->get_input_socket_reader(1);
123 }
124 
126 {
127  image_socket_ = nullptr;
128  degree_socket_ = nullptr;
129 }
130 
132 {
133  if (!is_degree_set_) {
134  float degree[4];
135  switch (execution_model_) {
137  degree_socket_->read_sampled(degree, 0, 0, PixelSampler::Nearest);
138  break;
140  degree[0] = get_input_operation(DEGREE_INPUT_INDEX)->get_constant_value_default(0.0f);
141  break;
142  }
143 
144  double rad;
145  if (do_degree2_rad_conversion_) {
146  rad = DEG2RAD((double)degree[0]);
147  }
148  else {
149  rad = degree[0];
150  }
151  cosine_ = cos(rad);
152  sine_ = sin(rad);
153 
154  is_degree_set_ = true;
155  }
156 }
157 
159  float x,
160  float y,
162 {
163  ensure_degree();
164  const float dy = y - center_y_;
165  const float dx = x - center_x_;
166  const float nx = center_x_ + (cosine_ * dx + sine_ * dy);
167  const float ny = center_y_ + (-sine_ * dx + cosine_ * dy);
168  image_socket_->read_sampled(output, nx, ny, sampler);
169 }
170 
172  ReadBufferOperation *read_operation,
173  rcti *output)
174 {
175  ensure_degree();
176  rcti new_input;
177 
178  const float dxmin = input->xmin - center_x_;
179  const float dymin = input->ymin - center_y_;
180  const float dxmax = input->xmax - center_x_;
181  const float dymax = input->ymax - center_y_;
182 
183  const float x1 = center_x_ + (cosine_ * dxmin + sine_ * dymin);
184  const float x2 = center_x_ + (cosine_ * dxmax + sine_ * dymin);
185  const float x3 = center_x_ + (cosine_ * dxmin + sine_ * dymax);
186  const float x4 = center_x_ + (cosine_ * dxmax + sine_ * dymax);
187  const float y1 = center_y_ + (-sine_ * dxmin + cosine_ * dymin);
188  const float y2 = center_y_ + (-sine_ * dxmax + cosine_ * dymin);
189  const float y3 = center_y_ + (-sine_ * dxmin + cosine_ * dymax);
190  const float y4 = center_y_ + (-sine_ * dxmax + cosine_ * dymax);
191  const float minx = MIN2(x1, MIN2(x2, MIN2(x3, x4)));
192  const float maxx = MAX2(x1, MAX2(x2, MAX2(x3, x4)));
193  const float miny = MIN2(y1, MIN2(y2, MIN2(y3, y4)));
194  const float maxy = MAX2(y1, MAX2(y2, MAX2(y3, y4)));
195 
196  new_input.xmax = ceil(maxx) + 1;
197  new_input.xmin = floor(minx) - 1;
198  new_input.ymax = ceil(maxy) + 1;
199  new_input.ymin = floor(miny) - 1;
200 
201  return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output);
202 }
203 
204 void RotateOperation::determine_canvas(const rcti &preferred_area, rcti &r_area)
205 {
207  NodeOperation::determine_canvas(preferred_area, r_area);
208  return;
209  }
210 
211  const bool image_determined =
212  get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area);
213  if (image_determined) {
214  rcti input_canvas = r_area;
215  rcti unused = COM_AREA_NONE;
216  get_input_socket(DEGREE_INPUT_INDEX)->determine_canvas(input_canvas, unused);
217 
218  ensure_degree();
219 
220  get_rotation_canvas(input_canvas, sine_, cosine_, r_area);
221  }
222 }
223 
224 void RotateOperation::get_area_of_interest(const int input_idx,
225  const rcti &output_area,
226  rcti &r_input_area)
227 {
228  if (input_idx == DEGREE_INPUT_INDEX) {
230  return;
231  }
232 
233  ensure_degree();
234 
235  const rcti &input_image_canvas = get_input_operation(IMAGE_INPUT_INDEX)->get_canvas();
237  input_image_canvas, this->get_canvas(), sine_, cosine_, output_area, r_input_area);
238  expand_area_for_sampler(r_input_area, sampler_);
239 }
240 
242  const rcti &area,
244 {
245  const MemoryBuffer *input_img = inputs[IMAGE_INPUT_INDEX];
246 
247  NodeOperation *image_op = get_input_operation(IMAGE_INPUT_INDEX);
248  float center_x, center_y;
249  get_rotation_center(image_op->get_canvas(), center_x, center_y);
250  float rotate_offset_x, rotate_offset_y;
252  image_op->get_canvas(), this->get_canvas(), rotate_offset_x, rotate_offset_y);
253 
254  for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) {
255  float x = rotate_offset_x + it.x + canvas_.xmin;
256  float y = rotate_offset_y + it.y + canvas_.ymin;
257  rotate_coords(x, y, center_x, center_y, sine_, cosine_);
258  input_img->read_elem_sampled(x - canvas_.xmin, y - canvas_.ymin, sampler_, it.out);
259  }
260 }
261 
262 } // namespace blender::compositor
#define DEG2RAD(_deg)
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 MAX2(a, b)
#define MIN2(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 GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_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 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 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 GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
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)
SocketReader * get_input_socket_reader(unsigned int index)
float get_constant_value_default(float default_value)
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 determine_canvas(const rcti &preferred_area, rcti &r_area) override
static void get_rotation_offset(const rcti &input_canvas, const rcti &rotate_canvas, float &r_offset_x, float &r_offset_y)
static void rotate_coords(float &x, float &y, float center_x, float center_y, float sine, float cosine)
static void get_rotation_area_of_interest(const rcti &input_canvas, const rcti &rotate_canvas, float sine, float cosine, const rcti &output_area, rcti &r_input_area)
static void get_area_rotation_bounds_inverted(const rcti &area, float center_x, float center_y, float sine, float cosine, rcti &r_bounds)
static void get_area_rotation_bounds(const rcti &area, float center_x, float center_y, float sine, float cosine, rcti &r_bounds)
static void get_rotation_canvas(const rcti &input_canvas, float sine, float cosine, rcti &r_canvas)
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
calculate a single pixel
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
static void get_rotation_center(const rcti &area, float &r_x, float &r_y)
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.
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:311
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_CONSTANT_INPUT_AREA_OF_INTEREST
Definition: COM_defines.h:113
constexpr rcti COM_AREA_NONE
Definition: COM_defines.h:112
T floor(const T &a)
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