Blender  V2.93
gpu_batch_presets.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2016 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "BLI_listbase.h"
25 #include "BLI_math.h"
26 #include "BLI_threads.h"
27 #include "BLI_utildefines.h"
28 #include "MEM_guardedalloc.h"
29 
30 #include "DNA_userdef_types.h"
31 
32 #include "UI_interface.h"
33 #include "UI_resources.h"
34 
35 #include "GPU_batch.h"
36 #include "GPU_batch_presets.h" /* own include */
37 #include "GPU_batch_utils.h"
38 
39 /* -------------------------------------------------------------------- */
43 /* Struct to store 3D Batches and their format */
44 static struct {
45  struct {
51  } batch;
52 
54 
55  struct {
58 
60 } g_presets_3d = {{0}};
61 
62 static struct {
63  struct {
66  } batch;
67 
72 
74 
75  struct {
77  } attr_id;
78 } g_presets_2d = {{0}};
79 
81 
84 /* -------------------------------------------------------------------- */
89 {
90  if (g_presets_3d.format.attr_len == 0) {
93  format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
95  format, "nor", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
96  }
97  return &g_presets_3d.format;
98 }
99 
101 {
102  if (g_presets_2d.format.attr_len == 0) {
103  GPUVertFormat *format = &g_presets_2d.format;
105  format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
107  format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
108  }
109  return &g_presets_2d.format;
110 }
111 
113  GPUVertBufRaw *nor_step,
114  float lat,
115  float lon)
116 {
117  float pos[3];
118  pos[0] = sinf(lat) * cosf(lon);
119  pos[1] = cosf(lat);
120  pos[2] = sinf(lat) * sinf(lon);
121  copy_v3_v3(GPU_vertbuf_raw_step(pos_step), pos);
122  copy_v3_v3(GPU_vertbuf_raw_step(nor_step), pos);
123 }
125 {
126  BLI_assert(lod >= 0 && lod <= 2);
128 
129  if (lod == 0) {
130  return g_presets_3d.batch.sphere_low;
131  }
132  if (lod == 1) {
133  return g_presets_3d.batch.sphere_med;
134  }
135 
136  return g_presets_3d.batch.sphere_high;
137 }
138 
140 {
141  BLI_assert(lod >= 0 && lod <= 1);
143 
144  if (lod == 0) {
145  return g_presets_3d.batch.sphere_wire_low;
146  }
147 
148  return g_presets_3d.batch.sphere_wire_med;
149 }
150 
153 /* -------------------------------------------------------------------- */
157 /* Replacement for gluSphere */
158 GPUBatch *gpu_batch_sphere(int lat_res, int lon_res)
159 {
160  const float lon_inc = 2 * M_PI / lon_res;
161  const float lat_inc = M_PI / lat_res;
162  float lon, lat;
163 
165  const uint vbo_len = (lat_res - 1) * lon_res * 6;
166  GPU_vertbuf_data_alloc(vbo, vbo_len);
167 
168  GPUVertBufRaw pos_step, nor_step;
169  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
170  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
171 
172  lon = 0.0f;
173  for (int i = 0; i < lon_res; i++, lon += lon_inc) {
174  lat = 0.0f;
175  for (int j = 0; j < lat_res; j++, lat += lat_inc) {
176  if (j != lat_res - 1) { /* Pole */
177  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon + lon_inc);
178  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon);
179  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat, lon);
180  }
181 
182  if (j != 0) { /* Pole */
183  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat, lon + lon_inc);
184  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon + lon_inc);
185  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat, lon);
186  }
187  }
188  }
189 
190  BLI_assert(vbo_len == GPU_vertbuf_raw_used(&pos_step));
191  BLI_assert(vbo_len == GPU_vertbuf_raw_used(&nor_step));
192 
194 }
195 
196 static GPUBatch *batch_sphere_wire(int lat_res, int lon_res)
197 {
198  const float lon_inc = 2 * M_PI / lon_res;
199  const float lat_inc = M_PI / lat_res;
200  float lon, lat;
201 
203  const uint vbo_len = (lat_res * lon_res * 2) + ((lat_res - 1) * lon_res * 2);
204  GPU_vertbuf_data_alloc(vbo, vbo_len);
205 
206  GPUVertBufRaw pos_step, nor_step;
207  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
208  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
209 
210  lon = 0.0f;
211  for (int i = 0; i < lon_res; i++, lon += lon_inc) {
212  lat = 0.0f;
213  for (int j = 0; j < lat_res; j++, lat += lat_inc) {
214  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon);
215  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat, lon);
216 
217  if (j != lat_res - 1) { /* Pole */
218  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon + lon_inc);
219  batch_sphere_lat_lon_vert(&pos_step, &nor_step, lat + lat_inc, lon);
220  }
221  }
222  }
223 
224  BLI_assert(vbo_len == GPU_vertbuf_raw_used(&pos_step));
225  BLI_assert(vbo_len == GPU_vertbuf_raw_used(&nor_step));
226 
228 }
229 
232 /* -------------------------------------------------------------------- */
237  float x1,
238  float y1,
239  float x2,
240  float y2,
241  GPUVertBufRaw *col_step,
242  const float color[4])
243 {
244  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x1, y1});
245  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
246 
247  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x2, y1});
248  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
249 
250  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x2, y2});
251  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
252 
253  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x1, y1});
254  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
255 
256  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x2, y2});
257  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
258 
259  copy_v2_v2(GPU_vertbuf_raw_step(pos_step), (const float[2]){x1, y2});
260  copy_v4_v4(GPU_vertbuf_raw_step(col_step), color);
261 }
262 
264  const float col_high[4],
265  const float col_dark[4],
266  const float width)
267 {
269  const uint vbo_len = 4 * 2 * (6 * 2);
270  GPU_vertbuf_data_alloc(vbo, vbo_len);
271 
272  GPUVertBufRaw pos_step, col_step;
273  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_2d.attr_id.pos, &pos_step);
274  GPU_vertbuf_attr_get_raw_data(vbo, g_presets_2d.attr_id.col, &col_step);
275 
276  const int px = (int)pixelsize;
277  const int px_zoom = max_ii(round_fl_to_int(width / 22.0f), 1);
278 
279  const int box_margin = max_ii(round_fl_to_int((float)(px_zoom * 2.0f)), px);
280  const int box_size = max_ii(round_fl_to_int((width / 8.0f) - px), px);
281 
282  const int y_ofs = max_ii(round_fl_to_int(width / 2.5f), px);
283  const int x_ofs = y_ofs;
284  int i_x, i_y;
285 
286  for (i_x = 0; i_x < 4; i_x++) {
287  for (i_y = 0; i_y < 2; i_y++) {
288  const int x_co = (x_ofs) + (i_x * (box_size + box_margin));
289  const int y_co = (y_ofs) + (i_y * (box_size + box_margin));
290 
292  x_co - box_size,
293  y_co - px_zoom,
294  x_co,
295  (y_co + box_size) - px_zoom,
296  &col_step,
297  col_dark);
299  &pos_step, x_co - box_size, y_co, x_co, y_co + box_size, &col_step, col_high);
300  }
301  }
303 }
304 
306  const float col_high[4],
307  const float col_dark[4],
308  const float width)
309 {
310  const bool parameters_changed = (g_presets_2d.panel_drag_widget_pixelsize != pixelsize) ||
311  (g_presets_2d.panel_drag_widget_width != width) ||
312  !equals_v4v4(g_presets_2d.panel_drag_widget_col_high,
313  col_high) ||
314  !equals_v4v4(g_presets_2d.panel_drag_widget_col_dark, col_dark);
315 
316  if (g_presets_2d.batch.panel_drag_widget && parameters_changed) {
317  gpu_batch_presets_unregister(g_presets_2d.batch.panel_drag_widget);
318  GPU_batch_discard(g_presets_2d.batch.panel_drag_widget);
319  g_presets_2d.batch.panel_drag_widget = NULL;
320  }
321 
322  if (!g_presets_2d.batch.panel_drag_widget) {
323  g_presets_2d.batch.panel_drag_widget = gpu_batch_preset_panel_drag_widget(
324  pixelsize, col_high, col_dark, width);
325  gpu_batch_presets_register(g_presets_2d.batch.panel_drag_widget);
326  g_presets_2d.panel_drag_widget_pixelsize = pixelsize;
327  g_presets_2d.panel_drag_widget_width = width;
328  copy_v4_v4(g_presets_2d.panel_drag_widget_col_high, col_high);
329  copy_v4_v4(g_presets_2d.panel_drag_widget_col_dark, col_dark);
330  }
331  return g_presets_2d.batch.panel_drag_widget;
332 }
333 
334 /* To be used with procedural placement inside shader. */
336 {
337  if (!g_presets_2d.batch.quad) {
339  GPU_vertbuf_data_alloc(vbo, 4);
340 
341  float pos_data[4][2] = {{0.0f, 0.0f}, {0.0f, 1.0f}, {1.0f, 1.0f}, {1.0f, 0.0f}};
342  GPU_vertbuf_attr_fill(vbo, g_presets_2d.attr_id.pos, pos_data);
343  /* Don't fill the color. */
344 
346 
348  }
349  return g_presets_2d.batch.quad;
350 }
351 
354 /* -------------------------------------------------------------------- */
359 {
361 
362  /* Hard coded resolution */
363  g_presets_3d.batch.sphere_low = gpu_batch_sphere(8, 16);
364  gpu_batch_presets_register(g_presets_3d.batch.sphere_low);
365 
366  g_presets_3d.batch.sphere_med = gpu_batch_sphere(16, 10);
367  gpu_batch_presets_register(g_presets_3d.batch.sphere_med);
368 
369  g_presets_3d.batch.sphere_high = gpu_batch_sphere(32, 24);
370  gpu_batch_presets_register(g_presets_3d.batch.sphere_high);
371 
372  g_presets_3d.batch.sphere_wire_low = batch_sphere_wire(6, 8);
373  gpu_batch_presets_register(g_presets_3d.batch.sphere_wire_low);
374 
375  g_presets_3d.batch.sphere_wire_med = batch_sphere_wire(8, 16);
376  gpu_batch_presets_register(g_presets_3d.batch.sphere_wire_med);
377 }
378 
380 {
382  BLI_addtail(&presets_list, BLI_genericNodeN(preset_batch));
384 }
385 
387 {
389  for (LinkData *link = presets_list.last; link; link = link->prev) {
390  if (preset_batch == link->data) {
391  BLI_remlink(&presets_list, link);
393  MEM_freeN(link);
394  return true;
395  }
396  }
398  return false;
399 }
400 
402 {
403  LinkData *link;
404  while ((link = BLI_pophead(&presets_list))) {
405  GPUBatch *preset = link->data;
406  GPU_batch_discard(preset);
407  MEM_freeN(link);
408  }
409 
410  BLI_mutex_end(&g_presets_3d.mutex);
411 }
412 
#define BLI_assert(a)
Definition: BLI_assert.h:58
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:257
struct LinkData * BLI_genericNodeN(void *data)
Definition: listbase.c:923
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
MINLINE int round_fl_to_int(float a)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:38
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE bool equals_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition: BLI_sys_types.h:83
void BLI_mutex_end(ThreadMutex *mutex)
Definition: threads.cc:416
void BLI_mutex_init(ThreadMutex *mutex)
Definition: threads.cc:396
int BLI_thread_is_main(void)
Definition: threads.cc:234
void BLI_mutex_lock(ThreadMutex *mutex)
Definition: threads.cc:401
void BLI_mutex_unlock(ThreadMutex *mutex)
Definition: threads.cc:406
pthread_mutex_t ThreadMutex
Definition: BLI_threads.h:83
GPUBatch
Definition: GPU_batch.h:93
void GPU_batch_discard(GPUBatch *)
Definition: gpu_batch.cc:127
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
Definition: gpu_batch.cc:60
@ GPU_BATCH_OWNS_VBO
Definition: GPU_batch.h:45
_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 width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:41
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:36
@ GPU_PRIM_TRIS
Definition: GPU_primitive.h:37
#define GPU_vertbuf_create_with_format(format)
struct GPUVertBuf GPUVertBuf
GPU_INLINE uint GPU_vertbuf_raw_used(GPUVertBufRaw *a)
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
void GPU_vertbuf_attr_fill(GPUVertBuf *, uint a_idx, const void *data)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *, uint a_idx, GPUVertBufRaw *access)
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
bool gpu_batch_presets_unregister(GPUBatch *preset_batch)
static ListBase presets_list
float panel_drag_widget_width
GPUVertFormat format
uint pos
GPUBatch * gpu_batch_sphere(int lat_res, int lon_res)
void gpu_batch_presets_register(GPUBatch *preset_batch)
static struct @612 g_presets_3d
GPUBatch * sphere_low
ThreadMutex mutex
static void batch_sphere_lat_lon_vert(GPUVertBufRaw *pos_step, GPUVertBufRaw *nor_step, float lat, float lon)
static GPUVertFormat * preset_2d_format(void)
GPUBatch * sphere_wire_low
struct @612::@614 batch
void gpu_batch_presets_exit(void)
struct @612::@615 attr_id
float panel_drag_widget_col_high[4]
GPUBatch * panel_drag_widget
static GPUVertFormat * preset_3d_format(void)
uint nor
GPUBatch * sphere_high
static struct @613 g_presets_2d
GPUBatch * GPU_batch_preset_sphere_wire(int lod)
GPUBatch * GPU_batch_preset_panel_drag_widget(const float pixelsize, const float col_high[4], const float col_dark[4], const float width)
GPUBatch * sphere_med
uint col
float panel_drag_widget_pixelsize
static void gpu_batch_preset_rectf_tris_color_ex(GPUVertBufRaw *pos_step, float x1, float y1, float x2, float y2, GPUVertBufRaw *col_step, const float color[4])
GPUBatch * sphere_wire_med
GPUBatch * quad
void gpu_batch_presets_init(void)
GPUBatch * GPU_batch_preset_sphere(int lod)
static GPUBatch * gpu_batch_preset_panel_drag_widget(float pixelsize, const float col_high[4], const float col_dark[4], const float width)
static GPUBatch * batch_sphere_wire(int lat_res, int lon_res)
GPUBatch * GPU_batch_preset_quad(void)
float panel_drag_widget_col_dark[4]
#define sinf(x)
#define cosf(x)
format
Definition: logImageCore.h:47
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void * data
Definition: DNA_listBase.h:42
void * last
Definition: DNA_listBase.h:47