[Bf-blender-cvs] [03d7d298b5a] temp-vert-normals-cleanup: Merge branch 'master' into temp-vert-normals-cleanup
Hans Goudey
noreply at git.blender.org
Wed Jan 12 21:26:24 CET 2022
Commit: 03d7d298b5aa804fa8ab7fb28ae26ced0b664e92
Author: Hans Goudey
Date: Wed Jan 12 14:26:07 2022 -0600
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB03d7d298b5aa804fa8ab7fb28ae26ced0b664e92
Merge branch 'master' into temp-vert-normals-cleanup
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/geometry_component_mesh.cc
index 162130397eb,88a58220b23..11b350ef2be
--- a/source/blender/blenkernel/intern/geometry_component_mesh.cc
+++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc
@@@ -144,16 -206,19 +144,16 @@@ VArray<float3> mesh_normals_varray(cons
}
case ATTR_DOMAIN_EDGE: {
/* In this case, start with vertex normals and convert to the edge domain, since the
- * conversion from edges to vertices is very simple. Use the full mask since the edges
- * might use the vertex normal from any index. */
- GVArray vert_normals = mesh_vertex_normals(
- mesh, verts, polys, loops, IndexRange(verts.size()));
- Span<float3> vert_normals_span = vert_normals.get_internal_span().typed<float3>();
+ * conversion from edges to vertices is very simple. Use "manual" domain interpolation
+ * instead of the GeometryComponent API to avoid calculating unnecessary values and to
+ * allow normalizing the result more simply. */
+ Span<float3> vert_normals{(float3 *)BKE_mesh_vertex_normals_ensure(&mesh), mesh.totvert};
Array<float3> edge_normals(mask.min_array_size());
-
- /* Use "manual" domain interpolation instead of the GeometryComponent API to avoid
- * calculating unnecessary values and to allow normalizing the result much more simply. */
+ Span<MEdge> edges{mesh.medge, mesh.totedge};
for (const int i : mask) {
const MEdge &edge = edges[i];
- edge_normals[i] =
- float3::interpolate(vert_normals[edge.v1], vert_normals[edge.v2], 0.5f).normalized();
+ edge_normals[i] = math::normalize(
- math::interpolate(vert_normals_span[edge.v1], vert_normals_span[edge.v2], 0.5f));
++ math::interpolate(vert_normals[edge.v1], vert_normals[edge.v2], 0.5f));
}
return VArray<float3>::ForContainer(std::move(edge_normals));
diff --cc source/blender/blenkernel/intern/mesh_normals.cc
index 16241b0f0dd,47ea55be871..d4f32dbc50c
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@@ -35,16 -35,12 +35,16 @@@
#include "BLI_alloca.h"
#include "BLI_bitmap.h"
+#include "BLI_array.hh"
- #include "BLI_float3.hh"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
#include "BLI_math.h"
++#include "BLI_math_vec_types.hh"
#include "BLI_memarena.h"
+#include "BLI_span.hh"
#include "BLI_stack.h"
#include "BLI_task.h"
+#include "BLI_task.hh"
#include "BLI_utildefines.h"
#include "BKE_customdata.h"
More information about the Bf-blender-cvs
mailing list