Cleanup: Remove unnecessary C wrappers for mesh evaluation functions
This commit is contained in:
@@ -347,12 +347,6 @@ bool BKE_mesh_vert_normals_are_dirty(const struct Mesh *mesh);
|
||||
*/
|
||||
bool BKE_mesh_poly_normals_are_dirty(const struct Mesh *mesh);
|
||||
|
||||
void BKE_mesh_calc_poly_normal(const int *poly_verts,
|
||||
int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
int verts_num,
|
||||
float r_no[3]);
|
||||
|
||||
/**
|
||||
* Called after calculating all modifiers.
|
||||
*/
|
||||
@@ -512,15 +506,6 @@ void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_
|
||||
|
||||
/* *** mesh_evaluate.cc *** */
|
||||
|
||||
void BKE_mesh_calc_poly_center(const int *poly_verts,
|
||||
int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
int verts_num,
|
||||
float r_cent[3]);
|
||||
float BKE_mesh_calc_poly_area(const int *poly_verts,
|
||||
int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
int verts_num);
|
||||
float BKE_mesh_calc_area(const struct Mesh *me);
|
||||
|
||||
bool BKE_mesh_center_median(const struct Mesh *me, float r_cent[3]);
|
||||
|
||||
@@ -74,22 +74,6 @@ float3 poly_center_calc(const Span<float3> vert_positions, const Span<int> poly_
|
||||
return poly_center_calc_ngon(vert_positions, poly_verts);
|
||||
}
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
|
||||
void BKE_mesh_calc_poly_center(const int *poly_verts,
|
||||
const int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
const int verts_num,
|
||||
float r_cent[3])
|
||||
{
|
||||
copy_v3_v3(r_cent,
|
||||
blender::bke::mesh::poly_center_calc(
|
||||
{reinterpret_cast<const blender::float3 *>(vert_positions), verts_num},
|
||||
{poly_verts, poly_size}));
|
||||
}
|
||||
|
||||
namespace blender::bke::mesh {
|
||||
|
||||
float poly_area_calc(const Span<float3> vert_positions, const Span<int> poly_verts)
|
||||
{
|
||||
if (poly_verts.size() == 3) {
|
||||
@@ -106,15 +90,6 @@ float poly_area_calc(const Span<float3> vert_positions, const Span<int> poly_ver
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
|
||||
float BKE_mesh_calc_poly_area(const int *poly_verts,
|
||||
const int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
const int verts_num)
|
||||
{
|
||||
return blender::bke::mesh::poly_area_calc(
|
||||
{reinterpret_cast<const float3 *>(vert_positions), verts_num}, {poly_verts, poly_size});
|
||||
}
|
||||
|
||||
float BKE_mesh_calc_area(const Mesh *me)
|
||||
{
|
||||
const Span<float3> positions = me->vert_positions();
|
||||
|
||||
@@ -170,18 +170,6 @@ float3 poly_normal_calc(const Span<float3> vert_positions, const Span<int> poly_
|
||||
|
||||
} // namespace blender::bke::mesh
|
||||
|
||||
void BKE_mesh_calc_poly_normal(const int *poly_verts,
|
||||
const int poly_size,
|
||||
const float (*vert_positions)[3],
|
||||
const int verts_num,
|
||||
float r_no[3])
|
||||
{
|
||||
copy_v3_v3(r_no,
|
||||
blender::bke::mesh::poly_normal_calc(
|
||||
{reinterpret_cast<const blender::float3 *>(vert_positions), verts_num},
|
||||
{poly_verts, poly_size}));
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
namespace blender::bke::mesh {
|
||||
|
||||
@@ -546,12 +546,13 @@ static void rna_MeshLoop_bitangent_get(PointerRNA *ptr, float *values)
|
||||
|
||||
static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
|
||||
{
|
||||
using namespace blender;
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
const int poly_start = *((const int *)ptr->data);
|
||||
const int poly_size = *(((const int *)ptr->data) + 1) - poly_start;
|
||||
const float(*positions)[3] = BKE_mesh_vert_positions(me);
|
||||
const blender::Span<int> corner_verts = me->corner_verts();
|
||||
BKE_mesh_calc_poly_normal(&corner_verts[poly_start], poly_size, positions, me->totvert, values);
|
||||
const Span<int> poly_verts = me->corner_verts().slice(poly_start, poly_size);
|
||||
const float3 result = bke::mesh::poly_normal_calc(me->vert_positions(), poly_verts);
|
||||
copy_v3_v3(values, result);
|
||||
}
|
||||
|
||||
static bool rna_MeshPolygon_hide_get(PointerRNA *ptr)
|
||||
@@ -650,22 +651,23 @@ static void rna_MeshPolygon_material_index_set(PointerRNA *ptr, int value)
|
||||
|
||||
static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
|
||||
{
|
||||
using namespace blender;
|
||||
Mesh *me = rna_mesh(ptr);
|
||||
const int poly_start = *((const int *)ptr->data);
|
||||
const int poly_size = *(((const int *)ptr->data) + 1) - poly_start;
|
||||
const float(*positions)[3] = BKE_mesh_vert_positions(me);
|
||||
const blender::Span<int> corner_verts = me->corner_verts();
|
||||
BKE_mesh_calc_poly_center(&corner_verts[poly_start], poly_size, positions, me->totvert, values);
|
||||
const Span<int> poly_verts = me->corner_verts().slice(poly_start, poly_size);
|
||||
const float3 result = bke::mesh::poly_center_calc(me->vert_positions(), poly_verts);
|
||||
copy_v3_v3(values, result);
|
||||
}
|
||||
|
||||
static float rna_MeshPolygon_area_get(PointerRNA *ptr)
|
||||
{
|
||||
using namespace blender;
|
||||
Mesh *me = (Mesh *)ptr->owner_id;
|
||||
const int poly_start = *((const int *)ptr->data);
|
||||
const int poly_size = *(((const int *)ptr->data) + 1) - poly_start;
|
||||
const float(*positions)[3] = BKE_mesh_vert_positions(me);
|
||||
const blender::Span<int> corner_verts = me->corner_verts();
|
||||
return BKE_mesh_calc_poly_area(&corner_verts[poly_start], poly_size, positions, me->totvert);
|
||||
const Span<int> poly_verts = me->corner_verts().slice(poly_start, poly_size);
|
||||
return bke::mesh::poly_area_calc(me->vert_positions(), poly_verts);
|
||||
}
|
||||
|
||||
static void rna_MeshPolygon_flip(ID *id, MIntProperty *poly_offset_p)
|
||||
|
||||
Reference in New Issue
Block a user