Cleanup: comments (long lines) in blenkernel
[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(const SubdivSettings *settings)
38 {
39   switch (settings->vtx_boundary_interpolation) {
40     case SUBDIV_VTX_BOUNDARY_NONE:
41       return OSD_VTX_BOUNDARY_NONE;
42     case SUBDIV_VTX_BOUNDARY_EDGE_ONLY:
43       return OSD_VTX_BOUNDARY_EDGE_ONLY;
44     case SUBDIV_VTX_BOUNDARY_EDGE_AND_CORNER:
45       return OSD_VTX_BOUNDARY_EDGE_AND_CORNER;
46   }
47   BLI_assert(!"Unknown vtx boundary interpolation");
48   return OSD_VTX_BOUNDARY_EDGE_ONLY;
49 }
50
51 /*OpenSubdiv_FVarLinearInterpolation*/ int BKE_subdiv_converter_fvar_linear_from_settings(
52     const SubdivSettings *settings)
53 {
54   switch (settings->fvar_linear_interpolation) {
55     case SUBDIV_FVAR_LINEAR_INTERPOLATION_NONE:
56       return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
57     case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY:
58       return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY;
59     case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_AND_JUNCTIONS:
60       return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS1;
61     case SUBDIV_FVAR_LINEAR_INTERPOLATION_CORNERS_JUNCTIONS_AND_CONCAVE:
62       return OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS2;
63     case SUBDIV_FVAR_LINEAR_INTERPOLATION_BOUNDARIES:
64       return OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES;
65     case SUBDIV_FVAR_LINEAR_INTERPOLATION_ALL:
66       return OSD_FVAR_LINEAR_INTERPOLATION_ALL;
67   }
68   BLI_assert(!"Unknown fvar linear interpolation");
69   return OSD_FVAR_LINEAR_INTERPOLATION_NONE;
70 }