44 const bool is_stroke_order_3d,
59 for (
int i = 0; i < tot_materials; i++) {
110 float radius =
len_v3(size);
111 mul_m4_v3(ob->object_to_world().ptr(), center);
126#define SORT_IMPL_LINKTYPE GPENCIL_tObject
128#define SORT_IMPL_FUNC gpencil_tobject_sort_fn_r
132#undef SORT_IMPL_LINKTYPE
192 const bool is_obact = ((pd->
obact) && (pd->
obact == ob));
199 if (is_obact && is_fade) {
214 const bool is_obact = ((pd->
obact) && (pd->
obact == ob));
216 !grease_pencil.is_layer_active(&layer);
221 if (is_obact && is_fade) {
228 return layer.opacity;
238 const bool use_onion = (gpf !=
nullptr) && (gpf->
runtime.
onion_id != 0.0f);
246 if (use_onion_custom_col) {
254 const float *onion_col_custom = use_next_col ? color_next : color_prev;
261 clamp_f(*r_alpha, 0.01f, 1.0f);
279 const bool use_onion = (onion_id != 0);
285 const bool use_next_col = onion_id > 0;
289 float3 color_next, color_prev;
290 if (use_onion_custom_col) {
299 const float4 onion_col_custom = use_next_col ?
float4(color_next, 1.0f) :
302 *r_alpha = use_onion_fade ? (1.0f /
abs(onion_id)) : 0.5f;
303 *r_alpha *= onion_factor;
304 *r_alpha = (onion_factor > 0.0f) ?
clamp_f(*r_alpha, 0.1f, 1.0f) :
305 clamp_f(*r_alpha, 0.01f, 1.0f);
308 return onion_col_custom;
315 layer_tint[3] = 0.0f;
328 const float hsv_saturation = 0.7f;
329 const float hsv_value = 0.6f;
334 const float hsv[3] = {
hue, hsv_saturation, hsv_value};
342 const float hsv_saturation = 0.7f;
343 const float hsv_value = 0.6f;
348 const float hsv[3] = {
hue, hsv_saturation, hsv_value};
367 const bool disable_masks_render = is_viewlayer_render &&
369 bool is_masked = disable_masks_render ?
false :
373 float vert_col_opacity = (override_vertcol) ?
395 bool valid_mask =
false;
424 is_masked = valid_mask;
520 const bool skip_onion)
524 if (skip_onion && layer->is_onion) {
527 if (layer->layer_id == layer_id) {
538 const bool is_used_as_mask,
553 const bool is_viewlayer_render = pd->
is_render && !layer.view_layer_name().is_empty() &&
555 const bool disable_masks_render = is_viewlayer_render &&
558 bool is_masked = !disable_masks_render && layer.use_masks() &&
561 const float vert_col_opacity = (override_vertcol) ?
570 pd, ob, grease_pencil, layer) :
575 pd, grease_pencil, onion_id, &layer_alpha);
580 tgp_layer->
layer_id = *grease_pencil.get_layer_index(layer);
581 tgp_layer->
is_onion = onion_id != 0;
588 bool valid_mask =
false;
600 const TreeNode *node = grease_pencil.find_node_by_name(mask->layer_name);
601 if (node ==
nullptr) {
604 const Layer &mask_layer = node->as_layer();
605 if ((&mask_layer == &layer) || !mask_layer.is_visible()) {
608 const int index = *grease_pencil.get_layer_index(mask_layer);
623 is_masked = valid_mask;
629 switch (layer.blend_mode) {
struct bGPDlayer * BKE_gpencil_layer_named_get(struct bGPdata *gpd, const char *name)
#define GPENCIL_SIMPLIFY_TINT(scene)
Low-level operations for grease pencil.
int BKE_object_material_count_eval(const struct Object *ob)
struct MaterialGPencilStyle * BKE_gpencil_material_settings(struct Object *ob, short act)
General operations, lookup, etc. for blender objects.
void BLI_bitmap_set_all(BLI_bitmap *bitmap, bool set, size_t bits)
#define BLI_BITMAP_SET(_bitmap, _index, _set)
unsigned int BLI_ghashutil_strhash_p_murmur(const void *ptr)
BLI_INLINE float BLI_hash_int_01(unsigned int k)
Single link-list utility macros. (header only api).
#define BLI_LINKS_APPEND(list, link)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
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])
float mat4_to_scale(const float mat[4][4])
void orthogonalize_m4(float R[4][4], int axis)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void unit_m4(float m[4][4])
void rescale_m4(float mat[4][4], const float scale[3])
void mul_m4_v3(const float M[4][4], float r[3])
bool invert_m4(float mat[4][4])
void transpose_m4(float R[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
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 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 normalize_v3(float n[3])
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)
#define GPENCIL_VERTEX_MODE(gpd)
@ GP_LAYER_DISABLE_MASKS_IN_VIEWLAYER
@ GP_DATA_STROKE_KEEPTHICKNESS
@ eGplBlendMode_HardLight
@ GP_LAYER_BLEND_HARDLIGHT
@ GP_LAYER_BLEND_MULTIPLY
@ GP_LAYER_BLEND_SUBTRACT
@ GP_LAYER_TREE_NODE_DISABLE_MASKS_IN_VIEWLAYER
@ GP_ONION_SKINNING_USE_FADE
@ GP_ONION_SKINNING_USE_CUSTOM_COLORS
@ GP_MATERIAL_IS_STROKE_HOLDOUT
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ OB_MODE_PAINT_GREASE_PENCIL
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_RANDOM_COLOR
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 Gabor Generate Gabor noise Gradient Generate interpolated color and intensity values based on the input vector Magic Generate a psychedelic color texture 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
void UI_GetThemeColor3fv(int colorid, float col[3])
struct GPUShader GPUShader
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
local_group_size(16, 16) .push_constant(Type b
DRWShadingGroup * DRW_shgroup_create(GPUShader *shader, DRWPass *pass)
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)
DRWPass * DRW_pass_create(const char *name, DRWState state)
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_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value)
void DRW_shgroup_call_procedural_triangles(DRWShadingGroup *shgroup, const Object *ob, uint tri_count)
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)
void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value)
void DRW_shgroup_stencil_mask(DRWShadingGroup *shgroup, uint mask)
@ DRW_STATE_STENCIL_EQUAL
@ DRW_STATE_STENCIL_ALWAYS
@ DRW_STATE_BLEND_ADD_FULL
@ DRW_STATE_DEPTH_LESS_EQUAL
@ DRW_STATE_BLEND_ALPHA_PREMUL
@ DRW_STATE_DEPTH_GREATER
@ DRW_STATE_WRITE_STENCIL
static void grease_pencil_layer_random_color_get(const Object *ob, const blender::bke::greasepencil::Layer &layer, float r_color[3])
static float4 grease_pencil_layer_final_tint_and_alpha_get(const GPENCIL_PrivateData *pd, const GreasePencil &grease_pencil, const int onion_id, float *r_alpha)
static float grease_pencil_layer_final_opacity_get(const GPENCIL_PrivateData *pd, const Object *ob, const GreasePencil &grease_pencil, const blender::bke::greasepencil::Layer &layer)
GPENCIL_tLayer * grease_pencil_layer_cache_add(GPENCIL_PrivateData *pd, const Object *ob, const blender::bke::greasepencil::Layer &layer, const int onion_id, const bool is_used_as_mask, GPENCIL_tObject *tgp_ob)
static float gpencil_layer_final_opacity_get(const GPENCIL_PrivateData *pd, const Object *ob, const bGPDlayer *gpl)
GPENCIL_tLayer * grease_pencil_layer_cache_get(GPENCIL_tObject *tgp_ob, int layer_id, const bool skip_onion)
GPENCIL_tObject * gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob, const bool is_stroke_order_3d, const blender::Bounds< float3 > bounds)
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_tLayer * gpencil_layer_cache_add(GPENCIL_PrivateData *pd, const Object *ob, const bGPDlayer *gpl, const bGPDframe *gpf, GPENCIL_tObject *tgp_ob)
#define GPENCIL_PIXEL_FACTOR
struct GPUShader * GPENCIL_shader_layer_blend_get(void)
struct GPUShader * GPENCIL_shader_geometry_get(void)
CCL_NAMESPACE_BEGIN ccl_device float invert(float color, float factor)
constexpr float LEGACY_RADIUS_CONVERSION_FACTOR
T midpoint(const T &a, const T &b)
GPUTexture * scene_depth_tx
struct BLI_memblock * gp_layer_pool
struct ViewLayer * view_layer
struct GPENCIL_PrivateData::@202 tobjects_infront
struct BLI_memblock * gp_maskbit_pool
struct BLI_memblock * gp_object_pool
float vertex_paint_opacity
float fade_gp_object_opacity
struct GPENCIL_PrivateData::@202 tobjects
GPUTexture * reveal_layer_tx
GPUTexture * color_layer_tx
DRWShadingGroup * base_shgrp
BLI_bitmap * mask_invert_bits
struct GPENCIL_tObject::@201 vfx
struct GPENCIL_tObject * next
struct GPENCIL_tObject::@200 layers
GreasePencilOnionSkinningSettings onion_skinning_settings
bGPDframe_Runtime runtime
float vertex_paint_opacity
ccl_device_inline int abs(int x)