Blender  V2.93
interface_draw.c
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #include <math.h>
25 #include <string.h>
26 
27 #include "DNA_color_types.h"
28 #include "DNA_curve_types.h"
29 #include "DNA_curveprofile_types.h"
30 #include "DNA_movieclip_types.h"
31 #include "DNA_screen_types.h"
32 
33 #include "BLI_math.h"
34 #include "BLI_polyfill_2d.h"
35 #include "BLI_rect.h"
36 #include "BLI_string.h"
37 #include "BLI_utildefines.h"
38 
39 #include "MEM_guardedalloc.h"
40 
41 #include "BKE_colorband.h"
42 #include "BKE_colortools.h"
43 #include "BKE_curveprofile.h"
44 #include "BKE_node.h"
45 #include "BKE_tracking.h"
46 
47 #include "IMB_colormanagement.h"
48 #include "IMB_imbuf.h"
49 #include "IMB_imbuf_types.h"
50 
51 #include "BIF_glutil.h"
52 
53 #include "BLF_api.h"
54 
55 #include "GPU_batch.h"
56 #include "GPU_batch_presets.h"
57 #include "GPU_immediate.h"
58 #include "GPU_immediate_util.h"
59 #include "GPU_matrix.h"
60 #include "GPU_state.h"
61 
62 #include "UI_interface.h"
63 
64 /* own include */
65 #include "interface_intern.h"
66 
67 static int roundboxtype = UI_CNR_ALL;
68 
70 {
71  /* Not sure the roundbox function is the best place to change this
72  * if this is undone, it's not that big a deal, only makes curves edges
73  * square for the */
75 }
76 
77 #if 0 /* unused */
78 int UI_draw_roundbox_corner_get(void)
79 {
80  return roundboxtype;
81 }
82 #endif
83 
84 void UI_draw_roundbox_4fv_ex(const rctf *rect,
85  const float inner1[4],
86  const float inner2[4],
87  float shade_dir,
88  const float outline[4],
89  float outline_width,
90  float rad)
91 {
92  /* WATCH: This is assuming the ModelViewProjectionMatrix is area pixel space.
93  * If it has been scaled, then it's no longer valid. */
94  uiWidgetBaseParameters widget_params = {
95  .recti.xmin = rect->xmin + outline_width,
96  .recti.ymin = rect->ymin + outline_width,
97  .recti.xmax = rect->xmax - outline_width,
98  .recti.ymax = rect->ymax - outline_width,
99  .rect = *rect,
100  .radi = rad,
101  .rad = rad,
102  .round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
103  .round_corners[1] = (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 1.0f : 0.0f,
104  .round_corners[2] = (roundboxtype & UI_CNR_TOP_RIGHT) ? 1.0f : 0.0f,
105  .round_corners[3] = (roundboxtype & UI_CNR_TOP_LEFT) ? 1.0f : 0.0f,
106  .color_inner1[0] = inner1 ? inner1[0] : 0.0f,
107  .color_inner1[1] = inner1 ? inner1[1] : 0.0f,
108  .color_inner1[2] = inner1 ? inner1[2] : 0.0f,
109  .color_inner1[3] = inner1 ? inner1[3] : 0.0f,
110  .color_inner2[0] = inner2 ? inner2[0] : inner1 ? inner1[0] : 0.0f,
111  .color_inner2[1] = inner2 ? inner2[1] : inner1 ? inner1[1] : 0.0f,
112  .color_inner2[2] = inner2 ? inner2[2] : inner1 ? inner1[2] : 0.0f,
113  .color_inner2[3] = inner2 ? inner2[3] : inner1 ? inner1[3] : 0.0f,
114  .color_outline[0] = outline ? outline[0] : inner1 ? inner1[0] : 0.0f,
115  .color_outline[1] = outline ? outline[1] : inner1 ? inner1[1] : 0.0f,
116  .color_outline[2] = outline ? outline[2] : inner1 ? inner1[2] : 0.0f,
117  .color_outline[3] = outline ? outline[3] : inner1 ? inner1[3] : 0.0f,
118  .shade_dir = shade_dir,
119  .alpha_discard = 1.0f,
120  };
123  GPU_batch_uniform_4fv_array(batch, "parameters", 11, (const float(*)[4]) & widget_params);
127 }
128 
130  const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
131 {
132  float colv[4] = {
133  ((float)col[0]) / 255,
134  ((float)col[1]) / 255,
135  ((float)col[2]) / 255,
136  ((float)alpha) / 255,
137  };
138  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
139 }
140 
142  const rctf *rect, bool filled, float rad, const float col[3], float alpha)
143 {
144  float colv[4] = {col[0], col[1], col[2], alpha};
145  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
146 }
147 
148 void UI_draw_roundbox_aa(const rctf *rect, bool filled, float rad, const float color[4])
149 {
150  /* XXX this is to emulate previous behavior of semitransparent fills but that's was a side effect
151  * of the previous AA method. Better fix the callers. */
152  float colv[4] = {color[0], color[1], color[2], color[3]};
153  if (filled) {
154  colv[3] *= 0.65f;
155  }
156 
157  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
158 }
159 
160 void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
161 {
162  /* Exactly the same as UI_draw_roundbox_aa but does not do the legacy transparency. */
163  UI_draw_roundbox_4fv_ex(rect, (filled) ? col : NULL, NULL, 1.0f, col, U.pixelsize, rad);
164 }
165 
166 /* linear horizontal shade within button or in outline */
167 /* view2d scrollers use it */
169  const rctf *rect, bool filled, float rad, float shadetop, float shadedown, const float col[4])
170 {
171  float inner1[4] = {0.0f, 0.0f, 0.0f, 0.0f};
172  float inner2[4] = {0.0f, 0.0f, 0.0f, 0.0f};
173  float outline[4];
174 
175  if (filled) {
176  inner1[0] = min_ff(1.0f, col[0] + shadetop);
177  inner1[1] = min_ff(1.0f, col[1] + shadetop);
178  inner1[2] = min_ff(1.0f, col[2] + shadetop);
179  inner1[3] = 1.0f;
180  inner2[0] = max_ff(0.0f, col[0] + shadedown);
181  inner2[1] = max_ff(0.0f, col[1] + shadedown);
182  inner2[2] = max_ff(0.0f, col[2] + shadedown);
183  inner2[3] = 1.0f;
184  }
185 
186  /* TODO: non-filled box don't have gradients. Just use middle color. */
187  outline[0] = clamp_f(col[0] + shadetop + shadedown, 0.0f, 1.0f);
188  outline[1] = clamp_f(col[1] + shadetop + shadedown, 0.0f, 1.0f);
189  outline[2] = clamp_f(col[2] + shadetop + shadedown, 0.0f, 1.0f);
190  outline[3] = clamp_f(col[3] + shadetop + shadedown, 0.0f, 1.0f);
191 
192  UI_draw_roundbox_4fv_ex(rect, inner1, inner2, 1.0f, outline, U.pixelsize, rad);
193 }
194 
195 void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
196 {
197  const int ofs_y = 4 * U.pixelsize;
198 
201 
203  immUniformColor4fv(color);
204 
205  immRecti(pos, pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize));
207 }
208 
209 /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
210 
211 /* based on UI_draw_roundbox_gl_mode,
212  * check on making a version which allows us to skip some sides */
213 void ui_draw_but_TAB_outline(const rcti *rect,
214  float rad,
215  uchar highlight[3],
216  uchar highlight_fade[3])
217 {
222  /* add a 1px offset, looks nicer */
223  const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize;
224  const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize;
225  int a;
226  float vec[4][2] = {
227  {0.195, 0.02},
228  {0.55, 0.169},
229  {0.831, 0.45},
230  {0.98, 0.805},
231  };
232 
233  /* mult */
234  for (a = 0; a < 4; a++) {
235  mul_v2_fl(vec[a], rad);
236  }
237 
240 
241  immAttr3ubv(col, highlight);
242 
243  /* start with corner left-top */
245  immVertex2f(pos, minx, maxy - rad);
246  for (a = 0; a < 4; a++) {
247  immVertex2f(pos, minx + vec[a][1], maxy - rad + vec[a][0]);
248  }
249  immVertex2f(pos, minx + rad, maxy);
250  }
251  else {
252  immVertex2f(pos, minx, maxy);
253  }
254 
255  /* corner right-top */
257  immVertex2f(pos, maxx - rad, maxy);
258  for (a = 0; a < 4; a++) {
259  immVertex2f(pos, maxx - rad + vec[a][0], maxy - vec[a][1]);
260  }
261  immVertex2f(pos, maxx, maxy - rad);
262  }
263  else {
264  immVertex2f(pos, maxx, maxy);
265  }
266 
267  immAttr3ubv(col, highlight_fade);
268 
269  /* corner right-bottom */
271  immVertex2f(pos, maxx, miny + rad);
272  for (a = 0; a < 4; a++) {
273  immVertex2f(pos, maxx - vec[a][1], miny + rad - vec[a][0]);
274  }
275  immVertex2f(pos, maxx - rad, miny);
276  }
277  else {
278  immVertex2f(pos, maxx, miny);
279  }
280 
281  /* corner left-bottom */
283  immVertex2f(pos, minx + rad, miny);
284  for (a = 0; a < 4; a++) {
285  immVertex2f(pos, minx + rad - vec[a][0], miny + vec[a][1]);
286  }
287  immVertex2f(pos, minx, miny + rad);
288  }
289  else {
290  immVertex2f(pos, minx, miny);
291  }
292 
293  immAttr3ubv(col, highlight);
294 
295  /* back to corner left-top */
296  immVertex2f(pos, minx, (roundboxtype & UI_CNR_TOP_LEFT) ? (maxy - rad) : maxy);
297 
298  immEnd();
300 }
301 
303  uiBut *but,
304  const uiWidgetColors *UNUSED(wcol),
305  const rcti *rect)
306 {
307 #ifdef WITH_HEADLESS
308  (void)rect;
309  (void)but;
310 #else
311  ImBuf *ibuf = (ImBuf *)but->poin;
312 
313  if (!ibuf) {
314  return;
315  }
316 
317  const int w = BLI_rcti_size_x(rect);
318  const int h = BLI_rcti_size_y(rect);
319 
320  /* scissor doesn't seem to be doing the right thing...? */
321 # if 0
322  /* prevent drawing outside widget area */
323  int scissor[4];
324  GPU_scissor_get(scissor);
325  GPU_scissor(rect->xmin, rect->ymin, w, h);
326 # endif
327 
328  /* Combine with premultiplied alpha. */
330 
331  if (w != ibuf->x || h != ibuf->y) {
332  /* We scale the bitmap, rather than have OGL do a worse job. */
333  IMB_scaleImBuf(ibuf, w, h);
334  }
335 
336  float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
337  if (but->col[3] != 0) {
338  /* Optionally use uiBut's col to recolor the image. */
339  rgba_uchar_to_float(col, but->col);
340  }
341 
344  (float)rect->xmin,
345  (float)rect->ymin,
346  ibuf->x,
347  ibuf->y,
348  GPU_RGBA8,
349  false,
350  ibuf->rect,
351  1.0f,
352  1.0f,
353  col);
354 
356 
357 # if 0
358  /* Restore scissor-test. */
359  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
360 # endif
361 
362 #endif
363 }
364 
374  const rctf *rect,
375  const float title_aspect[2],
376  const float action_aspect[2])
377 {
378  const float size_x_half = (rect->xmax - rect->xmin) * 0.5f;
379  const float size_y_half = (rect->ymax - rect->ymin) * 0.5f;
380 
381  const float *safe_areas[] = {title_aspect, action_aspect};
382  const int safe_len = ARRAY_SIZE(safe_areas);
383 
384  for (int i = 0; i < safe_len; i++) {
385  if (safe_areas[i][0] || safe_areas[i][1]) {
386  const float margin_x = safe_areas[i][0] * size_x_half;
387  const float margin_y = safe_areas[i][1] * size_y_half;
388 
389  const float minx = rect->xmin + margin_x;
390  const float miny = rect->ymin + margin_y;
391  const float maxx = rect->xmax - margin_x;
392  const float maxy = rect->ymax - margin_y;
393 
394  imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy);
395  }
396  }
397 }
398 
399 static void draw_scope_end(const rctf *rect)
400 {
402 
403  /* outline */
405  const float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
407  &(const rctf){
408  .xmin = rect->xmin - 1,
409  .xmax = rect->xmax + 1,
410  .ymin = rect->ymin,
411  .ymax = rect->ymax + 1,
412  },
413  false,
414  3.0f,
415  color);
416 }
417 
418 static void histogram_draw_one(float r,
419  float g,
420  float b,
421  float alpha,
422  float x,
423  float y,
424  float w,
425  float h,
426  const float *data,
427  int res,
428  const bool is_line,
429  uint pos_attr)
430 {
431  const float color[4] = {r, g, b, alpha};
432 
433  /* that can happen */
434  if (res == 0) {
435  return;
436  }
437 
438  GPU_line_smooth(true);
440 
441  immUniformColor4fv(color);
442 
443  if (is_line) {
444  /* curve outline */
445  GPU_line_width(1.5);
446 
448  for (int i = 0; i < res; i++) {
449  const float x2 = x + i * (w / (float)res);
450  immVertex2f(pos_attr, x2, y + (data[i] * h));
451  }
452  immEnd();
453  }
454  else {
455  /* under the curve */
456  immBegin(GPU_PRIM_TRI_STRIP, res * 2);
457  immVertex2f(pos_attr, x, y);
458  immVertex2f(pos_attr, x, y + (data[0] * h));
459  for (int i = 1; i < res; i++) {
460  const float x2 = x + i * (w / (float)res);
461  immVertex2f(pos_attr, x2, y + (data[i] * h));
462  immVertex2f(pos_attr, x2, y);
463  }
464  immEnd();
465 
466  /* curve outline */
467  immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f);
468 
471  for (int i = 0; i < res; i++) {
472  const float x2 = x + i * (w / (float)res);
473  immVertex2f(pos_attr, x2, y + (data[i] * h));
474  }
475  immEnd();
476  }
477 
478  GPU_line_smooth(false);
479 }
480 
481 #define HISTOGRAM_TOT_GRID_LINES 4
482 
484  uiBut *but,
485  const uiWidgetColors *UNUSED(wcol),
486  const rcti *recti)
487 {
488  Histogram *hist = (Histogram *)but->poin;
489  const int res = hist->x_resolution;
490  const bool is_line = (hist->flag & HISTO_FLAG_LINE) != 0;
491 
492  rctf rect = {
493  .xmin = (float)recti->xmin + 1,
494  .xmax = (float)recti->xmax - 1,
495  .ymin = (float)recti->ymin + 1,
496  .ymax = (float)recti->ymax - 1,
497  };
498 
499  const float w = BLI_rctf_size_x(&rect);
500  const float h = BLI_rctf_size_y(&rect) * hist->ymax;
501 
503 
504  float color[4];
508  &(const rctf){
509  .xmin = rect.xmin - 1,
510  .xmax = rect.xmax + 1,
511  .ymin = rect.ymin - 1,
512  .ymax = rect.ymax + 1,
513  },
514  true,
515  3.0f,
516  color);
517 
518  /* need scissor test, histogram can draw outside of boundary */
519  int scissor[4];
520  GPU_scissor_get(scissor);
521  GPU_scissor((rect.xmin - 1),
522  (rect.ymin - 1),
523  (rect.xmax + 1) - (rect.xmin - 1),
524  (rect.ymax + 1) - (rect.ymin - 1));
525 
528 
530 
531  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
532  /* draw grid lines here */
533  for (int i = 1; i <= HISTOGRAM_TOT_GRID_LINES; i++) {
534  const float fac = (float)i / (float)HISTOGRAM_TOT_GRID_LINES;
535 
536  /* so we can tell the 1.0 color point */
537  if (i == HISTOGRAM_TOT_GRID_LINES) {
538  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
539  }
540 
542 
543  immVertex2f(pos, rect.xmin, rect.ymin + fac * h);
544  immVertex2f(pos, rect.xmax, rect.ymin + fac * h);
545 
546  immVertex2f(pos, rect.xmin + fac * w, rect.ymin);
547  immVertex2f(pos, rect.xmin + fac * w, rect.ymax);
548 
549  immEnd();
550  }
551 
552  if (hist->mode == HISTO_MODE_LUMA) {
554  1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res, is_line, pos);
555  }
556  else if (hist->mode == HISTO_MODE_ALPHA) {
558  1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_a, res, is_line, pos);
559  }
560  else {
561  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_R)) {
563  1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res, is_line, pos);
564  }
565  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_G)) {
567  0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res, is_line, pos);
568  }
569  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_B)) {
571  0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res, is_line, pos);
572  }
573  }
574 
576 
577  /* Restore scissor test. */
578  GPU_scissor(UNPACK4(scissor));
579 
580  /* outline */
581  draw_scope_end(&rect);
582 }
583 
584 #undef HISTOGRAM_TOT_GRID_LINES
585 
586 static void waveform_draw_one(float *waveform, int nbr, const float col[3])
587 {
588  GPUVertFormat format = {0};
589  const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
590 
592  GPU_vertbuf_data_alloc(vbo, nbr);
593 
594  GPU_vertbuf_attr_fill(vbo, pos_id, waveform);
595 
596  /* TODO store the GPUBatch inside the scope */
599  GPU_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f);
601 
603 }
604 
606  uiBut *but,
607  const uiWidgetColors *UNUSED(wcol),
608  const rcti *recti)
609 {
610  Scopes *scopes = (Scopes *)but->poin;
611  int scissor[4];
612  float colors[3][3];
613  const float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
614  /* colors pre multiplied by alpha for speed up */
615  float colors_alpha[3][3], colorsycc_alpha[3][3];
616  float min, max;
617 
618  if (scopes == NULL) {
619  return;
620  }
621 
622  rctf rect = {
623  .xmin = (float)recti->xmin + 1,
624  .xmax = (float)recti->xmax - 1,
625  .ymin = (float)recti->ymin + 1,
626  .ymax = (float)recti->ymax - 1,
627  };
628 
629  if (scopes->wavefrm_yfac < 0.5f) {
630  scopes->wavefrm_yfac = 0.98f;
631  }
632  const float w = BLI_rctf_size_x(&rect) - 7;
633  const float h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac;
634  const float yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) * 0.5f;
635  const float w3 = w / 3.0f;
636 
637  /* log scale for alpha */
638  const float alpha = scopes->wavefrm_alpha * scopes->wavefrm_alpha;
639 
640  unit_m3(colors);
641 
642  for (int c = 0; c < 3; c++) {
643  for (int i = 0; i < 3; i++) {
644  colors_alpha[c][i] = colors[c][i] * alpha;
645  colorsycc_alpha[c][i] = colorsycc[c][i] * alpha;
646  }
647  }
648 
649  /* Flush text cache before changing scissors. */
651 
653 
654  float color[4];
658  &(const rctf){
659  .xmin = rect.xmin - 1,
660  .xmax = rect.xmax + 1,
661  .ymin = rect.ymin - 1,
662  .ymax = rect.ymax + 1,
663  },
664  true,
665  3.0f,
666  color);
667 
668  /* need scissor test, waveform can draw outside of boundary */
669  GPU_scissor_get(scissor);
670  GPU_scissor((rect.xmin - 1),
671  (rect.ymin - 1),
672  (rect.xmax + 1) - (rect.xmin - 1),
673  (rect.ymax + 1) - (rect.ymin - 1));
674 
675  /* draw scale numbers first before binding any shader */
676  for (int i = 0; i < 6; i++) {
677  char str[4];
678  BLI_snprintf(str, sizeof(str), "%-3d", i * 20);
679  str[3] = '\0';
680  BLF_color4f(BLF_default(), 1.0f, 1.0f, 1.0f, 0.08f);
681  BLF_draw_default(rect.xmin + 1, yofs - 5 + (i * 0.2f) * h, 0, str, sizeof(str) - 1);
682  }
683 
684  /* Flush text cache before drawing things on top. */
686 
688 
691 
693 
694  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
695 
696  /* draw grid lines here */
698 
699  for (int i = 0; i < 6; i++) {
700  immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h);
701  immVertex2f(pos, rect.xmax + 1, yofs + (i * 0.2f) * h);
702  }
703 
704  immEnd();
705 
706  /* 3 vertical separation */
707  if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
709 
710  for (int i = 1; i < 3; i++) {
711  immVertex2f(pos, rect.xmin + i * w3, rect.ymin);
712  immVertex2f(pos, rect.xmin + i * w3, rect.ymax);
713  }
714 
715  immEnd();
716  }
717 
718  /* separate min max zone on the right */
720  immVertex2f(pos, rect.xmin + w, rect.ymin);
721  immVertex2f(pos, rect.xmin + w, rect.ymax);
722  immEnd();
723 
724  /* 16-235-240 level in case of ITU-R BT601/709 */
725  immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
726  if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
728 
729  immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f);
730  immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f);
731 
732  immVertex2f(pos, rect.xmin + 22, yofs + h * 235.0f / 255.0f);
733  immVertex2f(pos, rect.xmin + w3, yofs + h * 235.0f / 255.0f);
734 
735  immVertex2f(pos, rect.xmin + 3 * w3, yofs + h * 235.0f / 255.0f);
736  immVertex2f(pos, rect.xmax + 1, yofs + h * 235.0f / 255.0f);
737 
738  immVertex2f(pos, rect.xmin + w3, yofs + h * 240.0f / 255.0f);
739  immVertex2f(pos, rect.xmax + 1, yofs + h * 240.0f / 255.0f);
740 
741  immEnd();
742  }
743  /* 7.5 IRE black point level for NTSC */
744  if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
746  immVertex2f(pos, rect.xmin, yofs + h * 0.075f);
747  immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f);
748  immEnd();
749  }
750 
751  if (scopes->ok && scopes->waveform_1 != NULL) {
753  GPU_point_size(1.0);
754 
755  /* LUMA (1 channel) */
756  if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
757  const float col[3] = {alpha, alpha, alpha};
758 
759  GPU_matrix_push();
760  GPU_matrix_translate_2f(rect.xmin, yofs);
762 
763  waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, col);
764 
765  GPU_matrix_pop();
766 
767  /* min max */
768  immUniformColor3f(0.5f, 0.5f, 0.5f);
769  min = yofs + scopes->minmax[0][0] * h;
770  max = yofs + scopes->minmax[0][1] * h;
771  CLAMP(min, rect.ymin, rect.ymax);
772  CLAMP(max, rect.ymin, rect.ymax);
773 
775  immVertex2f(pos, rect.xmax - 3, min);
776  immVertex2f(pos, rect.xmax - 3, max);
777  immEnd();
778  }
779  /* RGB (3 channel) */
780  else if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) {
781  GPU_matrix_push();
782  GPU_matrix_translate_2f(rect.xmin, yofs);
784 
785  waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, colors_alpha[0]);
786  waveform_draw_one(scopes->waveform_2, scopes->waveform_tot, colors_alpha[1]);
787  waveform_draw_one(scopes->waveform_3, scopes->waveform_tot, colors_alpha[2]);
788 
789  GPU_matrix_pop();
790  }
791  /* PARADE / YCC (3 channels) */
792  else if (ELEM(scopes->wavefrm_mode,
797  const int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB_PARADE);
798 
799  GPU_matrix_push();
800  GPU_matrix_translate_2f(rect.xmin, yofs);
801  GPU_matrix_scale_2f(w3, h);
802 
804  scopes->waveform_1, scopes->waveform_tot, (rgb) ? colors_alpha[0] : colorsycc_alpha[0]);
805 
806  GPU_matrix_translate_2f(1.0f, 0.0f);
808  scopes->waveform_2, scopes->waveform_tot, (rgb) ? colors_alpha[1] : colorsycc_alpha[1]);
809 
810  GPU_matrix_translate_2f(1.0f, 0.0f);
812  scopes->waveform_3, scopes->waveform_tot, (rgb) ? colors_alpha[2] : colorsycc_alpha[2]);
813 
814  GPU_matrix_pop();
815  }
816 
817  /* min max */
818  if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
819  for (int c = 0; c < 3; c++) {
820  if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB_PARADE, SCOPES_WAVEFRM_RGB)) {
821  immUniformColor3f(colors[c][0] * 0.75f, colors[c][1] * 0.75f, colors[c][2] * 0.75f);
822  }
823  else {
825  colorsycc[c][0] * 0.75f, colorsycc[c][1] * 0.75f, colorsycc[c][2] * 0.75f);
826  }
827  min = yofs + scopes->minmax[c][0] * h;
828  max = yofs + scopes->minmax[c][1] * h;
829  CLAMP(min, rect.ymin, rect.ymax);
830  CLAMP(max, rect.ymin, rect.ymax);
831 
833  immVertex2f(pos, rect.xmin + w + 2 + c * 2, min);
834  immVertex2f(pos, rect.xmin + w + 2 + c * 2, max);
835  immEnd();
836  }
837  }
838  }
839 
841 
842  /* Restore scissor test. */
843  GPU_scissor(UNPACK4(scissor));
844 
845  /* outline */
846  draw_scope_end(&rect);
847 
849 }
850 
851 static float polar_to_x(float center, float diam, float ampli, float angle)
852 {
853  return center + diam * ampli * cosf(angle);
854 }
855 
856 static float polar_to_y(float center, float diam, float ampli, float angle)
857 {
858  return center + diam * ampli * sinf(angle);
859 }
860 
862  uint pos, float centerx, float centery, float diam, const float colf[3])
863 {
864  float y, u, v;
865  float tangle = 0.0f, tampli;
866  float dangle, dampli, dangle2, dampli2;
867 
868  rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v, BLI_YUV_ITU_BT709);
869 
870  if (u > 0 && v >= 0) {
871  tangle = atanf(v / u);
872  }
873  else if (u > 0 && v < 0) {
874  tangle = atanf(v / u) + 2.0f * (float)M_PI;
875  }
876  else if (u < 0) {
877  tangle = atanf(v / u) + (float)M_PI;
878  }
879  else if (u == 0 && v > 0.0f) {
880  tangle = M_PI_2;
881  }
882  else if (u == 0 && v < 0.0f) {
883  tangle = -M_PI_2;
884  }
885  tampli = sqrtf(u * u + v * v);
886 
887  /* small target vary by 2.5 degree and 2.5 IRE unit */
888  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
889  dangle = DEG2RADF(2.5f);
890  dampli = 2.5f / 200.0f;
893  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle),
894  polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
896  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle),
897  polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
899  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle),
900  polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
902  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
903  polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
904  immEnd();
905  /* big target vary by 10 degree and 20% amplitude */
906  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
907  dangle = DEG2RADF(10.0f);
908  dampli = 0.2f * tampli;
909  dangle2 = DEG2RADF(5.0f);
910  dampli2 = 0.5f * dampli;
913  polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle),
914  polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle));
916  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle),
917  polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
919  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2),
920  polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2));
921  immEnd();
924  polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle),
925  polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle));
927  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle),
928  polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
930  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2),
931  polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2));
932  immEnd();
935  polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle),
936  polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle));
938  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle),
939  polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
941  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2),
942  polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2));
943  immEnd();
946  polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle),
947  polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle));
949  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
950  polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
952  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2),
953  polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2));
954  immEnd();
955 }
956 
958  uiBut *but,
959  const uiWidgetColors *UNUSED(wcol),
960  const rcti *recti)
961 {
962  const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
963  Scopes *scopes = (Scopes *)but->poin;
964 
965  const float colors[6][3] = {
966  {0.75, 0.0, 0.0},
967  {0.75, 0.75, 0.0},
968  {0.0, 0.75, 0.0},
969  {0.0, 0.75, 0.75},
970  {0.0, 0.0, 0.75},
971  {0.75, 0.0, 0.75},
972  };
973 
974  rctf rect = {
975  .xmin = (float)recti->xmin + 1,
976  .xmax = (float)recti->xmax - 1,
977  .ymin = (float)recti->ymin + 1,
978  .ymax = (float)recti->ymax - 1,
979  };
980 
981  const float w = BLI_rctf_size_x(&rect);
982  const float h = BLI_rctf_size_y(&rect);
983  const float centerx = rect.xmin + w * 0.5f;
984  const float centery = rect.ymin + h * 0.5f;
985  const float diam = (w < h) ? w : h;
986 
987  const float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
988 
990 
991  float color[4];
995  &(const rctf){
996  .xmin = rect.xmin - 1,
997  .xmax = rect.xmax + 1,
998  .ymin = rect.ymin - 1,
999  .ymax = rect.ymax + 1,
1000  },
1001  true,
1002  3.0f,
1003  color);
1004 
1005  /* need scissor test, hvectorscope can draw outside of boundary */
1006  int scissor[4];
1007  GPU_scissor_get(scissor);
1008  GPU_scissor((rect.xmin - 1),
1009  (rect.ymin - 1),
1010  (rect.xmax + 1) - (rect.xmin - 1),
1011  (rect.ymax + 1) - (rect.ymin - 1));
1012 
1015 
1017 
1018  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
1019  /* draw grid elements */
1020  /* cross */
1022 
1023  immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery);
1024  immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery);
1025 
1026  immVertex2f(pos, centerx, centery - (diam * 0.5f) - 5);
1027  immVertex2f(pos, centerx, centery + (diam * 0.5f) + 5);
1028 
1029  immEnd();
1030 
1031  /* circles */
1032  for (int j = 0; j < 5; j++) {
1033  const int increment = 15;
1034  immBegin(GPU_PRIM_LINE_LOOP, (int)(360 / increment));
1035  for (int i = 0; i <= 360 - increment; i += increment) {
1036  const float a = DEG2RADF((float)i);
1037  const float r = (j + 1) * 0.1f;
1038  immVertex2f(pos, polar_to_x(centerx, diam, r, a), polar_to_y(centery, diam, r, a));
1039  }
1040  immEnd();
1041  }
1042  /* skin tone line */
1043  immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
1044 
1046  immVertex2f(
1047  pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad));
1048  immVertex2f(
1049  pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad));
1050  immEnd();
1051 
1052  /* saturation points */
1053  for (int i = 0; i < 6; i++) {
1054  vectorscope_draw_target(pos, centerx, centery, diam, colors[i]);
1055  }
1056 
1057  if (scopes->ok && scopes->vecscope != NULL) {
1058  /* pixel point cloud */
1059  const float col[3] = {alpha, alpha, alpha};
1060 
1062  GPU_point_size(1.0);
1063 
1064  GPU_matrix_push();
1065  GPU_matrix_translate_2f(centerx, centery);
1066  GPU_matrix_scale_1f(diam);
1067 
1068  waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col);
1069 
1070  GPU_matrix_pop();
1071  }
1072 
1073  immUnbindProgram();
1074 
1075  /* Restore scissor test. */
1076  GPU_scissor(UNPACK4(scissor));
1077  /* outline */
1078  draw_scope_end(&rect);
1079 
1081 }
1082 
1084  uint pos, float x1, float y1, float halfwidth, float height)
1085 {
1086  GPU_line_smooth(true);
1087 
1089  immVertex2f(pos, x1 + halfwidth, y1);
1090  immVertex2f(pos, x1, y1 + height);
1091  immVertex2f(pos, x1 - halfwidth, y1);
1092  immEnd();
1093 
1094  GPU_line_smooth(false);
1095 }
1096 
1098  uint pos, float x1, float y1, float halfwidth, float height, bool fill)
1099 {
1100  if (fill) {
1101  GPU_polygon_smooth(true);
1102  }
1103  else {
1104  GPU_line_smooth(true);
1105  }
1106 
1108  immVertex2f(pos, x1 + halfwidth, y1);
1109  immVertex2f(pos, x1, y1 + height);
1110  immVertex2f(pos, x1 - halfwidth, y1);
1111  immEnd();
1112 
1113  if (fill) {
1114  GPU_polygon_smooth(false);
1115  }
1116  else {
1117  GPU_line_smooth(false);
1118  }
1119 }
1120 
1122  uint pos, float x1, float y1, float x2, float y2, bool fill)
1123 {
1125  immVertex2f(pos, x1, y1);
1126  immVertex2f(pos, x1, y2);
1127  immVertex2f(pos, x2, y2);
1128  immVertex2f(pos, x2, y1);
1129  immEnd();
1130 }
1131 
1132 static void ui_draw_colorband_handle(uint shdr_pos,
1133  const rcti *rect,
1134  float x,
1135  const float rgb[3],
1136  struct ColorManagedDisplay *display,
1137  bool active)
1138 {
1139  const float sizey = BLI_rcti_size_y(rect);
1140  const float min_width = 3.0f;
1141  float colf[3] = {UNPACK3(rgb)};
1142 
1143  const float half_width = floorf(sizey / 3.5f);
1144  const float height = half_width * 1.4f;
1145 
1146  float y1 = rect->ymin + (sizey * 0.16f);
1147  const float y2 = rect->ymax;
1148 
1149  /* align to pixels */
1150  x = floorf(x + 0.5f);
1151  y1 = floorf(y1 + 0.5f);
1152 
1153  if (active || half_width < min_width) {
1154  immUnbindProgram();
1155 
1157 
1158  float viewport_size[4];
1159  GPU_viewport_size_get_f(viewport_size);
1160  immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
1161 
1162  immUniform1i("colors_len", 2); /* "advanced" mode */
1164  "colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
1165  immUniform1f("dash_width", active ? 4.0f : 2.0f);
1166  immUniform1f("dash_factor", 0.5f);
1167 
1169  immVertex2f(shdr_pos, x, y1);
1170  immVertex2f(shdr_pos, x, y2);
1171  immEnd();
1172 
1173  immUnbindProgram();
1174 
1176 
1177  /* hide handles when zoomed out too far */
1178  if (half_width < min_width) {
1179  return;
1180  }
1181  }
1182 
1183  /* shift handle down */
1184  y1 -= half_width;
1185 
1186  immUniformColor3ub(0, 0, 0);
1188  shdr_pos, x - half_width, y1 - 1, x + half_width, y1 + height, false);
1189 
1190  /* draw all triangles blended */
1192 
1193  ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
1194 
1195  if (active) {
1196  immUniformColor3ub(196, 196, 196);
1197  }
1198  else {
1199  immUniformColor3ub(96, 96, 96);
1200  }
1201  ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
1202 
1203  if (active) {
1204  immUniformColor3ub(255, 255, 255);
1205  }
1206  else {
1207  immUniformColor3ub(128, 128, 128);
1208  }
1210  shdr_pos, x, y1 + height - 1, (half_width - 1), (half_width - 1));
1211 
1212  immUniformColor3ub(0, 0, 0);
1213  ui_draw_colorband_handle_tri_hlight(shdr_pos, x, y1 + height, half_width, half_width);
1214 
1216 
1217  immUniformColor3ub(128, 128, 128);
1219  shdr_pos, x - (half_width - 1), y1, x + (half_width - 1), y1 + height, true);
1220 
1221  if (display) {
1223  }
1224 
1225  immUniformColor3fv(colf);
1227  shdr_pos, x - (half_width - 2), y1 + 1, x + (half_width - 2), y1 + height - 2, true);
1228 }
1229 
1230 void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
1231 {
1232  struct ColorManagedDisplay *display = ui_block_cm_display_get(but->block);
1233  uint pos_id, col_id;
1234 
1235  uiButColorBand *but_coba = (uiButColorBand *)but;
1236  ColorBand *coba = (but_coba->edit_coba == NULL) ? (ColorBand *)but->poin : but_coba->edit_coba;
1237 
1238  if (coba == NULL) {
1239  return;
1240  }
1241 
1242  const float x1 = rect->xmin;
1243  const float sizex = rect->xmax - x1;
1244  const float sizey = BLI_rcti_size_y(rect);
1245  const float sizey_solid = sizey * 0.25f;
1246  const float y1 = rect->ymin;
1247 
1248  /* exit early if too narrow */
1249  if (sizex <= 0) {
1250  return;
1251  }
1252 
1256 
1257  /* Drawing the checkerboard. */
1258  const float checker_dark = UI_ALPHA_CHECKER_DARK / 255.0f;
1259  const float checker_light = UI_ALPHA_CHECKER_LIGHT / 255.0f;
1260  immUniform4f("color1", checker_dark, checker_dark, checker_dark, 1.0f);
1261  immUniform4f("color2", checker_light, checker_light, checker_light, 1.0f);
1262  immUniform1i("size", 8);
1263  immRectf(pos_id, x1, y1, x1 + sizex, rect->ymax);
1264  immUnbindProgram();
1265 
1266  /* New format */
1267  format = immVertexFormat();
1271 
1272  /* layer: color ramp */
1274 
1275  CBData *cbd = coba->data;
1276 
1277  float v1[2], v2[2];
1278  float colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */
1279 
1280  v1[1] = y1 + sizey_solid;
1281  v2[1] = rect->ymax;
1282 
1283  immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
1284  for (int a = 0; a <= sizex; a++) {
1285  const float pos = ((float)a) / sizex;
1286  BKE_colorband_evaluate(coba, pos, colf);
1287  if (display) {
1289  }
1290 
1291  v1[0] = v2[0] = x1 + a;
1292 
1293  immAttr4fv(col_id, colf);
1294  immVertex2fv(pos_id, v1);
1295  immVertex2fv(pos_id, v2);
1296  }
1297  immEnd();
1298 
1299  /* layer: color ramp without alpha for reference when manipulating ramp properties */
1300  v1[1] = y1;
1301  v2[1] = y1 + sizey_solid;
1302 
1303  immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
1304  for (int a = 0; a <= sizex; a++) {
1305  const float pos = ((float)a) / sizex;
1306  BKE_colorband_evaluate(coba, pos, colf);
1307  if (display) {
1309  }
1310 
1311  v1[0] = v2[0] = x1 + a;
1312 
1313  immAttr4f(col_id, colf[0], colf[1], colf[2], 1.0f);
1314  immVertex2fv(pos_id, v1);
1315  immVertex2fv(pos_id, v2);
1316  }
1317  immEnd();
1318 
1319  immUnbindProgram();
1320 
1322 
1323  /* New format */
1324  format = immVertexFormat();
1327 
1328  /* layer: box outline */
1329  immUniformColor4f(0.0f, 0.0f, 0.0f, 1.0f);
1330  imm_draw_box_wire_2d(pos_id, x1, y1, x1 + sizex, rect->ymax);
1331 
1332  /* layer: box outline */
1334  immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
1335 
1337  immVertex2f(pos_id, x1, y1);
1338  immVertex2f(pos_id, x1 + sizex, y1);
1339  immEnd();
1340 
1341  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f);
1342 
1344  immVertex2f(pos_id, x1, y1 - 1);
1345  immVertex2f(pos_id, x1 + sizex, y1 - 1);
1346  immEnd();
1347 
1349 
1350  /* layer: draw handles */
1351  for (int a = 0; a < coba->tot; a++, cbd++) {
1352  if (a != coba->cur) {
1353  const float pos = x1 + cbd->pos * (sizex - 1) + 1;
1354  ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, false);
1355  }
1356  }
1357 
1358  /* layer: active handle */
1359  if (coba->tot != 0) {
1360  cbd = &coba->data[coba->cur];
1361  const float pos = x1 + cbd->pos * (sizex - 1) + 1;
1362  ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, true);
1363  }
1364 
1365  immUnbindProgram();
1366 }
1367 
1368 void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
1369 {
1370  /* sphere color */
1371  const float diffuse[3] = {1.0f, 1.0f, 1.0f};
1372  float light[3];
1373  const float size = 0.5f * min_ff(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
1374 
1375  /* backdrop */
1378  &(const rctf){
1379  .xmin = rect->xmin,
1380  .xmax = rect->xmax,
1381  .ymin = rect->ymin,
1382  .ymax = rect->ymax,
1383  },
1384  true,
1385  5.0f,
1386  wcol->inner,
1387  255);
1388 
1390 
1391  /* setup lights */
1392  ui_but_v3_get(but, light);
1393 
1394  /* transform to button */
1395  GPU_matrix_push();
1396 
1397  const bool use_project_matrix = (size >= -GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT);
1398  if (use_project_matrix) {
1401  }
1402 
1403  GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect),
1404  rect->ymin + 0.5f * BLI_rcti_size_y(rect));
1406 
1407  GPUBatch *sphere = GPU_batch_preset_sphere(2);
1409  GPU_batch_uniform_4f(sphere, "color", diffuse[0], diffuse[1], diffuse[2], 1.0f);
1410  GPU_batch_uniform_3fv(sphere, "light", light);
1411  GPU_batch_draw(sphere);
1412 
1413  /* Restore. */
1415 
1416  /* AA circle */
1420  immUniformColor3ubv(wcol->inner);
1421 
1423  GPU_line_smooth(true);
1424  imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, 1.0f, 32);
1426  GPU_line_smooth(false);
1427 
1428  if (use_project_matrix) {
1430  }
1431 
1432  /* matrix after circle */
1433  GPU_matrix_pop();
1434 
1435  immUnbindProgram();
1436 }
1437 
1438 static void ui_draw_but_curve_grid(const uint pos,
1439  const rcti *rect,
1440  const float zoom_x,
1441  const float zoom_y,
1442  const float offset_x,
1443  const float offset_y,
1444  const float step)
1445 {
1446  const float start_x = (ceilf(offset_x / step) * step - offset_x) * zoom_x + rect->xmin;
1447  const float start_y = (ceilf(offset_y / step) * step - offset_y) * zoom_y + rect->ymin;
1448 
1449  const int line_count_x = ceilf((rect->xmax - start_x) / (step * zoom_x));
1450  const int line_count_y = ceilf((rect->ymax - start_y) / (step * zoom_y));
1451 
1452  if (line_count_x + line_count_y == 0) {
1453  return;
1454  }
1455 
1456  immBegin(GPU_PRIM_LINES, (line_count_x + line_count_y) * 2);
1457  for (int i = 0; i < line_count_x; i++) {
1458  const float x = start_x + i * step * zoom_x;
1459  immVertex2f(pos, x, rect->ymin);
1460  immVertex2f(pos, x, rect->ymax);
1461  }
1462  for (int i = 0; i < line_count_y; i++) {
1463  const float y = start_y + i * step * zoom_y;
1464  immVertex2f(pos, rect->xmin, y);
1465  immVertex2f(pos, rect->xmax, y);
1466  }
1467  immEnd();
1468 }
1469 
1470 static void gl_shaded_color_get(const uchar color[3], int shade, uchar r_color[3])
1471 {
1472  r_color[0] = color[0] - shade > 0 ? color[0] - shade : 0;
1473  r_color[1] = color[1] - shade > 0 ? color[1] - shade : 0;
1474  r_color[2] = color[2] - shade > 0 ? color[2] - shade : 0;
1475 }
1476 
1477 static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[3])
1478 {
1479  uchar color_shaded[3];
1480  gl_shaded_color_get(color, shade, color_shaded);
1481  rgb_uchar_to_float(r_color, color_shaded);
1482 }
1483 
1484 static void gl_shaded_color(const uchar *color, int shade)
1485 {
1486  uchar color_shaded[3];
1487  gl_shaded_color_get(color, shade, color_shaded);
1488  immUniformColor3ubv(color_shaded);
1489 }
1490 
1491 void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
1492 {
1493  uiButCurveMapping *but_cumap = (uiButCurveMapping *)but;
1494  CurveMapping *cumap = (but_cumap->edit_cumap == NULL) ? (CurveMapping *)but->poin :
1495  but_cumap->edit_cumap;
1496 
1497  const float clip_size_x = BLI_rctf_size_x(&cumap->curr);
1498  const float clip_size_y = BLI_rctf_size_y(&cumap->curr);
1499 
1500  /* zero-sized curve */
1501  if (clip_size_x == 0.0f || clip_size_y == 0.0f) {
1502  return;
1503  }
1504 
1505  /* calculate offset and zoom */
1506  const float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / clip_size_x;
1507  const float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / clip_size_y;
1508  const float offsx = cumap->curr.xmin - (1.0f / zoomx);
1509  const float offsy = cumap->curr.ymin - (1.0f / zoomy);
1510 
1511  /* exit early if too narrow */
1512  if (zoomx == 0.0f) {
1513  return;
1514  }
1515 
1516  CurveMap *cuma = &cumap->cm[cumap->cur];
1517 
1518  /* need scissor test, curve can draw outside of boundary */
1519  int scissor[4];
1520  GPU_scissor_get(scissor);
1521  rcti scissor_new = {
1522  .xmin = rect->xmin,
1523  .ymin = rect->ymin,
1524  .xmax = rect->xmax,
1525  .ymax = rect->ymax,
1526  };
1527  const rcti scissor_region = {0, region->winx, 0, region->winy};
1528  BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
1529  GPU_scissor(scissor_new.xmin,
1530  scissor_new.ymin,
1531  BLI_rcti_size_x(&scissor_new),
1532  BLI_rcti_size_y(&scissor_new));
1533 
1534  /* Do this first to not mess imm context */
1535  if (but_cumap->gradient_type == UI_GRAD_H) {
1536  /* magic trigger for curve backgrounds */
1537  const float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
1538 
1539  rcti grid = {
1540  .xmin = rect->xmin + zoomx * (-offsx),
1541  .xmax = grid.xmin + zoomx,
1542  .ymin = rect->ymin + zoomy * (-offsy),
1543  .ymax = grid.ymin + zoomy,
1544  };
1545 
1546  ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
1547  }
1548 
1549  GPU_line_width(1.0f);
1550 
1554 
1555  /* backdrop */
1556  float color_backdrop[4] = {0, 0, 0, 1};
1557 
1558  if (but_cumap->gradient_type == UI_GRAD_H) {
1559  /* grid, hsv uses different grid */
1561  ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0);
1562  immUniformColor4fv(color_backdrop);
1563  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
1565  }
1566  else {
1567  if (cumap->flag & CUMA_DO_CLIP) {
1568  gl_shaded_color_get_fl(wcol->inner, -20, color_backdrop);
1569  immUniformColor3fv(color_backdrop);
1570  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1571  immUniformColor3ubv(wcol->inner);
1572  immRectf(pos,
1573  rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
1574  rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
1575  rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
1576  rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
1577  }
1578  else {
1579  rgb_uchar_to_float(color_backdrop, wcol->inner);
1580  immUniformColor3fv(color_backdrop);
1581  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1582  }
1583 
1584  /* grid, every 0.25 step */
1585  gl_shaded_color(wcol->inner, -16);
1586  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f);
1587  /* grid, every 1.0 step */
1588  gl_shaded_color(wcol->inner, -24);
1589  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
1590  /* axes */
1591  gl_shaded_color(wcol->inner, -50);
1593  immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy));
1594  immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy));
1595  immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin);
1596  immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymax);
1597  immEnd();
1598  }
1599 
1600  /* cfra option */
1601  /* XXX 2.48 */
1602 #if 0
1603  if (cumap->flag & CUMA_DRAW_CFRA) {
1604  immUniformColor3ub(0x60, 0xc0, 0x40);
1606  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin);
1607  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax);
1608  immEnd();
1609  }
1610 #endif
1611  /* sample option */
1612 
1613  if (cumap->flag & CUMA_DRAW_SAMPLE) {
1614  immBegin(GPU_PRIM_LINES, 2); /* will draw one of the following 3 lines */
1615  if (but_cumap->gradient_type == UI_GRAD_H) {
1616  float tsample[3];
1617  float hsv[3];
1618  linearrgb_to_srgb_v3_v3(tsample, cumap->sample);
1619  rgb_to_hsv_v(tsample, hsv);
1620  immUniformColor3ub(240, 240, 240);
1621 
1622  immVertex2f(pos, rect->xmin + zoomx * (hsv[0] - offsx), rect->ymin);
1623  immVertex2f(pos, rect->xmin + zoomx * (hsv[0] - offsx), rect->ymax);
1624  }
1625  else if (cumap->cur == 3) {
1626  const float lum = IMB_colormanagement_get_luminance(cumap->sample);
1627  immUniformColor3ub(240, 240, 240);
1628 
1629  immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymin);
1630  immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymax);
1631  }
1632  else {
1633  if (cumap->cur == 0) {
1634  immUniformColor3ub(240, 100, 100);
1635  }
1636  else if (cumap->cur == 1) {
1637  immUniformColor3ub(100, 240, 100);
1638  }
1639  else {
1640  immUniformColor3ub(100, 100, 240);
1641  }
1642 
1643  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymin);
1644  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymax);
1645  }
1646  immEnd();
1647  }
1648  immUnbindProgram();
1649 
1650  if (cuma->table == NULL) {
1651  BKE_curvemapping_changed(cumap, false);
1652  }
1653 
1654  CurveMapPoint *cmp = cuma->table;
1655  rctf line_range;
1656 
1657  /* First curve point. */
1658  if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
1659  line_range.xmin = rect->xmin;
1660  line_range.ymin = rect->ymin + zoomy * (cmp[0].y - offsy);
1661  }
1662  else {
1663  line_range.xmin = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
1664  line_range.ymin = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
1665  }
1666  /* Last curve point. */
1667  if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
1668  line_range.xmax = rect->xmax;
1669  line_range.ymax = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy);
1670  }
1671  else {
1672  line_range.xmax = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
1673  line_range.ymax = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
1674  }
1675 
1678 
1679  /* Curve filled. */
1680  immUniformColor3ubvAlpha(wcol->item, 128);
1681  immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4);
1682  immVertex2f(pos, line_range.xmin, rect->ymin);
1683  immVertex2f(pos, line_range.xmin, line_range.ymin);
1684  for (int a = 0; a <= CM_TABLE; a++) {
1685  const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
1686  const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
1687  immVertex2f(pos, fx, rect->ymin);
1688  immVertex2f(pos, fx, fy);
1689  }
1690  immVertex2f(pos, line_range.xmax, rect->ymin);
1691  immVertex2f(pos, line_range.xmax, line_range.ymax);
1692  immEnd();
1693 
1694  /* Curve line. */
1695  GPU_line_width(1.0f);
1696  immUniformColor3ubvAlpha(wcol->item, 255);
1697  GPU_line_smooth(true);
1699  immVertex2f(pos, line_range.xmin, line_range.ymin);
1700  for (int a = 0; a <= CM_TABLE; a++) {
1701  const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
1702  const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
1703  immVertex2f(pos, fx, fy);
1704  }
1705  immVertex2f(pos, line_range.xmax, line_range.ymax);
1706  immEnd();
1707 
1708  /* Reset state for fill & line. */
1709  GPU_line_smooth(false);
1711  immUnbindProgram();
1712 
1713  /* The points, use aspect to make them visible on edges. */
1714  format = immVertexFormat();
1718 
1719  /* Calculate vertex colors based on text theme. */
1720  float color_vert[4], color_vert_select[4];
1721  UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
1722  UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
1723  if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
1724  interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
1725  }
1726  if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
1727  /* Ensure brightest text color is used for selection. */
1728  swap_v3_v3(color_vert, color_vert_select);
1729  }
1730 
1731  cmp = cuma->curve;
1732  GPU_point_size(max_ff(1.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
1734  for (int a = 0; a < cuma->totpoint; a++) {
1735  const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
1736  const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
1737  immAttr4fv(col, (cmp[a].flag & CUMA_SELECT) ? color_vert_select : color_vert);
1738  immVertex2f(pos, fx, fy);
1739  }
1740  immEnd();
1741  immUnbindProgram();
1742 
1743  /* Restore scissor-test. */
1744  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
1745 
1746  /* outline */
1747  format = immVertexFormat();
1750 
1752  imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1753 
1754  immUnbindProgram();
1755 }
1756 
1761 {
1762  return (point->flag & PROF_SELECT &&
1763  (ELEM(point->h1, HD_FREE, HD_ALIGN) || ELEM(point->h2, HD_FREE, HD_ALIGN))) ||
1765 }
1766 
1771  uiBut *but,
1772  const uiWidgetColors *wcol,
1773  const rcti *rect)
1774 {
1775  float fx, fy;
1776 
1777  uiButCurveProfile *but_profile = (uiButCurveProfile *)but;
1778  CurveProfile *profile = (but_profile->edit_profile == NULL) ? (CurveProfile *)but->poin :
1779  but_profile->edit_profile;
1780 
1781  /* Calculate offset and zoom. */
1782  const float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&profile->view_rect);
1783  const float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / BLI_rctf_size_y(&profile->view_rect);
1784  const float offsx = profile->view_rect.xmin - (1.0f / zoomx);
1785  const float offsy = profile->view_rect.ymin - (1.0f / zoomy);
1786 
1787  /* Exit early if too narrow. */
1788  if (zoomx == 0.0f) {
1789  return;
1790  }
1791 
1792  /* Test needed because path can draw outside of boundary. */
1793  int scissor[4];
1794  GPU_scissor_get(scissor);
1795  rcti scissor_new = {
1796  .xmin = rect->xmin,
1797  .ymin = rect->ymin,
1798  .xmax = rect->xmax,
1799  .ymax = rect->ymax,
1800  };
1801  const rcti scissor_region = {0, region->winx, 0, region->winy};
1802  BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
1803  GPU_scissor(scissor_new.xmin,
1804  scissor_new.ymin,
1805  BLI_rcti_size_x(&scissor_new),
1806  BLI_rcti_size_y(&scissor_new));
1807 
1808  GPU_line_width(1.0f);
1809 
1813 
1814  /* Draw the backdrop. */
1815  float color_backdrop[4] = {0, 0, 0, 1};
1816  if (profile->flag & PROF_USE_CLIP) {
1817  gl_shaded_color_get_fl((uchar *)wcol->inner, -20, color_backdrop);
1818  immUniformColor3fv(color_backdrop);
1819  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1820  immUniformColor3ubv((uchar *)wcol->inner);
1821  immRectf(pos,
1822  rect->xmin + zoomx * (profile->clip_rect.xmin - offsx),
1823  rect->ymin + zoomy * (profile->clip_rect.ymin - offsy),
1824  rect->xmin + zoomx * (profile->clip_rect.xmax - offsx),
1825  rect->ymin + zoomy * (profile->clip_rect.ymax - offsy));
1826  }
1827  else {
1828  rgb_uchar_to_float(color_backdrop, (uchar *)wcol->inner);
1829  immUniformColor3fv(color_backdrop);
1830  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1831  }
1832 
1833  /* 0.25 step grid. */
1834  gl_shaded_color((uchar *)wcol->inner, -16);
1835  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f);
1836  /* 1.0 step grid. */
1837  gl_shaded_color((uchar *)wcol->inner, -24);
1838  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
1839 
1840  /* Draw the path's fill. */
1841  if (profile->table == NULL) {
1843  }
1844  CurveProfilePoint *pts = profile->table;
1845  /* Also add the last points on the right and bottom edges to close off the fill polygon. */
1846  const bool add_left_tri = profile->view_rect.xmin < 0.0f;
1847  const bool add_bottom_tri = profile->view_rect.ymin < 0.0f;
1848  uint tot_points = (uint)PROF_TABLE_LEN(profile->path_len) + 1 + add_left_tri + add_bottom_tri;
1849  const uint tot_triangles = tot_points - 2;
1850 
1851  /* Create array of the positions of the table's points. */
1852  float(*table_coords)[2] = MEM_mallocN(sizeof(*table_coords) * tot_points, "table x coords");
1853  for (uint i = 0; i < (uint)PROF_TABLE_LEN(profile->path_len);
1854  i++) { /* Only add the points from the table here. */
1855  table_coords[i][0] = pts[i].x;
1856  table_coords[i][1] = pts[i].y;
1857  }
1858  /* Using some extra margin (-1.0f) for the coordinates used to complete the polygon
1859  * avoids the profile line crossing itself in some common situations, which can lead to
1860  * incorrect triangulation. See T841183. */
1861  if (add_left_tri && add_bottom_tri) {
1862  /* Add left side, bottom left corner, and bottom side points. */
1863  table_coords[tot_points - 3][0] = profile->view_rect.xmin - 1.0f;
1864  table_coords[tot_points - 3][1] = 1.0f;
1865  table_coords[tot_points - 2][0] = profile->view_rect.xmin - 1.0f;
1866  table_coords[tot_points - 2][1] = profile->view_rect.ymin - 1.0f;
1867  table_coords[tot_points - 1][0] = 1.0f;
1868  table_coords[tot_points - 1][1] = profile->view_rect.ymin - 1.0f;
1869  }
1870  else if (add_left_tri) {
1871  /* Add the left side and bottom left corner points. */
1872  table_coords[tot_points - 2][0] = profile->view_rect.xmin - 1.0f;
1873  table_coords[tot_points - 2][1] = 1.0f;
1874  table_coords[tot_points - 1][0] = profile->view_rect.xmin - 1.0f;
1875  table_coords[tot_points - 1][1] = -1.0f;
1876  }
1877  else if (add_bottom_tri) {
1878  /* Add the bottom side and bottom left corner points. */
1879  table_coords[tot_points - 2][0] = -1.0f;
1880  table_coords[tot_points - 2][1] = profile->view_rect.ymin - 1.0f;
1881  table_coords[tot_points - 1][0] = 1.0f;
1882  table_coords[tot_points - 1][1] = profile->view_rect.ymin - 1.0f;
1883  }
1884  else {
1885  /* Just add the bottom corner point. Side points would be redundant anyway. */
1886  table_coords[tot_points - 1][0] = -1.0f;
1887  table_coords[tot_points - 1][1] = -1.0f;
1888  }
1889 
1890  /* Calculate the table point indices of the triangles for the profile's fill. */
1891  uint(*tri_indices)[3] = MEM_mallocN(sizeof(*tri_indices) * tot_triangles, "return tri indices");
1892  BLI_polyfill_calc(table_coords, tot_points, -1, tri_indices);
1893 
1894  /* Draw the triangles for the profile fill. */
1895  immUniformColor3ubvAlpha((const uchar *)wcol->item, 128);
1897  GPU_polygon_smooth(false);
1898  immBegin(GPU_PRIM_TRIS, 3 * tot_triangles);
1899  for (uint i = 0; i < tot_triangles; i++) {
1900  for (uint j = 0; j < 3; j++) {
1901  uint *tri = tri_indices[i];
1902  fx = rect->xmin + zoomx * (table_coords[tri[j]][0] - offsx);
1903  fy = rect->ymin + zoomy * (table_coords[tri[j]][1] - offsy);
1904  immVertex2f(pos, fx, fy);
1905  }
1906  }
1907  immEnd();
1908  MEM_freeN(tri_indices);
1909 
1910  /* Draw the profile's path so the edge stands out a bit. */
1911  tot_points -= (add_left_tri + add_left_tri);
1912  GPU_line_width(1.0f);
1913  immUniformColor3ubvAlpha((const uchar *)wcol->item, 255);
1914  GPU_line_smooth(true);
1915  immBegin(GPU_PRIM_LINE_STRIP, tot_points - 1);
1916  for (uint i = 0; i < tot_points - 1; i++) {
1917  fx = rect->xmin + zoomx * (table_coords[i][0] - offsx);
1918  fy = rect->ymin + zoomy * (table_coords[i][1] - offsy);
1919  immVertex2f(pos, fx, fy);
1920  }
1921  immEnd();
1922  MEM_freeN(table_coords);
1923 
1924  /* Draw the handles for the selected control points. */
1925  pts = profile->path;
1926  tot_points = (uint)profile->path_len;
1927  int selected_free_points = 0;
1928  for (uint i = 0; i < tot_points; i++) {
1929  if (point_draw_handles(&pts[i])) {
1930  selected_free_points++;
1931  }
1932  }
1933  /* Draw the lines to the handles from the points. */
1934  if (selected_free_points > 0) {
1935  GPU_line_width(1.0f);
1936  gl_shaded_color((uchar *)wcol->inner, -24);
1937  GPU_line_smooth(true);
1938  immBegin(GPU_PRIM_LINES, selected_free_points * 4);
1939  float ptx, pty;
1940  for (uint i = 0; i < tot_points; i++) {
1941  if (point_draw_handles(&pts[i])) {
1942  ptx = rect->xmin + zoomx * (pts[i].x - offsx);
1943  pty = rect->ymin + zoomy * (pts[i].y - offsy);
1944 
1945  fx = rect->xmin + zoomx * (pts[i].h1_loc[0] - offsx);
1946  fy = rect->ymin + zoomy * (pts[i].h1_loc[1] - offsy);
1947  immVertex2f(pos, ptx, pty);
1948  immVertex2f(pos, fx, fy);
1949 
1950  fx = rect->xmin + zoomx * (pts[i].h2_loc[0] - offsx);
1951  fy = rect->ymin + zoomy * (pts[i].h2_loc[1] - offsy);
1952  immVertex2f(pos, ptx, pty);
1953  immVertex2f(pos, fx, fy);
1954  }
1955  }
1956  immEnd();
1957  }
1958  immUnbindProgram();
1959 
1960  /* New GPU instructions for control points and sampled points. */
1961  format = immVertexFormat();
1965 
1966  /* Calculate vertex colors based on text theme. */
1967  float color_vert[4], color_vert_select[4], color_sample[4];
1968  UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
1969  UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
1970  color_sample[0] = (float)wcol->item[0] / 255.0f;
1971  color_sample[1] = (float)wcol->item[1] / 255.0f;
1972  color_sample[2] = (float)wcol->item[2] / 255.0f;
1973  color_sample[3] = (float)wcol->item[3] / 255.0f;
1974  if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
1975  interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
1976  }
1977  if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
1978  /* Ensure brightest text color is used for selection. */
1979  swap_v3_v3(color_vert, color_vert_select);
1980  }
1981 
1982  /* Draw the control points. */
1983  GPU_line_smooth(false);
1985  GPU_point_size(max_ff(3.0f, min_ff(UI_DPI_FAC / but->block->aspect * 5.0f, 5.0f)));
1986  immBegin(GPU_PRIM_POINTS, tot_points);
1987  for (uint i = 0; i < tot_points; i++) {
1988  fx = rect->xmin + zoomx * (pts[i].x - offsx);
1989  fy = rect->ymin + zoomy * (pts[i].y - offsy);
1990  immAttr4fv(col, (pts[i].flag & PROF_SELECT) ? color_vert_select : color_vert);
1991  immVertex2f(pos, fx, fy);
1992  }
1993  immEnd();
1994 
1995  /* Draw the handle points. */
1996  if (selected_free_points > 0) {
1997  GPU_line_smooth(false);
1999  GPU_point_size(max_ff(2.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
2000  immBegin(GPU_PRIM_POINTS, selected_free_points * 2);
2001  for (uint i = 0; i < tot_points; i++) {
2002  if (point_draw_handles(&pts[i])) {
2003  fx = rect->xmin + zoomx * (pts[i].h1_loc[0] - offsx);
2004  fy = rect->ymin + zoomy * (pts[i].h1_loc[1] - offsy);
2005  immAttr4fv(col, (pts[i].flag & PROF_H1_SELECT) ? color_vert_select : color_vert);
2006  immVertex2f(pos, fx, fy);
2007 
2008  fx = rect->xmin + zoomx * (pts[i].h2_loc[0] - offsx);
2009  fy = rect->ymin + zoomy * (pts[i].h2_loc[1] - offsy);
2010  immAttr4fv(col, (pts[i].flag & PROF_H2_SELECT) ? color_vert_select : color_vert);
2011  immVertex2f(pos, fx, fy);
2012  }
2013  }
2014  immEnd();
2015  }
2016 
2017  /* Draw the sampled points in addition to the control points if they have been created */
2018  pts = profile->segments;
2019  tot_points = (uint)profile->segments_len;
2020  if (tot_points > 0 && pts) {
2021  GPU_point_size(max_ff(2.0f, min_ff(UI_DPI_FAC / but->block->aspect * 3.0f, 3.0f)));
2022  immBegin(GPU_PRIM_POINTS, tot_points);
2023  for (uint i = 0; i < tot_points; i++) {
2024  fx = rect->xmin + zoomx * (pts[i].x - offsx);
2025  fy = rect->ymin + zoomy * (pts[i].y - offsy);
2026  immAttr4fv(col, color_sample);
2027  immVertex2f(pos, fx, fy);
2028  }
2029  immEnd();
2030  }
2031  immUnbindProgram();
2032 
2033  /* Restore scissor-test. */
2034  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
2035 
2036  /* Outline */
2037  format = immVertexFormat();
2040 
2041  immUniformColor3ubv((const uchar *)wcol->outline);
2042  imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
2043  immUnbindProgram();
2044 }
2045 
2047  uiBut *but,
2048  const uiWidgetColors *UNUSED(wcol),
2049  const rcti *recti)
2050 {
2051  bool ok = false;
2052  MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
2053 
2054  rctf rect = {
2055  .xmin = (float)recti->xmin + 1,
2056  .xmax = (float)recti->xmax - 1,
2057  .ymin = (float)recti->ymin + 1,
2058  .ymax = (float)recti->ymax - 1,
2059  };
2060 
2061  const int width = BLI_rctf_size_x(&rect) + 1;
2062  const int height = BLI_rctf_size_y(&rect);
2063 
2065 
2066  /* need scissor test, preview image can draw outside of boundary */
2067  int scissor[4];
2068  GPU_scissor_get(scissor);
2069  GPU_scissor((rect.xmin - 1),
2070  (rect.ymin - 1),
2071  (rect.xmax + 1) - (rect.xmin - 1),
2072  (rect.ymax + 1) - (rect.ymin - 1));
2073 
2074  if (scopes->track_disabled) {
2075  const float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
2078  &(const rctf){
2079  .xmin = rect.xmin - 1,
2080  .xmax = rect.xmax + 1,
2081  .ymin = rect.ymin,
2082  .ymax = rect.ymax + 1,
2083  },
2084  true,
2085  3.0f,
2086  color);
2087 
2088  ok = true;
2089  }
2090  else if ((scopes->track_search) &&
2091  ((!scopes->track_preview) ||
2092  (scopes->track_preview->x != width || scopes->track_preview->y != height))) {
2093  if (scopes->track_preview) {
2094  IMB_freeImBuf(scopes->track_preview);
2095  }
2096 
2097  ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width,
2098  scopes->frame_height,
2099  scopes->track_search,
2100  scopes->track,
2101  &scopes->undist_marker,
2102  true,
2103  scopes->use_track_mask,
2104  width,
2105  height,
2106  scopes->track_pos);
2107  if (tmpibuf) {
2108  if (tmpibuf->rect_float) {
2109  IMB_rect_from_float(tmpibuf);
2110  }
2111 
2112  if (tmpibuf->rect) {
2113  scopes->track_preview = tmpibuf;
2114  }
2115  else {
2116  IMB_freeImBuf(tmpibuf);
2117  }
2118  }
2119  }
2120 
2121  if (!ok && scopes->track_preview) {
2122  GPU_matrix_push();
2123 
2124  /* draw content of pattern area */
2125  GPU_scissor(rect.xmin, rect.ymin, scissor[2], scissor[3]);
2126 
2127  if (width > 0 && height > 0) {
2128  ImBuf *drawibuf = scopes->track_preview;
2129  float col_sel[4], col_outline[4];
2130 
2131  if (scopes->use_track_mask) {
2132  const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
2135  &(const rctf){
2136  .xmin = rect.xmin - 1,
2137  .xmax = rect.xmax + 1,
2138  .ymin = rect.ymin,
2139  .ymax = rect.ymax + 1,
2140  },
2141  true,
2142  3.0f,
2143  color);
2144  }
2145 
2148  rect.xmin,
2149  rect.ymin + 1,
2150  drawibuf->x,
2151  drawibuf->y,
2152  GPU_RGBA8,
2153  true,
2154  drawibuf->rect,
2155  1.0f,
2156  1.0f,
2157  NULL);
2158 
2159  /* draw cross for pixel position */
2160  GPU_matrix_translate_2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]);
2161  GPU_scissor(rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect));
2162 
2167 
2169  UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline);
2170 
2171  /* Do stipple cross with geometry */
2172  immBegin(GPU_PRIM_LINES, 7 * 2 * 2);
2173  const float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f};
2174  for (int axe = 0; axe < 2; axe++) {
2175  for (int i = 0; i < 7; i++) {
2176  const float x1 = pos_sel[i] * (1 - axe);
2177  const float y1 = pos_sel[i] * axe;
2178  const float x2 = pos_sel[i + 1] * (1 - axe);
2179  const float y2 = pos_sel[i + 1] * axe;
2180 
2181  if (i % 2 == 1) {
2182  immAttr4fv(col, col_sel);
2183  }
2184  else {
2185  immAttr4fv(col, col_outline);
2186  }
2187 
2188  immVertex2f(pos, x1, y1);
2189  immVertex2f(pos, x2, y2);
2190  }
2191  }
2192  immEnd();
2193 
2194  immUnbindProgram();
2195  }
2196 
2197  GPU_matrix_pop();
2198 
2199  ok = true;
2200  }
2201 
2202  if (!ok) {
2203  const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
2206  &(const rctf){
2207  .xmin = rect.xmin - 1,
2208  .xmax = rect.xmax + 1,
2209  .ymin = rect.ymin,
2210  .ymax = rect.ymax + 1,
2211  },
2212  true,
2213  3.0f,
2214  color);
2215  }
2216 
2217  /* Restore scissor test. */
2218  GPU_scissor(UNPACK4(scissor));
2219  /* outline */
2220  draw_scope_end(&rect);
2221 
2223 }
2224 
2225 /* ****************************************************** */
2226 
2227 /* TODO: high quality UI drop shadows using GLSL shader and single draw call
2228  * would replace / modify the following 3 functions - merwin
2229  */
2230 
2231 static void ui_shadowbox(const rctf *rect, uint pos, uint color, float shadsize, uchar alpha)
2232 {
2246  const float v1[2] = {rect->xmax, rect->ymax - 0.3f * shadsize};
2247  const float v2[2] = {rect->xmax + shadsize, rect->ymax - 0.75f * shadsize};
2248  const float v3[2] = {rect->xmax, rect->ymin};
2249  const float v4[2] = {rect->xmax + shadsize, rect->ymin};
2250 
2251  const float v5[2] = {rect->xmax + 0.7f * shadsize, rect->ymin - 0.7f * shadsize};
2252 
2253  const float v6[2] = {rect->xmax, rect->ymin - shadsize};
2254  const float v7[2] = {rect->xmin + 0.3f * shadsize, rect->ymin};
2255  const float v8[2] = {rect->xmin + 0.5f * shadsize, rect->ymin - shadsize};
2256 
2257  /* right quad */
2258  immAttr4ub(color, 0, 0, 0, alpha);
2259  immVertex2fv(pos, v3);
2260  immVertex2fv(pos, v1);
2261  immAttr4ub(color, 0, 0, 0, 0);
2262  immVertex2fv(pos, v2);
2263 
2264  immVertex2fv(pos, v2);
2265  immVertex2fv(pos, v4);
2266  immAttr4ub(color, 0, 0, 0, alpha);
2267  immVertex2fv(pos, v3);
2268 
2269  /* corner shape */
2270  /* immAttr4ub(color, 0, 0, 0, alpha); */ /* Not needed, done above in previous tri */
2271  immVertex2fv(pos, v3);
2272  immAttr4ub(color, 0, 0, 0, 0);
2273  immVertex2fv(pos, v4);
2274  immVertex2fv(pos, v5);
2275 
2276  immVertex2fv(pos, v5);
2277  immVertex2fv(pos, v6);
2278  immAttr4ub(color, 0, 0, 0, alpha);
2279  immVertex2fv(pos, v3);
2280 
2281  /* bottom quad */
2282  /* immAttr4ub(color, 0, 0, 0, alpha); */ /* Not needed, done above in previous tri */
2283  immVertex2fv(pos, v3);
2284  immAttr4ub(color, 0, 0, 0, 0);
2285  immVertex2fv(pos, v6);
2286  immVertex2fv(pos, v8);
2287 
2288  immVertex2fv(pos, v8);
2289  immAttr4ub(color, 0, 0, 0, alpha);
2290  immVertex2fv(pos, v7);
2291  immVertex2fv(pos, v3);
2292 }
2293 
2295 {
2297 
2300  uint color = GPU_vertformat_attr_add(
2302 
2304 
2305  immBegin(GPU_PRIM_TRIS, 54);
2306 
2307  /* accumulated outline boxes to make shade not linear, is more pleasant */
2308  ui_shadowbox(rect, pos, color, 11.0, (20 * alpha) >> 8);
2309  ui_shadowbox(rect, pos, color, 7.0, (40 * alpha) >> 8);
2310  ui_shadowbox(rect, pos, color, 5.0, (80 * alpha) >> 8);
2311 
2312  immEnd();
2313 
2314  immUnbindProgram();
2315 
2317 }
2318 
2320  const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
2321 {
2322  float rad;
2323 
2324  if (radius > (BLI_rctf_size_y(rct) - 10.0f) * 0.5f) {
2325  rad = (BLI_rctf_size_y(rct) - 10.0f) * 0.5f;
2326  }
2327  else {
2328  rad = radius;
2329  }
2330 
2331  int a, i = 12;
2332 #if 0
2333  if (select) {
2334  a = i * aspect; /* same as below */
2335  }
2336  else
2337 #endif
2338  {
2339  a = i * aspect;
2340  }
2341 
2343  const float dalpha = alpha * 2.0f / 255.0f;
2344  float calpha = dalpha;
2345  float visibility = 1.0f;
2346  for (; i--;) {
2347  /* alpha ranges from 2 to 20 or so */
2348 #if 0 /* Old Method (pre 2.8) */
2349  float color[4] = {0.0f, 0.0f, 0.0f, calpha};
2351  true, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a, color);
2352 #endif
2353  /* Compute final visibility to match old method result. */
2354  /* TODO we could just find a better fit function inside the shader instead of this. */
2355  visibility = visibility * (1.0f - calpha);
2356  calpha += dalpha;
2357  }
2358 
2359  uiWidgetBaseParameters widget_params = {
2360  .recti.xmin = rct->xmin,
2361  .recti.ymin = rct->ymin,
2362  .recti.xmax = rct->xmax,
2363  .recti.ymax = rct->ymax - 10.0f,
2364  .rect.xmin = rct->xmin - a,
2365  .rect.ymin = rct->ymin - a,
2366  .rect.xmax = rct->xmax + a,
2367  .rect.ymax = rct->ymax - 10.0f + a,
2368  .radi = rad,
2369  .rad = rad + a,
2370  .round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
2371  .round_corners[1] = (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 1.0f : 0.0f,
2372  .round_corners[2] = (roundboxtype & UI_CNR_TOP_RIGHT) ? 1.0f : 0.0f,
2373  .round_corners[3] = (roundboxtype & UI_CNR_TOP_LEFT) ? 1.0f : 0.0f,
2374  .alpha_discard = 1.0f,
2375  };
2376 
2379  GPU_batch_uniform_4fv_array(batch, "parameters", 4, (const float(*)[4]) & widget_params);
2380  GPU_batch_uniform_1f(batch, "alpha", 1.0f - visibility);
2382 
2383  /* outline emphasis */
2384  const float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
2386  &(const rctf){
2387  .xmin = rct->xmin - 0.5f,
2388  .xmax = rct->xmax + 0.5f,
2389  .ymin = rct->ymin - 0.5f,
2390  .ymax = rct->ymax + 0.5f,
2391  },
2392  false,
2393  radius + 0.5f,
2394  color);
2395 
2397 }
typedef float(TangentPoint)[2]
void immDrawPixelsTex(IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, void *rect, float xzoom, float yzoom, const float color[4])
Definition: glutil.c:298
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition: glutil.c:66
bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4])
void BKE_curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles)
Definition: colortools.c:877
@ PROF_UPDATE_NONE
void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags)
Definition: curveprofile.c:905
struct ImBuf * BKE_tracking_sample_pattern(int frame_width, int frame_height, struct ImBuf *search_ib, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker, bool from_anchor, bool use_mask, int num_samples_x, int num_samples_y, float pos[2])
Definition: tracking.c:2728
void BLF_draw_default(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
Definition: blf_default.c:71
int BLF_default(void)
Definition: blf_default.c:55
void BLF_batch_draw_flush(void)
Definition: blf.c:476
void BLF_color4f(int fontid, float r, float g, float b, float a)
Definition: blf.c:450
MINLINE float max_ff(float a, float b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float min_ff(float a, float b)
#define M_PI_2
Definition: BLI_math_base.h:41
#define M_PI
Definition: BLI_math_base.h:38
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
Definition: math_color.c:254
#define BLI_YUV_ITU_BT709
void rgb_to_yuv(float r, float g, float b, float *r_y, float *r_u, float *r_v, int colorspace)
Definition: math_color.c:79
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:414
MINLINE void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
Definition: math_color.c:407
void unit_m3(float m[3][3])
Definition: math_matrix.c:58
#define DEG2RADF(_deg)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:49
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void swap_v3_v3(float a[3], float b[3])
void BLI_polyfill_calc(const float(*coords)[2], const unsigned int coords_tot, const int coords_sign, unsigned int(*r_tris)[3])
Definition: polyfill_2d.c:905
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:157
bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:153
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:161
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:165
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned char uchar
Definition: BLI_sys_types.h:86
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNPACK4(a)
#define ARRAY_SIZE(arr)
#define ARRAY_SET_ITEMS(...)
#define UNUSED(x)
#define UNPACK3(a)
#define ELEM(...)
@ CUMA_EXTEND_EXTRAPOLATE
@ CUMA_DO_CLIP
@ CUMA_DRAW_CFRA
@ CUMA_DRAW_SAMPLE
#define SCOPES_WAVEFRM_RGB_PARADE
@ HISTO_FLAG_LINE
#define SCOPES_WAVEFRM_YCC_JPEG
@ CUMA_SELECT
@ HISTO_MODE_B
@ HISTO_MODE_G
@ HISTO_MODE_LUMA
@ HISTO_MODE_RGB
@ HISTO_MODE_ALPHA
@ HISTO_MODE_R
#define SCOPES_WAVEFRM_RGB
#define SCOPES_WAVEFRM_YCC_601
#define SCOPES_WAVEFRM_YCC_709
#define SCOPES_WAVEFRM_LUMA
#define CM_TABLE
@ HD_FREE
@ HD_ALIGN
@ PROF_USE_CLIP
#define PROF_TABLE_LEN(n_pts)
@ PROF_H1_SELECT
@ PROF_H2_SELECT
NSNotificationCenter * center
GPUBatch
Definition: GPU_batch.h:93
#define GPU_batch_uniform_1f(batch, name, x)
Definition: GPU_batch.h:134
void GPU_batch_discard(GPUBatch *)
Definition: gpu_batch.cc:127
#define GPU_batch_uniform_4fv_array(batch, name, len, val)
Definition: GPU_batch.h:145
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
Definition: gpu_batch.cc:299
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
Definition: gpu_batch.cc:60
void GPU_batch_draw(GPUBatch *batch)
Definition: gpu_batch.cc:234
#define GPU_batch_uniform_3fv(batch, name, val)
Definition: GPU_batch.h:141
#define GPU_batch_uniform_4f(batch, name, x, y, z, w)
Definition: GPU_batch.h:138
@ GPU_BATCH_OWNS_VBO
Definition: GPU_batch.h:45
struct GPUBatch * GPU_batch_preset_sphere(int lod) ATTR_WARN_UNUSED_RESULT
void immAttr3ubv(uint attr_id, const unsigned char data[3])
void immUniform4f(const char *name, float x, float y, float z, float w)
void immAttr4fv(uint attr_id, const float data[4])
void immAttr4ub(uint attr_id, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void immUniform2f(const char *name, float x, float y)
void immUniformColor4f(float r, float g, float b, float a)
void immUniformColor3ub(unsigned char r, unsigned char g, unsigned char b)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immVertex2fv(uint attr_id, const float data[2])
void immUniformColor3ubv(const unsigned char rgb[3])
void immUniform1i(const char *name, int x)
void immBeginAtMost(GPUPrimType, uint max_vertex_len)
void immUniformColor3ubvAlpha(const unsigned char rgb[3], unsigned char a)
void immUniform1f(const char *name, float x)
void immUniformArray4fv(const char *bare_name, const float *data, int count)
void immAttr4f(uint attr_id, float x, float y, float z, float w)
void immUniformColor4fv(const float rgba[4])
GPUVertFormat * immVertexFormat(void)
void immUniformColor3f(float r, float g, float b)
void immBegin(GPUPrimType, uint vertex_len)
void immEnd(void)
void immUniformColor3fv(const float rgb[3])
void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2)
void immRecti(uint pos, int x1, int y1, int x2, int y2)
void immRectf(uint pos, float x1, float y1, float x2, float y2)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
_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 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 GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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
_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
_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 type
_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 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 v1
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:142
void GPU_matrix_scale_2f(float x, float y)
Definition: gpu_matrix.cc:232
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:156
void GPU_matrix_ortho_set_z(float near, float far)
Definition: gpu_matrix.cc:422
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:135
void GPU_matrix_scale_1f(float factor)
Definition: gpu_matrix.cc:225
#define GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT
Definition: GPU_matrix.h:236
void GPU_matrix_translate_2f(float x, float y)
Definition: gpu_matrix.cc:190
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:149
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:41
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:39
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:35
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:38
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:40
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:37
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
Definition: GPU_shader.h:365
@ GPU_SHADER_2D_CHECKER
Definition: GPU_shader.h:191
@ GPU_SHADER_2D_SMOOTH_COLOR
Definition: GPU_shader.h:185
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:171
@ GPU_SHADER_SIMPLE_LIGHTING
Definition: GPU_shader.h:163
@ GPU_SHADER_2D_IMAGE_COLOR
Definition: GPU_shader.h:187
@ GPU_SHADER_2D_WIDGET_SHADOW
Definition: GPU_shader.h:375
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:178
@ GPU_SHADER_2D_WIDGET_BASE
Definition: GPU_shader.h:373
void GPU_face_culling(eGPUFaceCullTest culling)
Definition: gpu_state.cc:60
@ GPU_BLEND_NONE
Definition: GPU_state.h:55
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:57
@ GPU_BLEND_ADDITIVE
Definition: GPU_state.h:59
@ GPU_BLEND_ALPHA_PREMULT
Definition: GPU_state.h:58
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:55
void GPU_line_width(float width)
Definition: gpu_state.cc:173
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:85
@ GPU_CULL_NONE
Definition: GPU_state.h:103
@ GPU_CULL_BACK
Definition: GPU_state.h:105
void GPU_scissor(int x, int y, int width, int height)
Definition: gpu_state.cc:204
void GPU_point_size(float size)
Definition: gpu_state.cc:179
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:279
void GPU_scissor_get(int coords[4])
Definition: gpu_state.cc:274
void GPU_polygon_smooth(bool enable)
Definition: gpu_state.cc:90
@ GPU_RGBA8
Definition: GPU_texture.h:88
#define GPU_vertbuf_create_with_format(format)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
void GPU_vertbuf_attr_fill(GPUVertBuf *, uint a_idx, const void *data)
@ GPU_FETCH_FLOAT
@ GPU_FETCH_INT_TO_FLOAT_UNIT
@ GPU_FETCH_INT_TO_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
@ GPU_COMP_I32
@ GPU_COMP_U8
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], struct ColorManagedDisplay *display)
bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
Definition: scaling.c:1667
void IMB_rect_from_float(struct ImBuf *ibuf)
Definition: divers.c:720
void IMB_freeImBuf(struct ImBuf *ibuf)
Definition: allocimbuf.c:211
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define UI_ALPHA_CHECKER_LIGHT
@ UI_CNR_BOTTOM_LEFT
@ UI_CNR_BOTTOM_RIGHT
@ UI_CNR_ALL
@ UI_CNR_TOP_LEFT
@ UI_CNR_TOP_RIGHT
#define UI_ALPHA_CHECKER_DARK
#define UI_DPI_FAC
Definition: UI_interface.h:309
@ UI_GRAD_H
Definition: UI_interface.h:402
@ TH_MARKER_OUTLINE
Definition: UI_resources.h:244
@ TH_PREVIEW_BACK
Definition: UI_resources.h:232
@ TH_SEL_MARKER
Definition: UI_resources.h:247
@ TH_TEXT
Definition: UI_resources.h:58
@ TH_TEXT_HI
Definition: UI_resources.h:59
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1199
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
static CCL_NAMESPACE_BEGIN const double alpha
GPUBatch * batch
Definition: drawnode.c:3779
#define str(s)
uint pos
uint col
void ui_but_v3_get(uiBut *but, float vec[3])
Definition: interface.c:2230
struct ColorManagedDisplay * ui_block_cm_display_get(uiBlock *block)
Definition: interface.c:3839
#define HISTOGRAM_TOT_GRID_LINES
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
static int roundboxtype
void UI_draw_safe_areas(uint pos, const rctf *rect, const float title_aspect[2], const float action_aspect[2])
static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[3])
static float polar_to_x(float center, float diam, float ampli, float angle)
static void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, const float *data, int res, const bool is_line, uint pos_attr)
void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
void UI_draw_roundbox_4fv_ex(const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
static void gl_shaded_color_get(const uchar color[3], int shade, uchar r_color[3])
static void ui_draw_colorband_handle_tri_hlight(uint pos, float x1, float y1, float halfwidth, float height)
static void draw_scope_end(const rctf *rect)
static void gl_shaded_color(const uchar *color, int shade)
static void ui_draw_colorband_handle_tri(uint pos, float x1, float y1, float halfwidth, float height, bool fill)
static float polar_to_y(float center, float diam, float ampli, float angle)
void UI_draw_roundbox_corner_set(int type)
void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
static void ui_shadowbox(const rctf *rect, uint pos, uint color, float shadsize, uchar alpha)
static void ui_draw_colorband_handle(uint shdr_pos, const rcti *rect, float x, const float rgb[3], struct ColorManagedDisplay *display, bool active)
void UI_draw_roundbox_3fv_alpha(const rctf *rect, bool filled, float rad, const float col[3], float alpha)
void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
void ui_draw_but_IMAGE(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
void UI_draw_box_shadow(const rctf *rect, uchar alpha)
static bool point_draw_handles(CurveProfilePoint *point)
void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
static void ui_draw_but_curve_grid(const uint pos, const rcti *rect, const float zoom_x, const float zoom_y, const float offset_x, const float offset_y, const float step)
void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
void UI_draw_roundbox_shade_x(const rctf *rect, bool filled, float rad, float shadetop, float shadedown, const float col[4])
void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
static void waveform_draw_one(float *waveform, int nbr, const float col[3])
static void vectorscope_draw_target(uint pos, float centerx, float centery, float diam, const float colf[3])
static void ui_draw_colorband_handle_box(uint pos, float x1, float y1, float x2, float y2, bool fill)
void ui_draw_but_CURVEPROFILE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
void UI_draw_roundbox_3ub_alpha(const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
void UI_draw_roundbox_aa(const rctf *rect, bool filled, float rad, const float color[4])
void ui_draw_but_TAB_outline(const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3])
void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *recti)
void ui_draw_gradient(const rcti *rect, const float hsv[3], const eButGradientType type, const float alpha)
struct GPUBatch * ui_batch_roundbox_widget_get(void)
struct GPUBatch * ui_batch_roundbox_shadow_get(void)
#define sinf(x)
#define cosf(x)
#define ceilf(x)
#define atanf(x)
#define floorf(x)
#define sqrtf(x)
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static ulong state[N]
static unsigned c
Definition: RandGen.cpp:97
static unsigned a[3]
Definition: RandGen.cpp:92
bool active
all scheduled work for the GPU.
#define min(a, b)
Definition: sort.c:51
CBData data[32]
CurveMapPoint * table
short totpoint
CurveMapPoint * curve
float ext_out[2]
float ext_in[2]
float sample[3]
CurveMap cm[4]
CurveProfilePoint * path
CurveProfilePoint * table
CurveProfilePoint * segments
float data_a[256]
float data_luma[256]
float data_r[256]
float data_b[256]
float data_g[256]
unsigned int * rect
float * rect_float
float xmax
Definition: DNA_vec_types.h:85
float xmin
Definition: DNA_vec_types.h:85
float ymax
Definition: DNA_vec_types.h:86
float ymin
Definition: DNA_vec_types.h:86
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
struct ColorBand * edit_coba
struct CurveMapping * edit_cumap
eButGradientType gradient_type
struct CurveProfile * edit_profile
uiBlock * block
char * poin
uchar col[4]
unsigned char inner[4]
unsigned char outline[4]
unsigned char item[4]
float max
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: util_avxb.h:167
uint len