Blender  V2.93
multires_subdiv.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2018 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "MEM_guardedalloc.h"
25 
26 #include "DNA_mesh_types.h"
27 #include "DNA_scene_types.h"
28 
29 #include "BLI_utildefines.h"
30 
31 #include "BKE_mesh.h"
32 #include "BKE_modifier.h"
33 #include "BKE_multires.h"
34 #include "BKE_subdiv.h"
35 #include "BKE_subdiv_mesh.h"
36 
38 {
39  settings->is_simple = false;
40  settings->is_adaptive = true;
41  settings->level = settings->is_simple ? 1 : mmd->quality;
44  mmd->boundary_smooth);
46  mmd->uv_smooth);
47 }
48 
50  const Scene *scene,
51  const Object *object,
52  const MultiresModifierData *mmd,
53  const bool use_render_params,
54  const bool ignore_simplify,
55  const bool ignore_control_edges)
56 {
57  const int level = multires_get_level(scene, object, mmd, use_render_params, ignore_simplify);
58  mesh_settings->resolution = (1 << level) + 1;
60  !ignore_control_edges;
61 }
int multires_get_level(const struct Scene *scene, const struct Object *ob, const struct MultiresModifierData *mmd, bool render, bool ignore_simplify)
eSubdivVtxBoundaryInterpolation BKE_subdiv_vtx_boundary_interpolation_from_subsurf(int boundary_smooth)
Definition: subdiv.c:75
eSubdivFVarLinearInterpolation BKE_subdiv_fvar_interpolation_from_uv_smooth(int uv_smooth)
Definition: subdiv.c:55
@ eMultiresModifierFlag_UseCrease
@ eMultiresModifierFlag_ControlEdges
Read Guarded memory(de)allocation.
Scene scene
void BKE_multires_subdiv_settings_init(SubdivSettings *settings, const MultiresModifierData *mmd)
void BKE_multires_subdiv_mesh_settings_init(SubdivToMeshSettings *mesh_settings, const Scene *scene, const Object *object, const MultiresModifierData *mmd, const bool use_render_params, const bool ignore_simplify, const bool ignore_control_edges)
bool is_adaptive
Definition: BKE_subdiv.h:76
eSubdivFVarLinearInterpolation fvar_linear_interpolation
Definition: BKE_subdiv.h:87
bool use_creases
Definition: BKE_subdiv.h:84
eSubdivVtxBoundaryInterpolation vtx_boundary_interpolation
Definition: BKE_subdiv.h:86