15#include <lagrange/SurfaceMesh.h>
16#include <lagrange/unify_index_buffer.h>
22template <
typename Scalar,
typename Index>
23bool involve_indexed_attribute(
24 const SurfaceMesh<Scalar, Index>& mesh,
27 if (attr_ids.empty()) {
28 bool has_indexed_attribute =
false;
30 if (has_indexed_attribute)
return;
31 auto name = mesh.get_attribute_name(
id);
32 if (mesh.attr_name_is_reserved(name))
return;
33 if (mesh.is_attribute_indexed(
id)) {
34 has_indexed_attribute =
true;
37 return has_indexed_attribute;
39 for (
auto id : attr_ids) {
40 if (mesh.is_attribute_indexed(
id))
return true;
46template <
typename Scalar,
typename Index>
47std::tuple<SurfaceMesh<Scalar, Index>, std::vector<AttributeId>> remap_indexed_attributes(
48 const SurfaceMesh<Scalar, Index>& in_mesh,
51 std::vector<AttributeId> attr_ids(in_attr_ids.begin(), in_attr_ids.end());
59 auto name = in_mesh.get_attribute_name(id);
60 la_runtime_assert(mesh.has_attribute(name));
61 return mesh.get_attribute_id(name);
64 return {mesh, attr_ids};
SurfaceMesh< Scalar, Index > unify_index_buffer(const SurfaceMesh< Scalar, Index > &mesh, const std::vector< AttributeId > &attribute_ids={})
Unify index buffers of the input mesh for all attributes specified in attribute_ids.
Definition unify_index_buffer.cpp:34
uint32_t AttributeId
Identified to be used to access an attribute.
Definition AttributeFwd.h:73
::nonstd::span< T, Extent > span
A bounds-safe view for sequences of objects.
Definition span.h:27
Mesh input/output.
Definition detect_file_format.h:18