Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/BKE_mesh.h')
-rw-r--r--source/blender/blenkernel/BKE_mesh.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 8f6786d4113..ebc3c31c08b 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -38,7 +38,6 @@ struct MLoop;
struct MLoopTri;
struct MLoopUV;
struct MPoly;
-struct MVert;
struct Main;
struct MemArena;
struct Mesh;
@@ -185,6 +184,8 @@ struct Mesh *BKE_mesh_new_nomain_from_curve(const struct Object *ob);
struct Mesh *BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob,
const struct ListBase *dispbase);
+bool BKE_mesh_attribute_required(const char *name);
+
bool BKE_mesh_ensure_facemap_customdata(struct Mesh *me);
bool BKE_mesh_clear_facemap_customdata(struct Mesh *me);
@@ -336,7 +337,7 @@ void BKE_mesh_vert_coords_apply(struct Mesh *mesh, const float (*vert_coords)[3]
*/
void BKE_mesh_recalc_looptri(const struct MLoop *mloop,
const struct MPoly *mpoly,
- const struct MVert *mvert,
+ const float (*positions)[3],
int totloop,
int totpoly,
struct MLoopTri *mlooptri);
@@ -350,7 +351,7 @@ void BKE_mesh_recalc_looptri(const struct MLoop *mloop,
*/
void BKE_mesh_recalc_looptri_with_normals(const struct MLoop *mloop,
const struct MPoly *mpoly,
- const struct MVert *mvert,
+ const float (*positions)[3],
int totloop,
int totpoly,
struct MLoopTri *mlooptri,
@@ -452,7 +453,7 @@ bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh);
* \note Usually #BKE_mesh_poly_normals_ensure is the preferred way to access face normals,
* since they may already be calculated and cached on the mesh.
*/
-void BKE_mesh_calc_normals_poly(const struct MVert *mvert,
+void BKE_mesh_calc_normals_poly(const float (*positions)[3],
int mvert_len,
const struct MLoop *mloop,
int mloop_len,
@@ -466,7 +467,7 @@ void BKE_mesh_calc_normals_poly(const struct MVert *mvert,
* \note Usually #BKE_mesh_vertex_normals_ensure is the preferred way to access vertex normals,
* since they may already be calculated and cached on the mesh.
*/
-void BKE_mesh_calc_normals_poly_and_vertex(const struct MVert *mvert,
+void BKE_mesh_calc_normals_poly_and_vertex(const float (*positions)[3],
int mvert_len,
const struct MLoop *mloop,
int mloop_len,
@@ -488,7 +489,7 @@ void BKE_mesh_calc_normals(struct Mesh *me);
* Called after calculating all modifiers.
*/
void BKE_mesh_ensure_normals_for_display(struct Mesh *mesh);
-void BKE_mesh_calc_normals_looptri(const struct MVert *mverts,
+void BKE_mesh_calc_normals_looptri(const float (*positions)[3],
int numVerts,
const struct MLoop *mloop,
const struct MLoopTri *looptri,
@@ -510,7 +511,7 @@ void BKE_mesh_loop_manifold_fan_around_vert_next(const struct MLoop *mloops,
* Used when defining an empty custom loop normals data layer,
* to keep same shading as with auto-smooth!
*/
-void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
+void BKE_edges_sharp_from_angle_set(const float (*positions)[3],
int numVerts,
struct MEdge *medges,
int numEdges,
@@ -631,7 +632,7 @@ void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space,
* Useful to materialize sharp edges (or non-smooth faces) without actually modifying the geometry
* (splitting edges).
*/
-void BKE_mesh_normals_loop_split(const struct MVert *mverts,
+void BKE_mesh_normals_loop_split(const float (*positions)[3],
const float (*vert_normals)[3],
int numVerts,
const struct MEdge *medges,
@@ -648,7 +649,7 @@ void BKE_mesh_normals_loop_split(const struct MVert *mverts,
short (*clnors_data)[2],
int *r_loop_to_poly);
-void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
+void BKE_mesh_normals_loop_custom_set(const float (*positions)[3],
const float (*vert_normals)[3],
int numVerts,
struct MEdge *medges,
@@ -660,7 +661,7 @@ void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
const float (*polynors)[3],
int numPolys,
short (*r_clnors_data)[2]);
-void BKE_mesh_normals_loop_custom_from_verts_set(const struct MVert *mverts,
+void BKE_mesh_normals_loop_custom_from_verts_set(const float (*positions)[3],
const float (*vert_normals)[3],
float (*r_custom_vertnors)[3],
int numVerts,
@@ -723,7 +724,7 @@ void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_
void BKE_mesh_calc_poly_normal(const struct MPoly *mpoly,
const struct MLoop *loopstart,
- const struct MVert *mvarray,
+ const float (*positions)[3],
float r_no[3]);
void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly,
const struct MLoop *loopstart,
@@ -731,17 +732,17 @@ void BKE_mesh_calc_poly_normal_coords(const struct MPoly *mpoly,
float r_no[3]);
void BKE_mesh_calc_poly_center(const struct MPoly *mpoly,
const struct MLoop *loopstart,
- const struct MVert *mvarray,
+ const float (*positions)[3],
float r_cent[3]);
/* NOTE: passing poly-normal is only a speedup so we can skip calculating it. */
float BKE_mesh_calc_poly_area(const struct MPoly *mpoly,
const struct MLoop *loopstart,
- const struct MVert *mvarray);
+ const float (*positions)[3]);
float BKE_mesh_calc_area(const struct Mesh *me);
float BKE_mesh_calc_poly_uv_area(const struct MPoly *mpoly, const struct MLoopUV *uv_array);
void BKE_mesh_calc_poly_angles(const struct MPoly *mpoly,
const struct MLoop *loopstart,
- const struct MVert *mvarray,
+ const float (*positions)[3],
float angles[]);
void BKE_mesh_poly_edgehash_insert(struct EdgeHash *ehash,
@@ -771,7 +772,7 @@ bool BKE_mesh_center_of_volume(const struct Mesh *me, float r_cent[3]);
* \param r_volume: Volume (unsigned).
* \param r_center: Center of mass.
*/
-void BKE_mesh_calc_volume(const struct MVert *mverts,
+void BKE_mesh_calc_volume(const float (*positions)[3],
int mverts_num,
const struct MLoopTri *mlooptri,
int looptri_num,
@@ -930,7 +931,7 @@ bool BKE_mesh_validate_material_indices(struct Mesh *me);
* by importers that load normals (for example).
*/
bool BKE_mesh_validate_arrays(struct Mesh *me,
- struct MVert *mverts,
+ float (*positions)[3],
unsigned int totvert,
struct MEdge *medges,
unsigned int totedge,
@@ -1035,13 +1036,14 @@ BLI_INLINE int *BKE_mesh_material_indices_for_write(Mesh *mesh)
&mesh->pdata, CD_PROP_INT32, CD_SET_DEFAULT, NULL, mesh->totpoly, "material_index");
}
-BLI_INLINE const MVert *BKE_mesh_verts(const Mesh *mesh)
+BLI_INLINE const float (*BKE_mesh_positions(const Mesh *mesh))[3]
{
- return (const MVert *)CustomData_get_layer(&mesh->vdata, CD_MVERT);
+ return (const float(*)[3])CustomData_get_layer_named(&mesh->vdata, CD_PROP_FLOAT3, "position");
}
-BLI_INLINE MVert *BKE_mesh_verts_for_write(Mesh *mesh)
+BLI_INLINE float (*BKE_mesh_positions_for_write(Mesh *mesh))[3]
{
- return (MVert *)CustomData_duplicate_referenced_layer(&mesh->vdata, CD_MVERT, mesh->totvert);
+ return (float(*)[3])CustomData_duplicate_referenced_layer_named(
+ &mesh->vdata, CD_PROP_FLOAT3, "position", mesh->totvert);
}
BLI_INLINE const MEdge *BKE_mesh_edges(const Mesh *mesh)
@@ -1092,15 +1094,16 @@ BLI_INLINE MDeformVert *BKE_mesh_deform_verts_for_write(Mesh *mesh)
#ifdef __cplusplus
+# include "BLI_math_vec_types.hh"
# include "BLI_span.hh"
-inline blender::Span<MVert> Mesh::verts() const
+inline blender::Span<blender::float3> Mesh::positions() const
{
- return {BKE_mesh_verts(this), this->totvert};
+ return {reinterpret_cast<const blender::float3 *>(BKE_mesh_positions(this)), this->totvert};
}
-inline blender::MutableSpan<MVert> Mesh::verts_for_write()
+inline blender::MutableSpan<blender::float3> Mesh::positions_for_write()
{
- return {BKE_mesh_verts_for_write(this), this->totvert};
+ return {reinterpret_cast<blender::float3 *>(BKE_mesh_positions_for_write(this)), this->totvert};
}
inline blender::Span<MEdge> Mesh::edges() const