Blender  V2.93
gpencil_draw_data.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  * Copyright 2019, Blender Foundation.
17  */
18 
23 #include "DRW_render.h"
24 
25 #include "DNA_light_types.h"
26 
27 #include "BKE_image.h"
28 
29 #include "BLI_hash.h"
30 #include "BLI_math_color.h"
31 #include "BLI_memblock.h"
32 
33 #include "GPU_uniform_buffer.h"
34 
35 #include "IMB_imbuf_types.h"
36 
37 #include "gpencil_engine.h"
38 
39 /* -------------------------------------------------------------------- */
44 {
46  matpool->next = NULL;
47  matpool->used_count = 0;
48  if (matpool->ubo == NULL) {
49  matpool->ubo = GPU_uniformbuf_create(sizeof(matpool->mat_data));
50  }
51  pd->last_material_pool = matpool;
52  return matpool;
53 }
54 
55 static struct GPUTexture *gpencil_image_texture_get(Image *image, bool *r_alpha_premult)
56 {
57  ImBuf *ibuf;
58  ImageUser iuser = {NULL};
59  struct GPUTexture *gpu_tex = NULL;
60  void *lock;
61 
62  iuser.ok = true;
63  ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
64 
65  if (ibuf != NULL && ibuf->rect != NULL) {
66  gpu_tex = BKE_image_get_gpu_texture(image, &iuser, ibuf);
67  *r_alpha_premult = (image->alpha_mode == IMA_ALPHA_PREMUL);
68  }
69  BKE_image_release_ibuf(image, ibuf, lock);
70 
71  return gpu_tex;
72 }
73 
74 static void gpencil_uv_transform_get(const float ofs[2],
75  const float scale[2],
76  const float rotation,
77  float r_uvmat[3][2])
78 {
79  /* OPTI this could use 3x2 matrices and reduce the number of operations drastically. */
80  float mat[4][4];
81  unit_m4(mat);
82  /* Offset to center. */
83  translate_m4(mat, 0.5f, 0.5f, 0.0f);
84  /* Reversed order. */
85  rescale_m4(mat, (float[3]){1.0f / scale[0], 1.0f / scale[1], 0.0});
86  rotate_m4(mat, 'Z', -rotation);
87  translate_m4(mat, ofs[0], ofs[1], 0.0f);
88  /* Convert to 3x2 */
89  copy_v2_v2(r_uvmat[0], mat[0]);
90  copy_v2_v2(r_uvmat[1], mat[1]);
91  copy_v2_v2(r_uvmat[2], mat[3]);
92 }
93 
94 static void gpencil_shade_color(float color[3])
95 {
96  /* This is scene refereed color, not gamma corrected and not per perceptual.
97  * So we lower the threshold a bit. (1.0 / 3.0) */
98  if (color[0] + color[1] + color[2] > 1.1) {
99  add_v3_fl(color, -0.25f);
100  }
101  else {
102  add_v3_fl(color, 0.15f);
103  }
104  CLAMP3(color, 0.0f, 1.0f);
105 }
106 
107 /* Apply all overrides from the solid viewport mode to the GPencil material. */
110  Object *ob,
111  int color_type,
112  MaterialGPencilStyle *gp_style,
113  const eV3DShadingLightingMode lighting_mode)
114 {
115  static MaterialGPencilStyle gp_style_tmp;
116 
117  switch (color_type) {
120  /* Random uses a random color by layer and this is done using the tint
121  * layer. A simple color by object, like meshes, is not practical in
122  * grease pencil. */
123  copy_v4_v4(gp_style_tmp.stroke_rgba, gp_style->stroke_rgba);
124  copy_v4_v4(gp_style_tmp.fill_rgba, gp_style->fill_rgba);
125  gp_style = &gp_style_tmp;
128  break;
130  memcpy(&gp_style_tmp, gp_style, sizeof(*gp_style));
131  gp_style = &gp_style_tmp;
132  if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
133  copy_v4_fl(gp_style->stroke_rgba, 1.0f);
134  gp_style->mix_stroke_factor = 0.0f;
135  }
136 
137  if ((gp_style->fill_style == GP_MATERIAL_FILL_STYLE_TEXTURE) && (gp_style->ima)) {
138  copy_v4_fl(gp_style->fill_rgba, 1.0f);
139  gp_style->mix_factor = 0.0f;
140  }
141  else if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) {
142  /* gp_style->fill_rgba is needed for correct gradient. */
143  gp_style->mix_factor = 0.0f;
144  }
145  break;
147  gp_style = &gp_style_tmp;
150  copy_v3_v3(gp_style->fill_rgba, pd->v3d_single_color);
151  gp_style->fill_rgba[3] = 1.0f;
152  copy_v4_v4(gp_style->stroke_rgba, gp_style->fill_rgba);
153  if (lighting_mode != V3D_LIGHTING_FLAT) {
154  gpencil_shade_color(gp_style->fill_rgba);
155  }
156  break;
158  gp_style = &gp_style_tmp;
161  copy_v4_v4(gp_style->fill_rgba, ob->color);
162  copy_v4_v4(gp_style->stroke_rgba, ob->color);
163  if (lighting_mode != V3D_LIGHTING_FLAT) {
164  gpencil_shade_color(gp_style->fill_rgba);
165  }
166  break;
168  gp_style = &gp_style_tmp;
171  copy_v4_fl(gp_style->fill_rgba, 1.0f);
172  copy_v4_fl(gp_style->stroke_rgba, 1.0f);
173  break;
174  default:
175  break;
176  }
177  return gp_style;
178 }
179 
186 {
188 
189  int mat_len = max_ii(1, ob->totcol);
190 
191  bool reuse_matpool = matpool && ((matpool->used_count + mat_len) <= GP_MATERIAL_BUFFER_LEN);
192 
193  if (reuse_matpool) {
194  /* Share the matpool with other objects. Return offset to first material. */
195  *ofs = matpool->used_count;
196  }
197  else {
198  matpool = gpencil_material_pool_add(pd);
199  *ofs = 0;
200  }
201 
202  /* Force vertex color in solid mode with vertex paint mode. Same behavior as meshes. */
203  bGPdata *gpd = (bGPdata *)ob->data;
204  int color_type = (pd->v3d_color_type != -1 && GPENCIL_VERTEX_MODE(gpd)) ?
206  pd->v3d_color_type;
207  const eV3DShadingLightingMode lighting_mode = (pd->v3d != NULL) ? pd->v3d->shading.light :
209 
210  GPENCIL_MaterialPool *pool = matpool;
211  for (int i = 0; i < mat_len; i++) {
212  if ((i > 0) && (pool->used_count == GP_MATERIAL_BUFFER_LEN)) {
213  pool->next = gpencil_material_pool_add(pd);
214  pool = pool->next;
215  }
216  int mat_id = pool->used_count++;
217 
218  gpMaterial *mat_data = &pool->mat_data[mat_id];
220 
221  if (gp_style->mode == GP_MATERIAL_MODE_LINE) {
222  mat_data->flag = 0;
223  }
224  else {
225  switch (gp_style->alignment_mode) {
227  mat_data->flag = GP_STROKE_ALIGNMENT_STROKE;
228  break;
230  mat_data->flag = GP_STROKE_ALIGNMENT_OBJECT;
231  break;
233  default:
234  mat_data->flag = GP_STROKE_ALIGNMENT_FIXED;
235  break;
236  }
237 
238  if (gp_style->mode == GP_MATERIAL_MODE_DOT) {
239  mat_data->flag |= GP_STROKE_DOTS;
240  }
241  }
242 
243  if ((gp_style->mode != GP_MATERIAL_MODE_LINE) ||
244  (gp_style->flag & GP_MATERIAL_DISABLE_STENCIL)) {
245  mat_data->flag |= GP_STROKE_OVERLAP;
246  }
247 
248  /* Material with holdout. */
249  if (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT) {
250  mat_data->flag |= GP_STROKE_HOLDOUT;
251  }
252  if (gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT) {
253  mat_data->flag |= GP_FILL_HOLDOUT;
254  }
255 
256  gp_style = gpencil_viewport_material_overrides(pd, ob, color_type, gp_style, lighting_mode);
257 
258  /* Dots or Squares rotation. */
259  mat_data->alignment_rot_cos = cosf(gp_style->alignment_rotation);
260  mat_data->alignment_rot_sin = sinf(gp_style->alignment_rotation);
261 
262  /* Stroke Style */
263  if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
264  bool premul;
265  pool->tex_stroke[mat_id] = gpencil_image_texture_get(gp_style->sima, &premul);
266  mat_data->flag |= pool->tex_stroke[mat_id] ? GP_STROKE_TEXTURE_USE : 0;
267  mat_data->flag |= premul ? GP_STROKE_TEXTURE_PREMUL : 0;
268  copy_v4_v4(mat_data->stroke_color, gp_style->stroke_rgba);
269  mat_data->stroke_texture_mix = 1.0f - gp_style->mix_stroke_factor;
270  mat_data->stroke_u_scale = 500.0f / gp_style->texture_pixsize;
271  }
272  else /* if (gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_SOLID) */ {
273  pool->tex_stroke[mat_id] = NULL;
274  mat_data->flag &= ~GP_STROKE_TEXTURE_USE;
275  copy_v4_v4(mat_data->stroke_color, gp_style->stroke_rgba);
276  mat_data->stroke_texture_mix = 0.0f;
277  }
278 
279  /* Fill Style */
280  if ((gp_style->fill_style == GP_MATERIAL_FILL_STYLE_TEXTURE) && (gp_style->ima)) {
281  bool use_clip = (gp_style->flag & GP_MATERIAL_TEX_CLAMP) != 0;
282  bool premul;
283  pool->tex_fill[mat_id] = gpencil_image_texture_get(gp_style->ima, &premul);
284  mat_data->flag |= pool->tex_fill[mat_id] ? GP_FILL_TEXTURE_USE : 0;
285  mat_data->flag |= premul ? GP_FILL_TEXTURE_PREMUL : 0;
286  mat_data->flag |= use_clip ? GP_FILL_TEXTURE_CLIP : 0;
288  gp_style->texture_scale,
289  gp_style->texture_angle,
290  mat_data->fill_uv_transform);
291  copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
292  mat_data->fill_texture_mix = 1.0f - gp_style->mix_factor;
293  }
294  else if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) {
295  bool use_radial = (gp_style->gradient_type == GP_MATERIAL_GRADIENT_RADIAL);
296  pool->tex_fill[mat_id] = NULL;
297  mat_data->flag |= GP_FILL_GRADIENT_USE;
298  mat_data->flag |= use_radial ? GP_FILL_GRADIENT_RADIAL : 0;
300  gp_style->texture_scale,
301  gp_style->texture_angle,
302  mat_data->fill_uv_transform);
303  copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
304  copy_v4_v4(mat_data->fill_mix_color, gp_style->mix_rgba);
305  mat_data->fill_texture_mix = 1.0f - gp_style->mix_factor;
306  if (gp_style->flag & GP_MATERIAL_FLIP_FILL) {
307  swap_v4_v4(mat_data->fill_color, mat_data->fill_mix_color);
308  }
309  }
310  else /* if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_SOLID) */ {
311  pool->tex_fill[mat_id] = NULL;
312  copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
313  mat_data->fill_texture_mix = 0.0f;
314  }
315  }
316 
317  return matpool;
318 }
319 
321  int mat_id,
322  GPUTexture **r_tex_stroke,
323  GPUTexture **r_tex_fill,
324  GPUUniformBuf **r_ubo_mat)
325 {
326  GPENCIL_MaterialPool *matpool = first_pool;
327  int pool_id = mat_id / GP_MATERIAL_BUFFER_LEN;
328  for (int i = 0; i < pool_id; i++) {
329  matpool = matpool->next;
330  }
331  mat_id = mat_id % GP_MATERIAL_BUFFER_LEN;
332  *r_ubo_mat = matpool->ubo;
333  if (r_tex_fill) {
334  *r_tex_fill = matpool->tex_fill[mat_id];
335  }
336  if (r_tex_stroke) {
337  *r_tex_stroke = matpool->tex_stroke[mat_id];
338  }
339 }
340 
343 /* -------------------------------------------------------------------- */
348 {
350  lightpool->light_used = 0;
351  /* Tag light list end. */
352  lightpool->light_data[0].color[0] = -1.0;
353  if (lightpool->ubo == NULL) {
354  lightpool->ubo = GPU_uniformbuf_create(sizeof(lightpool->light_data));
355  }
356  pd->last_light_pool = lightpool;
357  return lightpool;
358 }
359 
360 void gpencil_light_ambient_add(GPENCIL_LightPool *lightpool, const float color[3])
361 {
362  if (lightpool->light_used >= GPENCIL_LIGHT_BUFFER_LEN) {
363  return;
364  }
365 
366  gpLight *gp_light = &lightpool->light_data[lightpool->light_used];
367  gp_light->type = GP_LIGHT_TYPE_AMBIENT;
368  copy_v3_v3(gp_light->color, color);
369  lightpool->light_used++;
370 
371  if (lightpool->light_used < GPENCIL_LIGHT_BUFFER_LEN) {
372  /* Tag light list end. */
373  gp_light[1].color[0] = -1.0f;
374  }
375 }
376 
377 static float light_power_get(const Light *la)
378 {
379  if (la->type == LA_AREA) {
380  return 1.0f / (4.0f * M_PI);
381  }
382  if (ELEM(la->type, LA_SPOT, LA_LOCAL)) {
383  return 1.0f / (4.0f * M_PI * M_PI);
384  }
385 
386  return 1.0f / M_PI;
387 }
388 
390 {
391  Light *la = (Light *)ob->data;
392 
393  if (lightpool->light_used >= GPENCIL_LIGHT_BUFFER_LEN) {
394  return;
395  }
396 
397  gpLight *gp_light = &lightpool->light_data[lightpool->light_used];
398  float(*mat)[4] = (float(*)[4])gp_light->right;
399 
400  if (la->type == LA_SPOT) {
401  copy_m4_m4(mat, ob->imat);
402  gp_light->type = GP_LIGHT_TYPE_SPOT;
403  gp_light->spotsize = cosf(la->spotsize * 0.5f);
404  gp_light->spotblend = (1.0f - gp_light->spotsize) * la->spotblend;
405  }
406  else if (la->type == LA_AREA) {
407  /* Simulate area lights using a spot light. */
408  normalize_m4_m4(mat, ob->obmat);
409  invert_m4(mat);
410  gp_light->type = GP_LIGHT_TYPE_SPOT;
411  gp_light->spotsize = cosf(M_PI * 0.5f);
412  gp_light->spotblend = (1.0f - gp_light->spotsize) * 1.0f;
413  }
414  else if (la->type == LA_SUN) {
415  normalize_v3_v3(gp_light->forward, ob->obmat[2]);
416  gp_light->type = GP_LIGHT_TYPE_SUN;
417  }
418  else {
419  gp_light->type = GP_LIGHT_TYPE_POINT;
420  }
421  copy_v4_v4(gp_light->position, ob->obmat[3]);
422  copy_v3_v3(gp_light->color, &la->r);
423  mul_v3_fl(gp_light->color, la->energy * light_power_get(la));
424 
425  lightpool->light_used++;
426 
427  if (lightpool->light_used < GPENCIL_LIGHT_BUFFER_LEN) {
428  /* Tag light list end. */
429  gp_light[1].color[0] = -1.0f;
430  }
431 }
432 
437 {
438  GPENCIL_LightPool *lightpool = pd->last_light_pool;
439 
440  if (lightpool == NULL) {
441  lightpool = gpencil_light_pool_add(pd);
442  }
443  /* TODO(fclem): Light linking. */
444  // gpencil_light_pool_populate(lightpool, ob);
445 
446  return lightpool;
447 }
448 
449 void gpencil_material_pool_free(void *storage)
450 {
451  GPENCIL_MaterialPool *matpool = (GPENCIL_MaterialPool *)storage;
452  DRW_UBO_FREE_SAFE(matpool->ubo);
453 }
454 
455 void gpencil_light_pool_free(void *storage)
456 {
457  GPENCIL_LightPool *lightpool = (GPENCIL_LightPool *)storage;
458  DRW_UBO_FREE_SAFE(lightpool->ubo);
459 }
460 
463 /* -------------------------------------------------------------------- */
467 static void gpencil_view_layer_data_free(void *storage)
468 {
469  GPENCIL_ViewLayerData *vldata = (GPENCIL_ViewLayerData *)storage;
470 
477 }
478 
480 {
483 
484  /* NOTE(fclem) Putting this stuff in viewlayer means it is shared by all viewports.
485  * For now it is ok, but in the future, it could become a problem if we implement
486  * the caching system. */
487  if (*vldata == NULL) {
488  *vldata = MEM_callocN(sizeof(**vldata), "GPENCIL_ViewLayerData");
489 
490  (*vldata)->gp_light_pool = BLI_memblock_create(sizeof(GPENCIL_LightPool));
491  (*vldata)->gp_material_pool = BLI_memblock_create(sizeof(GPENCIL_MaterialPool));
492  (*vldata)->gp_maskbit_pool = BLI_memblock_create(BLI_BITMAP_SIZE(GP_MAX_MASKBITS));
493  (*vldata)->gp_object_pool = BLI_memblock_create(sizeof(GPENCIL_tObject));
494  (*vldata)->gp_layer_pool = BLI_memblock_create(sizeof(GPENCIL_tLayer));
495  (*vldata)->gp_vfx_pool = BLI_memblock_create(sizeof(GPENCIL_tVfx));
496  }
497 
498  return *vldata;
499 }
500 
typedef float(TangentPoint)[2]
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
Definition: image.c:5113
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
Definition: image.c:5100
struct GPUTexture * BKE_image_get_gpu_texture(struct Image *image, struct ImageUser *iuser, struct ImBuf *ibuf)
Definition: image_gpu.c:439
struct MaterialGPencilStyle * BKE_gpencil_material_settings(struct Object *ob, short act)
Definition: material.c:713
#define BLI_BITMAP_SIZE(_tot)
Definition: BLI_bitmap.h:47
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:38
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1187
void unit_m4(float m[4][4])
Definition: rct.c:1140
void translate_m4(float mat[4][4], float tx, float ty, float tz)
Definition: math_matrix.c:2325
void rescale_m4(float mat[4][4], const float scale[3])
Definition: math_matrix.c:2396
void normalize_m4_m4(float R[4][4], const float M[4][4]) ATTR_NONNULL()
Definition: math_matrix.c:1972
void copy_m4_m4(float m1[4][4], const float m2[4][4])
Definition: math_matrix.c:95
void rotate_m4(float mat[4][4], const char axis, const float angle)
Definition: math_matrix.c:2352
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void swap_v4_v4(float a[4], float b[4])
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void copy_v4_fl(float r[4], float f)
void BLI_memblock_destroy(BLI_memblock *mblk, MemblockValFreeFP free_callback) ATTR_NONNULL(1)
Definition: BLI_memblock.c:82
#define BLI_memblock_create(elem_size)
Definition: BLI_memblock.h:44
void * BLI_memblock_alloc(BLI_memblock *mblk) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memblock.c:133
#define UNUSED(x)
#define ELEM(...)
#define CLAMP3(vec, b, c)
#define GPENCIL_VERTEX_MODE(gpd)
#define GP_MATERIAL_BUFFER_LEN
@ IMA_ALPHA_PREMUL
#define LA_AREA
#define LA_SPOT
#define LA_SUN
#define LA_LOCAL
@ GP_MATERIAL_FOLLOW_OBJ
@ GP_MATERIAL_FOLLOW_PATH
@ GP_MATERIAL_FOLLOW_FIXED
@ GP_MATERIAL_FLIP_FILL
@ GP_MATERIAL_DISABLE_STENCIL
@ GP_MATERIAL_IS_STROKE_HOLDOUT
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ GP_MATERIAL_TEX_CLAMP
@ GP_MATERIAL_MODE_DOT
@ GP_MATERIAL_MODE_LINE
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
@ GP_MATERIAL_GRADIENT_RADIAL
@ GP_MATERIAL_FILL_STYLE_GRADIENT
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
@ V3D_SHADING_TEXTURE_COLOR
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_MATERIAL_COLOR
@ V3D_SHADING_OBJECT_COLOR
@ V3D_SHADING_RANDOM_COLOR
@ V3D_SHADING_SINGLE_COLOR
eV3DShadingLightingMode
@ V3D_LIGHTING_FLAT
@ V3D_LIGHTING_STUDIO
#define DRW_UBO_FREE_SAFE(ubo)
Definition: DRW_render.h:188
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
struct GPUUniformBuf GPUUniformBuf
#define GPU_uniformbuf_create(size)
Contains defines and structs used throughout the imbuf module.
char alpha_mode
void ** DRW_view_layer_engine_data_ensure(DrawEngineType *engine_type, void(*callback)(void *storage))
Definition: draw_manager.c:817
static MaterialGPencilStyle * gpencil_viewport_material_overrides(GPENCIL_PrivateData *pd, Object *ob, int color_type, MaterialGPencilStyle *gp_style, const eV3DShadingLightingMode lighting_mode)
GPENCIL_LightPool * gpencil_light_pool_create(GPENCIL_PrivateData *pd, Object *UNUSED(ob))
void gpencil_light_pool_populate(GPENCIL_LightPool *lightpool, Object *ob)
static GPENCIL_MaterialPool * gpencil_material_pool_add(GPENCIL_PrivateData *pd)
GPENCIL_ViewLayerData * GPENCIL_view_layer_data_ensure(void)
static void gpencil_shade_color(float color[3])
GPENCIL_LightPool * gpencil_light_pool_add(GPENCIL_PrivateData *pd)
void gpencil_light_pool_free(void *storage)
static struct GPUTexture * gpencil_image_texture_get(Image *image, bool *r_alpha_premult)
void gpencil_material_pool_free(void *storage)
static float light_power_get(const Light *la)
static void gpencil_view_layer_data_free(void *storage)
GPENCIL_MaterialPool * gpencil_material_pool_create(GPENCIL_PrivateData *pd, Object *ob, int *ofs)
void gpencil_light_ambient_add(GPENCIL_LightPool *lightpool, const float color[3])
void gpencil_material_resources_get(GPENCIL_MaterialPool *first_pool, int mat_id, GPUTexture **r_tex_stroke, GPUTexture **r_tex_fill, GPUUniformBuf **r_ubo_mat)
static void gpencil_uv_transform_get(const float ofs[2], const float scale[2], const float rotation, float r_uvmat[3][2])
DrawEngineType draw_engine_gpencil_type
#define GP_STROKE_OVERLAP
#define GP_STROKE_TEXTURE_PREMUL
#define GP_STROKE_ALIGNMENT_STROKE
#define GP_STROKE_ALIGNMENT_FIXED
#define GP_FILL_TEXTURE_PREMUL
#define GP_MAX_MASKBITS
#define GP_LIGHT_TYPE_AMBIENT
#define GP_FILL_HOLDOUT
#define GP_LIGHT_TYPE_POINT
#define GP_LIGHT_TYPE_SPOT
#define GP_STROKE_ALIGNMENT_OBJECT
#define GP_FILL_TEXTURE_USE
#define GP_STROKE_DOTS
#define GP_LIGHT_TYPE_SUN
#define GP_STROKE_TEXTURE_USE
#define GP_STROKE_HOLDOUT
#define GPENCIL_LIGHT_BUFFER_LEN
#define GP_FILL_TEXTURE_CLIP
#define GP_FILL_GRADIENT_RADIAL
#define GP_FILL_GRADIENT_USE
#define sinf(x)
#define cosf(x)
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
gpLight light_data[GPENCIL_LIGHT_BUFFER_LEN]
struct GPUUniformBuf * ubo
struct GPUTexture * tex_stroke[GP_MATERIAL_BUFFER_LEN]
struct GPUUniformBuf * ubo
struct GPUTexture * tex_fill[GP_MATERIAL_BUFFER_LEN]
struct GPENCIL_MaterialPool * next
gpMaterial mat_data[GP_MATERIAL_BUFFER_LEN]
GPENCIL_LightPool * last_light_pool
struct BLI_memblock * gp_material_pool
struct View3D * v3d
struct BLI_memblock * gp_light_pool
GPENCIL_MaterialPool * last_material_pool
struct BLI_memblock * gp_vfx_pool
struct BLI_memblock * gp_material_pool
struct BLI_memblock * gp_maskbit_pool
struct BLI_memblock * gp_light_pool
struct BLI_memblock * gp_layer_pool
struct BLI_memblock * gp_object_pool
unsigned int * rect
float r
float energy
float spotblend
float spotsize
short type
float imat[4][4]
float obmat[4][4]
float color[4]
void * data
View3DShading shading
float type
float spotsize
float forward[4]
float spotblend
float position[4]
float right[3]
float color[3]
float fill_uv_transform[3][2]
float alignment_rot_cos
float alignment_rot_sin
float stroke_texture_mix
float stroke_color[4]
float fill_texture_mix
float fill_mix_color[4]
float stroke_u_scale
float fill_color[4]