[Bf-blender-cvs] [2c803124d37] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic

Hans Goudey noreply at git.blender.org
Fri Oct 7 06:33:48 CEST 2022


Commit: 2c803124d371bbbd564dd4c5051258f53b799d36
Author: Hans Goudey
Date:   Thu Oct 6 23:26:44 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB2c803124d371bbbd564dd4c5051258f53b799d36

Merge branch 'master' into refactor-mesh-position-generic

===================================================================



===================================================================

diff --cc source/blender/blenkernel/intern/mball_tessellate.cc
index 00778ce2d79,5e8d2bc6d76..cab736a9a8c
--- a/source/blender/blenkernel/intern/mball_tessellate.cc
+++ b/source/blender/blenkernel/intern/mball_tessellate.cc
@@@ -1461,10 -1461,13 +1461,10 @@@ Mesh *BKE_mball_polygonize(Depsgraph *d
  
    Mesh *mesh = (Mesh *)BKE_id_new_nomain(ID_ME, ((ID *)ob->data)->name + 2);
  
 -  mesh->totvert = int(process.curvertex);
 -  MVert *mvert = static_cast<MVert *>(
 -      CustomData_add_layer(&mesh->vdata, CD_MVERT, CD_CONSTRUCT, nullptr, mesh->totvert));
 -  for (int i = 0; i < mesh->totvert; i++) {
 -    copy_v3_v3(mvert[i].co, process.co[i]);
 -  }
 -  MEM_freeN(process.co);
 +  mesh->totvert = (int)process.curvertex;
 +  CustomData_add_layer_named(
 +      &mesh->vdata, CD_PROP_FLOAT3, CD_ASSIGN, process.co, mesh->totvert, "position");
-   process.co = NULL;
++  process.co = nullptr;
  
    mesh->totpoly = int(process.curindex);
    MPoly *mpoly = static_cast<MPoly *>(
diff --cc source/blender/blenkernel/intern/mesh_evaluate.cc
index 0c33767ba72,9a199c9c768..7ee76c8ba5a
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@@ -530,8 -527,8 +530,8 @@@ bool BKE_mesh_center_of_volume(const Me
  /** \name Mesh Volume Calculation
   * \{ */
  
 -static bool mesh_calc_center_centroid_ex(const MVert *mverts,
 +static bool mesh_calc_center_centroid_ex(const float (*positions)[3],
-                                          int UNUSED(mverts_num),
+                                          int /*mverts_num*/,
                                           const MLoopTri *looptri,
                                           int looptri_num,
                                           const MLoop *mloop,
diff --cc source/blender/blenkernel/intern/mesh_mapping.cc
index 310905a7e46,667802d5f48..0abad8bed61
--- a/source/blender/blenkernel/intern/mesh_mapping.cc
+++ b/source/blender/blenkernel/intern/mesh_mapping.cc
@@@ -1178,12 -1181,11 +1178,12 @@@ bool BKE_mesh_calc_islands_loop_poly_ed
                                                const int totloop,
                                                MeshIslandStore *r_island_store)
  {
 +  UNUSED_VARS(positions, totvert);
    return mesh_calc_islands_loop_poly_uv(
-       edges, totedge, polys, totpoly, loops, totloop, NULL, r_island_store);
 -      verts, totvert, edges, totedge, polys, totpoly, loops, totloop, nullptr, r_island_store);
++      edges, totedge, polys, totpoly, loops, totloop, nullptr, r_island_store);
  }
  
 -bool BKE_mesh_calc_islands_loop_poly_uvmap(MVert *verts,
 +bool BKE_mesh_calc_islands_loop_poly_uvmap(float (*positions)[3],
                                             const int totvert,
                                             MEdge *edges,
                                             const int totedge,
@@@ -1194,10 -1196,9 +1194,10 @@@
                                             const MLoopUV *luvs,
                                             MeshIslandStore *r_island_store)
  {
 +  UNUSED_VARS(positions, totvert);
-   BLI_assert(luvs != NULL);
+   BLI_assert(luvs != nullptr);
    return mesh_calc_islands_loop_poly_uv(
 -      verts, totvert, edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
 +      edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
  }
  
  /** \} */
diff --cc source/blender/blenkernel/intern/mesh_normals.cc
index 2607b9ec6a4,e589aff1c73..1fc71ae762b
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@@ -186,13 -185,13 +186,13 @@@ static void mesh_calc_normals_poly_fn(v
  {
    const MeshCalcNormalsData_Poly *data = (MeshCalcNormalsData_Poly *)userdata;
    const MPoly *mp = &data->mpoly[pidx];
 -  BKE_mesh_calc_poly_normal(mp, data->mloop + mp->loopstart, data->mvert, data->pnors[pidx]);
 +  BKE_mesh_calc_poly_normal(mp, data->mloop + mp->loopstart, data->positions, data->pnors[pidx]);
  }
  
 -void BKE_mesh_calc_normals_poly(const MVert *mvert,
 +void BKE_mesh_calc_normals_poly(const float (*positions)[3],
-                                 int UNUSED(mvert_len),
+                                 int /*mvert_len*/,
                                  const MLoop *mloop,
-                                 int UNUSED(mloop_len),
+                                 int /*mloop_len*/,
                                  const MPoly *mpoly,
                                  int mpoly_len,
                                  float (*r_poly_normals)[3])
@@@ -307,10 -308,10 +308,10 @@@ static void mesh_calc_normals_poly_and_
    }
  }
  
 -void BKE_mesh_calc_normals_poly_and_vertex(const MVert *mvert,
 +void BKE_mesh_calc_normals_poly_and_vertex(const float (*positions)[3],
                                             const int mvert_len,
                                             const MLoop *mloop,
-                                            const int UNUSED(mloop_len),
+                                            const int /*mloop_len*/,
                                             const MPoly *mpoly,
                                             const int mpoly_len,
                                             float (*r_poly_normals)[3],
@@@ -943,8 -945,8 +944,8 @@@ static void mesh_edges_sharp_tag(LoopSp
    }
  }
  
 -void BKE_edges_sharp_from_angle_set(const struct MVert *mverts,
 +void BKE_edges_sharp_from_angle_set(const float (*positions)[3],
-                                     const int UNUSED(numVerts),
+                                     const int /*numVerts*/,
                                      struct MEdge *medges,
                                      const int numEdges,
                                      const struct MLoop *mloops,
@@@ -1604,9 -1605,9 +1605,9 @@@ static void loop_split_generator(TaskPo
  #endif
  }
  
 -void BKE_mesh_normals_loop_split(const MVert *mverts,
 +void BKE_mesh_normals_loop_split(const float (*positions)[3],
                                   const float (*vert_normals)[3],
-                                  const int UNUSED(numVerts),
+                                  const int /*numVerts*/,
                                   const MEdge *medges,
                                   const int numEdges,
                                   const MLoop *mloops,
diff --cc source/blender/blenkernel/intern/mesh_tangent.cc
index a1c6483bb41,1162986aaf5..a2d3000cbcd
--- a/source/blender/blenkernel/intern/mesh_tangent.cc
+++ b/source/blender/blenkernel/intern/mesh_tangent.cc
@@@ -67,17 -67,17 +67,17 @@@ struct BKEMeshToTangent 
      copy_v4_fl4(p_res, T.x, T.y, T.z, orientation ? 1.0f : -1.0f);
    }
  
 -  const MPoly *mpolys;     /* faces */
 -  const MLoop *mloops;     /* faces vertices */
 -  const MVert *mverts;     /* vertices */
 -  const MLoopUV *luvs;     /* texture coordinates */
 -  const float (*lnors)[3]; /* loops' normals */
 -  float (*tangents)[4];    /* output tangents */
 -  int num_polys;           /* number of polygons */
 +  const MPoly *mpolys;         /* faces */
 +  const MLoop *mloops;         /* faces vertices */
 +  const float (*positions)[3]; /* vertices */
 +  const MLoopUV *luvs;         /* texture coordinates */
 +  const float (*lnors)[3];     /* loops' normals */
 +  float (*tangents)[4];        /* output tangents */
 +  int num_polys;               /* number of polygons */
  };
  
 -void BKE_mesh_calc_loop_tangent_single_ex(const MVert *mverts,
 +void BKE_mesh_calc_loop_tangent_single_ex(const float (*positions)[3],
-                                           const int UNUSED(numVerts),
+                                           const int /*numVerts*/,
                                            const MLoop *mloops,
                                            float (*r_looptangent)[4],
                                            const float (*loopnors)[3],
@@@ -243,31 -241,27 +241,27 @@@ struct SGLSLMeshToTangent 
        if (precomputedFaceNormals) {
          return mikk::float3(precomputedFaceNormals[lt->poly]);
        }
-       else {
  #ifdef USE_LOOPTRI_DETECT_QUADS
-         const MPoly *mp = &mpoly[lt->poly];
-         float normal[3];
-         if (mp->totloop == 4) {
-           normal_quad_v3(normal,
-                          positions[mloop[mp->loopstart + 0].v],
-                          positions[mloop[mp->loopstart + 1].v],
-                          positions[mloop[mp->loopstart + 2].v],
-                          positions[mloop[mp->loopstart + 3].v]);
-         }
-         else
+       const MPoly *mp = &mpoly[lt->poly];
+       float normal[3];
+       if (mp->totloop == 4) {
+         normal_quad_v3(normal,
 -                       mvert[mloop[mp->loopstart + 0].v].co,
 -                       mvert[mloop[mp->loopstart + 1].v].co,
 -                       mvert[mloop[mp->loopstart + 2].v].co,
 -                       mvert[mloop[mp->loopstart + 3].v].co);
++                       positions[mloop[mp->loopstart + 0].v],
++                       positions[mloop[mp->loopstart + 1].v],
++                       positions[mloop[mp->loopstart + 2].v],
++                       positions[mloop[mp->loopstart + 3].v]);
+       }
+       else
  #endif
-         {
-           normal_tri_v3(normal,
-                         positions[mloop[lt->tri[0]].v],
-                         positions[mloop[lt->tri[1]].v],
-                         positions[mloop[lt->tri[2]].v]);
-         }
-         return mikk::float3(normal);
+       {
+         normal_tri_v3(normal,
 -                      mvert[mloop[lt->tri[0]].v].co,
 -                      mvert[mloop[lt->tri[1]].v].co,
 -                      mvert[mloop[lt->tri[2]].v].co);
++                      positions[mloop[lt->tri[0]].v],
++                      positions[mloop[lt->tri[1]].v],
++                      positions[mloop[lt->tri[2]].v]);
        }
+       return mikk::float3(normal);
      }
-     else {
-       return mikk::float3(vert_normals[mloop[loop_index].v]);
-     }
+     return mikk::float3(vert_normals[mloop[loop_index].v]);
    }
  
    void SetTangentSpace(const uint face_num, const uint vert_num, mikk::float3 T, bool orientation)
diff --cc source/blender/blenker

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list