Blender V5.0
bmesh_mesh.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
10
11#include "BLI_array.hh"
14#include "BLI_span.hh"
15
16#include "bmesh_class.hh"
17
19
20struct BMAllocTemplate;
21
24
26 bool use_toolflags : 1;
27};
28
39
45void BM_mesh_free(BMesh *bm);
60
68void bmesh_edit_begin(BMesh *bm, BMOpTypeFlag type_flag);
72void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag);
73
74void BM_mesh_elem_index_ensure_ex(BMesh *bm, char htype, int elem_offset[4]);
75void BM_mesh_elem_index_ensure(BMesh *bm, char htype);
89 BMesh *bm, const char *location, const char *func, const char *msg_a, const char *msg_b);
90
91#ifndef NDEBUG
96#endif
97
101void BM_mesh_toolflags_set(BMesh *bm, bool use_toolflags);
102
103void BM_mesh_elem_table_ensure(BMesh *bm, char htype);
104/* use BM_mesh_elem_table_ensure where possible to avoid full rebuild */
105void BM_mesh_elem_table_init(BMesh *bm, char htype);
106void BM_mesh_elem_table_free(BMesh *bm, char htype);
107
109{
110 BLI_assert((index >= 0) && (index < bm->totvert));
111 BLI_assert((bm->elem_table_dirty & BM_VERT) == 0);
112 return bm->vtable[index];
113}
115{
116 BLI_assert((index >= 0) && (index < bm->totedge));
117 BLI_assert((bm->elem_table_dirty & BM_EDGE) == 0);
118 return bm->etable[index];
119}
121{
122 BLI_assert((index >= 0) && (index < bm->totface));
123 BLI_assert((bm->elem_table_dirty & BM_FACE) == 0);
124 return bm->ftable[index];
125}
126
131
140
141// XXX
142
146int BM_mesh_elem_count(BMesh *bm, char htype);
147
162void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx);
163
172 BLI_mempool *vpool,
173 BLI_mempool *epool,
174 BLI_mempool *lpool,
175 BLI_mempool *fpool);
176
180
181/* used as an extern, defined in bmesh.h */
184
185#define BMALLOC_TEMPLATE_FROM_BM(bm) \
186 {(CHECK_TYPE_INLINE(bm, BMesh *), (bm)->totvert), (bm)->totedge, (bm)->totloop, (bm)->totface}
187
188#define _VA_BMALLOC_TEMPLATE_FROM_ME_1(me) \
189 { \
190 (CHECK_TYPE_INLINE(me, Mesh *), (me)->verts_num), \
191 (me)->edges_num, \
192 (me)->corners_num, \
193 (me)->faces_num, \
194 }
195#define _VA_BMALLOC_TEMPLATE_FROM_ME_2(me_a, me_b) \
196 { \
197 (CHECK_TYPE_INLINE(me_a, Mesh *), \
198 CHECK_TYPE_INLINE(me_b, Mesh *), \
199 (me_a)->verts_num + (me_b)->verts_num), \
200 (me_a)->edges_num + (me_b)->edges_num, \
201 (me_a)->corners_num + (me_b)->corners_num, \
202 (me_a)->faces_num + (me_b)->faces_num, \
203 }
204#define BMALLOC_TEMPLATE_FROM_ME(...) \
205 VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_ME_, __VA_ARGS__)
206
208
209/* Vertex coords access. */
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_INLINE
unsigned int uint
BMesh * bm
const BMAllocTemplate bm_mesh_allocsize_default
Definition bmesh_mesh.cc:30
const BMAllocTemplate bm_mesh_chunksize_default
Definition bmesh_mesh.cc:31
void BM_mesh_elem_toolflags_clear(BMesh *bm)
void BM_mesh_elem_index_ensure_ex(BMesh *bm, char htype, int elem_offset[4])
blender::Array< blender::float3 > BM_mesh_vert_coords_alloc(BMesh *bm)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_toolflags_set(BMesh *bm, bool use_toolflags)
void BM_mesh_data_free(BMesh *bm)
BMesh Free Mesh Data.
void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const uint *face_idx)
void BM_mesh_clear(BMesh *bm)
BMesh Clear Mesh.
BMEdge * BM_edge_at_index_find(BMesh *bm, int index)
void BM_mesh_elem_table_free(BMesh *bm, char htype)
BMVert * BM_vert_at_index_find_or_table(BMesh *bm, int index)
void BM_mesh_vert_normals_get(BMesh *bm, blender::MutableSpan< blender::float3 > normals)
void bmesh_edit_begin(BMesh *bm, BMOpTypeFlag type_flag)
BMesh Begin Edit.
void BM_mesh_rebuild(BMesh *bm, const BMeshCreateParams *params, BLI_mempool *vpool, BLI_mempool *epool, BLI_mempool *lpool, BLI_mempool *fpool)
void BM_mesh_elem_toolflags_ensure(BMesh *bm)
Definition bmesh_mesh.cc:82
void BM_mesh_vert_coords_apply(BMesh *bm, blender::Span< blender::float3 > vert_coords)
BMLoop * BM_loop_at_index_find(BMesh *bm, int index)
void BM_mesh_elem_index_ensure(BMesh *bm, char htype)
BLI_INLINE BMVert * BM_vert_at_index(BMesh *bm, const int index)
void BM_mesh_vert_coords_get(BMesh *bm, blender::MutableSpan< blender::float3 > positions)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
void BM_mesh_elem_table_ensure(BMesh *bm, char htype)
BMEdge * BM_edge_at_index_find_or_table(BMesh *bm, int index)
void BM_mesh_elem_table_init(BMesh *bm, char htype)
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func, const char *msg_a, const char *msg_b)
BMFace * BM_face_at_index_find(BMesh *bm, int index)
BMFace * BM_face_at_index_find_or_table(BMesh *bm, int index)
void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag)
BMesh End Edit.
bool BM_mesh_elem_table_check(BMesh *bm)
int BM_mesh_elem_count(BMesh *bm, char htype)
void BM_mesh_vert_coords_apply_with_mat4(BMesh *bm, blender::Span< blender::float3 > vert_coords, const blender::float4x4 &transform)
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
BMVert * BM_vert_at_index_find(BMesh *bm, int index)
#define BM_FACE
#define BM_EDGE
#define BM_VERT
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static float normals[][3]
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
MatBase< float, 4, 4 > float4x4