Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_mesh_sample.hh
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
| * | * | ||||
| * The interpolator is only valid as long as the mesh is valid. | * The interpolator is only valid as long as the mesh is valid. | ||||
| * Barycentric weights are needed when interpolating point or corner domain attributes, | * Barycentric weights are needed when interpolating point or corner domain attributes, | ||||
| * these are computed lazily when needed and re-used. | * these are computed lazily when needed and re-used. | ||||
| */ | */ | ||||
| class MeshAttributeInterpolator { | class MeshAttributeInterpolator { | ||||
| private: | private: | ||||
| const Mesh *mesh_; | const Mesh *mesh_; | ||||
| const IndexMask mask_; | |||||
| const Span<float3> positions_; | const Span<float3> positions_; | ||||
| const Span<int> looptri_indices_; | const Span<int> looptri_indices_; | ||||
| Array<float3> bary_coords_; | Array<float3> bary_coords_; | ||||
| Array<float3> nearest_weights_; | Array<float3> nearest_weights_; | ||||
| public: | public: | ||||
| MeshAttributeInterpolator(const Mesh *mesh, | MeshAttributeInterpolator(const Mesh *mesh, | ||||
| const IndexMask mask, | |||||
| const Span<float3> positions, | const Span<float3> positions, | ||||
| const Span<int> looptri_indices); | const Span<int> looptri_indices); | ||||
| void sample_data(const GVArray &src, | void sample_data(const GVArray &src, | ||||
| const AttributeDomain domain, | const AttributeDomain domain, | ||||
| const eAttributeMapMode mode, | const eAttributeMapMode mode, | ||||
| const IndexMask mask, | |||||
| const GMutableSpan dst); | const GMutableSpan dst); | ||||
| void sample_attribute(const ReadAttributeLookup &src_attribute, | void sample_attribute(const ReadAttributeLookup &src_attribute, | ||||
| OutputAttribute &dst_attribute, | OutputAttribute &dst_attribute, | ||||
| eAttributeMapMode mode); | eAttributeMapMode mode); | ||||
| protected: | protected: | ||||
| Span<float3> ensure_barycentric_coords(); | Span<float3> ensure_barycentric_coords(); | ||||
| Span<float3> ensure_nearest_weights(); | Span<float3> ensure_nearest_weights(); | ||||
| }; | }; | ||||
| } // namespace blender::bke::mesh_surface_sample | } // namespace blender::bke::mesh_surface_sample | ||||