31 #include "../engines/gpencil/gpencil_defines.h"
33 #define BEZIER_HANDLE (1 << 3)
103 memset(cache, 0,
sizeof(*cache));
106 cache->is_dirty =
true;
107 cache->cache_frame = cfra;
185 if (
format.attr_len == 0) {
205 if (
format.attr_len == 0) {
221 if (
format.attr_len == 0) {
238 if (
format.attr_len == 0) {
267 return batch->verts[0];
279 float asp_normalized = (asp > 1.0f) ? (1.0f / asp) : asp;
347 for (
int i = 0; i < pts_len; i++) {
370 for (
int i = 0; i < tri_len; i++) {
415 bool do_onion =
true;
447 for (
int i = 0; i < 2; i++) {
493 int end = start + pts_len;
494 for (
int i = start; i < end; i++) {
520 bool do_onion =
true;
548 gps->
hardeness = brush->gpencil_settings->hardeness;
559 gps->
caps[0] = gps->
caps[1] = (short)brush->gpencil_settings->caps_type;
590 for (
int i = 0; i < vert_len; i++) {
628 float(*tpoints2d)[2] =
MEM_mallocN(
sizeof(*tpoints2d) * vert_len, __func__);
630 for (
int i = 0; i < vert_len; i++) {
689 #define GP_EDIT_POINT_SELECTED (1 << 0)
690 #define GP_EDIT_STROKE_SELECTED (1 << 1)
691 #define GP_EDIT_MULTIFRAME (1 << 2)
692 #define GP_EDIT_STROKE_START (1 << 3)
693 #define GP_EDIT_STROKE_END (1 << 4)
694 #define GP_EDIT_POINT_DIMMED (1 << 5)
741 for (
int i = 0; i < v_len; i++) {
774 const bool handle_selected)
818 vert_ptr->
data = vflag[0];
822 vert_ptr->
data = vflag[1];
827 vert_ptr->
data = vflag[1];
831 vert_ptr->
data = vflag[2];
846 bool do_onion =
true;
typedef float(TangentPoint)[2]
void BKE_gpencil_visible_stroke_advanced_iter(struct ViewLayer *view_layer, struct Object *ob, gpIterCb layer_cb, gpIterCb stroke_cb, void *thunk, bool do_onion, int cfra)
void BKE_gpencil_stroke_uv_update(struct bGPDstroke *gps)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) 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])
void BLI_polyfill_calc(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3])
#define SET_FLAG_FROM_TEST(value, test, flag)
float DEG_get_ctime(const Depsgraph *graph)
#define BEZT_ISSEL_ANY(bezt)
#define GPU_batch_create(prim, verts, elem)
#define GPU_batch_vertbuf_add(batch, verts)
#define GPU_BATCH_DISCARD_SAFE(batch)
int GPU_batch_instbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo)
GPUBatch * GPU_batch_create_ex(GPUPrimType prim, GPUVertBuf *vert, GPUIndexBuf *elem, eGPUBatchFlag owns_flag)
struct GPUIndexBuf GPUIndexBuf
#define GPU_INDEXBUF_DISCARD_SAFE(elem)
void GPU_indexbuf_init(GPUIndexBufBuilder *, GPUPrimType, uint prim_len, uint vertex_len)
void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *)
GPUIndexBuf * GPU_indexbuf_build(GPUIndexBufBuilder *)
void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *, uint v)
void GPU_indexbuf_init_ex(GPUIndexBufBuilder *, GPUPrimType, uint index_len, uint vertex_len)
void GPU_indexbuf_add_tri_verts(GPUIndexBufBuilder *, uint v1, uint v2, uint v3)
uint GPU_vertbuf_get_vertex_len(const GPUVertBuf *verts)
#define GPU_vertbuf_create_with_format(format)
struct GPUVertBuf GPUVertBuf
void GPU_vertbuf_data_alloc(GPUVertBuf *, uint v_len)
void * GPU_vertbuf_get_data(const GPUVertBuf *verts)
#define GPU_VERTBUF_DISCARD_SAFE(verts)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
GPUBatch * DRW_gpencil_dummy_buffer_get(void)
@ VFLAG_VERT_SELECTED_BEZT_HANDLE
@ VFLAG_VERT_GPENCIL_BEZT_HANDLE
static void gpencil_buffer_add_point(gpStrokeVert *verts, gpColorVert *cols, const bGPDstroke *gps, const bGPDspoint *pt, int v, bool is_endpoint)
struct gpEditCurveVert gpEditCurveVert
void DRW_gpencil_batch_cache_dirty_tag(bGPdata *gpd)
GPUBatch * DRW_cache_gpencil_edit_lines_get(Object *ob, int cfra)
GPUBatch * DRW_cache_gpencil_edit_points_get(Object *ob, int cfra)
static GPUVertFormat * gpencil_edit_stroke_format(void)
GPUBatch * DRW_cache_gpencil_strokes_get(Object *ob, int cfra)
void DRW_gpencil_batch_cache_free(bGPdata *gpd)
struct gpColorVert gpColorVert
static void gpencil_buffer_add_stroke(gpStrokeVert *verts, gpColorVert *cols, const bGPDstroke *gps)
static uint32_t gpencil_point_edit_flag(const bool layer_lock, const bGPDspoint *pt, int v, int v_len)
static void gpencil_object_verts_count_cb(bGPDlayer *UNUSED(gpl), bGPDframe *UNUSED(gpf), bGPDstroke *gps, void *thunk)
static void gpencil_edit_stroke_iter_cb(bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps, void *thunk)
GPUBatch * DRW_cache_gpencil_sbuffer_stroke_get(Object *ob)
struct gpEditCurveIterData gpEditCurveIterData
static void gpencil_batch_cache_clear(GpencilBatchCache *cache)
GPUBatch * DRW_cache_gpencil_sbuffer_fill_get(Object *ob)
static uint32_t gpencil_beztriple_vflag_get(char flag, char col_id, bool handle_point, const bool handle_selected)
struct gpIterData gpIterData
static bool gpencil_batch_cache_valid(GpencilBatchCache *cache, bGPdata *gpd, int cfra)
static GPUVertFormat * gpencil_stroke_format(void)
BLI_INLINE int32_t pack_rotation_aspect_hardness(float rot, float asp, float hard)
struct gpEditIterData gpEditIterData
struct gpEditVert gpEditVert
static GPUVertBuf * gpencil_dummy_buffer_get(void)
GPUBatch * DRW_cache_gpencil_fills_get(Object *ob, int cfra)
int DRW_gpencil_material_count_get(bGPdata *gpd)
static GPUVertFormat * gpencil_color_format(void)
static void gpencil_edit_batches_ensure(Object *ob, GpencilBatchCache *cache, int cfra)
static GpencilBatchCache * gpencil_batch_cache_get(Object *ob, int cfra)
static void gpencil_edit_curve_stroke_iter_cb(bGPDlayer *gpl, bGPDframe *UNUSED(gpf), bGPDstroke *gps, void *thunk)
void DRW_cache_gpencil_sbuffer_clear(Object *ob)
struct GpencilBatchCache GpencilBatchCache
GPUBatch * DRW_cache_gpencil_edit_curve_points_get(Object *ob, int cfra)
#define GP_EDIT_MULTIFRAME
static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_stroke, bool do_fill)
#define GP_EDIT_POINT_DIMMED
static void gpencil_lines_indices_cb(bGPDlayer *UNUSED(gpl), bGPDframe *UNUSED(gpf), bGPDstroke *gps, void *thunk)
static GPUVertFormat * gpencil_edit_curve_format(void)
static void gpencil_buffer_add_fill(GPUIndexBufBuilder *ibo, const bGPDstroke *gps)
GPUBatch * DRW_cache_gpencil_face_wireframe_get(Object *ob)
GPUBatch * DRW_cache_gpencil_edit_curve_handles_get(Object *ob, int cfra)
#define GP_EDIT_POINT_SELECTED
static GpencilBatchCache * gpencil_batch_cache_init(Object *ob, int cfra)
static void gpencil_edit_curve_stroke_count_cb(bGPDlayer *gpl, bGPDframe *UNUSED(gpf), bGPDstroke *gps, void *thunk)
static void gpencil_stroke_iter_cb(bGPDlayer *UNUSED(gpl), bGPDframe *UNUSED(gpf), bGPDstroke *gps, void *thunk)
static int gpencil_stroke_is_cyclic(const bGPDstroke *gps)
static void gpencil_batches_ensure(Object *ob, GpencilBatchCache *cache, int cfra)
#define GP_EDIT_STROKE_SELECTED
#define GP_EDIT_STROKE_END
struct gpStrokeVert gpStrokeVert
#define GP_EDIT_STROKE_START
static float gpencil_point_edit_weight(const MDeformVert *dvert, int v, int vgindex)
bGPDstroke * DRW_cache_gpencil_sbuffer_stroke_data_get(Object *ob)
const DRWContextState * DRW_context_state_get(void)
static bool is_cyclic(const Nurb *nu)
#define GPENCIL_MATERIAL_BUFFER_LEN
void ED_gpencil_tpoint_to_point(ARegion *region, float origin[3], const tGPspoint *tpt, bGPDspoint *pt)
void ED_gpencil_drawing_reference_get(const Scene *scene, const Object *ob, char align_flag, float r_vec[3])
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
MINLINE unsigned char unit_float_to_uchar_clamp(float val)
struct Depsgraph * depsgraph
GPUBatch * edit_points_batch
GPUBatch * edit_curve_points_batch
GPUVertBuf * edit_curve_vbo
GPUBatch * edit_lines_batch
GPUBatch * edit_curve_handles_batch
struct ToolSettings * toolsettings
bGPDcurve_point * curve_points
bGPDframe_Runtime runtime
struct bGPDspoint * pt_orig
bGPDspoint_Runtime runtime
bGPDstroke_Runtime runtime
struct bGPDcurve * editcurve
struct MDeformVert * dvert
struct GpencilBatchCache * gpencil_cache
struct GPUBatch * sbuffer_stroke_batch
struct GPUBatch * sbuffer_fill_batch
struct bGPDstroke * sbuffer_gps
ListBase vertex_group_names
int vertex_group_active_index
int32_t packed_asp_hard_rot