Blender  V3.3
mesh_runtime.cc File Reference
#include "atomic_ops.h"
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "BLI_math_geom.h"
#include "BLI_task.hh"
#include "BKE_bvhutils.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_shrinkwrap.h"
#include "BKE_subdiv_ccg.h"

Go to the source code of this file.

Functions

Mesh Runtime Struct Utils
static void mesh_runtime_init_mutexes (Mesh *mesh)
 Initialize the runtime mutexes of the given mesh. More...
 
static void mesh_runtime_free_mutexes (Mesh *mesh)
 free the mutexes of the given mesh runtime. More...
 
void BKE_mesh_runtime_init_data (Mesh *mesh)
 Initialize the runtime of the given mesh. More...
 
void BKE_mesh_runtime_free_data (Mesh *mesh)
 Free all data (and mutexes) inside the runtime of the given mesh. More...
 
void BKE_mesh_runtime_reset_on_copy (Mesh *mesh, const int UNUSED(flag))
 
void BKE_mesh_runtime_clear_cache (Mesh *mesh)
 This function clears runtime cache of the given mesh. More...
 
static void mesh_ensure_looptri_data (Mesh *mesh)
 
void BKE_mesh_runtime_looptri_recalc (Mesh *mesh)
 
int BKE_mesh_runtime_looptri_len (const Mesh *mesh)
 
const MLoopTriBKE_mesh_runtime_looptri_ensure (const Mesh *mesh)
 
void BKE_mesh_runtime_verttri_from_looptri (MVertTri *r_verttri, const MLoop *mloop, const MLoopTri *looptri, int looptri_num)
 
bool BKE_mesh_runtime_ensure_edit_data (struct Mesh *mesh)
 
bool BKE_mesh_runtime_reset_edit_data (Mesh *mesh)
 
bool BKE_mesh_runtime_clear_edit_data (Mesh *mesh)
 
void BKE_mesh_runtime_clear_geometry (Mesh *mesh)
 
void BKE_mesh_tag_coords_changed (Mesh *mesh)
 
void BKE_mesh_tag_coords_changed_uniformly (Mesh *mesh)
 
Mesh Runtime Validation
bool BKE_mesh_runtime_is_valid (Mesh *me_eval)
 

Mesh Batch Cache Callbacks

void(* BKE_mesh_batch_cache_dirty_tag_cb )(Mesh *me, eMeshBatchDirtyMode mode) = nullptr
 
void(* BKE_mesh_batch_cache_free_cb )(Mesh *me) = nullptr
 
void BKE_mesh_batch_cache_dirty_tag (Mesh *me, eMeshBatchDirtyMode mode)
 
void BKE_mesh_batch_cache_free (Mesh *me)
 

Function Documentation

◆ BKE_mesh_batch_cache_dirty_tag()

void BKE_mesh_batch_cache_dirty_tag ( Mesh me,
eMeshBatchDirtyMode  mode 
)

◆ BKE_mesh_batch_cache_free()

void BKE_mesh_batch_cache_free ( Mesh me)

◆ BKE_mesh_runtime_clear_cache()

void BKE_mesh_runtime_clear_cache ( struct Mesh mesh)

◆ BKE_mesh_runtime_clear_edit_data()

bool BKE_mesh_runtime_clear_edit_data ( Mesh mesh)

◆ BKE_mesh_runtime_clear_geometry()

void BKE_mesh_runtime_clear_geometry ( Mesh mesh)

◆ BKE_mesh_runtime_ensure_edit_data()

bool BKE_mesh_runtime_ensure_edit_data ( struct Mesh mesh)

◆ BKE_mesh_runtime_free_data()

void BKE_mesh_runtime_free_data ( Mesh mesh)

Free all data (and mutexes) inside the runtime of the given mesh.

Definition at line 72 of file mesh_runtime.cc.

References BKE_mesh_runtime_clear_cache(), mesh, and mesh_runtime_free_mutexes().

Referenced by mesh_free_data().

◆ BKE_mesh_runtime_init_data()

void BKE_mesh_runtime_init_data ( struct Mesh mesh)

Initialize the runtime of the given mesh.

Function expects that the runtime is already cleared.

