Blender  V3.3
gpencil_cache_utils.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2017 Blender Foundation. */
3 
8 #include "DRW_engine.h"
9 #include "DRW_render.h"
10 
11 #include "ED_gpencil.h"
12 #include "ED_view3d.h"
13 
14 #include "DNA_gpencil_types.h"
15 #include "DNA_view3d_types.h"
16 
17 #include "BKE_gpencil.h"
18 #include "BKE_lib_id.h"
19 #include "BKE_object.h"
20 
21 #include "BLI_hash.h"
22 #include "BLI_link_utils.h"
23 #include "BLI_memblock.h"
24 
25 #include "gpencil_engine.h"
26 
27 #include "draw_cache_impl.h"
28 
29 #include "DEG_depsgraph.h"
30 
31 /* -------------------------------------------------------------------- */
36 {
37  bGPdata *gpd = (bGPdata *)ob->data;
39 
40  tgp_ob->layers.first = tgp_ob->layers.last = NULL;
41  tgp_ob->vfx.first = tgp_ob->vfx.last = NULL;
42  tgp_ob->camera_z = dot_v3v3(pd->camera_z_axis, ob->obmat[3]);
43  tgp_ob->is_drawmode3d = (gpd->draw_mode == GP_DRAWMODE_3D) || pd->draw_depth_only;
44  tgp_ob->object_scale = mat4_to_scale(ob->obmat);
45 
46  /* Check if any material with holdout flag enabled. */
47  tgp_ob->do_mat_holdout = false;
48  const int tot_materials = BKE_object_material_count_eval(ob);
49  for (int i = 0; i < tot_materials; i++) {
51  if (((gp_style != NULL) && (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT)) ||
52  ((gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT))) {
53  tgp_ob->do_mat_holdout = true;
54  break;
55  }
56  }
57 
58  /* Find the normal most likely to represent the gpObject. */
59  /* TODO: This does not work quite well if you use
60  * strokes not aligned with the object axes. Maybe we could try to
61  * compute the minimum axis of all strokes. But this would be more
62  * computationally heavy and should go into the GPData evaluation. */
63  const BoundBox *bbox = BKE_object_boundbox_get(ob);
64  /* Convert bbox to matrix */
65  float mat[4][4], size[3], center[3];
68  unit_m4(mat);
69  copy_v3_v3(mat[3], center);
70  /* Avoid division by 0.0 later. */
71  add_v3_fl(size, 1e-8f);
72  rescale_m4(mat, size);
73  /* BBox space to World. */
74  mul_m4_m4m4(mat, ob->obmat, mat);
76  /* BBox center to camera vector. */
77  sub_v3_v3v3(tgp_ob->plane_normal, pd->camera_pos, mat[3]);
78  }
79  else {
80  copy_v3_v3(tgp_ob->plane_normal, pd->camera_z_axis);
81  }
82  /* World to BBox space. */
83  invert_m4(mat);
84  /* Normalize the vector in BBox space. */
85  mul_mat3_m4_v3(mat, tgp_ob->plane_normal);
86  normalize_v3(tgp_ob->plane_normal);
87 
88  transpose_m4(mat);
89  /* mat is now a "normal" matrix which will transform
90  * BBox space normal to world space. */
91  mul_mat3_m4_v3(mat, tgp_ob->plane_normal);
92  normalize_v3(tgp_ob->plane_normal);
93 
94  /* Define a matrix that will be used to render a triangle to merge the depth of the rendered
95  * gpencil object with the rest of the scene. */
96  unit_m4(tgp_ob->plane_mat);
97  copy_v3_v3(tgp_ob->plane_mat[2], tgp_ob->plane_normal);
98  orthogonalize_m4(tgp_ob->plane_mat, 2);
100  float radius = len_v3(size);
101  mul_m4_v3(ob->obmat, center);
102  rescale_m4(tgp_ob->plane_mat, (float[3]){radius, radius, radius});
103  copy_v3_v3(tgp_ob->plane_mat[3], center);
104 
105  /* Add to corresponding list if is in front. */
106  if (ob->dtx & OB_DRAW_IN_FRONT) {
107  BLI_LINKS_APPEND(&pd->tobjects_infront, tgp_ob);
108  }
109  else {
110  BLI_LINKS_APPEND(&pd->tobjects, tgp_ob);
111  }
112 
113  return tgp_ob;
114 }
115 
116 #define SORT_IMPL_LINKTYPE GPENCIL_tObject
117 
118 #define SORT_IMPL_FUNC gpencil_tobject_sort_fn_r
119 #include "../../blenlib/intern/list_sort_impl.h"
120 #undef SORT_IMPL_FUNC
121 
122 #undef SORT_IMPL_LINKTYPE
123 
124 static int gpencil_tobject_dist_sort(const void *a, const void *b)
125 {
126  const GPENCIL_tObject *ob_a = (const GPENCIL_tObject *)a;
127  const GPENCIL_tObject *ob_b = (const GPENCIL_tObject *)b;
128  /* Reminder, camera_z is negative in front of the camera. */
129  if (ob_a->camera_z > ob_b->camera_z) {
130  return 1;
131  }
132  if (ob_a->camera_z < ob_b->camera_z) {
133  return -1;
134  }
135 
136  return 0;
137 }
138 
140 {
141  /* Sort object by distance to the camera. */
142  if (pd->tobjects.first) {
143  pd->tobjects.first = gpencil_tobject_sort_fn_r(pd->tobjects.first, gpencil_tobject_dist_sort);
144  /* Relink last pointer. */
145  while (pd->tobjects.last->next) {
146  pd->tobjects.last = pd->tobjects.last->next;
147  }
148  }
149  if (pd->tobjects_infront.first) {
150  pd->tobjects_infront.first = gpencil_tobject_sort_fn_r(pd->tobjects_infront.first,
152  /* Relink last pointer. */
153  while (pd->tobjects_infront.last->next) {
155  }
156  }
157 
158  /* Join both lists, adding in front. */
159  if (pd->tobjects_infront.first != NULL) {
160  if (pd->tobjects.last != NULL) {
163  }
164  else {
165  /* Only in front objects. */
168  }
169  }
170 }
171 
174 /* -------------------------------------------------------------------- */
179  const Object *ob,
180  const bGPDlayer *gpl)
181 {
182  const bool is_obact = ((pd->obact) && (pd->obact == ob));
183  const bool is_fade = ((pd->fade_layer_opacity > -1.0f) && (is_obact) &&
184  ((gpl->flag & GP_LAYER_ACTIVE) == 0));
185 
186  /* Defines layer opacity. For active object depends of layer opacity factor, and
187  * for no active object, depends if the fade grease pencil objects option is enabled. */
188  if (!pd->is_render) {
189  if (is_obact && is_fade) {
190  return gpl->opacity * pd->fade_layer_opacity;
191  }
192  if (!is_obact && (pd->fade_gp_object_opacity > -1.0f)) {
193  return gpl->opacity * pd->fade_gp_object_opacity;
194  }
195  }
196  return gpl->opacity;
197 }
198 
200  const bGPdata *gpd,
201  const bGPDlayer *gpl,
202  const bGPDframe *gpf,
203  float r_tint[4],
204  float *r_alpha)
205 {
206  const bool use_onion = (gpf != NULL) && (gpf->runtime.onion_id != 0.0f);
207  if (use_onion) {
208  const bool use_onion_custom_col = (gpd->onion_flag & GP_ONION_GHOST_PREVCOL) != 0;
209  const bool use_onion_fade = (gpd->onion_flag & GP_ONION_FADE) != 0;
210  const bool use_next_col = gpf->runtime.onion_id > 0.0f;
211 
212  const float *onion_col_custom = (use_onion_custom_col) ?
213  (use_next_col ? gpd->gcolor_next : gpd->gcolor_prev) :
214  U.gpencil_new_layer_col;
215 
216  copy_v4_fl4(r_tint, UNPACK3(onion_col_custom), 1.0f);
217 
218  *r_alpha = use_onion_fade ? (1.0f / abs(gpf->runtime.onion_id)) : 0.5f;
219  *r_alpha *= gpd->onion_factor;
220  *r_alpha = (gpd->onion_factor > 0.0f) ? clamp_f(*r_alpha, 0.1f, 1.0f) :
221  clamp_f(*r_alpha, 0.01f, 1.0f);
222  }
223  else {
224  copy_v4_v4(r_tint, gpl->tintcolor);
225  if (GPENCIL_SIMPLIFY_TINT(pd->scene)) {
226  r_tint[3] = 0.0f;
227  }
228  *r_alpha = 1.0f;
229  }
230 
231  *r_alpha *= pd->xray_alpha;
232 }
233 
234 /* Random color by layer. */
236  const bGPDlayer *gpl,
237  float r_color[3])
238 {
239  const float hsv_saturation = 0.7f;
240  const float hsv_value = 0.6f;
241 
243  uint gpl_hash = BLI_ghashutil_strhash_p_murmur(gpl->info);
244  float hue = BLI_hash_int_01(ob_hash * gpl_hash);
245  const float hsv[3] = {hue, hsv_saturation, hsv_value};
246  hsv_to_rgb_v(hsv, r_color);
247 }
248 
250  const Object *ob,
251  const bGPDlayer *gpl,
252  const bGPDframe *gpf,
253  GPENCIL_tObject *tgp_ob)
254 {
255  bGPdata *gpd = (bGPdata *)ob->data;
256 
257  const bool is_in_front = (ob->dtx & OB_DRAW_IN_FRONT);
258  const bool is_screenspace = (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS) != 0;
259  const bool override_vertcol = (pd->v3d_color_type != -1);
260  const bool is_vert_col_mode = (pd->v3d_color_type == V3D_SHADING_VERTEX_COLOR) ||
261  GPENCIL_VERTEX_MODE(gpd) || pd->is_render;
262  const bool is_viewlayer_render = pd->is_render && (gpl->viewlayername[0] != '\0') &&
263  STREQ(pd->view_layer->name, gpl->viewlayername);
264  const bool disable_masks_render = is_viewlayer_render &&
266  bool is_masked = disable_masks_render ? false :
267  (gpl->flag & GP_LAYER_USE_MASK) &&
269 
270  float vert_col_opacity = (override_vertcol) ?
271  (is_vert_col_mode ? pd->vertex_paint_opacity : 0.0f) :
272  (pd->is_render ? gpl->vertex_paint_opacity :
274  /* Negate thickness sign to tag that strokes are in screen space.
275  * Convert to world units (by default, 1 meter = 2000 pixels). */
276  float thickness_scale = (is_screenspace) ? -1.0f : (gpd->pixfactor / GPENCIL_PIXEL_FACTOR);
277  float layer_opacity = gpencil_layer_final_opacity_get(pd, ob, gpl);
278  float layer_tint[4];
279  float layer_alpha;
280  gpencil_layer_final_tint_and_alpha_get(pd, gpd, gpl, gpf, layer_tint, &layer_alpha);
281 
282  /* Create the new layer descriptor. */
284  BLI_LINKS_APPEND(&tgp_ob->layers, tgp_layer);
285  tgp_layer->layer_id = BLI_findindex(&gpd->layers, gpl);
286  tgp_layer->mask_bits = NULL;
287  tgp_layer->mask_invert_bits = NULL;
288  tgp_layer->blend_ps = NULL;
289 
290  /* Masking: Go through mask list and extract valid masks in a bitmap. */
291  if (is_masked) {
292  bool valid_mask = false;
293  /* WARNING: only #GP_MAX_MASKBITS amount of bits.
294  * TODO(fclem): Find a better system without any limitation. */
295  tgp_layer->mask_bits = BLI_memblock_alloc(pd->gp_maskbit_pool);
297  BLI_bitmap_set_all(tgp_layer->mask_bits, false, GP_MAX_MASKBITS);
298 
300  bGPDlayer *gpl_mask = BKE_gpencil_layer_named_get(gpd, mask->name);
301  if (gpl_mask && (gpl_mask != gpl) && ((gpl_mask->flag & GP_LAYER_HIDE) == 0) &&
302  ((mask->flag & GP_MASK_HIDE) == 0)) {
303  int index = BLI_findindex(&gpd->layers, gpl_mask);
304  if (index < GP_MAX_MASKBITS) {
305  const bool invert = (mask->flag & GP_MASK_INVERT) != 0;
306  BLI_BITMAP_SET(tgp_layer->mask_bits, index, true);
307  BLI_BITMAP_SET(tgp_layer->mask_invert_bits, index, invert);
308  valid_mask = true;
309  }
310  }
311  }
312 
313  if (valid_mask) {
314  pd->use_mask_fb = true;
315  }
316  else {
317  tgp_layer->mask_bits = NULL;
318  }
319  is_masked = valid_mask;
320  }
321 
322  /* Blending: Force blending for masked layer. */
323  if (is_masked || (gpl->blend_mode != eGplBlendMode_Regular) || (layer_opacity < 1.0f)) {
325  switch (gpl->blend_mode) {
328  break;
329  case eGplBlendMode_Add:
331  break;
334  break;
339  break;
340  }
341 
343  /* For these effect to propagate, we need a signed floating point buffer. */
344  pd->use_signed_fb = true;
345  }
346 
347  tgp_layer->blend_ps = DRW_pass_create("GPencil Blend Layer", state);
348 
350  DRWShadingGroup *grp = DRW_shgroup_create(sh, tgp_layer->blend_ps);
351  DRW_shgroup_uniform_int_copy(grp, "blendMode", gpl->blend_mode);
352  DRW_shgroup_uniform_float_copy(grp, "blendOpacity", layer_opacity);
353  DRW_shgroup_uniform_texture_ref(grp, "colorBuf", &pd->color_layer_tx);
354  DRW_shgroup_uniform_texture_ref(grp, "revealBuf", &pd->reveal_layer_tx);
355  DRW_shgroup_uniform_texture_ref(grp, "maskBuf", (is_masked) ? &pd->mask_tx : &pd->dummy_tx);
356  DRW_shgroup_stencil_mask(grp, 0xFF);
358 
359  if (gpl->blend_mode == eGplBlendMode_HardLight) {
360  /* We cannot do custom blending on Multi-Target frame-buffers.
361  * Workaround by doing 2 passes. */
362  grp = DRW_shgroup_create(sh, tgp_layer->blend_ps);
365  DRW_shgroup_uniform_int_copy(grp, "blendMode", 999);
367  }
368 
369  pd->use_layer_fb = true;
370  }
371 
372  /* Geometry pass */
373  {
374  GPUTexture *depth_tex = (is_in_front) ? pd->dummy_tx : pd->scene_depth_tx;
375  GPUTexture **mask_tex = (is_masked) ? &pd->mask_tx : &pd->dummy_tx;
376 
378  /* For 2D mode, we render all strokes with uniform depth (increasing with stroke id). */
380  /* Always write stencil. Only used as optimization for blending. */
382 
383  tgp_layer->geom_ps = DRW_pass_create("GPencil Layer", state);
384 
386  DRWShadingGroup *grp = tgp_layer->base_shgrp = DRW_shgroup_create(sh, tgp_layer->geom_ps);
387 
388  DRW_shgroup_uniform_texture(grp, "gpSceneDepthTexture", depth_tex);
389  DRW_shgroup_uniform_texture_ref(grp, "gpMaskTexture", mask_tex);
390  DRW_shgroup_uniform_vec3_copy(grp, "gpNormal", tgp_ob->plane_normal);
391  DRW_shgroup_uniform_bool_copy(grp, "gpStrokeOrder3d", tgp_ob->is_drawmode3d);
392  DRW_shgroup_uniform_float_copy(grp, "gpThicknessScale", tgp_ob->object_scale);
393  DRW_shgroup_uniform_float_copy(grp, "gpThicknessOffset", (float)gpl->line_change);
394  DRW_shgroup_uniform_float_copy(grp, "gpThicknessWorldScale", thickness_scale);
395  DRW_shgroup_uniform_float_copy(grp, "gpVertexColorOpacity", vert_col_opacity);
396 
397  /* If random color type, need color by layer. */
398  float gpl_color[4];
399  copy_v4_v4(gpl_color, layer_tint);
401  gpencil_layer_random_color_get(ob, gpl, gpl_color);
402  gpl_color[3] = 1.0f;
403  }
404  DRW_shgroup_uniform_vec4_copy(grp, "gpLayerTint", gpl_color);
405 
406  DRW_shgroup_uniform_float_copy(grp, "gpLayerOpacity", layer_alpha);
407  DRW_shgroup_stencil_mask(grp, 0xFF);
408  }
409 
410  return tgp_layer;
411 }
412 
414 {
415  if (number >= 0) {
416  GPENCIL_tLayer *layer = tgp_ob->layers.first;
417  while (layer != NULL) {
418  if (layer->layer_id == number) {
419  return layer;
420  }
421  layer = layer->next;
422  }
423  }
424  return NULL;
425 }
426 
#define GPENCIL_SIMPLIFY_TINT(scene)
Definition: BKE_gpencil.h:50
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
Definition: gpencil.c:1419
struct MaterialGPencilStyle * BKE_gpencil_material_settings(struct Object *ob, short act)
Definition: material.c:805
int BKE_object_material_count_eval(struct Object *ob)
Definition: material.c:746
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])
const struct BoundBox * BKE_object_boundbox_get(struct Object *ob)
Definition: object.cc:3684
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
Definition: bitmap.c:17
#define BLI_BITMAP_SET(_bitmap, _index, _set)
Definition: BLI_bitmap.h:102
unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
BLI_INLINE float BLI_hash_int_01(unsigned int k)
Definition: BLI_hash.h:94
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
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:49
void orthogonalize_m4(float R[4][4], int axis)
Definition: math_matrix.c:1523
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1206
void unit_m4(float m[4][4])
Definition: rct.c:1090
void mul_mat3_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:790
void rescale_m4(float mat[4][4], const float scale[3])
Definition: math_matrix.c:2362
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
float mat4_to_scale(const float M[4][4])
Definition: math_matrix.c:2185
void transpose_m4(float R[4][4])
Definition: math_matrix.c:1377
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:115
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNPACK3(a)
#define ELEM(...)
#define STREQ(a, b)
#define GPENCIL_VERTEX_MODE(gpd)
@ GP_MASK_INVERT
@ GP_MASK_HIDE
@ GP_DRAWMODE_3D
@ GP_LAYER_DISABLE_MASKS_IN_VIEWLAYER
@ 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:298
@ DRW_STATE_STENCIL_EQUAL
Definition: DRW_render.h:320
@ DRW_STATE_STENCIL_ALWAYS
Definition: DRW_render.h:319
@ DRW_STATE_BLEND_SUB
Definition: DRW_render.h:334
@ DRW_STATE_WRITE_DEPTH
Definition: DRW_render.h:302
@ DRW_STATE_BLEND_ADD_FULL
Definition: DRW_render.h:326
@ DRW_STATE_WRITE_COLOR
Definition: DRW_render.h:303
@ DRW_STATE_DEPTH_LESS_EQUAL
Definition: DRW_render.h:311
@ DRW_STATE_BLEND_ALPHA_PREMUL
Definition: DRW_render.h:330
@ DRW_STATE_DEPTH_GREATER
Definition: DRW_render.h:313
@ DRW_STATE_BLEND_MUL
Definition: DRW_render.h:333
@ DRW_STATE_WRITE_STENCIL
Definition: DRW_render.h:305
NSNotificationCenter * center
struct GPUShader GPUShader
Definition: GPU_shader.h:20
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
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 or normal between and object coordinate space Combine Create a color from its hue
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
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_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)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
Definition: invert.h:8
const int state
ccl_gpu_kernel_postfix ccl_global float int int int int sh
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static unsigned a[3]
Definition: RandGen.cpp:78
T abs(const T &a)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
GPUTexture * scene_depth_tx
struct BLI_memblock * gp_layer_pool
struct ViewLayer * view_layer
struct BLI_memblock * gp_maskbit_pool
struct BLI_memblock * gp_object_pool
struct GPENCIL_PrivateData::@219 tobjects_infront
GPUTexture * dummy_tx
GPENCIL_tObject * first
GPUTexture * mask_tx
struct Scene * scene
GPENCIL_tObject * last
struct GPENCIL_PrivateData::@219 tobjects
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::@217 layers
struct GPENCIL_tObject * next
float plane_normal[3]
GPENCIL_tLayer * first
char name[66]
Definition: DNA_ID.h:378
float obmat[4][4]
void * data
char name[64]
bGPDframe_Runtime runtime
char info[128]
float tintcolor[4]
char viewlayername[64]
float vertex_paint_opacity
ListBase mask_layers
float gcolor_prev[3]
ListBase layers
float gcolor_next[3]
float onion_factor