|
Blender
V2.93
|
#include "DNA_curve_types.h"#include "DNA_gpencil_types.h"#include "DNA_meshdata_types.h"#include "DNA_screen_types.h"#include "BKE_deform.h"#include "BKE_gpencil.h"#include "BKE_gpencil_geom.h"#include "DRW_engine.h"#include "DRW_render.h"#include "ED_gpencil.h"#include "GPU_batch.h"#include "DEG_depsgraph_query.h"#include "BLI_hash.h"#include "BLI_polyfill_2d.h"#include "draw_cache.h"#include "draw_cache_impl.h"Go to the source code of this file.
Classes | |
| struct | GpencilBatchCache |
| struct | gpStrokeVert |
| struct | gpEditVert |
| struct | gpEditCurveVert |
| struct | gpColorVert |
| struct | gpIterData |
| struct | gpEditIterData |
| struct | gpEditCurveIterData |
Macros | |
| #define | BEZIER_HANDLE (1 << 3) |
| #define | COLOR_SHIFT 5 |
| #define | GP_EDIT_POINT_SELECTED (1 << 0) |
| #define | GP_EDIT_STROKE_SELECTED (1 << 1) |
| #define | GP_EDIT_MULTIFRAME (1 << 2) |
| #define | GP_EDIT_STROKE_START (1 << 3) |
| #define | GP_EDIT_STROKE_END (1 << 4) |
| #define | GP_EDIT_POINT_DIMMED (1 << 5) |
Typedefs | |
| typedef struct GpencilBatchCache | GpencilBatchCache |
| typedef struct gpEditIterData | gpEditIterData |
| typedef struct gpEditCurveIterData | gpEditCurveIterData |
Vertex Formats. | |
| typedef struct gpStrokeVert | gpStrokeVert |
| typedef struct gpEditVert | gpEditVert |
| typedef struct gpEditCurveVert | gpEditCurveVert |
| typedef struct gpColorVert | gpColorVert |
| static GPUVertFormat * | gpencil_stroke_format (void) |
| static GPUVertFormat * | gpencil_edit_stroke_format (void) |
| static GPUVertFormat * | gpencil_edit_curve_format (void) |
| static GPUVertFormat * | gpencil_color_format (void) |
| #define BEZIER_HANDLE (1 << 3) |
Definition at line 47 of file draw_cache_impl_gpencil.c.
| #define COLOR_SHIFT 5 |
Definition at line 48 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_MULTIFRAME (1 << 2) |
Definition at line 677 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_POINT_DIMMED (1 << 5) |
Definition at line 680 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_POINT_SELECTED (1 << 0) |
Definition at line 675 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_STROKE_END (1 << 4) |
Definition at line 679 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_STROKE_SELECTED (1 << 1) |
Definition at line 676 of file draw_cache_impl_gpencil.c.
| #define GP_EDIT_STROKE_START (1 << 3) |
Definition at line 678 of file draw_cache_impl_gpencil.c.
| typedef struct gpColorVert gpColorVert |
| typedef struct gpEditCurveIterData gpEditCurveIterData |
| typedef struct gpEditCurveVert gpEditCurveVert |
| typedef struct gpEditIterData gpEditIterData |
| typedef struct gpEditVert gpEditVert |
| typedef struct GpencilBatchCache GpencilBatchCache |
| typedef struct gpIterData gpIterData |
| typedef struct gpStrokeVert gpStrokeVert |
Definition at line 925 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::edit_curve_handles_batch, gpencil_batch_cache_get(), gpencil_batches_ensure(), and gpencil_edit_batches_ensure().
Referenced by OVERLAY_edit_gpencil_cache_populate().
Definition at line 934 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::edit_curve_points_batch, gpencil_batch_cache_get(), gpencil_batches_ensure(), and gpencil_edit_batches_ensure().
Referenced by OVERLAY_edit_gpencil_cache_populate().
Definition at line 907 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::edit_lines_batch, gpencil_batch_cache_get(), gpencil_batches_ensure(), and gpencil_edit_batches_ensure().
Referenced by OVERLAY_edit_gpencil_cache_populate().
Definition at line 916 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::edit_points_batch, gpencil_batch_cache_get(), gpencil_batches_ensure(), and gpencil_edit_batches_ensure().
Referenced by OVERLAY_edit_gpencil_cache_populate().
Definition at line 489 of file draw_cache_impl_gpencil.c.
References BKE_gpencil_visible_stroke_iter(), Object::data, DEG_get_ctime(), DRWContextState::depsgraph, DRW_context_state_get(), gpIterData::gpd, gpencil_batch_cache_get(), gpencil_batches_ensure(), gpencil_lines_indices_cb(), GPU_batch_create_ex(), GPU_BATCH_OWNS_INDEX, GPU_indexbuf_build(), GPU_indexbuf_init_ex(), GPU_PRIM_LINE_STRIP, GPU_vertbuf_get_vertex_len(), gpIterData::ibo, GpencilBatchCache::lines_batch, NULL, and GpencilBatchCache::vbo.
Referenced by DRW_cache_object_face_wireframe_get().
Definition at line 465 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::fill_batch, gpencil_batch_cache_get(), and gpencil_batches_ensure().
Referenced by gpencil_stroke_cache_populate().
| void DRW_cache_gpencil_sbuffer_clear | ( | Object * | ob | ) |
Definition at line 662 of file draw_cache_impl_gpencil.c.
References Object::data, GPU_BATCH_DISCARD_SAFE, MEM_SAFE_FREE, bGPdata::runtime, bGPdata_Runtime::sbuffer_fill_batch, bGPdata_Runtime::sbuffer_gps, and bGPdata_Runtime::sbuffer_stroke_batch.
Referenced by GPENCIL_draw_scene(), and GPENCIL_draw_scene_depth_only().
Definition at line 652 of file draw_cache_impl_gpencil.c.
References Object::data, gpencil_sbuffer_stroke_ensure(), bGPdata::runtime, and bGPdata_Runtime::sbuffer_fill_batch.
Referenced by gpencil_stroke_cache_populate().
| bGPDstroke* DRW_cache_gpencil_sbuffer_stroke_data_get | ( | Object * | ob | ) |
Definition at line 526 of file draw_cache_impl_gpencil.c.
References bGPDstroke::aspect_ratio, bGPDstroke::caps, copy_v2_v2(), copy_v4_v4(), Object::data, bGPDstroke::fill_opacity_fac, bGPDstroke::flag, GP_STROKE_CAP_ROUND, bGPDstroke::hardeness, if(), bGPDstroke::mat_nr, bGPdata_Runtime::matid, max_ii(), MEM_callocN, NULL, bGPDstroke::runtime, bGPdata::runtime, bGPdata_Runtime::sbuffer_brush, bGPdata_Runtime::sbuffer_gps, bGPdata_Runtime::sbuffer_sflag, bGPdata_Runtime::sbuffer_used, bGPDstroke_Runtime::stroke_start, bGPDstroke::thickness, bGPDstroke::tot_triangles, bGPDstroke::totpoints, bGPDstroke::vert_color_fill, and bGPdata_Runtime::vert_color_fill.
Referenced by GPENCIL_cache_init().
Definition at line 644 of file draw_cache_impl_gpencil.c.
References Object::data, gpencil_sbuffer_stroke_ensure(), bGPdata::runtime, and bGPdata_Runtime::sbuffer_stroke_batch.
Referenced by gpencil_stroke_cache_populate().
Definition at line 457 of file draw_cache_impl_gpencil.c.
References gpencil_batch_cache_get(), gpencil_batches_ensure(), and GpencilBatchCache::stroke_batch.
Referenced by gpencil_stroke_cache_populate().
| void DRW_gpencil_batch_cache_dirty_tag | ( | bGPdata * | gpd | ) |
Definition at line 154 of file draw_cache_impl_gpencil.c.
References bGPdata::flag, and GP_DATA_CACHE_IS_DIRTY.
Referenced by DRW_engines_register().
| void DRW_gpencil_batch_cache_free | ( | bGPdata * | gpd | ) |
Definition at line 159 of file draw_cache_impl_gpencil.c.
References bGPdata::flag, GP_DATA_CACHE_IS_DIRTY, gpencil_batch_cache_clear(), bGPdata_Runtime::gpencil_cache, MEM_SAFE_FREE, and bGPdata::runtime.
Referenced by DRW_engines_register().
|
static |
Definition at line 117 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::edit_curve_handles_batch, GpencilBatchCache::edit_curve_points_batch, GpencilBatchCache::edit_curve_vbo, GpencilBatchCache::edit_lines_batch, GpencilBatchCache::edit_points_batch, GpencilBatchCache::edit_vbo, GpencilBatchCache::fill_batch, GPU_BATCH_DISCARD_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_VERTBUF_DISCARD_SAFE, GpencilBatchCache::ibo, GpencilBatchCache::is_dirty, GpencilBatchCache::lines_batch, GpencilBatchCache::stroke_batch, GpencilBatchCache::vbo, and GpencilBatchCache::vbo_col.
Referenced by DRW_gpencil_batch_cache_free(), and gpencil_batch_cache_get().
|
static |
Definition at line 141 of file draw_cache_impl_gpencil.c.
References Object::data, gpencil_batch_cache_clear(), gpencil_batch_cache_init(), gpencil_batch_cache_valid(), bGPdata_Runtime::gpencil_cache, if(), and bGPdata::runtime.
Referenced by DRW_cache_gpencil_edit_curve_handles_get(), DRW_cache_gpencil_edit_curve_points_get(), DRW_cache_gpencil_edit_lines_get(), DRW_cache_gpencil_edit_points_get(), DRW_cache_gpencil_face_wireframe_get(), DRW_cache_gpencil_fills_get(), and DRW_cache_gpencil_strokes_get().
|
static |
Definition at line 98 of file draw_cache_impl_gpencil.c.
References Object::data, bGPdata_Runtime::gpencil_cache, if(), MEM_callocN, and bGPdata::runtime.
Referenced by gpencil_batch_cache_get().
|
static |
Definition at line 77 of file draw_cache_impl_gpencil.c.
References GpencilBatchCache::cache_frame, bGPdata::flag, GP_DATA_CACHE_IS_DIRTY, GpencilBatchCache::is_dirty, and NULL.
Referenced by gpencil_batch_cache_get().
|
static |
Definition at line 394 of file draw_cache_impl_gpencil.c.
References BKE_gpencil_visible_stroke_iter(), BLI_assert, gpIterData::cols, Object::data, GpencilBatchCache::fill_batch, bGPdata::flag, GP_DATA_CACHE_IS_DIRTY, gpIterData::gpd, gpencil_color_format(), gpencil_dummy_buffer_get(), gpencil_object_verts_count_cb(), gpencil_stroke_format(), gpencil_stroke_iter_cb(), GPU_batch_create, GPU_batch_instbuf_add_ex(), GPU_batch_vertbuf_add, GPU_indexbuf_build(), GPU_indexbuf_init(), GPU_PRIM_TRI_STRIP, GPU_PRIM_TRIS, GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertbuf_get_data(), GpencilBatchCache::ibo, gpIterData::ibo, if(), GpencilBatchCache::is_dirty, gpStrokeVert::mat, NULL, GpencilBatchCache::stroke_batch, gpIterData::tri_len, GpencilBatchCache::vbo, GpencilBatchCache::vbo_col, gpIterData::vert_len, and gpIterData::verts.
Referenced by DRW_cache_gpencil_edit_curve_handles_get(), DRW_cache_gpencil_edit_curve_points_get(), DRW_cache_gpencil_edit_lines_get(), DRW_cache_gpencil_edit_points_get(), DRW_cache_gpencil_face_wireframe_get(), DRW_cache_gpencil_fills_get(), and DRW_cache_gpencil_strokes_get().
|
static |
Definition at line 757 of file draw_cache_impl_gpencil.c.
References BEZIER_HANDLE, COLOR_SHIFT, SELECT, SET_FLAG_FROM_TEST, VFLAG_VERT_GPENCIL_BEZT_HANDLE, VFLAG_VERT_SELECTED, and VFLAG_VERT_SELECTED_BEZT_HANDLE.
Referenced by gpencil_edit_curve_stroke_iter_cb().
|
static |
Definition at line 358 of file draw_cache_impl_gpencil.c.
References GPU_indexbuf_add_tri_verts(), bGPDstroke::runtime, bGPDstroke_Runtime::stroke_start, bGPDstroke::tot_triangles, bGPDstroke::triangles, v, and bGPDtriangle::verts.
Referenced by gpencil_stroke_iter_cb().
|
static |
Definition at line 297 of file draw_cache_impl_gpencil.c.
References bGPDstroke::aspect_ratio, bGPDstroke::caps, col, copy_v2_v2(), copy_v3_v3(), copy_v4_v4(), e, bGPDstroke::fill_opacity_fac, GP_MATERIAL_BUFFER_LEN, GP_STROKE_CAP_ROUND, bGPDstroke::hardeness, gpStrokeVert::mat, bGPDstroke::mat_nr, max_ff(), pack_rotation_aspect_hardness(), gpStrokeVert::packed_asp_hard_rot, gpStrokeVert::point_id, gpStrokeVert::pos, bGPDspoint::pressure, bGPDstroke::runtime, gpStrokeVert::strength, bGPDspoint::strength, gpStrokeVert::stroke_id, bGPDstroke_Runtime::stroke_start, gpStrokeVert::thickness, bGPDstroke::thickness, gpStrokeVert::u_stroke, bGPDspoint::uv_fac, gpStrokeVert::uv_fill, bGPDspoint::uv_fill, bGPDspoint::uv_rot, v, bGPDspoint::vert_color, bGPDstroke::vert_color_fill, verts, and bGPDspoint::x.
Referenced by gpencil_buffer_add_stroke().
|
static |
Definition at line 333 of file draw_cache_impl_gpencil.c.
References gpencil_buffer_add_point(), gpencil_stroke_is_cyclic(), max_ii(), min_ii(), bGPDstroke::points, bGPDstroke::runtime, bGPDstroke_Runtime::stroke_start, bGPDstroke::totpoints, v, and verts.
Referenced by gpencil_sbuffer_stroke_ensure(), and gpencil_stroke_iter_cb().
|
static |
Definition at line 234 of file draw_cache_impl_gpencil.c.
References GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_vertformat_attr_add(), and GPU_vertformat_multiload_enable().
Referenced by gpencil_batches_ensure(), and gpencil_sbuffer_stroke_ensure().
|
static |
Definition at line 263 of file draw_cache_impl_gpencil.c.
References batch, DRW_gpencil_dummy_buffer_get(), and GPUBatch.
Referenced by gpencil_batches_ensure(), and gpencil_sbuffer_stroke_ensure().
|
static |
Definition at line 822 of file draw_cache_impl_gpencil.c.
References Object::actdef, BKE_gpencil_visible_stroke_iter(), BLI_assert, BLI_findlink(), gpIterData::curve_len, Object::data, Object::defbase, GpencilBatchCache::edit_curve_handles_batch, GpencilBatchCache::edit_curve_points_batch, GpencilBatchCache::edit_curve_vbo, GpencilBatchCache::edit_lines_batch, GpencilBatchCache::edit_points_batch, GpencilBatchCache::edit_vbo, bGPdata::flag, GP_DATA_CACHE_IS_DIRTY, gpIterData::gpd, gpencil_edit_curve_format(), gpencil_edit_curve_stroke_count_cb(), gpencil_edit_curve_stroke_iter_cb(), gpencil_edit_stroke_format(), gpencil_edit_stroke_iter_cb(), GPU_batch_create, GPU_batch_vertbuf_add, GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertbuf_get_data(), GPU_vertbuf_get_vertex_len(), if(), GpencilBatchCache::is_dirty, NULL, GpencilBatchCache::vbo, gpEditIterData::verts, gpEditCurveIterData::verts, and gpEditIterData::vgindex.
Referenced by DRW_cache_gpencil_edit_curve_handles_get(), DRW_cache_gpencil_edit_curve_points_get(), DRW_cache_gpencil_edit_lines_get(), and DRW_cache_gpencil_edit_points_get().
|
static |
Definition at line 217 of file draw_cache_impl_gpencil.c.
References GPU_COMP_F32, GPU_COMP_U32, GPU_FETCH_FLOAT, GPU_FETCH_INT, and GPU_vertformat_attr_add().
Referenced by gpencil_edit_batches_ensure().
|
static |
Definition at line 737 of file draw_cache_impl_gpencil.c.
References gpIterData::curve_len, bGPDstroke_Runtime::curve_start, bGPDstroke::editcurve, bGPDlayer::flag, GP_LAYER_LOCKED, NULL, bGPDstroke::runtime, and bGPDcurve::tot_curve_points.
Referenced by gpencil_edit_batches_ensure().
|
static |
Definition at line 773 of file draw_cache_impl_gpencil.c.
References bGPDcurve_point::bezt, BEZT_ISSEL_ANY, bGPDcurve::curve_points, bGPDstroke_Runtime::curve_start, gpEditCurveVert::data, bGPDstroke::editcurve, BezTriple::f1, BezTriple::f2, BezTriple::f3, bGPDcurve::flag, bGPDlayer::flag, GP_CURVE_SELECT, GP_LAYER_LOCKED, gpencil_beztriple_vflag_get(), BezTriple::h1, BezTriple::h2, bGPDlayer::layer_mat, mul_v3_m4v3(), NULL, gpEditCurveVert::pos, bGPDstroke::runtime, bGPDcurve::tot_curve_points, v, BezTriple::vec, and gpEditCurveIterData::verts.
Referenced by gpencil_edit_batches_ensure().
|
static |
Definition at line 201 of file draw_cache_impl_gpencil.c.
References GPU_COMP_F32, GPU_COMP_U32, GPU_FETCH_FLOAT, GPU_FETCH_INT, and GPU_vertformat_attr_add().
Referenced by gpencil_edit_batches_ensure().
|
static |
Definition at line 710 of file draw_cache_impl_gpencil.c.
References bGPDstroke::dvert, bGPDstroke::flag, bGPDlayer::flag, GP_EDIT_MULTIFRAME, GP_EDIT_STROKE_SELECTED, GP_LAYER_LOCKED, GP_STROKE_SELECT, gpencil_point_edit_flag(), gpencil_point_edit_weight(), NULL, bGPDframe_Runtime::onion_id, bGPDstroke::points, bGPDstroke::runtime, bGPDframe::runtime, SET_FLAG_FROM_TEST, bGPDstroke_Runtime::stroke_start, bGPDstroke::totpoints, v, gpEditIterData::verts, gpEditVert::vflag, gpEditIterData::vgindex, and gpEditVert::weight.
Referenced by gpencil_edit_batches_ensure().
|
static |
Definition at line 473 of file draw_cache_impl_gpencil.c.
References gpencil_stroke_is_cyclic(), GPU_indexbuf_add_generic_vert(), GPU_indexbuf_add_primitive_restart(), gpIterData::ibo, bGPDstroke::runtime, bGPDstroke_Runtime::stroke_start, and bGPDstroke::totpoints.
Referenced by DRW_cache_gpencil_face_wireframe_get().
|
static |
Definition at line 380 of file draw_cache_impl_gpencil.c.
References bGPDstroke_Runtime::fill_start, gpencil_stroke_is_cyclic(), bGPDstroke::runtime, bGPDstroke_Runtime::stroke_start, bGPDstroke::tot_triangles, bGPDstroke::totpoints, gpIterData::tri_len, and gpIterData::vert_len.
Referenced by gpencil_batches_ensure().
|
static |
Definition at line 692 of file draw_cache_impl_gpencil.c.
References bGPDspoint::flag, GP_EDIT_POINT_DIMMED, GP_EDIT_POINT_SELECTED, GP_EDIT_STROKE_END, GP_EDIT_STROKE_START, GP_SPOINT_SELECT, NULL, bGPDspoint_Runtime::pt_orig, bGPDspoint::runtime, SET_FLAG_FROM_TEST, and v.
Referenced by gpencil_edit_stroke_iter_cb().
|
static |
Definition at line 705 of file draw_cache_impl_gpencil.c.
References BKE_defvert_find_weight(), and v.
Referenced by gpencil_edit_stroke_iter_cb().
|
static |
Definition at line 552 of file draw_cache_impl_gpencil.c.
References batch, BKE_gpencil_stroke_uv_update(), BLI_assert, BLI_polyfill_calc(), copy_v2_v2(), copy_v4_v4(), GPUIndexBufBuilder::data, DRW_context_state_get(), ED_gpencil_drawing_reference_get(), ED_gpencil_tpoint_to_point(), float(), gpencil_buffer_add_stroke(), gpencil_color_format(), gpencil_dummy_buffer_get(), gpencil_stroke_format(), ToolSettings::gpencil_v3d_align, GPU_batch_create, GPU_batch_create_ex(), GPU_batch_instbuf_add_ex(), GPU_BATCH_OWNS_INDEX, GPU_batch_vertbuf_add, GPU_indexbuf_build(), GPU_indexbuf_init(), GPU_PRIM_TRI_STRIP, GPU_PRIM_TRIS, GPU_vertbuf_create_with_format, GPU_vertbuf_data_alloc(), GPU_vertbuf_get_data(), GPUBatch, Object::imat, GPUIndexBufBuilder::index_len, MEM_freeN, MEM_mallocN, mul_m4_v3(), NULL, OB_GPENCIL, DRWContextState::obact, bGPDstroke::points, DRWContextState::region, bGPDstroke::runtime, bGPdata::runtime, bGPdata_Runtime::sbuffer, bGPdata_Runtime::sbuffer_fill_batch, bGPdata_Runtime::sbuffer_gps, bGPdata_Runtime::sbuffer_stroke_batch, bGPdata_Runtime::sbuffer_used, scene, DRWContextState::scene, bGPDstroke_Runtime::stroke_start, Scene::toolsettings, bGPDstroke::tot_triangles, Object::type, tGPspoint::vert_color, bGPDspoint::vert_color, verts, x, and bGPDspoint::x.
Referenced by DRW_cache_gpencil_sbuffer_fill_get(), and DRW_cache_gpencil_sbuffer_stroke_get().
|
static |
Definition at line 181 of file draw_cache_impl_gpencil.c.
References GPU_COMP_F32, GPU_COMP_I32, GPU_FETCH_FLOAT, GPU_FETCH_INT, GPU_vertformat_attr_add(), and GPU_vertformat_multiload_enable().
Referenced by gpencil_batches_ensure(), and gpencil_sbuffer_stroke_ensure().
|
static |
Definition at line 269 of file draw_cache_impl_gpencil.c.
References bGPDstroke::flag, GP_STROKE_CYCLIC, and bGPDstroke::totpoints.
Referenced by gpencil_buffer_add_stroke(), gpencil_lines_indices_cb(), and gpencil_object_verts_count_cb().
|
static |
Definition at line 368 of file draw_cache_impl_gpencil.c.
References gpIterData::cols, gpencil_buffer_add_fill(), gpencil_buffer_add_stroke(), gpIterData::ibo, bGPDstroke::tot_triangles, and gpIterData::verts.
Referenced by gpencil_batches_ensure().
| BLI_INLINE int32_t pack_rotation_aspect_hardness | ( | float | rot, |
| float | asp, | ||
| float | hard | ||
| ) |
Definition at line 274 of file draw_cache_impl_gpencil.c.
References cosf, rot, and unit_float_to_uchar_clamp().
Referenced by gpencil_buffer_add_point().