Blender  V2.93
gpencil_cache_utils.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 2017, Blender Foundation.
17  */
18 
23 #include "DRW_engine.h"
24 #include "DRW_render.h"
25 
26 #include "ED_gpencil.h"
27 #include "ED_view3d.h"
28 
29 #include "DNA_gpencil_types.h"
30 #include "DNA_view3d_types.h"
31 
32 #include "BKE_gpencil.h"
33 #include "BKE_lib_id.h"
34 #include "BKE_object.h"
35 
36 #include "BLI_hash.h"
37 #include "BLI_link_utils.h"
38 #include "BLI_memblock.h"
39 
40 #include "gpencil_engine.h"
41 
42 #include "draw_cache_impl.h"
43 
44 #include "DEG_depsgraph.h"
45 
46 /* -------------------------------------------------------------------- */
51 {
52  bGPdata *gpd = (bGPdata *)ob->data;
54 
55  tgp_ob->layers.first = tgp_ob->layers.last = NULL;
56  tgp_ob->vfx.first = tgp_ob->vfx.last = NULL;
57  tgp_ob->camera_z = dot_v3v3(pd->camera_z_axis, ob->obmat[3]);
58  tgp_ob->is_drawmode3d = (gpd->draw_mode == GP_DRAWMODE_3D) || pd->draw_depth_only;
59  tgp_ob->object_scale = mat4_to_scale(ob->obmat);
60 
61  /* Check if any material with holdout flag enabled. */
62  tgp_ob->do_mat_holdout = false;
63  for (int i = 0; i < ob->totcol; i++) {
65  if (((gp_style != NULL) && (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT)) ||
66  ((gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT))) {
67  tgp_ob->do_mat_holdout = true;
68  break;
69  }
70  }
71 
72  /* Find the normal most likely to represent the gpObject. */
73  /* TODO: This does not work quite well if you use
74  * strokes not aligned with the object axes. Maybe we could try to
75  * compute the minimum axis of all strokes. But this would be more
76  * computationally heavy and should go into the GPData evaluation. */
78  /* Convert bbox to matrix */
79  float mat[4][4], size[3], center[3];
82  unit_m4(mat);
83  copy_v3_v3(mat[3], center);
84  /* Avoid division by 0.0 later. */
85  add_v3_fl(size, 1e-8f);
86  rescale_m4(mat, size);
87  /* BBox space to World. */
88  mul_m4_m4m4(mat, ob->obmat, mat);
90  /* BBox center to camera vector. */
91  sub_v3_v3v3(tgp_ob->plane_normal, pd->camera_pos, mat[3]);
92  }
93  else {
94  copy_v3_v3(tgp_ob->plane_normal, pd->camera_z_axis);
95  }
96  /* World to BBox space. */
97  invert_m4(mat);
98  /* Normalize the vector in BBox space. */
99  mul_mat3_m4_v3(mat, tgp_ob->plane_normal);
100  normalize_v3(tgp_ob->plane_normal);
101 
102  transpose_m4(mat);
103  /* mat is now a "normal" matrix which will transform
104  * BBox space normal to world space. */
105  mul_mat3_m4_v3(mat, tgp_ob->plane_normal);
106  normalize_v3(tgp_ob->plane_normal);
107 
108  /* Define a matrix that will be used to render a triangle to merge the depth of the rendered
109  * gpencil object with the rest of the scene. */
110  unit_m4(tgp_ob->plane_mat);
111  copy_v3_v3(tgp_ob->plane_mat[2], tgp_ob->plane_normal);
112  orthogonalize_m4(tgp_ob->plane_mat, 2);
113  mul_mat3_m4_v3(ob->obmat, size);
114  float radius = len_v3(size);
115  mul_m4_v3(ob->obmat, center);
116  rescale_m4(tgp_ob->plane_mat, (float[3]){radius, radius, radius});
117  copy_v3_v3(tgp_ob->plane_mat[3], center);
118 
119  /* Add to corresponding list if is in front. */
120  if (ob->dtx & OB_DRAW_IN_FRONT) {
121  BLI_LINKS_APPEND(&pd->tobjects_infront, tgp_ob);
122  }
123  else {
124  BLI_LINKS_APPEND(&pd->tobjects, tgp_ob);
125  }
126 
127  return tgp_ob;
128 }
129 
130 #define SORT_IMPL_LINKTYPE GPENCIL_tObject
131 
132 #define SORT_IMPL_FUNC gpencil_tobject_sort_fn_r
133 #include "../../blenlib/intern/list_sort_impl.h"
134 #undef SORT_IMPL_FUNC
135 
136 #undef SORT_IMPL_LINKTYPE
137 
138 static int gpencil_tobject_dist_sort(const void *a, const void *b)
139 {
140  const GPENCIL_tObject *ob_a = (const GPENCIL_tObject *)a;
141  const GPENCIL_tObject *ob_b = (const GPENCIL_tObject *)b;
142  /* Reminder, camera_z is negative in front of the camera. */
143  if (ob_a->camera_z > ob_b->camera_z) {
144  return 1;
145  }
146  if (ob_a->camera_z < ob_b->camera_z) {
147  return -1;
148  }
149 
150  return 0;
151 }
152 
154 {
155  /* Sort object by distance to the camera. */
156  if (pd->tobjects.first) {
157  pd->tobjects.first = gpencil_tobject_sort_fn_r(pd->tobjects.first, gpencil_tobject_dist_sort);
158  /* Relink last pointer. */
159  while (pd->tobjects.last->next) {
160  pd->tobjects.last = pd->tobjects.last->next;
161  }
162  }
163  if (pd->tobjects_infront.first) {
164  pd->tobjects_infront.first = gpencil_tobject_sort_fn_r(pd->tobjects_infront.first,
166  /* Relink last pointer. */
167  while (pd->tobjects_infront.last->next) {
169  }
170  }
171 
172  /* Join both lists, adding in front. */
173  if (pd->tobjects_infront.first != NULL) {
174  if (pd->tobjects.last != NULL) {
177  }
178  else {
179  /* Only in front objects. */
182  }
183  }
184 }
185 
188 /* -------------------------------------------------------------------- */
193  const Object *ob,
194  const bGPDlayer *gpl)
195 {
196  const bool is_obact = ((pd->obact) && (pd->obact == ob));
197  const bool is_fade = ((pd->fade_layer_opacity > -1.0f) && (is_obact) &&
198  ((gpl->flag & GP_LAYER_ACTIVE) == 0));
199 
200  /* Defines layer opacity. For active object depends of layer opacity factor, and
201  * for no active object, depends if the fade grease pencil objects option is enabled. */
202  if (!pd->is_render) {
203  if (is_obact && is_fade) {
204  return gpl->opacity * pd->fade_layer_opacity;
205  }
206  if (!is_obact && (pd->fade_gp_object_opacity > -1.0f)) {
207  return gpl->opacity * pd->fade_gp_object_opacity;
208  }
209  }
210  return gpl->opacity;
211 }
212 
214  const bGPdata *gpd,
215  const bGPDlayer *gpl,
216  const bGPDframe *gpf,
217  float r_tint[4],
218  float *r_alpha)
219 {
220  const bool use_onion = (gpf != NULL) && (gpf->runtime.onion_id != 0.0f);
221  if (use_onion) {
222  const bool use_onion_custom_col = (gpd->onion_flag & GP_ONION_GHOST_PREVCOL) != 0;
223  const bool use_onion_fade = (gpd->onion_flag & GP_ONION_FADE) != 0;
224  const bool use_next_col = gpf->runtime.onion_id > 0.0f;
225 
226  const float *onion_col_custom = (use_onion_custom_col) ?
227  (use_next_col ? gpd->gcolor_next : gpd->gcolor_prev) :
228  U.gpencil_new_layer_col;
229 
230  copy_v4_fl4(r_tint, UNPACK3(onion_col_custom), 1.0f);
231 
232  *r_alpha = use_onion_fade ? (1.0f / abs(gpf->runtime.onion_id)) : 0.5f;
233  *r_alpha *= gpd->onion_factor;
234  *r_alpha = (gpd->onion_factor > 0.0f) ? clamp_f(*r_alpha, 0.1f, 1.0f) :
235  clamp_f(*r_alpha, 0.01f, 1.0f);
236  }
237  else {
238  copy_v4_v4(r_tint, gpl->tintcolor);
239  if (GPENCIL_SIMPLIFY_TINT(pd->scene)) {
240  r_tint[3] = 0.0f;
241  }
242  *r_alpha = 1.0f;
243  }
244 
245  *r_alpha *= pd->xray_alpha;
246 }
247 
248 /* Random color by layer. */
250  const bGPDlayer *gpl,
251  float r_color[3])
252 {
253  const float hsv_saturation = 0.7f;
254  const float hsv_value = 0.6f;
255 
257  uint gpl_hash = BLI_ghashutil_strhash_p_murmur(gpl->info);
258  float hue = BLI_hash_int_01(ob_hash * gpl_hash);
259  const float hsv[3] = {hue, hsv_saturation, hsv_value};
260  hsv_to_rgb_v(hsv, r_color);
261 }
262 
264  const Object *ob,
265  const bGPDlayer *gpl,
266  const bGPDframe *gpf,
267  GPENCIL_tObject *tgp_ob)
268 {
269  bGPdata *gpd = (bGPdata *)ob->data;
270 
271  const bool is_in_front = (ob->dtx & OB_DRAW_IN_FRONT);
272  const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0;
273  const bool override_vertcol = (pd->v3d_color_type != -1);
274  const bool is_vert_col_mode = (pd->v3d_color_type == V3D_SHADING_VERTEX_COLOR) ||
275  GPENCIL_VERTEX_MODE(gpd) || pd->is_render;
276  bool is_masked = (gpl->flag & GP_LAYER_USE_MASK) && !BLI_listbase_is_empty(&gpl->mask_layers);
277 
278  float vert_col_opacity = (override_vertcol) ?
279  (is_vert_col_mode ? pd->vertex_paint_opacity : 0.0f) :
280  pd->is_render ? gpl->vertex_paint_opacity :
282  /* Negate thickness sign to tag that strokes are in screen space.
283  * Convert to world units (by default, 1 meter = 2000 px). */
284  float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / GPENCIL_PIXEL_FACTOR);
285  float layer_opacity = gpencil_layer_final_opacity_get(pd, ob, gpl);
286  float layer_tint[4];
287  float layer_alpha;
288  gpencil_layer_final_tint_and_alpha_get(pd, gpd, gpl, gpf, layer_tint, &layer_alpha);
289 
290  /* Create the new layer descriptor. */
292  BLI_LINKS_APPEND(&tgp_ob->layers, tgp_layer);
293  tgp_layer->layer_id = BLI_findindex(&gpd->layers, gpl);
294  tgp_layer->mask_bits = NULL;
295  tgp_layer->mask_invert_bits = NULL;
296  tgp_layer->blend_ps = NULL;
297 
298  /* Masking: Go through mask list and extract valid masks in a bitmap. */
299  if (is_masked) {
300  bool valid_mask = false;
301  /* Warning: only GP_MAX_MASKBITS amount of bits.
302  * TODO(fclem): Find a better system without any limitation. */
303  tgp_layer->mask_bits = BLI_memblock_alloc(pd->gp_maskbit_pool);
305  BLI_bitmap_set_all(tgp_layer->mask_bits, false, GP_MAX_MASKBITS);
306 
308  bGPDlayer *gpl_mask = BKE_gpencil_layer_named_get(gpd, mask->name);
309  if (gpl_mask && (gpl_mask != gpl) && ((gpl_mask->flag & GP_LAYER_HIDE) == 0) &&
310  ((mask->flag & GP_MASK_HIDE) == 0)) {
311  int index = BLI_findindex(&gpd->layers, gpl_mask);
312  if (index < GP_MAX_MASKBITS) {
313  const bool invert = (mask->flag & GP_MASK_INVERT) != 0;
314  BLI_BITMAP_SET(tgp_layer->mask_bits, index, true);
315  BLI_BITMAP_SET(tgp_layer->mask_invert_bits, index, invert);
316  valid_mask = true;
317  }
318  }
319  }
320 
321  if (valid_mask) {
322  pd->use_mask_fb = true;
323  }
324  else {
325  tgp_layer->mask_bits = NULL;
326  }
327  is_masked = valid_mask;
328  }
329 
330  /* Blending: Force blending for masked layer. */
331  if (is_masked || (gpl->blend_mode != eGplBlendMode_Regular) || (layer_opacity < 1.0f)) {
333  switch (gpl->blend_mode) {
336  break;
337  case eGplBlendMode_Add:
339  break;
342  break;
347  break;
348  }
349 
351  /* For these effect to propagate, we need a signed floating point buffer. */
352  pd->use_signed_fb = true;
353  }
354 
355  tgp_layer->blend_ps = DRW_pass_create("GPencil Blend Layer", state);
356 
358  DRWShadingGroup *grp = DRW_shgroup_create(sh, tgp_layer->blend_ps);
359  DRW_shgroup_uniform_int_copy(grp, "blendMode", gpl->blend_mode);
360  DRW_shgroup_uniform_float_copy(grp, "blendOpacity", layer_opacity);
361  DRW_shgroup_uniform_texture_ref(grp, "colorBuf", &pd->color_layer_tx);
362  DRW_shgroup_uniform_texture_ref(grp, "revealBuf", &pd->reveal_layer_tx);
363  DRW_shgroup_uniform_texture_ref(grp, "maskBuf", (is_masked) ? &pd->mask_tx : &pd->dummy_tx);
364  DRW_shgroup_stencil_mask(grp, 0xFF);
366 
367  if (gpl->blend_mode == eGplBlendMode_HardLight) {
368  /* We cannot do custom blending on Multi-Target frame-buffers.
369  * Workaround by doing 2 passes. */
370  grp = DRW_shgroup_create(sh, tgp_layer->blend_ps);
373  DRW_shgroup_uniform_int_copy(grp, "blendMode", 999);
375  }
376 
377  pd->use_layer_fb = true;
378  }
379 
380  /* Geometry pass */
381  {
382  GPUTexture *depth_tex = (is_in_front) ? pd->dummy_tx : pd->scene_depth_tx;
383  GPUTexture **mask_tex = (is_masked) ? &pd->mask_tx : &pd->dummy_tx;
384 
386  /* For 2D mode, we render all strokes with uniform depth (increasing with stroke id). */
388  /* Always write stencil. Only used as optimization for blending. */
390 
391  tgp_layer->geom_ps = DRW_pass_create("GPencil Layer", state);
392 
393  struct GPUShader *sh = GPENCIL_shader_geometry_get();
394  DRWShadingGroup *grp = tgp_layer->base_shgrp = DRW_shgroup_create(sh, tgp_layer->geom_ps);
395 
396  DRW_shgroup_uniform_texture(grp, "gpSceneDepthTexture", depth_tex);
397  DRW_shgroup_uniform_texture_ref(grp, "gpMaskTexture", mask_tex);
398  DRW_shgroup_uniform_vec3_copy(grp, "gpNormal", tgp_ob->plane_normal);
399  DRW_shgroup_uniform_bool_copy(grp, "strokeOrder3d", tgp_ob->is_drawmode3d);
400  DRW_shgroup_uniform_float_copy(grp, "thicknessScale", tgp_ob->object_scale);
403  DRW_shgroup_uniform_float_copy(grp, "thicknessOffset", (float)gpl->line_change);
404  DRW_shgroup_uniform_float_copy(grp, "thicknessWorldScale", thickness_scale);
405  DRW_shgroup_uniform_float_copy(grp, "vertexColorOpacity", vert_col_opacity);
406 
407  /* If random color type, need color by layer. */
408  float gpl_color[4];
409  copy_v4_v4(gpl_color, layer_tint);
411  gpencil_layer_random_color_get(ob, gpl, gpl_color);
412  gpl_color[3] = 1.0f;
413  }
414  DRW_shgroup_uniform_vec4_copy(grp, "layerTint", gpl_color);
415 
416  DRW_shgroup_uniform_float_copy(grp, "layerOpacity", layer_alpha);
417  DRW_shgroup_stencil_mask(grp, 0xFF);
418  }
419 
420  return tgp_layer;
421 }
422 
424 {
425  if (number >= 0) {
426  GPENCIL_tLayer *layer = tgp_ob->layers.first;
427  while (layer != NULL) {
428  if (layer->layer_id == number) {
429  return layer;
430  }
431  layer = layer->next;
432  }
433  }
434  return NULL;
435 }
436 
#define GPENCIL_SIMPLIFY_TINT(scene)
Definition: BKE_gpencil.h:64
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
Definition: gpencil.c:1496
struct MaterialGPencilStyle * BKE_gpencil_material_settings(struct Object *ob, short act)
Definition: material.c:713
General operations, lookup, etc. for blender objects.
void BKE_boundbox_calc_size_aabb(const struct BoundBox *bb, float r_size[3])
void BKE_boundbox_calc_center_aabb(const struct BoundBox *bb, float r_cent[3])
struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.c:3817
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
Definition: bitmap.c:33
#define BLI_BITMAP_SET(_bitmap, _index, _set)
Definition: BLI_bitmap.h:93
unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
BLI_INLINE float BLI_hash_int_01(unsigned int k)
Definition: BLI_hash.h:108
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:124
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float clamp_f(float value, float min, float max)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
Definition: math_color.c:68
void orthogonalize_m4(float R[4][4], int axis)
Definition: math_matrix.c:1514
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:262
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1187
void unit_m4(float m[4][4])
Definition: rct.c:1140
void mul_mat3_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:794
void rescale_m4(float mat[4][4], const float scale[3])
Definition: math_matrix.c:2396
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:732
float mat4_to_scale(const float M[4][4])
Definition: math_matrix.c:2196
void transpose_m4(float R[4][4])
Definition: math_matrix.c:1358
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void copy_v4_fl4(float v[4], float x, float y, float z, float w)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void * BLI_memblock_alloc(BLI_memblock *mblk) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition: BLI_memblock.c:133
unsigned int uint
Definition: BLI_sys_types.h:83
#define UNPACK3(a)
#define ELEM(...)
#define GPENCIL_VERTEX_MODE(gpd)
@ GP_MASK_INVERT
@ GP_MASK_HIDE
@ GP_DRAWMODE_3D
@ GP_LAYER_ACTIVE
@ GP_LAYER_USE_MASK
@ GP_LAYER_HIDE
@ GP_ONION_GHOST_PREVCOL
@ GP_ONION_FADE
@ GP_DATA_STROKE_KEEPTHICKNESS
@ eGplBlendMode_Regular
@ eGplBlendMode_Add
@ eGplBlendMode_Multiply
@ eGplBlendMode_Divide
@ eGplBlendMode_Subtract
@ eGplBlendMode_HardLight
@ GP_MATERIAL_IS_STROKE_HOLDOUT
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ OB_DRAW_IN_FRONT
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_RANDOM_COLOR
DRWState
Definition: DRW_render.h:312
@ DRW_STATE_STENCIL_EQUAL
Definition: DRW_render.h:332
@ DRW_STATE_STENCIL_ALWAYS
Definition: DRW_render.h:331
@ DRW_STATE_BLEND_SUB
Definition: DRW_render.h:346
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:314
@ DRW_STATE_BLEND_ADD_FULL
Definition: DRW_render.h:338
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:315
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:323
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:342
@ DRW_STATE_DEPTH_GREATER
Definition: DRW_render.h:325
@ DRW_STATE_BLEND_MUL
Definition: DRW_render.h:345
@ DRW_STATE_WRITE_STENCIL
Definition: DRW_render.h:317
NSNotificationCenter * center
struct GPUShader GPUShader
Definition: GPU_shader.h:33
struct GPUTexture GPUTexture
Definition: GPU_texture.h:33
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
const float * DRW_viewport_size_get(void)
Definition: draw_manager.c:439
const float * DRW_viewport_invert_size_get(void)
Definition: draw_manager.c:444
void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value)
void DRW_shgroup_state_disable(DRWShadingGroup *shgroup, DRWState state)
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)
void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state)
void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
bool DRW_view_is_persp_get(const DRWView *view)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, Object *ob, uint tri_count)
void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
DRWShadingGroup * DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass)
void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_uniform_texture_ref(DRWShadingGroup *shgroup, const char *name, GPUTexture **tex)
DRWPass * DRW_pass_create(const char *name, DRWState state)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value)
void DRW_shgroup_stencil_mask(DRWShadingGroup *shgroup, uint mask)
GPENCIL_tLayer * gpencil_layer_cache_get(GPENCIL_tObject *tgp_ob, int number)
GPENCIL_tLayer * gpencil_layer_cache_add(GPENCIL_PrivateData *pd, const Object *ob, const bGPDlayer *gpl, const bGPDframe *gpf, GPENCIL_tObject *tgp_ob)
static float gpencil_layer_final_opacity_get(const GPENCIL_PrivateData *pd, const Object *ob, const bGPDlayer *gpl)
static int gpencil_tobject_dist_sort(const void *a, const void *b)
static void gpencil_layer_final_tint_and_alpha_get(const GPENCIL_PrivateData *pd, const bGPdata *gpd, const bGPDlayer *gpl, const bGPDframe *gpf, float r_tint[4], float *r_alpha)
static void gpencil_layer_random_color_get(const Object *ob, const bGPDlayer *gpl, float r_color[3])
void gpencil_object_cache_sort(GPENCIL_PrivateData *pd)
GPENCIL_tObject * gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob)
struct GPUShader * GPENCIL_shader_layer_blend_get(void)
#define GP_MAX_MASKBITS
#define GPENCIL_PIXEL_FACTOR
struct GPUShader * GPENCIL_shader_geometry_get(void)
static ulong state[N]
static unsigned a[3]
Definition: RandGen.cpp:92
GPUTexture * scene_depth_tx
struct BLI_memblock * gp_layer_pool
struct BLI_memblock * gp_maskbit_pool
struct BLI_memblock * gp_object_pool
GPUTexture * dummy_tx
GPENCIL_tObject * first
GPUTexture * mask_tx
struct GPENCIL_PrivateData::@211 tobjects_infront
struct GPENCIL_PrivateData::@211 tobjects
struct Scene * scene
GPENCIL_tObject * last
GPUTexture * reveal_layer_tx
GPUTexture * color_layer_tx
DRWShadingGroup * base_shgrp
BLI_bitmap * mask_invert_bits
DRWPass * geom_ps
BLI_bitmap * mask_bits
DRWPass * blend_ps
struct GPENCIL_tLayer * next
struct GPENCIL_tObject::@209 layers
struct GPENCIL_tObject * next
float plane_normal[3]
GPENCIL_tLayer * first
char name[66]
Definition: DNA_ID.h:283
float obmat[4][4]
void * data
bGPDframe_Runtime runtime
char info[128]
float tintcolor[4]
float vertex_paint_opacity
ListBase mask_layers
float gcolor_prev[3]
ListBase layers
float gcolor_next[3]
float onion_factor
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: svm_invert.h:19
__forceinline const avxi abs(const avxi &a)
Definition: util_avxi.h:186
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)