69 switch (boundary_smooth) {
100#ifdef WITH_OPENSUBDIV
105 topology_refiner_settings.
level = settings->
level;
110 converter, topology_refiner_settings);
118 subdiv->settings = *settings;
119 subdiv->topology_refiner = osd_topology_refiner;
120 subdiv->evaluator =
nullptr;
121 subdiv->displacement_evaluator =
nullptr;
133 if (
mesh->verts_num == 0) {
149#ifdef WITH_OPENSUBDIV
151 bool can_reuse_subdiv =
true;
152 if (
subdiv !=
nullptr &&
subdiv->topology_refiner !=
nullptr) {
154 can_reuse_subdiv =
false;
158 can_reuse_subdiv =
subdiv->topology_refiner->isEqualToConverter(converter);
163 can_reuse_subdiv =
false;
165 if (can_reuse_subdiv) {
192#ifdef WITH_OPENSUBDIV
193 if (
subdiv->evaluator !=
nullptr) {
202 delete subdiv->topology_refiner;
216#ifdef WITH_OPENSUBDIV
217 if (!
subdiv->cache_.face_ptex_offset.is_empty()) {
218 return subdiv->cache_.face_ptex_offset;
221 if (topology_refiner ==
nullptr) {
224 const int num_coarse_faces = topology_refiner->
base_level().GetNumFaces();
225 subdiv->cache_.face_ptex_offset.reinitialize(num_coarse_faces + 1);
227 for (
int face_index = 0; face_index < num_coarse_faces; face_index++) {
228 const int face_size = topology_refiner->
base_level().GetFaceVertices(face_index).size();
229 const int num_ptex_faces = face_size == 4 ? 1 : face_size;
230 subdiv->cache_.face_ptex_offset[face_index] = ptex_offset;
231 ptex_offset += num_ptex_faces;
233 subdiv->cache_.face_ptex_offset[num_coarse_faces] = ptex_offset;
234 return subdiv->cache_.face_ptex_offset;
void(* BKE_subsurf_modifier_free_gpu_cache_cb)(blender::bke::subdiv::Subdiv *subdiv)
#define BLI_assert_msg(a, msg)
@ SUBSURF_BOUNDARY_SMOOTH_ALL
@ SUBSURF_BOUNDARY_SMOOTH_PRESERVE_CORNERS
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS
@ SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES
@ SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE
Read Guarded memory(de)allocation.
const OpenSubdiv::Far::TopologyLevel & base_level() const
static TopologyRefinerImpl * createFromConverter(OpenSubdiv_Converter *converter, const OpenSubdiv_TopologyRefinerSettings &settings)
void free(Subdiv *subdiv)
void converter_init_for_mesh(OpenSubdiv_Converter *converter, const Settings *settings, const Mesh *mesh)
@ SUBDIV_VTX_BOUNDARY_EDGE_AND_CORNER
@ SUBDIV_VTX_BOUNDARY_EDGE_ONLY
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE
@ SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL
Subdiv * new_from_mesh(const Settings *settings, const Mesh *mesh)
void stats_init(SubdivStats *stats)
void displacement_detach(Subdiv *subdiv)
FVarLinearInterpolation fvar_interpolation_from_uv_smooth(int uv_smooth)
Subdiv * update_from_converter(Subdiv *subdiv, const Settings *settings, OpenSubdiv_Converter *converter)
Subdiv * new_from_converter(const Settings *settings, OpenSubdiv_Converter *converter)
void stats_begin(SubdivStats *stats, StatsValue value)
void stats_end(SubdivStats *stats, StatsValue value)
void converter_free(OpenSubdiv_Converter *converter)
VtxBoundaryInterpolation vtx_boundary_interpolation_from_subsurf(int boundary_smooth)
@ SUBDIV_STATS_TOPOLOGY_REFINER_CREATION_TIME
@ SUBDIV_STATS_TOPOLOGY_COMPARE
Subdiv * update_from_mesh(Subdiv *subdiv, const Settings *settings, const Mesh *mesh)
bool settings_equal(const Settings *settings_a, const Settings *settings_b)
Span< int > face_ptex_offset_get(Subdiv *subdiv)
void openSubdiv_cleanup()
@ OPENSUBDIV_EVALUATOR_CPU
int(* getNumVertices)(const OpenSubdiv_Converter *converter)
VtxBoundaryInterpolation vtx_boundary_interpolation
FVarLinearInterpolation fvar_linear_interpolation