Blender  V3.3
draw_cache_impl_mesh.cc File Reference

Mesh API for render engines. More...

#include <optional>
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_buffer.h"
#include "BLI_edgehash.h"
#include "BLI_index_range.hh"
#include "BLI_listbase.h"
#include "BLI_map.hh"
#include "BLI_math_bits.h"
#include "BLI_math_vector.h"
#include "BLI_span.hh"
#include "BLI_string.h"
#include "BLI_string_ref.hh"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_attribute.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_cache.h"
#include "BKE_editmesh_tangent.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_mesh_tangent.h"
#include "BKE_modifier.h"
#include "BKE_object_deform.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_subdiv_modifier.h"
#include "atomic_ops.h"
#include "bmesh.h"
#include "GPU_batch.h"
#include "GPU_material.h"
#include "DRW_render.h"
#include "ED_mesh.h"
#include "ED_uvedit.h"
#include "draw_cache_extract.hh"
#include "draw_cache_inline.h"
#include "draw_subdivision.h"
#include "draw_cache_impl.h"
#include "mesh_extractors/extract_mesh.hh"

Go to the source code of this file.

Functions

Vertex Group Selection
static void drw_mesh_weight_state_clear (struct DRW_MeshWeightState *wstate)
 
static void drw_mesh_weight_state_copy (struct DRW_MeshWeightState *wstate_dst, const struct DRW_MeshWeightState *wstate_src)
 
static bool drw_mesh_flags_equal (const bool *array1, const bool *array2, int size)
 
static bool drw_mesh_weight_state_compare (const struct DRW_MeshWeightState *a, const struct DRW_MeshWeightState *b)
 
static void drw_mesh_weight_state_extract (Object *ob, Mesh *me, const ToolSettings *ts, bool paint_mode, struct DRW_MeshWeightState *wstate)
 
Mesh GPUBatch Cache
BLI_INLINE void mesh_batch_cache_add_request (MeshBatchCache *cache, DRWBatchFlag new_flag)
 
static bool mesh_batch_cache_valid (Object *object, Mesh *me)
 
static void mesh_batch_cache_init (Object *object, Mesh *me)
 
void DRW_mesh_batch_cache_validate (Object *object, Mesh *me)
 
static MeshBatchCache * mesh_batch_cache_get (Mesh *me)
 
static void mesh_batch_cache_check_vertex_group (MeshBatchCache *cache, const struct DRW_MeshWeightState *wstate)
 
static void mesh_batch_cache_request_surface_batches (MeshBatchCache *cache)
 
static void mesh_batch_cache_discard_shaded_tri (MeshBatchCache *cache)
 
static void mesh_batch_cache_discard_uvedit (MeshBatchCache *cache)
 
static void mesh_batch_cache_discard_uvedit_select (MeshBatchCache *cache)
 
void DRW_mesh_batch_cache_dirty_tag (Mesh *me, eMeshBatchDirtyMode mode)
 
static void mesh_buffer_list_clear (MeshBufferList *mbuflist)
 
static void mesh_buffer_cache_clear (MeshBufferCache *mbc)
 
static void mesh_batch_cache_free_subdiv_cache (MeshBatchCache *cache)
 
void DRW_mesh_batch_cache_free (Mesh *me)
 
Public API
static void texpaint_request_active_uv (MeshBatchCache *cache, Object *object, Mesh *me)
 
static void request_active_and_default_color_attributes (const Object &object, const Mesh &mesh, DRW_Attributes &attributes)
 
