Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-03-10 14:41:50 +0300
committerJacques Lucke <jacques@blender.org>2021-03-10 14:41:50 +0300
commit4fece16d458e75bc408c62814c9d2b86637ab92e (patch)
tree5c88debbb2135cc8332cb9a3a066e0986f41f65d /source/blender/nodes
parent368647bd25d6bb0b32f5e439838c06e0e46ac8da (diff)
Geometry Nodes: transfer polygon attributes to points in Point Distribute node
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc21
1 files changed, 21 insertions, 0 deletions
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
@@ -310,6 +310,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,
Span<int> looptri_indices,
@@ -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;