[Bf-blender-cvs] [b18f6083e34] refactor-mesh-corners-generic: Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic
Hans Goudey
noreply at git.blender.org
Mon Dec 19 23:00:09 CET 2022
Commit: b18f6083e34c3f05ae906a8771754e2828a55b90
Author: Hans Goudey
Date: Sun Dec 18 23:34:39 2022 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rBb18f6083e34c3f05ae906a8771754e2828a55b90
Merge branch 'refactor-mesh-position-generic' into refactor-mesh-corners-generic
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_mesh.h
index 6d9021a1b29,548ed122f3e..0d7ab95efb2
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@@ -487,11 -475,10 +475,11 @@@ void BKE_mesh_ensure_normals_for_displa
*/
void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
int numEdges,
- const struct MLoop *mloops,
- int numLoops,
+ const int *corner_verts,
+ const int *corner_edges,
+ int corners_num,
const struct MPoly *mpolys,
- const float (*polynors)[3],
+ const float (*poly_normals)[3],
int numPolys,
float split_angle);
@@@ -612,12 -599,11 +600,12 @@@ void BKE_mesh_normals_loop_split(const
int numVerts,
const struct MEdge *medges,
int numEdges,
- const int *corner_verts,
- const int *corner_edges,
- float (*r_loopnors)[3],
- int corners_num,
- const struct MLoop *mloops,
++ const int *corner_verts,
++ const int *corner_edges,
+ float (*r_loop_normals)[3],
+ int numLoops,
const struct MPoly *mpolys,
- const float (*polynors)[3],
+ const float (*poly_normals)[3],
int numPolys,
bool use_split_normals,
float split_angle,
@@@ -630,12 -616,11 +618,12 @@@ void BKE_mesh_normals_loop_custom_set(c
int numVerts,
struct MEdge *medges,
int numEdges,
- const struct MLoop *mloops,
+ const int *corner_verts,
+ const int *corner_edges,
- float (*r_custom_loopnors)[3],
- int corners_num,
+ float (*r_custom_loop_normals)[3],
+ int numLoops,
const struct MPoly *mpolys,
- const float (*polynors)[3],
+ const float (*poly_normals)[3],
int numPolys,
short (*r_clnors_data)[2]);
void BKE_mesh_normals_loop_custom_from_verts_set(const float (*positions)[3],
@@@ -644,11 -629,10 +632,11 @@@
int numVerts,
struct MEdge *medges,
int numEdges,
- const struct MLoop *mloops,
- int numLoops,
+ const int *corner_verts,
+ const int *corner_edges,
+ int corners_num,
const struct MPoly *mpolys,
- const float (*polynors)[3],
+ const float (*poly_normals)[3],
int numPolys,
short (*r_clnors_data)[2]);
diff --cc source/blender/blenkernel/BKE_mesh_tangent.h
index 464f9554039,88c69122e9c..95ca3d0aed2
--- a/source/blender/blenkernel/BKE_mesh_tangent.h
+++ b/source/blender/blenkernel/BKE_mesh_tangent.h
@@@ -19,9 -19,9 +19,9 @@@ struct ReportList
*/
void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
int numVerts,
- const struct MLoop *mloops,
+ const int *corner_verts,
float (*r_looptangent)[4],
- const float (*loopnors)[3],
+ const float (*loop_normals)[3],
const struct MLoopUV *loopuv,
int numLoops,
const struct MPoly *mpolys,
diff --cc source/blender/blenkernel/BKE_shrinkwrap.h
index 9bfd3715009,b13a1cbd034..e444d890c88
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@@ -75,8 -75,7 +75,8 @@@ typedef struct ShrinkwrapTreeData
const struct MPoly *polys;
const float (*vert_normals)[3];
+ const int *corner_edges;
- const float (*pnors)[3];
+ const float (*poly_normals)[3];
const float (*clnors)[3];
ShrinkwrapBoundaryData *boundary;
} ShrinkwrapTreeData;
diff --cc source/blender/blenkernel/intern/key.cc
index ed0890268c2,998193efc47..b4de379ed1f
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@@ -2236,19 -2236,18 +2236,19 @@@ void BKE_keyblock_mesh_calc_normals(con
BKE_keyblock_convert_to_mesh(kb, positions, mesh->totvert);
const MEdge *edges = BKE_mesh_edges(mesh);
const MPoly *polys = BKE_mesh_polys(mesh);
- const MLoop *loops = BKE_mesh_loops(mesh);
+ const int *corner_verts = BKE_mesh_corner_verts(mesh);
+ const int *corner_edges = BKE_mesh_corner_edges(mesh);
- const bool loop_normals_needed = r_loopnors != nullptr;
- const bool vert_normals_needed = r_vertnors != nullptr || loop_normals_needed;
- const bool poly_normals_needed = r_polynors != nullptr || vert_normals_needed ||
+ const bool loop_normals_needed = r_loop_normals != nullptr;
+ const bool vert_normals_needed = r_vert_normals != nullptr || loop_normals_needed;
+ const bool poly_normals_needed = r_poly_normals != nullptr || vert_normals_needed ||
loop_normals_needed;
- float(*vert_normals)[3] = r_vertnors;
- float(*poly_normals)[3] = r_polynors;
+ float(*vert_normals)[3] = r_vert_normals;
+ float(*poly_normals)[3] = r_poly_normals;
bool free_vert_normals = false;
bool free_poly_normals = false;
- if (vert_normals_needed && r_vertnors == nullptr) {
+ if (vert_normals_needed && r_vert_normals == nullptr) {
vert_normals = static_cast<float(*)[3]>(
MEM_malloc_arrayN(mesh->totvert, sizeof(float[3]), __func__));
free_vert_normals = true;
@@@ -2281,9 -2280,8 +2281,9 @@@
mesh->totvert,
edges,
mesh->totedge,
- loops,
+ corner_verts,
+ corner_edges,
- r_loopnors,
+ r_loop_normals,
mesh->totloop,
polys,
poly_normals,
diff --cc source/blender/blenkernel/intern/mesh_iterators.cc
index a2628cd33a9,c89e0f41de1..2e5c30cd99d
--- a/source/blender/blenkernel/intern/mesh_iterators.cc
+++ b/source/blender/blenkernel/intern/mesh_iterators.cc
@@@ -185,13 -185,13 +185,13 @@@ void BKE_mesh_foreach_mapped_loop(Mesh
}
}
else {
- const float(*lnors)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
- static_cast<const float(*)[3]>(
- CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
- nullptr;
+ const float(*loop_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
+ static_cast<const float(*)[3]>(
+ CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
+ nullptr;
const float(*positions)[3] = BKE_mesh_positions(mesh);
- const MLoop *ml = BKE_mesh_loops(mesh);
+ const Span<int> corner_verts = mesh->corner_verts();
const MPoly *mp = BKE_mesh_polys(mesh);
const int *v_index = static_cast<const int *>(
CustomData_get_layer(&mesh->vdata, CD_ORIGINDEX));
@@@ -201,11 -201,10 +201,11 @@@
if (v_index || f_index) {
for (p_idx = 0; p_idx < mesh->totpoly; p_idx++, mp++) {
- for (i = 0; i < mp->totloop; i++, ml++) {
- const int v_idx = v_index ? v_index[ml->v] : ml->v;
+ for (i = 0; i < mp->totloop; i++) {
+ const int vert_i = corner_verts[i];
+ const int v_idx = v_index ? v_index[vert_i] : vert_i;
const int f_idx = f_index ? f_index[p_idx] : p_idx;
- const float *no = lnors ? *lnors++ : nullptr;
+ const float *no = loop_normals ? *loop_normals++ : nullptr;
if (ELEM(ORIGINDEX_NONE, v_idx, f_idx)) {
continue;
}
@@@ -215,11 -214,11 +215,11 @@@
}
else {
for (p_idx = 0; p_idx < mesh->totpoly; p_idx++, mp++) {
- for (i = 0; i < mp->totloop; i++, ml++) {
- const int v_idx = ml->v;
+ for (i = 0; i < mp->totloop; i++) {
+ const int vert_i = corner_verts[i];
const int f_idx = p_idx;
- const float *no = lnors ? *lnors++ : nullptr;
+ const float *no = loop_normals ? *loop_normals++ : nullptr;
- func(userData, v_idx, f_idx, positions[
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list