GPUBatch * DRW_mesh_batch_cache_get_all_verts (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_all_edges (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_loose_edges (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface_weights (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edge_detection (Mesh *me, bool *r_is_manifold)
 
GPUBatch * DRW_mesh_batch_cache_get_wireframes_face (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_mesh_analysis (Mesh *me)
 
GPUBatch ** DRW_mesh_batch_cache_get_surface_shaded (Object *object, Mesh *me, struct GPUMaterial **gpumat_array, uint gpumat_array_len)
 
GPUBatch ** DRW_mesh_batch_cache_get_surface_texpaint (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface_texpaint_single (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface_vertpaint (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface_sculpt (Object *object, Mesh *me)
 
int DRW_mesh_material_count_get (const Object *object, const Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_sculpt_overlays (Mesh *me)
 
Edit Mode API
GPUVertBuf * DRW_mesh_batch_cache_pos_vertbuf_get (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_triangles (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_edges (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_vertices (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_vnors (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_lnors (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_facedots (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edit_skin_roots (Mesh *me)
 
Edit Mode selection API
GPUBatch * DRW_mesh_batch_cache_get_triangles_with_select_id (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_facedots_with_select_id (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edges_with_select_id (Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_verts_with_select_id (Mesh *me)
 
UV Image editor API
static void edituv_request_active_uv (MeshBatchCache *cache, Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_area (Object *object, Mesh *me, float **tot_area, float **tot_uv_area)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_faces_stretch_angle (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_faces (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_edges (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_verts (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_edituv_facedots (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_uv_edges (Object *object, Mesh *me)
 
GPUBatch * DRW_mesh_batch_cache_get_surface_edges (Object *object, Mesh *me)
 
Grouped batch generation
void DRW_mesh_batch_cache_free_old (Mesh *me, int ctime)
 
static void drw_add_attributes_vbo (GPUBatch *batch, MeshBufferList *mbuflist, DRW_Attributes *attr_used)
 
void DRW_mesh_batch_cache_create_requested (struct TaskGraph *task_graph, Object *ob, Mesh *me, const Scene *scene, const bool is_paint_mode, const bool use_hide)
 

Dependencies between buffer and batch

#define BUFFER_INDEX(buff_name)   ((offsetof(MeshBufferList, buff_name) - offsetof(MeshBufferList, vbo)) / sizeof(void *))
 
#define BUFFER_LEN   (sizeof(MeshBufferList) / sizeof(void *))
 
#define _BATCH_MAP1(a)   batches_that_use_buffer(BUFFER_INDEX(a))
 
#define _BATCH_MAP2(a, b)   _BATCH_MAP1(a) | _BATCH_MAP1(b)
 
#define _BATCH_MAP3(a, b, c)   _BATCH_MAP2(a, b) | _BATCH_MAP1(c)
 
#define _BATCH_MAP4(a, b, c, d)   _BATCH_MAP3(a, b, c) | _BATCH_MAP1(d)
 
#define _BATCH_MAP5(a, b, c, d, e)   _BATCH_MAP4(a, b, c, d) | _BATCH_MAP1(e)
 
#define _BATCH_MAP6(a, b, c, d, e, f)   _BATCH_MAP5(a, b, c, d, e) | _BATCH_MAP1(f)
 
#define _BATCH_MAP7(a, b, c, d, e, f, g)   _BATCH_MAP6(a, b, c, d, e, f) | _BATCH_MAP1(g)
 
#define _BATCH_MAP8(a, b, c, d, e, f, g, h)   _BATCH_MAP7(a, b, c, d, e, f, g) | _BATCH_MAP1(h)
 
#define _BATCH_MAP9(a, b, c, d, e, f, g, h, i)   _BATCH_MAP8(a, b, c, d, e, f, g, h) | _BATCH_MAP1(i)
 
#define _BATCH_MAP10(a, b, c, d, e, f, g, h, i, j)   _BATCH_MAP9(a, b, c, d, e, f, g, h, i) | _BATCH_MAP1(j)
 
#define BATCH_MAP(...)   VA_NARGS_CALL_OVERLOAD(_BATCH_MAP, __VA_ARGS__)
 
#define TRIS_PER_MAT_INDEX   BUFFER_LEN
 
static constexpr DRWBatchFlag batches_that_use_buffer (const int buffer_index)
 
static void mesh_batch_cache_discard_surface_batches (MeshBatchCache *cache)
 
static void mesh_batch_cache_clear (Mesh *me)
 
static void mesh_batch_cache_discard_batch (MeshBatchCache *cache, const DRWBatchFlag batch_map)
 
BLI_INLINE bool mesh_cd_layers_type_overlap (DRW_MeshCDMask a, DRW_MeshCDMask b)
 
BLI_INLINE bool mesh_cd_layers_type_equal (DRW_MeshCDMask a, DRW_MeshCDMask b)
 
BLI_INLINE void mesh_cd_layers_type_merge (DRW_MeshCDMask *a, DRW_MeshCDMask b)
 
BLI_INLINE void mesh_cd_layers_type_clear (DRW_MeshCDMask *a)
 
static void mesh_cd_calc_edit_uv_layer (const Mesh *UNUSED(me), DRW_MeshCDMask *cd_used)
 
static void mesh_cd_calc_active_uv_layer (const Object *object, const Mesh *me, DRW_MeshCDMask *cd_used)
 
static void mesh_cd_calc_active_mask_uv_layer (const Object *object, const Mesh *me, DRW_MeshCDMask *cd_used)
 
static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers (const Object *object, const Mesh *me, struct GPUMaterial **gpumat_array, int gpumat_array_len, DRW_Attributes *attributes)
 

Detailed Description

Mesh API for render engines.

Definition in file draw_cache_impl_mesh.cc.

Macro Definition Documentation

◆ _BATCH_MAP1

#define _BATCH_MAP1 (   a)    batches_that_use_buffer(BUFFER_INDEX(a))

Definition at line 82 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP10

#define _BATCH_MAP10 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i,
  j 
)    _BATCH_MAP9(a, b, c, d, e, f, g, h, i) | _BATCH_MAP1(j)

Definition at line 91 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP2

#define _BATCH_MAP2 (   a,
  b 
)    _BATCH_MAP1(a) | _BATCH_MAP1(b)

Definition at line 83 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP3

#define _BATCH_MAP3 (   a,
  b,
  c 
)    _BATCH_MAP2(a, b) | _BATCH_MAP1(c)

Definition at line 84 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP4

#define _BATCH_MAP4 (   a,
  b,
  c,
  d 
)    _BATCH_MAP3(a, b, c) | _BATCH_MAP1(d)

Definition at line 85 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP5

#define _BATCH_MAP5 (   a,
  b,
  c,
  d,
  e 
)    _BATCH_MAP4(a, b, c, d) | _BATCH_MAP1(e)

Definition at line 86 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP6

#define _BATCH_MAP6 (   a,
  b,
  c,
  d,
  e,
  f 
)    _BATCH_MAP5(a, b, c, d, e) | _BATCH_MAP1(f)

Definition at line 87 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP7

#define _BATCH_MAP7 (   a,
  b,
  c,
  d,
  e,
  f,
  g 
)    _BATCH_MAP6(a, b, c, d, e, f) | _BATCH_MAP1(g)

Definition at line 88 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP8

#define _BATCH_MAP8 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h 
)    _BATCH_MAP7(a, b, c, d, e, f, g) | _BATCH_MAP1(h)

Definition at line 89 of file draw_cache_impl_mesh.cc.

◆ _BATCH_MAP9

#define _BATCH_MAP9 (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  i 
)    _BATCH_MAP8(a, b, c, d, e, f, g, h) | _BATCH_MAP1(i)

Definition at line 90 of file draw_cache_impl_mesh.cc.

◆ BATCH_MAP

#define BATCH_MAP (   ...)    VA_NARGS_CALL_OVERLOAD(_BATCH_MAP, __VA_ARGS__)

Definition at line 93 of file draw_cache_impl_mesh.cc.

◆ BUFFER_INDEX

#define BUFFER_INDEX (   buff_name)    ((offsetof(MeshBufferList, buff_name) - offsetof(MeshBufferList, vbo)) / sizeof(void *))

Definition at line 79 of file draw_cache_impl_mesh.cc.

◆ BUFFER_LEN

#define BUFFER_LEN   (sizeof(MeshBufferList) / sizeof(void *))

Definition at line 80 of file draw_cache_impl_mesh.cc.

◆ TRIS_PER_MAT_INDEX

#define TRIS_PER_MAT_INDEX   BUFFER_LEN

Definition at line 97 of file draw_cache_impl_mesh.cc.

Function Documentation

◆ batches_that_use_buffer()

static constexpr DRWBatchFlag batches_that_use_buffer ( const int  buffer_index)
staticconstexpr

◆ drw_add_attributes_vbo()

static void drw_add_attributes_vbo ( GPUBatch *  batch,
MeshBufferList *  mbuflist,
DRW_Attributes *  attr_used 
)
static

◆ DRW_mesh_batch_cache_create_requested()

void DRW_mesh_batch_cache_create_requested ( struct TaskGraph *  task_graph,
Object *  ob,
Mesh *  me,
const Scene *  scene,
const bool  is_paint_mode,
const bool  use_hide 
)

TODO: The code and data structure is ready to support modified UV display but the selection code for UVs needs to support it first. So for now, only display the cage in all cases.

Definition at line 1331 of file draw_cache_impl_mesh.cc.

References blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::add_or_modify(), MeshBatchList::all_edges, MeshBatchList::all_verts, MeshBatchCache::attr_needed, MeshBatchCache::attr_used, MeshBatchCache::attr_used_over_time, MeshBatchCache::batch, MeshBatchCache::batch_ready, MeshBatchCache::batch_requested, batches_that_use_buffer(), BKE_object_get_editmesh_eval_cage(), BKE_object_get_editmesh_eval_final(), BKE_pbvh_update_normals(), BKE_subsurf_modifier_has_gpu_subdiv(), BLI_assert, BLI_task_graph_work_and_wait(), MeshBufferCache::buff, BUFFER_INDEX, MeshBatchCache::cage, MeshBatchCache::cd_needed, CD_ORCO, MeshBatchCache::cd_used, MeshBatchCache::cd_used_over_time, CustomData_get_layer(), Object::data, drw_add_attributes_vbo(), drw_attributes_clear(), drw_attributes_merge(), drw_attributes_overlap(), DRW_batch_requested(), DRW_create_subdivision(), DRW_ibo_request(), drw_mesh_weight_state_clear(), drw_mesh_weight_state_copy(), drw_mesh_weight_state_extract(), DRW_object_is_in_edit_mode(), DRW_vbo_request(), MeshBatchList::edge_detection, MeshBufferList::edge_fac, MeshBufferList::edge_idx, MeshBufferList::edit_data, MeshBatchList::edit_edges, MeshBatchList::edit_fdots, MeshBatchList::edit_lnor, Mesh::edit_mesh, MeshBatchList::edit_mesh_analysis, MeshBatchList::edit_selection_edges, MeshBatchList::edit_selection_faces, MeshBatchList::edit_selection_fdots, MeshBatchList::edit_selection_verts, MeshBatchList::edit_skin_roots, MeshBatchList::edit_triangles, MeshBatchList::edit_vertices, MeshBatchList::edit_vnor, MeshBufferList::edituv_data, MeshBatchList::edituv_edges, MeshBatchList::edituv_faces, MeshBatchList::edituv_faces_stretch_angle, MeshBatchList::edituv_faces_stretch_area, MeshBufferList::edituv_fdots, MeshBatchList::edituv_fdots, MeshBufferList::edituv_lines, MeshBufferList::edituv_points, MeshBufferList::edituv_stretch_angle, MeshBufferList::edituv_stretch_area, MeshBufferList::edituv_tris, MeshBatchList::edituv_verts, MeshBufferList::fdot_idx, MeshBufferList::fdots, MeshBufferList::fdots_edituv_data, MeshBufferList::fdots_nor, MeshBufferList::fdots_pos, MeshBufferList::fdots_uv, MeshBatchCache::final, FOREACH_MESH_BUFFER_CACHE, GPU_BATCH_CLEAR_SAFE, GPU_INDEXBUF_DISCARD_SAFE, GPU_MAX_ATTR, GPU_PRIM_LINES, GPU_PRIM_LINES_ADJ, GPU_PRIM_POINTS, GPU_PRIM_TRIS, GPU_VERTBUF_DISCARD_SAFE, MeshBufferList::ibo, Mesh_Runtime::is_original, MeshBatchCache::is_uvsyncsel, MeshBufferList::lines, MeshBufferList::lines_adjacency, MeshBufferList::lines_loose, MeshBufferList::lines_paint_mask, MeshBufferList::lnor, blender::Map< Key, Value, InlineBufferCapacity, ProbingStrategy, Hash, IsEqual, Slot, Allocator >::lookup(), MeshBatchList::loose_edges, MeshBatchCache::mat_len, MBC_ALL_EDGES, MBC_ALL_VERTS, MBC_EDGE_DETECTION, MBC_EDIT_EDGES, MBC_EDIT_FACEDOTS, MBC_EDIT_LNOR, MBC_EDIT_MESH_ANALYSIS, MBC_EDIT_SELECTION_EDGES, MBC_EDIT_SELECTION_FACEDOTS, MBC_EDIT_SELECTION_FACES, MBC_EDIT_SELECTION_VERTS, MBC_EDIT_TRIANGLES, MBC_EDIT_VERTICES, MBC_EDIT_VNOR, MBC_EDITUV, MBC_EDITUV_EDGES, MBC_EDITUV_FACEDOTS, MBC_EDITUV_FACES, MBC_EDITUV_FACES_STRETCH_ANGLE, MBC_EDITUV_FACES_STRETCH_AREA, MBC_EDITUV_VERTS, MBC_LOOSE_EDGES, MBC_SCULPT_OVERLAYS, MBC_SKIN_ROOTS, MBC_SURFACE, MBC_SURFACE_PER_MAT, MBC_SURFACE_WEIGHTS, MBC_WIRE_EDGES, MBC_WIRE_LOOPS, MBC_WIRE_LOOPS_UVS, ME_WRAPPER_TYPE_BMESH, mesh, MeshBufferList::mesh_analysis, mesh_batch_cache_check_vertex_group(), mesh_batch_cache_free_subdiv_cache(), mesh_batch_cache_get(), blender::draw::mesh_buffer_cache_create_requested(), mesh_cd_layers_type_clear(), mesh_cd_layers_type_merge(), mesh_cd_layers_type_overlap(), Object::mode, OB_MESH, OB_MODE_EDIT, Object::obmat, DRW_MeshCDMask::orco, MeshBufferList::orco, SculptSession::pbvh, MeshBufferList::points, MeshBufferList::poly_idx, MeshBufferList::pos_nor, Mesh_Runtime::render_mutex, Mesh::runtime, scene, Object::sculpt, MeshBufferList::sculpt_data, DRW_MeshCDMask::sculpt_overlays, MeshBatchList::sculpt_overlays, MeshBufferList::skin_roots, Mesh_Runtime::subdiv_ccg, MeshBatchList::surface, MeshBatchCache::surface_per_mat, MeshBatchList::surface_weights, DRW_MeshCDMask::tan, MeshBufferList::tan, DRW_MeshCDMask::tan_orco, Scene::toolsettings, MeshBufferList::tris, MeshBatchCache::tris_per_mat, TRIS_PER_MAT_INDEX, Object::type, UNUSED, DRW_MeshCDMask::uv, MeshBufferList::uv, MeshBatchCache::uv_cage, ToolSettings::uv_flag, UV_SYNC_SELECTION, MeshBufferList::vbo, Mesh::vdata, MeshBufferList::vert_idx, MeshBatchCache::weight_state, MeshBufferList::weights, MeshBatchList::wire_edges, MeshBatchList::wire_loops, MeshBatchList::wire_loops_uvs, and Mesh_Runtime::wrapper_type.

◆ DRW_mesh_batch_cache_dirty_tag()

void DRW_mesh_batch_cache_dirty_tag ( Mesh *  me,
eMeshBatchDirtyMode  mode 
)

◆ DRW_mesh_batch_cache_free()

void DRW_mesh_batch_cache_free ( Mesh *  me)

◆ DRW_mesh_batch_cache_free_old()

void DRW_mesh_batch_cache_free_old ( struct Mesh *  me,
int  ctime 
)

Thread safety need to be assured by caller. Don't call this during drawing.

Note
For now this only free the shading batches / VBO if any cd layers is not needed anymore.

Definition at line 1264 of file draw_cache_impl_mesh.cc.

References MeshBatchCache::attr_used, MeshBatchCache::attr_used_over_time, Mesh_Runtime::batch_cache, MeshBatchCache::cd_used, MeshBatchCache::cd_used_over_time, drw_attributes_clear(), drw_attributes_overlap(), MeshBatchCache::lastmatch, mesh_batch_cache_discard_shaded_tri(), mesh_cd_layers_type_clear(), mesh_cd_layers_type_equal(), and Mesh::runtime.

Referenced by DRW_batch_cache_free_old().

◆ DRW_mesh_batch_cache_get_all_edges()

GPUBatch* DRW_mesh_batch_cache_get_all_edges ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_all_verts()

GPUBatch* DRW_mesh_batch_cache_get_all_verts ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edge_detection()

GPUBatch* DRW_mesh_batch_cache_get_edge_detection ( Mesh *  me,
bool *  r_is_manifold 
)

◆ DRW_mesh_batch_cache_get_edges_with_select_id()

GPUBatch* DRW_mesh_batch_cache_get_edges_with_select_id ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_edges()

GPUBatch* DRW_mesh_batch_cache_get_edit_edges ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_facedots()

GPUBatch* DRW_mesh_batch_cache_get_edit_facedots ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_lnors()

GPUBatch* DRW_mesh_batch_cache_get_edit_lnors ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_mesh_analysis()

GPUBatch* DRW_mesh_batch_cache_get_edit_mesh_analysis ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_skin_roots()

GPUBatch* DRW_mesh_batch_cache_get_edit_skin_roots ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_triangles()

GPUBatch* DRW_mesh_batch_cache_get_edit_triangles ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_vertices()

GPUBatch* DRW_mesh_batch_cache_get_edit_vertices ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edit_vnors()

GPUBatch* DRW_mesh_batch_cache_get_edit_vnors ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_edituv_edges()

GPUBatch* DRW_mesh_batch_cache_get_edituv_edges ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_edituv_facedots()

GPUBatch* DRW_mesh_batch_cache_get_edituv_facedots ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_edituv_faces()

GPUBatch* DRW_mesh_batch_cache_get_edituv_faces ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_edituv_faces_stretch_angle()

GPUBatch* DRW_mesh_batch_cache_get_edituv_faces_stretch_angle ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_edituv_faces_stretch_area()

GPUBatch* DRW_mesh_batch_cache_get_edituv_faces_stretch_area ( struct Object *  object,
struct Mesh *  me,
float **  tot_area,
float **  tot_uv_area 
)

Creates the GPUBatch for drawing the UV Stretching Area Overlay. Optional retrieves the total area or total uv area of the mesh.

The cache->tot_area and cache->tot_uv_areaupdate are calculation are only valid after callingDRW_mesh_batch_cache_create_requested`.

Definition at line 1184 of file draw_cache_impl_mesh.cc.

References MeshBatchCache::batch, DRW_batch_request(), MeshBatchList::edituv_faces_stretch_area, edituv_request_active_uv(), MBC_EDITUV_FACES_STRETCH_AREA, mesh_batch_cache_add_request(), mesh_batch_cache_get(), MeshBatchCache::tot_area, and MeshBatchCache::tot_uv_area.

Referenced by overlay_edit_uv_cache_populate().

◆ DRW_mesh_batch_cache_get_edituv_verts()

GPUBatch* DRW_mesh_batch_cache_get_edituv_verts ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_facedots_with_select_id()

GPUBatch* DRW_mesh_batch_cache_get_facedots_with_select_id ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_loose_edges()

GPUBatch* DRW_mesh_batch_cache_get_loose_edges ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_sculpt_overlays()

GPUBatch* DRW_mesh_batch_cache_get_sculpt_overlays ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_surface()

GPUBatch* DRW_mesh_batch_cache_get_surface ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_surface_edges()

GPUBatch* DRW_mesh_batch_cache_get_surface_edges ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_surface_sculpt()

GPUBatch* DRW_mesh_batch_cache_get_surface_sculpt ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_surface_shaded()

GPUBatch** DRW_mesh_batch_cache_get_surface_shaded ( Object *  object,
Mesh *  me,
struct GPUMaterial **  gpumat_array,
uint  gpumat_array_len 
)

◆ DRW_mesh_batch_cache_get_surface_texpaint()

GPUBatch** DRW_mesh_batch_cache_get_surface_texpaint ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_surface_texpaint_single()

GPUBatch* DRW_mesh_batch_cache_get_surface_texpaint_single ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_surface_vertpaint()

GPUBatch* DRW_mesh_batch_cache_get_surface_vertpaint ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_surface_weights()

GPUBatch* DRW_mesh_batch_cache_get_surface_weights ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_triangles_with_select_id()

GPUBatch* DRW_mesh_batch_cache_get_triangles_with_select_id ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_uv_edges()

GPUBatch* DRW_mesh_batch_cache_get_uv_edges ( Object *  object,
Mesh *  me 
)

◆ DRW_mesh_batch_cache_get_verts_with_select_id()

GPUBatch* DRW_mesh_batch_cache_get_verts_with_select_id ( Mesh *  me)

◆ DRW_mesh_batch_cache_get_wireframes_face()

GPUBatch* DRW_mesh_batch_cache_get_wireframes_face ( Mesh *  me)

◆ DRW_mesh_batch_cache_pos_vertbuf_get()

GPUVertBuf* DRW_mesh_batch_cache_pos_vertbuf_get ( Mesh *  me)

◆ DRW_mesh_batch_cache_validate()

void DRW_mesh_batch_cache_validate ( Object *  object,
Mesh *  me 
)

◆ drw_mesh_flags_equal()

static bool drw_mesh_flags_equal ( const bool *  array1,
const bool *  array2,
int  size 
)
static

Definition at line 451 of file draw_cache_impl_mesh.cc.

References size().

Referenced by drw_mesh_weight_state_compare().

◆ DRW_mesh_material_count_get()

int DRW_mesh_material_count_get ( const Object *  object,
const Mesh *  me 
)

Definition at line 1043 of file draw_cache_impl_mesh.cc.

References mesh_render_mat_len_get().

◆ drw_mesh_weight_state_clear()

static void drw_mesh_weight_state_clear ( struct DRW_MeshWeightState *  wstate)
static

◆ drw_mesh_weight_state_compare()

static bool drw_mesh_weight_state_compare ( const struct DRW_MeshWeightState *  a,
const struct DRW_MeshWeightState *  b 
)
static

Compare two selection structures.

Definition at line 458 of file draw_cache_impl_mesh.cc.

References Freestyle::a, usdtokens::b(), and drw_mesh_flags_equal().

Referenced by mesh_batch_cache_check_vertex_group().

◆ drw_mesh_weight_state_copy()

static void drw_mesh_weight_state_copy ( struct DRW_MeshWeightState *  wstate_dst,
const struct DRW_MeshWeightState *  wstate_src 
)
static

Copy selection data from one structure to another, including heap memory.

Definition at line 430 of file draw_cache_impl_mesh.cc.

References DRW_MeshWeightState::defgroup_locked, DRW_MeshWeightState::defgroup_sel, DRW_MeshWeightState::defgroup_unlocked, MEM_dupallocN, and MEM_SAFE_FREE.

Referenced by DRW_mesh_batch_cache_create_requested().

◆ drw_mesh_weight_state_extract()

static void drw_mesh_weight_state_extract ( Object *  ob,
Mesh *  me,
const ToolSettings *  ts,
bool  paint_mode,
struct DRW_MeshWeightState *  wstate 
)
static

◆ edituv_request_active_uv()

static void edituv_request_active_uv ( MeshBatchCache *  cache,
Object *  object,
Mesh *  me 
)
static

◆ mesh_batch_cache_add_request()

BLI_INLINE void mesh_batch_cache_add_request ( MeshBatchCache *  cache,
DRWBatchFlag  new_flag 
)

◆ mesh_batch_cache_check_vertex_group()

static void mesh_batch_cache_check_vertex_group ( MeshBatchCache *  cache,
const struct DRW_MeshWeightState *  wstate 
)
static

◆ mesh_batch_cache_clear()

static void mesh_batch_cache_clear ( Mesh *  me)
static

◆ mesh_batch_cache_discard_batch()

static void mesh_batch_cache_discard_batch ( MeshBatchCache *  cache,
const DRWBatchFlag  batch_map 
)
static

◆ mesh_batch_cache_discard_shaded_tri()

static void mesh_batch_cache_discard_shaded_tri ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_discard_surface_batches()

static void mesh_batch_cache_discard_surface_batches ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_discard_uvedit()

static void mesh_batch_cache_discard_uvedit ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_discard_uvedit_select()

static void mesh_batch_cache_discard_uvedit_select ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_free_subdiv_cache()

static void mesh_batch_cache_free_subdiv_cache ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_get()

static MeshBatchCache* mesh_batch_cache_get ( Mesh *  me)
static

Definition at line 629 of file draw_cache_impl_mesh.cc.

References Mesh_Runtime::batch_cache, and Mesh::runtime.

Referenced by DRW_mesh_batch_cache_create_requested(), DRW_mesh_batch_cache_get_all_edges(), DRW_mesh_batch_cache_get_all_verts(), DRW_mesh_batch_cache_get_edge_detection(), DRW_mesh_batch_cache_get_edges_with_select_id(), DRW_mesh_batch_cache_get_edit_edges(), DRW_mesh_batch_cache_get_edit_facedots(), DRW_mesh_batch_cache_get_edit_lnors(), DRW_mesh_batch_cache_get_edit_mesh_analysis(), DRW_mesh_batch_cache_get_edit_skin_roots(), DRW_mesh_batch_cache_get_edit_triangles(), DRW_mesh_batch_cache_get_edit_vertices(), DRW_mesh_batch_cache_get_edit_vnors(), DRW_mesh_batch_cache_get_edituv_edges(), DRW_mesh_batch_cache_get_edituv_facedots(), DRW_mesh_batch_cache_get_edituv_faces(), DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(), DRW_mesh_batch_cache_get_edituv_faces_stretch_area(), DRW_mesh_batch_cache_get_edituv_verts(), DRW_mesh_batch_cache_get_facedots_with_select_id(), DRW_mesh_batch_cache_get_loose_edges(), DRW_mesh_batch_cache_get_sculpt_overlays(), DRW_mesh_batch_cache_get_surface(), DRW_mesh_batch_cache_get_surface_edges(), DRW_mesh_batch_cache_get_surface_sculpt(), DRW_mesh_batch_cache_get_surface_shaded(), DRW_mesh_batch_cache_get_surface_texpaint(), DRW_mesh_batch_cache_get_surface_texpaint_single(), DRW_mesh_batch_cache_get_surface_vertpaint(), DRW_mesh_batch_cache_get_surface_weights(), DRW_mesh_batch_cache_get_triangles_with_select_id(), DRW_mesh_batch_cache_get_uv_edges(), DRW_mesh_batch_cache_get_verts_with_select_id(), DRW_mesh_batch_cache_get_wireframes_face(), and DRW_mesh_batch_cache_pos_vertbuf_get().

◆ mesh_batch_cache_init()

static void mesh_batch_cache_init ( Object *  object,
Mesh *  me 
)
static

◆ mesh_batch_cache_request_surface_batches()

static void mesh_batch_cache_request_surface_batches ( MeshBatchCache *  cache)
static

◆ mesh_batch_cache_valid()

static bool mesh_batch_cache_valid ( Object *  object,
Mesh *  me 
)
static

◆ mesh_buffer_cache_clear()

static void mesh_buffer_cache_clear ( MeshBufferCache *  mbc)
static

◆ mesh_buffer_list_clear()

static void mesh_buffer_list_clear ( MeshBufferList *  mbuflist)
static

◆ mesh_cd_calc_active_mask_uv_layer()

static void mesh_cd_calc_active_mask_uv_layer ( const Object *  object,
const Mesh *  me,
DRW_MeshCDMask *  cd_used 
)
static

◆ mesh_cd_calc_active_uv_layer()

static void mesh_cd_calc_active_uv_layer ( const Object *  object,
const Mesh *  me,
DRW_MeshCDMask *  cd_used 
)
static

◆ mesh_cd_calc_edit_uv_layer()

static void mesh_cd_calc_edit_uv_layer ( const Mesh *  UNUSEDme,
DRW_MeshCDMask *  cd_used 
)
static

Definition at line 239 of file draw_cache_impl_mesh.cc.

References DRW_MeshCDMask::edit_uv.

Referenced by edituv_request_active_uv().

◆ mesh_cd_calc_used_gpu_layers()

static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers ( const Object *  object,
const Mesh *  me,
struct GPUMaterial **  gpumat_array,
int  gpumat_array_len,
DRW_Attributes *  attributes 
)
static

◆ mesh_cd_layers_type_clear()

BLI_INLINE void mesh_cd_layers_type_clear ( DRW_MeshCDMask *  a)

◆ mesh_cd_layers_type_equal()

BLI_INLINE bool mesh_cd_layers_type_equal ( DRW_MeshCDMask  a,
DRW_MeshCDMask  b 
)

Definition at line 222 of file draw_cache_impl_mesh.cc.

References Freestyle::a, and usdtokens::b().

Referenced by DRW_mesh_batch_cache_free_old().

◆ mesh_cd_layers_type_merge()

BLI_INLINE void mesh_cd_layers_type_merge ( DRW_MeshCDMask *  a,
DRW_MeshCDMask  b 
)

◆ mesh_cd_layers_type_overlap()

BLI_INLINE bool mesh_cd_layers_type_overlap ( DRW_MeshCDMask  a,
DRW_MeshCDMask  b 
)

Definition at line 217 of file draw_cache_impl_mesh.cc.

References Freestyle::a, and usdtokens::b().

Referenced by DRW_mesh_batch_cache_create_requested().

◆ request_active_and_default_color_attributes()

static void request_active_and_default_color_attributes ( const Object &  object,
const Mesh &  mesh,
DRW_Attributes &  attributes 
)
static

◆ texpaint_request_active_uv()

static void texpaint_request_active_uv ( MeshBatchCache *  cache,
Object *  object,
Mesh *  me 
)
static