/* SPDX-FileCopyrightText: 2011-2024 Blender Foundation * * SPDX-License-Identifier: Apache-2.0 */ #pragma once #include "subd/osd.h" #include "util/types.h" #include "util/vector.h" #include #include CCL_NAMESPACE_BEGIN class Mesh; class Attribute; /* Attribute Interpolation. */ struct SubdAttribute { std::function interp; vector refined_data; }; class SubdAttributeInterpolation { protected: Mesh &mesh; #ifdef WITH_OPENSUBDIV OsdMesh &osd_mesh; OsdData &osd_data; #endif public: vector vertex_attributes; vector triangle_attributes; #ifdef WITH_OPENSUBDIV SubdAttributeInterpolation(Mesh &mesh, OsdMesh &osd_mesh, OsdData &osd_data); #else SubdAttributeInterpolation(Mesh &mesh); #endif void setup(); protected: bool support_interp_attribute(const Attribute &attr) const; void setup_attribute(const Attribute &subd_attr, Attribute &mesh_attr); template void setup_attribute_vertex_linear(const Attribute &subd_attr, Attribute &mesh_attr, const int motion_step = -1); template void setup_attribute_corner_linear(const Attribute &subd_attr, Attribute &mesh_attr, const int motion_step = -1); #ifdef WITH_OPENSUBDIV template void setup_attribute_vertex_smooth(const Attribute &subd_attr, Attribute &mesh_attr, const int motion_step = -1); template void setup_attribute_corner_smooth(Attribute &mesh_attr, const int channel, const vector &merged_values); #endif template void setup_attribute_face(const Attribute &subd_attr, Attribute &mesh_attr); template void setup_attribute_type(const Attribute &subd_attr, Attribute &mesh_attr); }; CCL_NAMESPACE_END