Definition at line 67 of file mesh_runtime.cc.

References mesh, and mesh_runtime_init_mutexes().

Referenced by mesh_blend_read_data(), and mesh_init_data().

◆ BKE_mesh_runtime_is_valid()

bool BKE_mesh_runtime_is_valid ( Mesh me_eval)

◆ BKE_mesh_runtime_looptri_ensure()

const MLoopTri* BKE_mesh_runtime_looptri_ensure ( const Mesh mesh)

◆ BKE_mesh_runtime_looptri_len()

int BKE_mesh_runtime_looptri_len ( const Mesh mesh)

◆ BKE_mesh_runtime_looptri_recalc()

void BKE_mesh_runtime_looptri_recalc ( Mesh mesh)

◆ BKE_mesh_runtime_reset_edit_data()

bool BKE_mesh_runtime_reset_edit_data ( Mesh mesh)

◆ BKE_mesh_runtime_reset_on_copy()

void BKE_mesh_runtime_reset_on_copy ( Mesh mesh,
const int   UNUSEDflag 
)

◆ BKE_mesh_runtime_verttri_from_looptri()

void BKE_mesh_runtime_verttri_from_looptri ( MVertTri r_verttri,
const MLoop mloop,
const MLoopTri looptri,
int  looptri_num 
)

Definition at line 195 of file mesh_runtime.cc.

References MLoopTri::tri, MVertTri::tri, and MLoop::v.

◆ BKE_mesh_tag_coords_changed()

void BKE_mesh_tag_coords_changed ( struct Mesh mesh)

◆ BKE_mesh_tag_coords_changed_uniformly()

void BKE_mesh_tag_coords_changed_uniformly ( struct Mesh mesh)

◆ mesh_ensure_looptri_data()

static void mesh_ensure_looptri_data ( Mesh mesh)
static

Ensure the array is large enough

Note
This function must always be thread-protected by caller. It should only be used by internal code.

Definition at line 118 of file mesh_runtime.cc.

References MLoopTri_Store::array, MLoopTri_Store::array_wip, BLI_assert, MLoopTri_Store::len, MLoopTri_Store::len_alloc, Mesh_Runtime::looptris, MEM_malloc_arrayN, MEM_SAFE_FREE, mesh, poly_to_tri_count(), Mesh::runtime, SWAP, Mesh::totloop, and Mesh::totpoly.

Referenced by BKE_mesh_runtime_looptri_recalc().

◆ mesh_runtime_free_mutexes()

static void mesh_runtime_free_mutexes ( Mesh mesh)
static

free the mutexes of the given mesh runtime.

Definition at line 48 of file mesh_runtime.cc.

References BLI_mutex_end(), Mesh_Runtime::eval_mutex, MEM_freeN, mesh, Mesh_Runtime::normals_mutex, Mesh_Runtime::render_mutex, and Mesh::runtime.

Referenced by BKE_mesh_runtime_free_data().

◆ mesh_runtime_init_mutexes()

static void mesh_runtime_init_mutexes ( Mesh mesh)
static

Initialize the runtime mutexes of the given mesh.

Any existing mutexes will be overridden.

Definition at line 35 of file mesh_runtime.cc.

References BLI_mutex_init(), Mesh_Runtime::eval_mutex, mesh, Mesh_Runtime::normals_mutex, Mesh_Runtime::render_mutex, and Mesh::runtime.

Referenced by BKE_mesh_runtime_init_data(), and BKE_mesh_runtime_reset_on_copy().

Variable Documentation

◆ BKE_mesh_batch_cache_dirty_tag_cb

void(* BKE_mesh_batch_cache_dirty_tag_cb) (Mesh *me, eMeshBatchDirtyMode mode) ( Mesh me,
eMeshBatchDirtyMode  mode 
) = nullptr

Definition at line 291 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_dirty_tag(), and DRW_engines_register().

◆ BKE_mesh_batch_cache_free_cb

void(* BKE_mesh_batch_cache_free_cb) (Mesh *me) ( Mesh me) = nullptr

Definition at line 292 of file mesh_runtime.cc.

Referenced by BKE_mesh_batch_cache_free(), and DRW_engines_register().