[Bf-blender-cvs] [4fece16d458] master: Geometry Nodes: transfer polygon attributes to points in Point Distribute node
Jacques Lucke
noreply at git.blender.org
Wed Mar 10 12:41:57 CET 2021
Commit: 4fece16d458e75bc408c62814c9d2b86637ab92e
Author: Jacques Lucke
Date: Wed Mar 10 12:41:50 2021 +0100
Branches: master
https://developer.blender.org/rB4fece16d458e75bc408c62814c9d2b86637ab92e
Geometry Nodes: transfer polygon attributes to points in Point Distribute node
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
index 19dd8564a38..4795970377a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc
@@ -309,6 +309,23 @@ BLI_NOINLINE static void interpolate_attribute_corner(const Mesh &mesh,
}
}
+template<typename T>
+BLI_NOINLINE static void interpolate_attribute_polygon(const Mesh &mesh,
+ const Span<int> looptri_indices,
+ const Span<T> data_in,
+ MutableSpan<T> data_out)
+{
+ BLI_assert(data_in.size() == mesh.totpoly);
+ Span<MLoopTri> looptris = get_mesh_looptris(mesh);
+
+ for (const int i : data_out.index_range()) {
+ const int looptri_index = looptri_indices[i];
+ const MLoopTri &looptri = looptris[looptri_index];
+ const int poly_index = looptri.poly;
+ data_out[i] = data_in[poly_index];
+ }
+}
+
template<typename T>
BLI_NOINLINE static void interpolate_attribute(const Mesh &mesh,
Span<float3> bary_coords,
@@ -327,6 +344,10 @@ BLI_NOINLINE static void interpolate_attribute(const Mesh &mesh,
mesh, bary_coords, looptri_indices, source_span, output_span);
break;
}
+ case ATTR_DOMAIN_POLYGON: {
+ interpolate_attribute_polygon<T>(mesh, looptri_indices, source_span, output_span);
+ break;
+ }
default: {
/* Not supported currently. */
return;
More information about the Bf-blender-cvs
mailing list