Blender  V3.3
interface_draw.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include <math.h>
9 #include <string.h>
10 
11 #include "DNA_color_types.h"
12 #include "DNA_curve_types.h"
13 #include "DNA_curveprofile_types.h"
14 #include "DNA_movieclip_types.h"
15 #include "DNA_screen_types.h"
16 
17 #include "BLI_math.h"
18 #include "BLI_polyfill_2d.h"
19 #include "BLI_rect.h"
20 #include "BLI_string.h"
21 #include "BLI_utildefines.h"
22 
23 #include "MEM_guardedalloc.h"
24 
25 #include "BKE_colorband.h"
26 #include "BKE_colortools.h"
27 #include "BKE_curveprofile.h"
28 #include "BKE_node.h"
29 #include "BKE_tracking.h"
30 
31 #include "IMB_colormanagement.h"
32 #include "IMB_imbuf.h"
33 #include "IMB_imbuf_types.h"
34 
35 #include "BIF_glutil.h"
36 
37 #include "BLF_api.h"
38 
39 #include "GPU_batch.h"
40 #include "GPU_batch_presets.h"
41 #include "GPU_context.h"
42 #include "GPU_immediate.h"
43 #include "GPU_immediate_util.h"
44 #include "GPU_matrix.h"
45 #include "GPU_shader_shared.h"
46 #include "GPU_state.h"
47 
48 #include "UI_interface.h"
49 
50 /* own include */
51 #include "interface_intern.h"
52 
53 static int roundboxtype = UI_CNR_ALL;
54 
56 {
57  /* Not sure the roundbox function is the best place to change this
58  * if this is undone, it's not that big a deal, only makes curves edges square. */
60 }
61 
62 #if 0 /* unused */
63 int UI_draw_roundbox_corner_get(void)
64 {
65  return roundboxtype;
66 }
67 #endif
68 
69 void UI_draw_roundbox_4fv_ex(const rctf *rect,
70  const float inner1[4],
71  const float inner2[4],
72  float shade_dir,
73  const float outline[4],
74  float outline_width,
75  float rad)
76 {
77  /* WATCH: This is assuming the ModelViewProjectionMatrix is area pixel space.
78  * If it has been scaled, then it's no longer valid. */
79  uiWidgetBaseParameters widget_params = {
80  .recti.xmin = rect->xmin + outline_width,
81  .recti.ymin = rect->ymin + outline_width,
82  .recti.xmax = rect->xmax - outline_width,
83  .recti.ymax = rect->ymax - outline_width,
84  .rect = *rect,
85  .radi = rad,
86  .rad = rad,
87  .round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
88  .round_corners[1] = (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 1.0f : 0.0f,
89  .round_corners[2] = (roundboxtype & UI_CNR_TOP_RIGHT) ? 1.0f : 0.0f,
90  .round_corners[3] = (roundboxtype & UI_CNR_TOP_LEFT) ? 1.0f : 0.0f,
91  .color_inner1[0] = inner1 ? inner1[0] : 0.0f,
92  .color_inner1[1] = inner1 ? inner1[1] : 0.0f,
93  .color_inner1[2] = inner1 ? inner1[2] : 0.0f,
94  .color_inner1[3] = inner1 ? inner1[3] : 0.0f,
95  .color_inner2[0] = inner2 ? inner2[0] :
96  inner1 ? inner1[0] :
97  0.0f,
98  .color_inner2[1] = inner2 ? inner2[1] :
99  inner1 ? inner1[1] :
100  0.0f,
101  .color_inner2[2] = inner2 ? inner2[2] :
102  inner1 ? inner1[2] :
103  0.0f,
104  .color_inner2[3] = inner2 ? inner2[3] :
105  inner1 ? inner1[3] :
106  0.0f,
107  .color_outline[0] = outline ? outline[0] :
108  inner1 ? inner1[0] :
109  0.0f,
110  .color_outline[1] = outline ? outline[1] :
111  inner1 ? inner1[1] :
112  0.0f,
113  .color_outline[2] = outline ? outline[2] :
114  inner1 ? inner1[2] :
115  0.0f,
116  .color_outline[3] = outline ? outline[3] :
117  inner1 ? inner1[3] :
118  0.0f,
119  .shade_dir = shade_dir,
120  .alpha_discard = 1.0f,
121  };
124  GPU_batch_uniform_4fv_array(batch, "parameters", 11, (const float(*)[4]) & widget_params);
128 }
129 
131  const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
132 {
133  const float colv[4] = {
134  ((float)col[0]) / 255,
135  ((float)col[1]) / 255,
136  ((float)col[2]) / 255,
137  ((float)alpha) / 255,
138  };
139  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
140 }
141 
143  const rctf *rect, bool filled, float rad, const float col[3], float alpha)
144 {
145  const float colv[4] = {col[0], col[1], col[2], alpha};
146  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
147 }
148 
149 void UI_draw_roundbox_aa(const rctf *rect, bool filled, float rad, const float color[4])
150 {
151  /* XXX this is to emulate previous behavior of semitransparent fills but that's was a side effect
152  * of the previous AA method. Better fix the callers. */
153  float colv[4] = {color[0], color[1], color[2], color[3]};
154  if (filled) {
155  colv[3] *= 0.65f;
156  }
157 
158  UI_draw_roundbox_4fv_ex(rect, (filled) ? colv : NULL, NULL, 1.0f, colv, U.pixelsize, rad);
159 }
160 
161 void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
162 {
163  /* Exactly the same as UI_draw_roundbox_aa but does not do the legacy transparency. */
164  UI_draw_roundbox_4fv_ex(rect, (filled) ? col : NULL, NULL, 1.0f, col, U.pixelsize, rad);
165 }
166 
167 void UI_draw_text_underline(int pos_x, int pos_y, int len, int height, const float color[4])
168 {
169  const int ofs_y = 4 * U.pixelsize;
170 
173 
176 
177  immRecti(pos, pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize));
179 }
180 
181 /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
182 
183 void ui_draw_but_TAB_outline(const rcti *rect,
184  float rad,
185  uchar highlight[3],
186  uchar highlight_fade[3])
187 {
192  /* add a 1px offset, looks nicer */
193  const int minx = rect->xmin + U.pixelsize, maxx = rect->xmax - U.pixelsize;
194  const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize;
195  int a;
196  float vec[4][2] = {
197  {0.195, 0.02},
198  {0.55, 0.169},
199  {0.831, 0.45},
200  {0.98, 0.805},
201  };
202 
203  /* Multiply. */
204  for (a = 0; a < 4; a++) {
205  mul_v2_fl(vec[a], rad);
206  }
207 
210 
211  immAttr3ubv(col, highlight);
212 
213  /* start with corner left-top */
215  immVertex2f(pos, minx, maxy - rad);
216  for (a = 0; a < 4; a++) {
217  immVertex2f(pos, minx + vec[a][1], maxy - rad + vec[a][0]);
218  }
219  immVertex2f(pos, minx + rad, maxy);
220  }
221  else {
222  immVertex2f(pos, minx, maxy);
223  }
224 
225  /* corner right-top */
227  immVertex2f(pos, maxx - rad, maxy);
228  for (a = 0; a < 4; a++) {
229  immVertex2f(pos, maxx - rad + vec[a][0], maxy - vec[a][1]);
230  }
231  immVertex2f(pos, maxx, maxy - rad);
232  }
233  else {
234  immVertex2f(pos, maxx, maxy);
235  }
236 
237  immAttr3ubv(col, highlight_fade);
238 
239  /* corner right-bottom */
241  immVertex2f(pos, maxx, miny + rad);
242  for (a = 0; a < 4; a++) {
243  immVertex2f(pos, maxx - vec[a][1], miny + rad - vec[a][0]);
244  }
245  immVertex2f(pos, maxx - rad, miny);
246  }
247  else {
248  immVertex2f(pos, maxx, miny);
249  }
250 
251  /* corner left-bottom */
253  immVertex2f(pos, minx + rad, miny);
254  for (a = 0; a < 4; a++) {
255  immVertex2f(pos, minx + rad - vec[a][0], miny + vec[a][1]);
256  }
257  immVertex2f(pos, minx, miny + rad);
258  }
259  else {
260  immVertex2f(pos, minx, miny);
261  }
262 
263  immAttr3ubv(col, highlight);
264 
265  /* back to corner left-top */
266  immVertex2f(pos, minx, (roundboxtype & UI_CNR_TOP_LEFT) ? (maxy - rad) : maxy);
267 
268  immEnd();
270 }
271 
273  uiBut *but,
274  const uiWidgetColors *UNUSED(wcol),
275  const rcti *rect)
276 {
277 #ifdef WITH_HEADLESS
278  (void)rect;
279  (void)but;
280 #else
281  ImBuf *ibuf = (ImBuf *)but->poin;
282 
283  if (!ibuf) {
284  return;
285  }
286 
287  const int w = BLI_rcti_size_x(rect);
288  const int h = BLI_rcti_size_y(rect);
289 
290  /* scissor doesn't seem to be doing the right thing...? */
291 # if 0
292  /* prevent drawing outside widget area */
293  int scissor[4];
294  GPU_scissor_get(scissor);
295  GPU_scissor(rect->xmin, rect->ymin, w, h);
296 # endif
297 
298  /* Combine with premultiplied alpha. */
300 
301  if (w != ibuf->x || h != ibuf->y) {
302  /* We scale the bitmap, rather than have OGL do a worse job. */
303  IMB_scaleImBuf(ibuf, w, h);
304  }
305 
306  float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
307  if (but->col[3] != 0) {
308  /* Optionally use uiBut's col to recolor the image. */
309  rgba_uchar_to_float(col, but->col);
310  }
311 
314  (float)rect->xmin,
315  (float)rect->ymin,
316  ibuf->x,
317  ibuf->y,
318  GPU_RGBA8,
319  false,
320  ibuf->rect,
321  1.0f,
322  1.0f,
323  col);
324 
326 
327 # if 0
328  /* Restore scissor-test. */
329  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
330 # endif
331 
332 #endif
333 }
334 
336  const rctf *rect,
337  const float title_aspect[2],
338  const float action_aspect[2])
339 {
340  const float size_x_half = (rect->xmax - rect->xmin) * 0.5f;
341  const float size_y_half = (rect->ymax - rect->ymin) * 0.5f;
342 
343  const float *safe_areas[] = {title_aspect, action_aspect};
344  const int safe_len = ARRAY_SIZE(safe_areas);
345 
346  for (int i = 0; i < safe_len; i++) {
347  if (safe_areas[i][0] || safe_areas[i][1]) {
348  const float margin_x = safe_areas[i][0] * size_x_half;
349  const float margin_y = safe_areas[i][1] * size_y_half;
350 
351  const float minx = rect->xmin + margin_x;
352  const float miny = rect->ymin + margin_y;
353  const float maxx = rect->xmax - margin_x;
354  const float maxy = rect->ymax - margin_y;
355 
356  imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy);
357  }
358  }
359 }
360 
361 static void draw_scope_end(const rctf *rect)
362 {
364 
365  /* outline */
367  const float color[4] = {0.0f, 0.0f, 0.0f, 0.5f};
369  &(const rctf){
370  .xmin = rect->xmin - 1,
371  .xmax = rect->xmax + 1,
372  .ymin = rect->ymin,
373  .ymax = rect->ymax + 1,
374  },
375  false,
376  3.0f,
377  color);
378 }
379 
380 static void histogram_draw_one(float r,
381  float g,
382  float b,
383  float alpha,
384  float x,
385  float y,
386  float w,
387  float h,
388  const float *data,
389  int res,
390  const bool is_line,
391  uint pos_attr)
392 {
393  const float color[4] = {r, g, b, alpha};
394 
395  /* that can happen */
396  if (res == 0) {
397  return;
398  }
399 
400  GPU_line_smooth(true);
402 
404 
405  if (is_line) {
406  /* curve outline */
407  GPU_line_width(1.5);
408 
410  for (int i = 0; i < res; i++) {
411  const float x2 = x + i * (w / (float)res);
412  immVertex2f(pos_attr, x2, y + (data[i] * h));
413  }
414  immEnd();
415 
416  GPU_line_width(1.0f);
417  }
418  else {
419  /* under the curve */
420  immBegin(GPU_PRIM_TRI_STRIP, res * 2);
421  immVertex2f(pos_attr, x, y);
422  immVertex2f(pos_attr, x, y + (data[0] * h));
423  for (int i = 1; i < res; i++) {
424  const float x2 = x + i * (w / (float)res);
425  immVertex2f(pos_attr, x2, y + (data[i] * h));
426  immVertex2f(pos_attr, x2, y);
427  }
428  immEnd();
429 
430  /* curve outline */
431  immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f);
432 
435  for (int i = 0; i < res; i++) {
436  const float x2 = x + i * (w / (float)res);
437  immVertex2f(pos_attr, x2, y + (data[i] * h));
438  }
439  immEnd();
440  }
441 
442  GPU_line_smooth(false);
443 }
444 
445 #define HISTOGRAM_TOT_GRID_LINES 4
446 
448  uiBut *but,
449  const uiWidgetColors *UNUSED(wcol),
450  const rcti *recti)
451 {
452  Histogram *hist = (Histogram *)but->poin;
453  const int res = hist->x_resolution;
454  const bool is_line = (hist->flag & HISTO_FLAG_LINE) != 0;
455 
456  rctf rect = {
457  .xmin = (float)recti->xmin + 1,
458  .xmax = (float)recti->xmax - 1,
459  .ymin = (float)recti->ymin + 1,
460  .ymax = (float)recti->ymax - 1,
461  };
462 
463  const float w = BLI_rctf_size_x(&rect);
464  const float h = BLI_rctf_size_y(&rect) * hist->ymax;
465 
467 
468  float color[4];
472  &(const rctf){
473  .xmin = rect.xmin - 1,
474  .xmax = rect.xmax + 1,
475  .ymin = rect.ymin - 1,
476  .ymax = rect.ymax + 1,
477  },
478  true,
479  3.0f,
480  color);
481 
482  /* need scissor test, histogram can draw outside of boundary */
483  int scissor[4];
484  GPU_scissor_get(scissor);
485  GPU_scissor((rect.xmin - 1),
486  (rect.ymin - 1),
487  (rect.xmax + 1) - (rect.xmin - 1),
488  (rect.ymax + 1) - (rect.ymin - 1));
489 
492 
494 
495  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
496  /* draw grid lines here */
497  for (int i = 1; i <= HISTOGRAM_TOT_GRID_LINES; i++) {
498  const float fac = (float)i / (float)HISTOGRAM_TOT_GRID_LINES;
499 
500  /* so we can tell the 1.0 color point */
501  if (i == HISTOGRAM_TOT_GRID_LINES) {
502  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
503  }
504 
506 
507  immVertex2f(pos, rect.xmin, rect.ymin + fac * h);
508  immVertex2f(pos, rect.xmax, rect.ymin + fac * h);
509 
510  immVertex2f(pos, rect.xmin + fac * w, rect.ymin);
511  immVertex2f(pos, rect.xmin + fac * w, rect.ymax);
512 
513  immEnd();
514  }
515 
516  if (hist->mode == HISTO_MODE_LUMA) {
518  1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_luma, res, is_line, pos);
519  }
520  else if (hist->mode == HISTO_MODE_ALPHA) {
522  1.0, 1.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_a, res, is_line, pos);
523  }
524  else {
525  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_R)) {
527  1.0, 0.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_r, res, is_line, pos);
528  }
529  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_G)) {
531  0.0, 1.0, 0.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_g, res, is_line, pos);
532  }
533  if (ELEM(hist->mode, HISTO_MODE_RGB, HISTO_MODE_B)) {
535  0.0, 0.0, 1.0, 0.75, rect.xmin, rect.ymin, w, h, hist->data_b, res, is_line, pos);
536  }
537  }
538 
540 
541  /* Restore scissor test. */
542  GPU_scissor(UNPACK4(scissor));
543 
544  /* outline */
545  draw_scope_end(&rect);
546 }
547 
548 #undef HISTOGRAM_TOT_GRID_LINES
549 
550 static void waveform_draw_one(float *waveform, int waveform_num, const float col[3])
551 {
552  GPUVertFormat format = {0};
553  const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
554 
556  GPU_vertbuf_data_alloc(vbo, waveform_num);
557 
558  GPU_vertbuf_attr_fill(vbo, pos_id, waveform);
559 
560  /* TODO: store the #GPUBatch inside the scope. */
563  GPU_batch_uniform_4f(batch, "color", col[0], col[1], col[2], 1.0f);
565 
567 }
568 
570  uiBut *but,
571  const uiWidgetColors *UNUSED(wcol),
572  const rcti *recti)
573 {
574  Scopes *scopes = (Scopes *)but->poin;
575  int scissor[4];
576  float colors[3][3];
577  const float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
578  /* colors pre multiplied by alpha for speed up */
579  float colors_alpha[3][3], colorsycc_alpha[3][3];
580  float min, max;
581 
582  if (scopes == NULL) {
583  return;
584  }
585 
586  rctf rect = {
587  .xmin = (float)recti->xmin + 1,
588  .xmax = (float)recti->xmax - 1,
589  .ymin = (float)recti->ymin + 1,
590  .ymax = (float)recti->ymax - 1,
591  };
592 
593  if (scopes->wavefrm_yfac < 0.5f) {
594  scopes->wavefrm_yfac = 0.98f;
595  }
596  const float w = BLI_rctf_size_x(&rect) - 7;
597  const float h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac;
598  const float yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) * 0.5f;
599  const float w3 = w / 3.0f;
600 
601  /* log scale for alpha */
602  const float alpha = scopes->wavefrm_alpha * scopes->wavefrm_alpha;
603 
604  unit_m3(colors);
605 
606  for (int c = 0; c < 3; c++) {
607  for (int i = 0; i < 3; i++) {
608  colors_alpha[c][i] = colors[c][i] * alpha;
609  colorsycc_alpha[c][i] = colorsycc[c][i] * alpha;
610  }
611  }
612 
613  /* Flush text cache before changing scissors. */
615 
617 
618  float color[4];
622  &(const rctf){
623  .xmin = rect.xmin - 1,
624  .xmax = rect.xmax + 1,
625  .ymin = rect.ymin - 1,
626  .ymax = rect.ymax + 1,
627  },
628  true,
629  3.0f,
630  color);
631 
632  /* need scissor test, waveform can draw outside of boundary */
633  GPU_scissor_get(scissor);
634  GPU_scissor((rect.xmin - 1),
635  (rect.ymin - 1),
636  (rect.xmax + 1) - (rect.xmin - 1),
637  (rect.ymax + 1) - (rect.ymin - 1));
638 
639  /* draw scale numbers first before binding any shader */
640  for (int i = 0; i < 6; i++) {
641  char str[4];
642  BLI_snprintf(str, sizeof(str), "%-3d", i * 20);
643  str[3] = '\0';
644  BLF_color4f(BLF_default(), 1.0f, 1.0f, 1.0f, 0.08f);
645  BLF_draw_default(rect.xmin + 1, yofs - 5 + (i * 0.2f) * h, 0, str, sizeof(str) - 1);
646  }
647 
648  /* Flush text cache before drawing things on top. */
650 
652 
655 
657 
658  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
659 
660  /* draw grid lines here */
662 
663  for (int i = 0; i < 6; i++) {
664  immVertex2f(pos, rect.xmin + 22, yofs + (i * 0.2f) * h);
665  immVertex2f(pos, rect.xmax + 1, yofs + (i * 0.2f) * h);
666  }
667 
668  immEnd();
669 
670  /* 3 vertical separation */
671  if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
673 
674  for (int i = 1; i < 3; i++) {
675  immVertex2f(pos, rect.xmin + i * w3, rect.ymin);
676  immVertex2f(pos, rect.xmin + i * w3, rect.ymax);
677  }
678 
679  immEnd();
680  }
681 
682  /* separate min max zone on the right */
684  immVertex2f(pos, rect.xmin + w, rect.ymin);
685  immVertex2f(pos, rect.xmin + w, rect.ymax);
686  immEnd();
687 
688  /* 16-235-240 level in case of ITU-R BT601/709 */
689  immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
690  if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
692 
693  immVertex2f(pos, rect.xmin + 22, yofs + h * 16.0f / 255.0f);
694  immVertex2f(pos, rect.xmax + 1, yofs + h * 16.0f / 255.0f);
695 
696  immVertex2f(pos, rect.xmin + 22, yofs + h * 235.0f / 255.0f);
697  immVertex2f(pos, rect.xmin + w3, yofs + h * 235.0f / 255.0f);
698 
699  immVertex2f(pos, rect.xmin + 3 * w3, yofs + h * 235.0f / 255.0f);
700  immVertex2f(pos, rect.xmax + 1, yofs + h * 235.0f / 255.0f);
701 
702  immVertex2f(pos, rect.xmin + w3, yofs + h * 240.0f / 255.0f);
703  immVertex2f(pos, rect.xmax + 1, yofs + h * 240.0f / 255.0f);
704 
705  immEnd();
706  }
707  /* 7.5 IRE black point level for NTSC */
708  if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
710  immVertex2f(pos, rect.xmin, yofs + h * 0.075f);
711  immVertex2f(pos, rect.xmax + 1, yofs + h * 0.075f);
712  immEnd();
713  }
714 
715  if (scopes->ok && scopes->waveform_1 != NULL) {
717  GPU_point_size(1.0);
718 
719  /* LUMA (1 channel) */
720  if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
721  const float col[3] = {alpha, alpha, alpha};
722 
723  GPU_matrix_push();
724  GPU_matrix_translate_2f(rect.xmin, yofs);
726 
727  waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, col);
728 
729  GPU_matrix_pop();
730 
731  /* min max */
732  immUniformColor3f(0.5f, 0.5f, 0.5f);
733  min = yofs + scopes->minmax[0][0] * h;
734  max = yofs + scopes->minmax[0][1] * h;
735  CLAMP(min, rect.ymin, rect.ymax);
736  CLAMP(max, rect.ymin, rect.ymax);
737 
739  immVertex2f(pos, rect.xmax - 3, min);
740  immVertex2f(pos, rect.xmax - 3, max);
741  immEnd();
742  }
743  /* RGB (3 channel) */
744  else if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB) {
745  GPU_matrix_push();
746  GPU_matrix_translate_2f(rect.xmin, yofs);
748 
749  waveform_draw_one(scopes->waveform_1, scopes->waveform_tot, colors_alpha[0]);
750  waveform_draw_one(scopes->waveform_2, scopes->waveform_tot, colors_alpha[1]);
751  waveform_draw_one(scopes->waveform_3, scopes->waveform_tot, colors_alpha[2]);
752 
753  GPU_matrix_pop();
754  }
755  /* PARADE / YCC (3 channels) */
756  else if (ELEM(scopes->wavefrm_mode,
761  const int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB_PARADE);
762 
763  GPU_matrix_push();
764  GPU_matrix_translate_2f(rect.xmin, yofs);
765  GPU_matrix_scale_2f(w3, h);
766 
768  scopes->waveform_1, scopes->waveform_tot, (rgb) ? colors_alpha[0] : colorsycc_alpha[0]);
769 
770  GPU_matrix_translate_2f(1.0f, 0.0f);
772  scopes->waveform_2, scopes->waveform_tot, (rgb) ? colors_alpha[1] : colorsycc_alpha[1]);
773 
774  GPU_matrix_translate_2f(1.0f, 0.0f);
776  scopes->waveform_3, scopes->waveform_tot, (rgb) ? colors_alpha[2] : colorsycc_alpha[2]);
777 
778  GPU_matrix_pop();
779  }
780 
781  /* min max */
782  if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
783  for (int c = 0; c < 3; c++) {
784  if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB_PARADE, SCOPES_WAVEFRM_RGB)) {
785  immUniformColor3f(colors[c][0] * 0.75f, colors[c][1] * 0.75f, colors[c][2] * 0.75f);
786  }
787  else {
789  colorsycc[c][0] * 0.75f, colorsycc[c][1] * 0.75f, colorsycc[c][2] * 0.75f);
790  }
791  min = yofs + scopes->minmax[c][0] * h;
792  max = yofs + scopes->minmax[c][1] * h;
793  CLAMP(min, rect.ymin, rect.ymax);
794  CLAMP(max, rect.ymin, rect.ymax);
795 
797  immVertex2f(pos, rect.xmin + w + 2 + c * 2, min);
798  immVertex2f(pos, rect.xmin + w + 2 + c * 2, max);
799  immEnd();
800  }
801  }
802  }
803 
805 
806  /* Restore scissor test. */
807  GPU_scissor(UNPACK4(scissor));
808 
809  /* outline */
810  draw_scope_end(&rect);
811 
813 }
814 
815 static float polar_to_x(float center, float diam, float ampli, float angle)
816 {
817  return center + diam * ampli * cosf(angle);
818 }
819 
820 static float polar_to_y(float center, float diam, float ampli, float angle)
821 {
822  return center + diam * ampli * sinf(angle);
823 }
824 
826  uint pos, float centerx, float centery, float diam, const float colf[3])
827 {
828  float y, u, v;
829  float tangle = 0.0f, tampli;
830  float dangle, dampli, dangle2, dampli2;
831 
832  rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v, BLI_YUV_ITU_BT709);
833 
834  if (u > 0 && v >= 0) {
835  tangle = atanf(v / u);
836  }
837  else if (u > 0 && v < 0) {
838  tangle = atanf(v / u) + 2.0f * (float)M_PI;
839  }
840  else if (u < 0) {
841  tangle = atanf(v / u) + (float)M_PI;
842  }
843  else if (u == 0 && v > 0.0f) {
844  tangle = M_PI_2;
845  }
846  else if (u == 0 && v < 0.0f) {
847  tangle = -M_PI_2;
848  }
849  tampli = sqrtf(u * u + v * v);
850 
851  /* small target vary by 2.5 degree and 2.5 IRE unit */
852  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
853  dangle = DEG2RADF(2.5f);
854  dampli = 2.5f / 200.0f;
857  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle),
858  polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
860  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle),
861  polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
863  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle),
864  polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
866  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
867  polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
868  immEnd();
869  /* big target vary by 10 degree and 20% amplitude */
870  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
871  dangle = DEG2RADF(10.0f);
872  dampli = 0.2f * tampli;
873  dangle2 = DEG2RADF(5.0f);
874  dampli2 = 0.5f * dampli;
877  polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle),
878  polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle));
880  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle),
881  polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
883  polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2),
884  polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2));
885  immEnd();
888  polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle),
889  polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle));
891  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle),
892  polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
894  polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2),
895  polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2));
896  immEnd();
899  polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle),
900  polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle));
902  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle),
903  polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
905  polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2),
906  polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2));
907  immEnd();
910  polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle),
911  polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle));
913  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
914  polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
916  polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2),
917  polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2));
918  immEnd();
919 }
920 
922  uiBut *but,
923  const uiWidgetColors *UNUSED(wcol),
924  const rcti *recti)
925 {
926  const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
927  Scopes *scopes = (Scopes *)but->poin;
928 
929  const float colors[6][3] = {
930  {0.75, 0.0, 0.0},
931  {0.75, 0.75, 0.0},
932  {0.0, 0.75, 0.0},
933  {0.0, 0.75, 0.75},
934  {0.0, 0.0, 0.75},
935  {0.75, 0.0, 0.75},
936  };
937 
938  rctf rect = {
939  .xmin = (float)recti->xmin + 1,
940  .xmax = (float)recti->xmax - 1,
941  .ymin = (float)recti->ymin + 1,
942  .ymax = (float)recti->ymax - 1,
943  };
944 
945  const float w = BLI_rctf_size_x(&rect);
946  const float h = BLI_rctf_size_y(&rect);
947  const float centerx = rect.xmin + w * 0.5f;
948  const float centery = rect.ymin + h * 0.5f;
949  const float diam = (w < h) ? w : h;
950 
951  const float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
952 
954 
955  float color[4];
959  &(const rctf){
960  .xmin = rect.xmin - 1,
961  .xmax = rect.xmax + 1,
962  .ymin = rect.ymin - 1,
963  .ymax = rect.ymax + 1,
964  },
965  true,
966  3.0f,
967  color);
968 
969  /* need scissor test, hvectorscope can draw outside of boundary */
970  int scissor[4];
971  GPU_scissor_get(scissor);
972  GPU_scissor((rect.xmin - 1),
973  (rect.ymin - 1),
974  (rect.xmax + 1) - (rect.xmin - 1),
975  (rect.ymax + 1) - (rect.ymin - 1));
976 
979 
981 
982  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
983  /* draw grid elements */
984  /* cross */
986 
987  immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery);
988  immVertex2f(pos, centerx + (diam * 0.5f) + 5, centery);
989 
990  immVertex2f(pos, centerx, centery - (diam * 0.5f) - 5);
991  immVertex2f(pos, centerx, centery + (diam * 0.5f) + 5);
992 
993  immEnd();
994 
995  /* circles */
996  for (int j = 0; j < 5; j++) {
997  const int increment = 15;
998  immBegin(GPU_PRIM_LINE_LOOP, (int)(360 / increment));
999  for (int i = 0; i <= 360 - increment; i += increment) {
1000  const float a = DEG2RADF((float)i);
1001  const float r = (j + 1) * 0.1f;
1002  immVertex2f(pos, polar_to_x(centerx, diam, r, a), polar_to_y(centery, diam, r, a));
1003  }
1004  immEnd();
1005  }
1006  /* skin tone line */
1007  immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
1008 
1010  immVertex2f(
1011  pos, polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5f, skin_rad));
1012  immVertex2f(
1013  pos, polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1f, skin_rad));
1014  immEnd();
1015 
1016  /* saturation points */
1017  for (int i = 0; i < 6; i++) {
1018  vectorscope_draw_target(pos, centerx, centery, diam, colors[i]);
1019  }
1020 
1021  if (scopes->ok && scopes->vecscope != NULL) {
1022  /* pixel point cloud */
1023  const float col[3] = {alpha, alpha, alpha};
1024 
1026  GPU_point_size(1.0);
1027 
1028  GPU_matrix_push();
1029  GPU_matrix_translate_2f(centerx, centery);
1030  GPU_matrix_scale_1f(diam);
1031 
1032  waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col);
1033 
1034  GPU_matrix_pop();
1035  }
1036 
1037  immUnbindProgram();
1038 
1039  /* Restore scissor test. */
1040  GPU_scissor(UNPACK4(scissor));
1041  /* outline */
1042  draw_scope_end(&rect);
1043 
1045 }
1046 
1048  uint pos, float x1, float y1, float halfwidth, float height)
1049 {
1050  GPU_line_smooth(true);
1051 
1053  immVertex2f(pos, x1 + halfwidth, y1);
1054  immVertex2f(pos, x1, y1 + height);
1055  immVertex2f(pos, x1 - halfwidth, y1);
1056  immEnd();
1057 
1058  GPU_line_smooth(false);
1059 }
1060 
1062  uint pos, float x1, float y1, float halfwidth, float height, bool fill)
1063 {
1064  if (fill) {
1065  GPU_polygon_smooth(true);
1066  }
1067  else {
1068  GPU_line_smooth(true);
1069  }
1070 
1072  immVertex2f(pos, x1 + halfwidth, y1);
1073  immVertex2f(pos, x1, y1 + height);
1074  immVertex2f(pos, x1 - halfwidth, y1);
1075  immEnd();
1076 
1077  if (fill) {
1078  GPU_polygon_smooth(false);
1079  }
1080  else {
1081  GPU_line_smooth(false);
1082  }
1083 }
1084 
1086  uint pos, float x1, float y1, float x2, float y2, bool fill)
1087 {
1088  if (fill) {
1090  immVertex2f(pos, x2, y1);
1091  immVertex2f(pos, x1, y1);
1092  immVertex2f(pos, x2, y2);
1093  immVertex2f(pos, x1, y2);
1094  immEnd();
1095  }
1096  else {
1098  immVertex2f(pos, x1, y1);
1099  immVertex2f(pos, x1, y2);
1100  immVertex2f(pos, x2, y2);
1101  immVertex2f(pos, x2, y1);
1102  immVertex2f(pos, x1, y1);
1103  immEnd();
1104  }
1105 }
1106 
1107 static void ui_draw_colorband_handle(uint shdr_pos,
1108  const rcti *rect,
1109  float x,
1110  const float rgb[3],
1111  struct ColorManagedDisplay *display,
1112  bool active)
1113 {
1114  const float sizey = BLI_rcti_size_y(rect);
1115  const float min_width = 3.0f;
1116  float colf[3] = {UNPACK3(rgb)};
1117 
1118  const float half_width = floorf(sizey / 3.5f);
1119  const float height = half_width * 1.4f;
1120 
1121  float y1 = rect->ymin + (sizey * 0.16f);
1122  const float y2 = rect->ymax;
1123 
1124  /* align to pixels */
1125  x = floorf(x + 0.5f);
1126  y1 = floorf(y1 + 0.5f);
1127 
1128  if (active || half_width < min_width) {
1129  immUnbindProgram();
1130 
1132 
1133  float viewport_size[4];
1134  GPU_viewport_size_get_f(viewport_size);
1135  immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
1136 
1137  immUniform1i("colors_len", 2); /* "advanced" mode */
1138  immUniform4f("color", 0.8f, 0.8f, 0.8f, 1.0f);
1139  immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f);
1140  immUniform1f("dash_width", active ? 4.0f : 2.0f);
1141  immUniform1f("dash_factor", 0.5f);
1142 
1144  immVertex2f(shdr_pos, x, y1);
1145  immVertex2f(shdr_pos, x, y2);
1146  immEnd();
1147 
1148  immUnbindProgram();
1149 
1151 
1152  /* hide handles when zoomed out too far */
1153  if (half_width < min_width) {
1154  return;
1155  }
1156  }
1157 
1158  /* shift handle down */
1159  y1 -= half_width;
1160 
1161  immUniformColor3ub(0, 0, 0);
1163  shdr_pos, x - half_width, y1 - 1, x + half_width, y1 + height, false);
1164 
1165  /* draw all triangles blended */
1167 
1168  ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
1169 
1170  if (active) {
1171  immUniformColor3ub(196, 196, 196);
1172  }
1173  else {
1174  immUniformColor3ub(96, 96, 96);
1175  }
1176  ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
1177 
1178  if (active) {
1179  immUniformColor3ub(255, 255, 255);
1180  }
1181  else {
1182  immUniformColor3ub(128, 128, 128);
1183  }
1185  shdr_pos, x, y1 + height - 1, (half_width - 1), (half_width - 1));
1186 
1187  immUniformColor3ub(0, 0, 0);
1188  ui_draw_colorband_handle_tri_hlight(shdr_pos, x, y1 + height, half_width, half_width);
1189 
1191 
1192  immUniformColor3ub(128, 128, 128);
1194  shdr_pos, x - (half_width - 1), y1, x + (half_width - 1), y1 + height, true);
1195 
1196  if (display) {
1198  }
1199 
1200  immUniformColor3fv(colf);
1202  shdr_pos, x - (half_width - 2), y1 + 1, x + (half_width - 2), y1 + height - 2, true);
1203 }
1204 
1205 void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
1206 {
1207  struct ColorManagedDisplay *display = ui_block_cm_display_get(but->block);
1208  uint pos_id, col_id;
1209 
1210  uiButColorBand *but_coba = (uiButColorBand *)but;
1211  ColorBand *coba = (but_coba->edit_coba == NULL) ? (ColorBand *)but->poin : but_coba->edit_coba;
1212 
1213  if (coba == NULL) {
1214  return;
1215  }
1216 
1217  const float x1 = rect->xmin;
1218  const float sizex = rect->xmax - x1;
1219  const float sizey = BLI_rcti_size_y(rect);
1220  const float sizey_solid = sizey * 0.25f;
1221  const float y1 = rect->ymin;
1222 
1223  /* exit early if too narrow */
1224  if (sizex <= 0) {
1225  return;
1226  }
1227 
1231 
1232  /* Drawing the checkerboard. */
1233  const float checker_dark = UI_ALPHA_CHECKER_DARK / 255.0f;
1234  const float checker_light = UI_ALPHA_CHECKER_LIGHT / 255.0f;
1235  immUniform4f("color1", checker_dark, checker_dark, checker_dark, 1.0f);
1236  immUniform4f("color2", checker_light, checker_light, checker_light, 1.0f);
1237  immUniform1i("size", 8);
1238  immRectf(pos_id, x1, y1, x1 + sizex, rect->ymax);
1239  immUnbindProgram();
1240 
1241  /* New format */
1242  format = immVertexFormat();
1246 
1247  /* layer: color ramp */
1249 
1250  CBData *cbd = coba->data;
1251 
1252  float v1[2], v2[2];
1253  float colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */
1254 
1255  v1[1] = y1 + sizey_solid;
1256  v2[1] = rect->ymax;
1257 
1258  immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
1259  for (int a = 0; a <= sizex; a++) {
1260  const float pos = ((float)a) / sizex;
1261  BKE_colorband_evaluate(coba, pos, colf);
1262  if (display) {
1264  }
1265 
1266  v1[0] = v2[0] = x1 + a;
1267 
1268  immAttr4fv(col_id, colf);
1269  immVertex2fv(pos_id, v1);
1270  immVertex2fv(pos_id, v2);
1271  }
1272  immEnd();
1273 
1274  /* layer: color ramp without alpha for reference when manipulating ramp properties */
1275  v1[1] = y1;
1276  v2[1] = y1 + sizey_solid;
1277 
1278  immBegin(GPU_PRIM_TRI_STRIP, (sizex + 1) * 2);
1279  for (int a = 0; a <= sizex; a++) {
1280  const float pos = ((float)a) / sizex;
1281  BKE_colorband_evaluate(coba, pos, colf);
1282  if (display) {
1284  }
1285 
1286  v1[0] = v2[0] = x1 + a;
1287 
1288  immAttr4f(col_id, colf[0], colf[1], colf[2], 1.0f);
1289  immVertex2fv(pos_id, v1);
1290  immVertex2fv(pos_id, v2);
1291  }
1292  immEnd();
1293 
1294  immUnbindProgram();
1295 
1297 
1298  /* New format */
1299  format = immVertexFormat();
1302 
1303  /* layer: box outline */
1304  immUniformColor4f(0.0f, 0.0f, 0.0f, 1.0f);
1305  imm_draw_box_wire_2d(pos_id, x1, y1, x1 + sizex, rect->ymax);
1306 
1307  /* layer: box outline */
1309  immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
1310 
1312  immVertex2f(pos_id, x1, y1);
1313  immVertex2f(pos_id, x1 + sizex, y1);
1314  immEnd();
1315 
1316  immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f);
1317 
1319  immVertex2f(pos_id, x1, y1 - 1);
1320  immVertex2f(pos_id, x1 + sizex, y1 - 1);
1321  immEnd();
1322 
1324 
1325  /* layer: draw handles */
1326  for (int a = 0; a < coba->tot; a++, cbd++) {
1327  if (a != coba->cur) {
1328  const float pos = x1 + cbd->pos * (sizex - 1) + 1;
1329  ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, false);
1330  }
1331  }
1332 
1333  /* layer: active handle */
1334  if (coba->tot != 0) {
1335  cbd = &coba->data[coba->cur];
1336  const float pos = x1 + cbd->pos * (sizex - 1) + 1;
1337  ui_draw_colorband_handle(pos_id, rect, pos, &cbd->r, display, true);
1338  }
1339 
1340  immUnbindProgram();
1341 }
1342 
1344  const uiWidgetColors *wcol,
1345  const rcti *rect,
1346  const float radius)
1347 {
1348  /* sphere color */
1349  const float diffuse[3] = {1.0f, 1.0f, 1.0f};
1350  float light[3];
1351  const float size = 0.5f * min_ff(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect));
1352 
1353  /* backdrop */
1356  &(const rctf){
1357  .xmin = rect->xmin,
1358  .xmax = rect->xmax,
1359  .ymin = rect->ymin,
1360  .ymax = rect->ymax,
1361  },
1362  true,
1363  radius,
1364  wcol->inner,
1365  255);
1366 
1368 
1369  /* setup lights */
1370  ui_but_v3_get(but, light);
1371 
1372  /* transform to button */
1373  GPU_matrix_push();
1374 
1375  const bool use_project_matrix = (size >= -GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT);
1376  if (use_project_matrix) {
1379  }
1380 
1381  GPU_matrix_translate_2f(rect->xmin + 0.5f * BLI_rcti_size_x(rect),
1382  rect->ymin + 0.5f * BLI_rcti_size_y(rect));
1384 
1385  GPUBatch *sphere = GPU_batch_preset_sphere(2);
1386  struct SimpleLightingData simple_lighting_data;
1387  copy_v4_fl4(simple_lighting_data.color, diffuse[0], diffuse[1], diffuse[2], 1.0f);
1388  copy_v3_v3(simple_lighting_data.light, light);
1390  sizeof(struct SimpleLightingData), &simple_lighting_data, __func__);
1391 
1393  GPU_batch_uniformbuf_bind(sphere, "simple_lighting_data", ubo);
1394  GPU_batch_draw(sphere);
1395  GPU_uniformbuf_free(ubo);
1396 
1397  /* Restore. */
1399 
1400  /* AA circle */
1404  immUniformColor3ubv(wcol->inner);
1405 
1407  GPU_line_smooth(true);
1408  imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, 1.0f, 32);
1410  GPU_line_smooth(false);
1411 
1412  if (use_project_matrix) {
1414  }
1415 
1416  /* matrix after circle */
1417  GPU_matrix_pop();
1418 
1419  immUnbindProgram();
1420 }
1421 
1422 static void ui_draw_but_curve_grid(const uint pos,
1423  const rcti *rect,
1424  const float zoom_x,
1425  const float zoom_y,
1426  const float offset_x,
1427  const float offset_y,
1428  const float step)
1429 {
1430  const float start_x = (ceilf(offset_x / step) * step - offset_x) * zoom_x + rect->xmin;
1431  const float start_y = (ceilf(offset_y / step) * step - offset_y) * zoom_y + rect->ymin;
1432 
1433  const int line_count_x = ceilf((rect->xmax - start_x) / (step * zoom_x));
1434  const int line_count_y = ceilf((rect->ymax - start_y) / (step * zoom_y));
1435 
1436  if (line_count_x + line_count_y == 0) {
1437  return;
1438  }
1439 
1440  immBegin(GPU_PRIM_LINES, (line_count_x + line_count_y) * 2);
1441  for (int i = 0; i < line_count_x; i++) {
1442  const float x = start_x + i * step * zoom_x;
1443  immVertex2f(pos, x, rect->ymin);
1444  immVertex2f(pos, x, rect->ymax);
1445  }
1446  for (int i = 0; i < line_count_y; i++) {
1447  const float y = start_y + i * step * zoom_y;
1448  immVertex2f(pos, rect->xmin, y);
1449  immVertex2f(pos, rect->xmax, y);
1450  }
1451  immEnd();
1452 }
1453 
1454 static void gl_shaded_color_get(const uchar color[3], int shade, uchar r_color[3])
1455 {
1456  r_color[0] = color[0] - shade > 0 ? color[0] - shade : 0;
1457  r_color[1] = color[1] - shade > 0 ? color[1] - shade : 0;
1458  r_color[2] = color[2] - shade > 0 ? color[2] - shade : 0;
1459 }
1460 
1461 static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[3])
1462 {
1463  uchar color_shaded[3];
1464  gl_shaded_color_get(color, shade, color_shaded);
1465  rgb_uchar_to_float(r_color, color_shaded);
1466 }
1467 
1468 static void gl_shaded_color(const uchar *color, int shade)
1469 {
1470  uchar color_shaded[3];
1471  gl_shaded_color_get(color, shade, color_shaded);
1472  immUniformColor3ubv(color_shaded);
1473 }
1474 
1475 void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
1476 {
1477  uiButCurveMapping *but_cumap = (uiButCurveMapping *)but;
1478  CurveMapping *cumap = (but_cumap->edit_cumap == NULL) ? (CurveMapping *)but->poin :
1479  but_cumap->edit_cumap;
1480 
1481  const float clip_size_x = BLI_rctf_size_x(&cumap->curr);
1482  const float clip_size_y = BLI_rctf_size_y(&cumap->curr);
1483 
1484  /* zero-sized curve */
1485  if (clip_size_x == 0.0f || clip_size_y == 0.0f) {
1486  return;
1487  }
1488 
1489  /* calculate offset and zoom */
1490  const float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / clip_size_x;
1491  const float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / clip_size_y;
1492  const float offsx = cumap->curr.xmin - (1.0f / zoomx);
1493  const float offsy = cumap->curr.ymin - (1.0f / zoomy);
1494 
1495  /* exit early if too narrow */
1496  if (zoomx == 0.0f) {
1497  return;
1498  }
1499 
1500  CurveMap *cuma = &cumap->cm[cumap->cur];
1501 
1502  /* need scissor test, curve can draw outside of boundary */
1503  int scissor[4];
1504  GPU_scissor_get(scissor);
1505  rcti scissor_new = {
1506  .xmin = rect->xmin,
1507  .ymin = rect->ymin,
1508  .xmax = rect->xmax,
1509  .ymax = rect->ymax,
1510  };
1511  const rcti scissor_region = {0, region->winx, 0, region->winy};
1512  BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
1513  GPU_scissor(scissor_new.xmin,
1514  scissor_new.ymin,
1515  BLI_rcti_size_x(&scissor_new),
1516  BLI_rcti_size_y(&scissor_new));
1517 
1518  /* Do this first to not mess imm context */
1519  if (but_cumap->gradient_type == UI_GRAD_H) {
1520  /* magic trigger for curve backgrounds */
1521  const float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
1522 
1523  rcti grid = {
1524  .xmin = rect->xmin + zoomx * (-offsx),
1525  .xmax = grid.xmin + zoomx,
1526  .ymin = rect->ymin + zoomy * (-offsy),
1527  .ymax = grid.ymin + zoomy,
1528  };
1529 
1530  ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
1531  }
1532 
1533  GPU_line_width(1.0f);
1534 
1538 
1539  /* backdrop */
1540  float color_backdrop[4] = {0, 0, 0, 1};
1541 
1542  if (but_cumap->gradient_type == UI_GRAD_H) {
1543  /* grid, hsv uses different grid */
1545  ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0);
1546  immUniformColor4fv(color_backdrop);
1547  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
1549  }
1550  else {
1551  if (cumap->flag & CUMA_DO_CLIP) {
1552  gl_shaded_color_get_fl(wcol->inner, -20, color_backdrop);
1553  immUniformColor3fv(color_backdrop);
1554  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1555  immUniformColor3ubv(wcol->inner);
1556  immRectf(pos,
1557  rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
1558  rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
1559  rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
1560  rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
1561  }
1562  else {
1563  rgb_uchar_to_float(color_backdrop, wcol->inner);
1564  immUniformColor3fv(color_backdrop);
1565  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1566  }
1567 
1568  /* grid, every 0.25 step */
1569  gl_shaded_color(wcol->inner, -16);
1570  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f);
1571  /* grid, every 1.0 step */
1572  gl_shaded_color(wcol->inner, -24);
1573  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
1574  /* axes */
1575  gl_shaded_color(wcol->inner, -50);
1577  immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy));
1578  immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy));
1579  immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymin);
1580  immVertex2f(pos, rect->xmin + zoomx * (-offsx), rect->ymax);
1581  immEnd();
1582  }
1583 
1584  /* cfra option */
1585  /* XXX 2.48 */
1586 #if 0
1587  if (cumap->flag & CUMA_DRAW_CFRA) {
1588  immUniformColor3ub(0x60, 0xc0, 0x40);
1590  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin);
1591  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax);
1592  immEnd();
1593  }
1594 #endif
1595  /* sample option */
1596 
1597  if (cumap->flag & CUMA_DRAW_SAMPLE) {
1598  immBegin(GPU_PRIM_LINES, 2); /* will draw one of the following 3 lines */
1599  if (but_cumap->gradient_type == UI_GRAD_H) {
1600  float tsample[3];
1601  float hsv[3];
1602  linearrgb_to_srgb_v3_v3(tsample, cumap->sample);
1603  rgb_to_hsv_v(tsample, hsv);
1604  immUniformColor3ub(240, 240, 240);
1605 
1606  immVertex2f(pos, rect->xmin + zoomx * (hsv[0] - offsx), rect->ymin);
1607  immVertex2f(pos, rect->xmin + zoomx * (hsv[0] - offsx), rect->ymax);
1608  }
1609  else if (cumap->cur == 3) {
1610  const float lum = IMB_colormanagement_get_luminance(cumap->sample);
1611  immUniformColor3ub(240, 240, 240);
1612 
1613  immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymin);
1614  immVertex2f(pos, rect->xmin + zoomx * (lum - offsx), rect->ymax);
1615  }
1616  else {
1617  if (cumap->cur == 0) {
1618  immUniformColor3ub(240, 100, 100);
1619  }
1620  else if (cumap->cur == 1) {
1621  immUniformColor3ub(100, 240, 100);
1622  }
1623  else {
1624  immUniformColor3ub(100, 100, 240);
1625  }
1626 
1627  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymin);
1628  immVertex2f(pos, rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymax);
1629  }
1630  immEnd();
1631  }
1632  immUnbindProgram();
1633 
1634  if (cuma->table == NULL) {
1635  BKE_curvemapping_changed(cumap, false);
1636  }
1637 
1638  CurveMapPoint *cmp = cuma->table;
1639  rctf line_range;
1640 
1641  /* First curve point. */
1642  if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
1643  line_range.xmin = rect->xmin;
1644  line_range.ymin = rect->ymin + zoomy * (cmp[0].y - offsy);
1645  }
1646  else {
1647  line_range.xmin = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
1648  line_range.ymin = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
1649  }
1650  /* Last curve point. */
1651  if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
1652  line_range.xmax = rect->xmax;
1653  line_range.ymax = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy);
1654  }
1655  else {
1656  line_range.xmax = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
1657  line_range.ymax = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
1658  }
1659 
1662 
1663  /* Curve filled. */
1664  immUniformColor3ubvAlpha(wcol->item, 128);
1665  immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4);
1666  immVertex2f(pos, line_range.xmin, rect->ymin);
1667  immVertex2f(pos, line_range.xmin, line_range.ymin);
1668  for (int a = 0; a <= CM_TABLE; a++) {
1669  const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
1670  const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
1671  immVertex2f(pos, fx, rect->ymin);
1672  immVertex2f(pos, fx, fy);
1673  }
1674  immVertex2f(pos, line_range.xmax, rect->ymin);
1675  immVertex2f(pos, line_range.xmax, line_range.ymax);
1676  immEnd();
1677 
1678  /* Curve line. */
1679  GPU_line_width(1.0f);
1680  immUniformColor3ubvAlpha(wcol->item, 255);
1681  GPU_line_smooth(true);
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, fy);
1688  }
1689  immVertex2f(pos, line_range.xmax, line_range.ymax);
1690  immEnd();
1691 
1692  /* Reset state for fill & line. */
1693  GPU_line_smooth(false);
1695  immUnbindProgram();
1696 
1697  /* The points, use aspect to make them visible on edges. */
1698  format = immVertexFormat();
1702 
1703  /* Calculate vertex colors based on text theme. */
1704  float color_vert[4], color_vert_select[4];
1705  UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
1706  UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
1707  if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
1708  interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
1709  }
1710  if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
1711  /* Ensure brightest text color is used for selection. */
1712  swap_v3_v3(color_vert, color_vert_select);
1713  }
1714 
1715  cmp = cuma->curve;
1716  GPU_point_size(max_ff(1.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
1718  for (int a = 0; a < cuma->totpoint; a++) {
1719  const float fx = rect->xmin + zoomx * (cmp[a].x - offsx);
1720  const float fy = rect->ymin + zoomy * (cmp[a].y - offsy);
1721  immAttr4fv(col, (cmp[a].flag & CUMA_SELECT) ? color_vert_select : color_vert);
1722  immVertex2f(pos, fx, fy);
1723  }
1724  immEnd();
1725  immUnbindProgram();
1726 
1727  /* Restore scissor-test. */
1728  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
1729 
1730  /* outline */
1731  format = immVertexFormat();
1734 
1736  imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1737 
1738  immUnbindProgram();
1739 }
1740 
1745 {
1746  return (point->flag & PROF_SELECT &&
1747  (ELEM(point->h1, HD_FREE, HD_ALIGN) || ELEM(point->h2, HD_FREE, HD_ALIGN))) ||
1749 }
1750 
1752  uiBut *but,
1753  const uiWidgetColors *wcol,
1754  const rcti *rect)
1755 {
1756  float fx, fy;
1757 
1758  uiButCurveProfile *but_profile = (uiButCurveProfile *)but;
1759  CurveProfile *profile = (but_profile->edit_profile == NULL) ? (CurveProfile *)but->poin :
1760  but_profile->edit_profile;
1761 
1762  /* Calculate offset and zoom. */
1763  const float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&profile->view_rect);
1764  const float zoomy = (BLI_rcti_size_y(rect) - 2.0f) / BLI_rctf_size_y(&profile->view_rect);
1765  const float offsx = profile->view_rect.xmin - (1.0f / zoomx);
1766  const float offsy = profile->view_rect.ymin - (1.0f / zoomy);
1767 
1768  /* Exit early if too narrow. */
1769  if (zoomx == 0.0f) {
1770  return;
1771  }
1772 
1773  /* Test needed because path can draw outside of boundary. */
1774  int scissor[4];
1775  GPU_scissor_get(scissor);
1776  rcti scissor_new = {
1777  .xmin = rect->xmin,
1778  .ymin = rect->ymin,
1779  .xmax = rect->xmax,
1780  .ymax = rect->ymax,
1781  };
1782  const rcti scissor_region = {0, region->winx, 0, region->winy};
1783  BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
1784  GPU_scissor(scissor_new.xmin,
1785  scissor_new.ymin,
1786  BLI_rcti_size_x(&scissor_new),
1787  BLI_rcti_size_y(&scissor_new));
1788 
1789  GPU_line_width(1.0f);
1790 
1794 
1795  /* Draw the backdrop. */
1796  float color_backdrop[4] = {0, 0, 0, 1};
1797  if (profile->flag & PROF_USE_CLIP) {
1798  gl_shaded_color_get_fl((uchar *)wcol->inner, -20, color_backdrop);
1799  immUniformColor3fv(color_backdrop);
1800  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1801  immUniformColor3ubv((uchar *)wcol->inner);
1802  immRectf(pos,
1803  rect->xmin + zoomx * (profile->clip_rect.xmin - offsx),
1804  rect->ymin + zoomy * (profile->clip_rect.ymin - offsy),
1805  rect->xmin + zoomx * (profile->clip_rect.xmax - offsx),
1806  rect->ymin + zoomy * (profile->clip_rect.ymax - offsy));
1807  }
1808  else {
1809  rgb_uchar_to_float(color_backdrop, (uchar *)wcol->inner);
1810  immUniformColor3fv(color_backdrop);
1811  immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
1812  }
1813 
1814  /* 0.25 step grid. */
1815  gl_shaded_color((uchar *)wcol->inner, -16);
1816  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f);
1817  /* 1.0 step grid. */
1818  gl_shaded_color((uchar *)wcol->inner, -24);
1819  ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f);
1820 
1821  /* Draw the path's fill. */
1822  if (profile->table == NULL) {
1824  }
1825  CurveProfilePoint *pts = profile->table;
1826  /* Also add the last points on the right and bottom edges to close off the fill polygon. */
1827  const bool add_left_tri = profile->view_rect.xmin < 0.0f;
1828  const bool add_bottom_tri = profile->view_rect.ymin < 0.0f;
1829  int tot_points = BKE_curveprofile_table_size(profile) + 1 + add_left_tri + add_bottom_tri;
1830  const uint tot_triangles = tot_points - 2;
1831 
1832  /* Create array of the positions of the table's points. */
1833  float(*table_coords)[2] = MEM_mallocN(sizeof(*table_coords) * tot_points, "table x coords");
1834  for (uint i = 0; i < (uint)BKE_curveprofile_table_size(profile); i++) {
1835  /* Only add the points from the table here. */
1836  table_coords[i][0] = pts[i].x;
1837  table_coords[i][1] = pts[i].y;
1838  }
1839  /* Using some extra margin (-1.0f) for the coordinates used to complete the polygon
1840  * avoids the profile line crossing itself in some common situations, which can lead to
1841  * incorrect triangulation. See T841183. */
1842  if (add_left_tri && add_bottom_tri) {
1843  /* Add left side, bottom left corner, and bottom side points. */
1844  table_coords[tot_points - 3][0] = profile->view_rect.xmin - 1.0f;
1845  table_coords[tot_points - 3][1] = 1.0f;
1846  table_coords[tot_points - 2][0] = profile->view_rect.xmin - 1.0f;
1847  table_coords[tot_points - 2][1] = profile->view_rect.ymin - 1.0f;
1848  table_coords[tot_points - 1][0] = 1.0f;
1849  table_coords[tot_points - 1][1] = profile->view_rect.ymin - 1.0f;
1850  }
1851  else if (add_left_tri) {
1852  /* Add the left side and bottom left corner points. */
1853  table_coords[tot_points - 2][0] = profile->view_rect.xmin - 1.0f;
1854  table_coords[tot_points - 2][1] = 1.0f;
1855  table_coords[tot_points - 1][0] = profile->view_rect.xmin - 1.0f;
1856  table_coords[tot_points - 1][1] = -1.0f;
1857  }
1858  else if (add_bottom_tri) {
1859  /* Add the bottom side and bottom left corner points. */
1860  table_coords[tot_points - 2][0] = -1.0f;
1861  table_coords[tot_points - 2][1] = profile->view_rect.ymin - 1.0f;
1862  table_coords[tot_points - 1][0] = 1.0f;
1863  table_coords[tot_points - 1][1] = profile->view_rect.ymin - 1.0f;
1864  }
1865  else {
1866  /* Just add the bottom corner point. Side points would be redundant anyway. */
1867  table_coords[tot_points - 1][0] = -1.0f;
1868  table_coords[tot_points - 1][1] = -1.0f;
1869  }
1870 
1871  /* Calculate the table point indices of the triangles for the profile's fill. */
1872  if (tot_triangles > 0) {
1873  uint(*tri_indices)[3] = MEM_mallocN(sizeof(*tri_indices) * tot_triangles, __func__);
1874  BLI_polyfill_calc(table_coords, tot_points, -1, tri_indices);
1875 
1876  /* Draw the triangles for the profile fill. */
1877  immUniformColor3ubvAlpha((const uchar *)wcol->item, 128);
1879  GPU_polygon_smooth(false);
1880  immBegin(GPU_PRIM_TRIS, 3 * tot_triangles);
1881  for (uint i = 0; i < tot_triangles; i++) {
1882  for (uint j = 0; j < 3; j++) {
1883  uint *tri = tri_indices[i];
1884  fx = rect->xmin + zoomx * (table_coords[tri[j]][0] - offsx);
1885  fy = rect->ymin + zoomy * (table_coords[tri[j]][1] - offsy);
1886  immVertex2f(pos, fx, fy);
1887  }
1888  }
1889  immEnd();
1890  MEM_freeN(tri_indices);
1891  }
1892 
1893  /* Draw the profile's path so the edge stands out a bit. */
1894  tot_points -= (add_left_tri + add_left_tri);
1895  const int edges_len = tot_points - 1;
1896  if (edges_len > 0) {
1897  GPU_line_width(1.0f);
1898  immUniformColor3ubvAlpha((const uchar *)wcol->item, 255);
1899  GPU_line_smooth(true);
1900  immBegin(GPU_PRIM_LINE_STRIP, tot_points);
1901  for (int i = 0; i < tot_points; i++) {
1902  fx = rect->xmin + zoomx * (table_coords[i][0] - offsx);
1903  fy = rect->ymin + zoomy * (table_coords[i][1] - offsy);
1904  immVertex2f(pos, fx, fy);
1905  }
1906  immEnd();
1907  }
1908 
1909  MEM_SAFE_FREE(table_coords);
1910 
1911  /* Draw the handles for the selected control points. */
1912  pts = profile->path;
1913  const int path_len = tot_points = (uint)profile->path_len;
1914  int selected_free_points = 0;
1915  for (int i = 0; i < path_len; i++) {
1916  if (point_draw_handles(&pts[i])) {
1917  selected_free_points++;
1918  }
1919  }
1920  /* Draw the lines to the handles from the points. */
1921  if (selected_free_points > 0) {
1922  GPU_line_width(1.0f);
1923  gl_shaded_color((uchar *)wcol->inner, -24);
1924  GPU_line_smooth(true);
1925  immBegin(GPU_PRIM_LINES, selected_free_points * 4);
1926  float ptx, pty;
1927  for (int i = 0; i < path_len; i++) {
1928  if (point_draw_handles(&pts[i])) {
1929  ptx = rect->xmin + zoomx * (pts[i].x - offsx);
1930  pty = rect->ymin + zoomy * (pts[i].y - offsy);
1931 
1932  fx = rect->xmin + zoomx * (pts[i].h1_loc[0] - offsx);
1933  fy = rect->ymin + zoomy * (pts[i].h1_loc[1] - offsy);
1934  immVertex2f(pos, ptx, pty);
1935  immVertex2f(pos, fx, fy);
1936 
1937  fx = rect->xmin + zoomx * (pts[i].h2_loc[0] - offsx);
1938  fy = rect->ymin + zoomy * (pts[i].h2_loc[1] - offsy);
1939  immVertex2f(pos, ptx, pty);
1940  immVertex2f(pos, fx, fy);
1941  }
1942  }
1943  immEnd();
1944  }
1945  immUnbindProgram();
1946 
1947  /* New GPU instructions for control points and sampled points. */
1948  format = immVertexFormat();
1952 
1953  /* Calculate vertex colors based on text theme. */
1954  float color_vert[4], color_vert_select[4], color_sample[4];
1955  UI_GetThemeColor4fv(TH_TEXT_HI, color_vert);
1956  UI_GetThemeColor4fv(TH_TEXT, color_vert_select);
1957  color_sample[0] = (float)wcol->item[0] / 255.0f;
1958  color_sample[1] = (float)wcol->item[1] / 255.0f;
1959  color_sample[2] = (float)wcol->item[2] / 255.0f;
1960  color_sample[3] = (float)wcol->item[3] / 255.0f;
1961  if (len_squared_v3v3(color_vert, color_vert_select) < 0.1f) {
1962  interp_v3_v3v3(color_vert, color_vert_select, color_backdrop, 0.75f);
1963  }
1964  if (len_squared_v3(color_vert) > len_squared_v3(color_vert_select)) {
1965  /* Ensure brightest text color is used for selection. */
1966  swap_v3_v3(color_vert, color_vert_select);
1967  }
1968 
1969  /* Draw the control points. */
1970  GPU_line_smooth(false);
1971  if (path_len > 0) {
1973  GPU_point_size(max_ff(3.0f, min_ff(UI_DPI_FAC / but->block->aspect * 5.0f, 5.0f)));
1974  immBegin(GPU_PRIM_POINTS, path_len);
1975  for (int i = 0; i < path_len; i++) {
1976  fx = rect->xmin + zoomx * (pts[i].x - offsx);
1977  fy = rect->ymin + zoomy * (pts[i].y - offsy);
1978  immAttr4fv(col, (pts[i].flag & PROF_SELECT) ? color_vert_select : color_vert);
1979  immVertex2f(pos, fx, fy);
1980  }
1981  immEnd();
1982  }
1983 
1984  /* Draw the handle points. */
1985  if (selected_free_points > 0) {
1986  GPU_line_smooth(false);
1988  GPU_point_size(max_ff(2.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f)));
1989  immBegin(GPU_PRIM_POINTS, selected_free_points * 2);
1990  for (int i = 0; i < path_len; i++) {
1991  if (point_draw_handles(&pts[i])) {
1992  fx = rect->xmin + zoomx * (pts[i].h1_loc[0] - offsx);
1993  fy = rect->ymin + zoomy * (pts[i].h1_loc[1] - offsy);
1994  immAttr4fv(col, (pts[i].flag & PROF_H1_SELECT) ? color_vert_select : color_vert);
1995  immVertex2f(pos, fx, fy);
1996 
1997  fx = rect->xmin + zoomx * (pts[i].h2_loc[0] - offsx);
1998  fy = rect->ymin + zoomy * (pts[i].h2_loc[1] - offsy);
1999  immAttr4fv(col, (pts[i].flag & PROF_H2_SELECT) ? color_vert_select : color_vert);
2000  immVertex2f(pos, fx, fy);
2001  }
2002  }
2003  immEnd();
2004  }
2005 
2006  /* Draw the sampled points in addition to the control points if they have been created */
2007  pts = profile->segments;
2008  const int segments_len = (uint)profile->segments_len;
2009  if (segments_len > 0 && pts) {
2010  GPU_point_size(max_ff(2.0f, min_ff(UI_DPI_FAC / but->block->aspect * 3.0f, 3.0f)));
2011  immBegin(GPU_PRIM_POINTS, segments_len);
2012  for (int i = 0; i < segments_len; i++) {
2013  fx = rect->xmin + zoomx * (pts[i].x - offsx);
2014  fy = rect->ymin + zoomy * (pts[i].y - offsy);
2015  immAttr4fv(col, color_sample);
2016  immVertex2f(pos, fx, fy);
2017  }
2018  immEnd();
2019  }
2020  immUnbindProgram();
2021 
2022  /* Restore scissor-test. */
2023  GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
2024 
2025  /* Outline */
2026  format = immVertexFormat();
2029 
2030  immUniformColor3ubv((const uchar *)wcol->outline);
2031  imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
2032  immUnbindProgram();
2033 }
2034 
2036  uiBut *but,
2037  const uiWidgetColors *UNUSED(wcol),
2038  const rcti *recti)
2039 {
2040  bool ok = false;
2041  MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
2042 
2043  rctf rect = {
2044  .xmin = (float)recti->xmin + 1,
2045  .xmax = (float)recti->xmax - 1,
2046  .ymin = (float)recti->ymin + 1,
2047  .ymax = (float)recti->ymax - 1,
2048  };
2049 
2050  const int width = BLI_rctf_size_x(&rect) + 1;
2051  const int height = BLI_rctf_size_y(&rect);
2052 
2054 
2055  /* need scissor test, preview image can draw outside of boundary */
2056  int scissor[4];
2057  GPU_scissor_get(scissor);
2058  GPU_scissor((rect.xmin - 1),
2059  (rect.ymin - 1),
2060  (rect.xmax + 1) - (rect.xmin - 1),
2061  (rect.ymax + 1) - (rect.ymin - 1));
2062 
2063  if (scopes->track_disabled) {
2064  const float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
2067  &(const rctf){
2068  .xmin = rect.xmin - 1,
2069  .xmax = rect.xmax + 1,
2070  .ymin = rect.ymin,
2071  .ymax = rect.ymax + 1,
2072  },
2073  true,
2074  3.0f,
2075  color);
2076 
2077  ok = true;
2078  }
2079  else if ((scopes->track_search) &&
2080  ((!scopes->track_preview) ||
2081  (scopes->track_preview->x != width || scopes->track_preview->y != height))) {
2082  if (scopes->track_preview) {
2083  IMB_freeImBuf(scopes->track_preview);
2084  }
2085 
2086  ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width,
2087  scopes->frame_height,
2088  scopes->track_search,
2089  scopes->track,
2090  &scopes->undist_marker,
2091  true,
2092  scopes->use_track_mask,
2093  width,
2094  height,
2095  scopes->track_pos);
2096  if (tmpibuf) {
2097  if (tmpibuf->rect_float) {
2098  IMB_rect_from_float(tmpibuf);
2099  }
2100 
2101  if (tmpibuf->rect) {
2102  scopes->track_preview = tmpibuf;
2103  }
2104  else {
2105  IMB_freeImBuf(tmpibuf);
2106  }
2107  }
2108  }
2109 
2110  if (!ok && scopes->track_preview) {
2111  GPU_matrix_push();
2112 
2113  /* draw content of pattern area */
2114  GPU_scissor(rect.xmin, rect.ymin, scissor[2], scissor[3]);
2115 
2116  if (width > 0 && height > 0) {
2117  ImBuf *drawibuf = scopes->track_preview;
2118  float col_sel[4], col_outline[4];
2119 
2120  if (scopes->use_track_mask) {
2121  const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
2124  &(const rctf){
2125  .xmin = rect.xmin - 1,
2126  .xmax = rect.xmax + 1,
2127  .ymin = rect.ymin,
2128  .ymax = rect.ymax + 1,
2129  },
2130  true,
2131  3.0f,
2132  color);
2133  }
2134 
2137  rect.xmin,
2138  rect.ymin + 1,
2139  drawibuf->x,
2140  drawibuf->y,
2141  GPU_RGBA8,
2142  true,
2143  drawibuf->rect,
2144  1.0f,
2145  1.0f,
2146  NULL);
2147 
2148  /* draw cross for pixel position */
2149  GPU_matrix_translate_2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]);
2150  GPU_scissor(rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect));
2151 
2156 
2158  UI_GetThemeColor4fv(TH_MARKER_OUTLINE, col_outline);
2159 
2160  /* Do stipple cross with geometry */
2161  immBegin(GPU_PRIM_LINES, 7 * 2 * 2);
2162  const float pos_sel[8] = {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f, 11.0f};
2163  for (int axe = 0; axe < 2; axe++) {
2164  for (int i = 0; i < 7; i++) {
2165  const float x1 = pos_sel[i] * (1 - axe);
2166  const float y1 = pos_sel[i] * axe;
2167  const float x2 = pos_sel[i + 1] * (1 - axe);
2168  const float y2 = pos_sel[i + 1] * axe;
2169 
2170  if (i % 2 == 1) {
2171  immAttr4fv(col, col_sel);
2172  }
2173  else {
2174  immAttr4fv(col, col_outline);
2175  }
2176 
2177  immVertex2f(pos, x1, y1);
2178  immVertex2f(pos, x2, y2);
2179  }
2180  }
2181  immEnd();
2182 
2183  immUnbindProgram();
2184  }
2185 
2186  GPU_matrix_pop();
2187 
2188  ok = true;
2189  }
2190 
2191  if (!ok) {
2192  const float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
2195  &(const rctf){
2196  .xmin = rect.xmin - 1,
2197  .xmax = rect.xmax + 1,
2198  .ymin = rect.ymin,
2199  .ymax = rect.ymax + 1,
2200  },
2201  true,
2202  3.0f,
2203  color);
2204  }
2205 
2206  /* Restore scissor test. */
2207  GPU_scissor(UNPACK4(scissor));
2208  /* outline */
2209  draw_scope_end(&rect);
2210 
2212 }
2213 
2214 /* ****************************************************** */
2215 
2216 /* TODO(merwin): high quality UI drop shadows using GLSL shader and single draw call
2217  * would replace / modify the following 3 functions. */
2218 
2219 static void ui_shadowbox(const rctf *rect, uint pos, uint color, float shadsize, uchar alpha)
2220 {
2234  const float v1[2] = {rect->xmax, rect->ymax - 0.3f * shadsize};
2235  const float v2[2] = {rect->xmax + shadsize, rect->ymax - 0.75f * shadsize};
2236  const float v3[2] = {rect->xmax, rect->ymin};
2237  const float v4[2] = {rect->xmax + shadsize, rect->ymin};
2238 
2239  const float v5[2] = {rect->xmax + 0.7f * shadsize, rect->ymin - 0.7f * shadsize};
2240 
2241  const float v6[2] = {rect->xmax, rect->ymin - shadsize};
2242  const float v7[2] = {rect->xmin + 0.3f * shadsize, rect->ymin};
2243  const float v8[2] = {rect->xmin + 0.5f * shadsize, rect->ymin - shadsize};
2244 
2245  /* right quad */
2246  immAttr4ub(color, 0, 0, 0, alpha);
2247  immVertex2fv(pos, v3);
2248  immVertex2fv(pos, v1);
2249  immAttr4ub(color, 0, 0, 0, 0);
2250  immVertex2fv(pos, v2);
2251 
2252  immVertex2fv(pos, v2);
2253  immVertex2fv(pos, v4);
2254  immAttr4ub(color, 0, 0, 0, alpha);
2255  immVertex2fv(pos, v3);
2256 
2257  /* corner shape */
2258  // immAttr4ub(color, 0, 0, 0, alpha); /* Not needed, done above in previous tri. */
2259  immVertex2fv(pos, v3);
2260  immAttr4ub(color, 0, 0, 0, 0);
2261  immVertex2fv(pos, v4);
2262  immVertex2fv(pos, v5);
2263 
2264  immVertex2fv(pos, v5);
2265  immVertex2fv(pos, v6);
2266  immAttr4ub(color, 0, 0, 0, alpha);
2267  immVertex2fv(pos, v3);
2268 
2269  /* bottom quad */
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, v6);
2274  immVertex2fv(pos, v8);
2275 
2276  immVertex2fv(pos, v8);
2277  immAttr4ub(color, 0, 0, 0, alpha);
2278  immVertex2fv(pos, v7);
2279  immVertex2fv(pos, v3);
2280 }
2281 
2282 void UI_draw_box_shadow(const rctf *rect, uchar alpha)
2283 {
2285 
2290 
2292 
2293  immBegin(GPU_PRIM_TRIS, 54);
2294 
2295  /* accumulated outline boxes to make shade not linear, is more pleasant */
2296  ui_shadowbox(rect, pos, color, 11.0, (20 * alpha) >> 8);
2297  ui_shadowbox(rect, pos, color, 7.0, (40 * alpha) >> 8);
2298  ui_shadowbox(rect, pos, color, 5.0, (80 * alpha) >> 8);
2299 
2300  immEnd();
2301 
2302  immUnbindProgram();
2303 
2305 }
2306 
2308  const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select))
2309 {
2310  const float max_radius = (BLI_rctf_size_y(rct) - 10.0f) * 0.5f;
2311  const float rad = min_ff(radius, max_radius);
2312 
2313  /* This undoes the scale of the view for higher zoom factors to clamp the shadow size. */
2314  const float clamped_aspect = smoothminf(aspect, 1.0f, 0.5f);
2315 
2316  const float shadow_softness = 0.6f * U.widget_unit * clamped_aspect;
2317  const float shadow_offset = 0.5f * U.widget_unit * clamped_aspect;
2318  const float shadow_alpha = 0.5f * alpha;
2319 
2321 
2322  uiWidgetBaseParameters widget_params = {
2323  .recti.xmin = rct->xmin,
2324  .recti.ymin = rct->ymin,
2325  .recti.xmax = rct->xmax,
2326  .recti.ymax = rct->ymax - shadow_offset,
2327  .rect.xmin = rct->xmin - shadow_softness,
2328  .rect.ymin = rct->ymin - shadow_softness,
2329  .rect.xmax = rct->xmax + shadow_softness,
2330  .rect.ymax = rct->ymax - shadow_offset + shadow_softness,
2331  .radi = rad,
2332  .rad = rad + shadow_softness,
2333  .round_corners[0] = (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 1.0f : 0.0f,
2334  .round_corners[1] = (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 1.0f : 0.0f,
2335  .round_corners[2] = (roundboxtype & UI_CNR_TOP_RIGHT) ? 1.0f : 0.0f,
2336  .round_corners[3] = (roundboxtype & UI_CNR_TOP_LEFT) ? 1.0f : 0.0f,
2337  .alpha_discard = 1.0f,
2338  };
2339 
2342  GPU_batch_uniform_4fv_array(batch, "parameters", 4, (const float(*)[4]) & widget_params);
2343  GPU_batch_uniform_1f(batch, "alpha", shadow_alpha);
2345 
2346  /* outline emphasis */
2347  const float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
2349  &(const rctf){
2350  .xmin = rct->xmin - 0.5f,
2351  .xmax = rct->xmax + 0.5f,
2352  .ymin = rct->ymin - 0.5f,
2353  .ymax = rct->ymax + 0.5f,
2354  },
2355  false,
2356  radius + 0.5f,
2357  color);
2358 
2360 }
typedef float(TangentPoint)[2]
void immDrawPixelsTexTiled(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:333
IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
Definition: glutil.c:44
bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4])
void BKE_curvemapping_changed(struct CurveMapping *cumap, bool rem_doubles)
Definition: colortools.c:855
@ PROF_UPDATE_NONE
void BKE_curveprofile_update(struct CurveProfile *profile, int update_flags)
int BKE_curveprofile_table_size(const struct CurveProfile *profile)
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:2627
int BLF_default(void)
Definition: blf_default.c:44
void BLF_batch_draw_flush(void)
Definition: blf.c:472
void BLF_color4f(int fontid, float r, float g, float b, float a)
Definition: blf.c:446
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
Definition: blf_default.c:59
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
#define M_PI_2
Definition: BLI_math_base.h:23
#define M_PI
Definition: BLI_math_base.h:20
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
Definition: math_color.c:232
#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:59
void rgba_uchar_to_float(float r_col[4], const unsigned char col_ub[4])
Definition: math_color.c:383
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:376
void unit_m3(float m[3][3])
Definition: math_matrix.c:40
#define DEG2RADF(_deg)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
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 copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
MINLINE void swap_v3_v3(float a[3], float b[3])
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
Definition: polyfill_2d.c:875
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
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:186
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition: BLI_rect.h:198
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:70
unsigned int uint
Definition: BLI_sys_types.h:67
#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
@ SCOPES_WAVEFRM_YCC_JPEG
@ SCOPES_WAVEFRM_RGB
@ SCOPES_WAVEFRM_YCC_601
@ SCOPES_WAVEFRM_YCC_709
@ SCOPES_WAVEFRM_LUMA
@ SCOPES_WAVEFRM_RGB_PARADE
@ HISTO_MODE_B
@ HISTO_MODE_G
@ HISTO_MODE_LUMA
@ HISTO_MODE_RGB
@ HISTO_MODE_ALPHA
@ HISTO_MODE_R
@ CUMA_SELECT
@ HISTO_FLAG_LINE
#define CM_TABLE
@ HD_FREE
@ HD_ALIGN
@ PROF_H1_SELECT
@ PROF_H2_SELECT
@ PROF_USE_CLIP
NSNotificationCenter * center
GPUBatch
Definition: GPU_batch.h:78
#define GPU_batch_uniform_1f(batch, name, x)
Definition: GPU_batch.h:144
void GPU_batch_discard(GPUBatch *)
Definition: gpu_batch.cc:109
#define GPU_batch_uniformbuf_bind(batch, name, ubo)
Definition: GPU_batch.h:159
#define GPU_batch_uniform_4fv_array(batch, name, len, val)
Definition: GPU_batch.h:155
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
Definition: gpu_batch.cc:287
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
Definition: gpu_batch.cc:43
void GPU_batch_draw(GPUBatch *batch)
Definition: gpu_batch.cc:223
#define GPU_batch_uniform_4f(batch, name, x, y, z, w)
Definition: GPU_batch.h:148
@ GPU_BATCH_OWNS_VBO
Definition: GPU_batch.h:30
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 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 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 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 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 v1
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:126
void GPU_matrix_scale_2f(float x, float y)
Definition: gpu_matrix.cc:216
void GPU_matrix_pop_projection(void)
Definition: gpu_matrix.cc:140
void GPU_matrix_ortho_set_z(float near, float far)
Definition: gpu_matrix.cc:406
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
void GPU_matrix_scale_1f(float factor)
Definition: gpu_matrix.cc:209
#define GPU_MATRIX_ORTHO_CLIP_NEAR_DEFAULT
Definition: GPU_matrix.h:237
void GPU_matrix_translate_2f(float x, float y)
Definition: gpu_matrix.cc:174
void GPU_matrix_push_projection(void)
Definition: gpu_matrix.cc:133
@ GPU_PRIM_LINE_LOOP
Definition: GPU_primitive.h:23
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_PRIM_POINTS
Definition: GPU_primitive.h:19
@ GPU_PRIM_LINE_STRIP
Definition: GPU_primitive.h:22
@ GPU_PRIM_TRI_STRIP
Definition: GPU_primitive.h:24
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:21
@ GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR
Definition: GPU_shader.h:349
@ GPU_SHADER_2D_CHECKER
Definition: GPU_shader.h:221
@ GPU_SHADER_2D_SMOOTH_COLOR
Definition: GPU_shader.h:215
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_SHADER_SIMPLE_LIGHTING
Definition: GPU_shader.h:193
@ GPU_SHADER_2D_IMAGE_COLOR
Definition: GPU_shader.h:217
@ GPU_SHADER_2D_WIDGET_SHADOW
Definition: GPU_shader.h:357
@ GPU_SHADER_2D_FLAT_COLOR
Definition: GPU_shader.h:208
@ GPU_SHADER_2D_WIDGET_BASE
Definition: GPU_shader.h:355
void GPU_face_culling(eGPUFaceCullTest culling)
Definition: gpu_state.cc:44
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
@ GPU_BLEND_ADDITIVE
Definition: GPU_state.h:64
@ GPU_BLEND_ALPHA_PREMULT
Definition: GPU_state.h:63
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:75
@ GPU_CULL_NONE
Definition: GPU_state.h:108
@ GPU_CULL_BACK
Definition: GPU_state.h:110
void GPU_scissor(int x, int y, int width, int height)
Definition: gpu_state.cc:185
void GPU_point_size(float size)
Definition: gpu_state.cc:164
void GPU_viewport_size_get_f(float coords[4])
Definition: gpu_state.cc:259
void GPU_scissor_get(int coords[4])
Definition: gpu_state.cc:254
void GPU_polygon_smooth(bool enable)
Definition: gpu_state.cc:80
@ GPU_RGBA8
Definition: GPU_texture.h:87
struct GPUUniformBuf GPUUniformBuf
GPUUniformBuf * GPU_uniformbuf_create_ex(size_t size, const void *data, const char *name)
void GPU_uniformbuf_free(GPUUniformBuf *ubo)
#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:1644
void IMB_rect_from_float(struct ImBuf *ibuf)
Definition: divers.c:696
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
#define UI_ALPHA_CHECKER_LIGHT
#define UI_ALPHA_CHECKER_DARK
#define UI_DPI_FAC
Definition: UI_interface.h:305
@ UI_CNR_BOTTOM_LEFT
@ UI_CNR_BOTTOM_RIGHT
@ UI_CNR_ALL
@ UI_CNR_TOP_LEFT
@ UI_CNR_TOP_RIGHT
@ UI_GRAD_H
Definition: UI_interface.h:403
@ TH_MARKER_OUTLINE
Definition: UI_resources.h:228
@ TH_PREVIEW_BACK
Definition: UI_resources.h:216
@ TH_SEL_MARKER
Definition: UI_resources.h:231
@ TH_TEXT
Definition: UI_resources.h:42
@ TH_TEXT_HI
Definition: UI_resources.h:43
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
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
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
SyclQueue void void size_t num_bytes void
int len
Definition: draw_manager.c:108
#define str(s)
uint pos
uint col
struct @653::@655 batch
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
void ui_but_v3_get(uiBut *but, float vec[3])
Definition: interface.cc:2291
struct ColorManagedDisplay * ui_block_cm_display_get(uiBlock *block)
Definition: interface.cc:3928
#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)
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_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const rcti *rect)
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_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rect, const float radius)
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)
static void waveform_draw_one(float *waveform, int waveform_num, const float col[3])
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], eButGradientType type, float alpha)
struct GPUBatch * ui_batch_roundbox_widget_get(void)
struct GPUBatch * ui_batch_roundbox_shadow_get(void)
const int state
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
MINLINE float smoothminf(float a, float b, float c)
#define ceilf(x)
Definition: metal/compat.h:225
#define atanf(x)
Definition: metal/compat.h:223
#define floorf(x)
Definition: metal/compat.h:224
#define sqrtf(x)
Definition: metal/compat.h:243
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
bool active
all scheduled work for the GPU.
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)
static const pxr::TfToken rgb("rgb", pxr::TfToken::Immortal)
#define min(a, b)
Definition: sort.c:35
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:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
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