doxygen: add newline after \file
[blender.git] / source / blender / blenkernel / intern / subdiv_converter.c
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 by Blender Foundation.
17  * All rights reserved.
18  */
19
20 /** \file
21  * \ingroup bke
22  */
23
24 #include "subdiv_converter.h"
25
26 #include "BLI_utildefines.h"
27
28 #include "opensubdiv_converter_capi.h"
29
30 void BKE_subdiv_converter_free(struct OpenSubdiv_Converter *converter)
31 {
32         if (converter->freeUserData) {
33                 converter->freeUserData(converter);
34         }
35 }
36
37 int BKE_subdiv_converter_vtx_boundary_interpolation_from_settings(
38         const SubdivSettings *settings)
39 {
40         switch (settings->vtx_boundary_interpolation) {
41                 case SUBDIV_VTX_BOUNDARY_NONE:
42                         return OSD_VTX_BOUNDARY_NONE;
43                 case SUBDIV_VTX_BOUNDARY_EDGE_ONLY:
44                         return OSD_VTX_BOUNDARY_EDGE_ONLY;
45                 case SUBDIV_VTX_BOUNDARY_EDGE_AND_CORNER:
46                         return OSD_VTX_BOUNDARY_EDGE_AND_CORNER;
47         }
48         BLI_assert(!"Unknown vtx boundary interpolation");
49         return OSD_VTX_BOUNDARY_EDGE_ONLY;
50 }
51
52 /*OpenSubdiv_FVarLinearInterpolation*/ int
53 BKE_subdiv_converter_fvar_linear_from_settings(const SubdivSettings *settings)
54 {
55         switch (settings->fvar_linear_interpolation) {
56                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE:
57                         return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
58                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY:
59                         return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY;
60                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS:
61                         return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS1;
62                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE:
63                         return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS2;
64                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES:
65                         return OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES;
66                 case SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL:
67                         return OSD_FVAR_LINEAR_INTERPOLATION_ALL;
68         }
69         BLI_assert(!"Unknown fvar linear interpolation");
70         return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
71 }