Blender  V3.3
type_convert.cc
Go to the documentation of this file.
1 // Copyright 2018 Blender Foundation. All rights reserved.
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software Foundation,
15 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 //
17 // Author: Sergey Sharybin
18 
19 #ifdef _MSC_VER
20 # include <iso646.h>
21 #endif
22 
24 
25 #include <cassert>
26 #include <opensubdiv/sdc/crease.h>
27 
28 namespace blender {
29 namespace opensubdiv {
30 
31 OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type)
32 {
33  switch (type) {
35  return OpenSubdiv::Sdc::SCHEME_BILINEAR;
36  case OSD_SCHEME_CATMARK:
37  return OpenSubdiv::Sdc::SCHEME_CATMARK;
38  case OSD_SCHEME_LOOP:
39  return OpenSubdiv::Sdc::SCHEME_LOOP;
40  }
41  assert(!"Unknown scheme type passed via C-API");
42  return OpenSubdiv::Sdc::SCHEME_CATMARK;
43 }
44 
45 OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFromCAPI(
47 {
48  typedef OpenSubdiv::Sdc::Options Options;
49  switch (linear_interpolation) {
51  return Options::FVAR_LINEAR_NONE;
53  return Options::FVAR_LINEAR_CORNERS_ONLY;
55  return Options::FVAR_LINEAR_CORNERS_PLUS1;
57  return Options::FVAR_LINEAR_CORNERS_PLUS2;
59  return Options::FVAR_LINEAR_BOUNDARIES;
61  return Options::FVAR_LINEAR_ALL;
62  }
63  assert(!"Unknown fvar linear interpolation passed via C-API");
64  return Options::FVAR_LINEAR_NONE;
65 }
66 
68  OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation)
69 {
70  typedef OpenSubdiv::Sdc::Options Options;
71  switch (linear_interpolation) {
72  case Options::FVAR_LINEAR_NONE:
74  case Options::FVAR_LINEAR_CORNERS_ONLY:
76  case Options::FVAR_LINEAR_CORNERS_PLUS1:
78  case Options::FVAR_LINEAR_CORNERS_PLUS2:
80  case Options::FVAR_LINEAR_BOUNDARIES:
82  case Options::FVAR_LINEAR_ALL:
84  }
85  assert(!"Unknown fvar linear interpolation passed via C-API");
87 }
88 
89 OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI(
90  OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation)
91 {
92  using OpenSubdiv::Sdc::Options;
93 
94  switch (boundary_interpolation) {
96  return Options::VTX_BOUNDARY_NONE;
98  return Options::VTX_BOUNDARY_EDGE_ONLY;
100  return Options::VTX_BOUNDARY_EDGE_AND_CORNER;
101  }
102  assert(!"Unknown veretx boundary interpolation.");
103  return Options::VTX_BOUNDARY_EDGE_ONLY;
104 }
105 
106 } // namespace opensubdiv
107 } // namespace blender
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
static void linear_interpolation(const T &a, const T &b, MutableSpan< T > dst)
OpenSubdiv_FVarLinearInterpolation getCAPIFVarLinearInterpolationFromOSD(OpenSubdiv::Sdc::Options::FVarLinearInterpolation linear_interpolation)
Definition: type_convert.cc:67
OpenSubdiv::Sdc::Options::VtxBoundaryInterpolation getVtxBoundaryInterpolationFromCAPI(OpenSubdiv_VtxBoundaryInterpolation boundary_interpolation)
Definition: type_convert.cc:89
OpenSubdiv::Sdc::SchemeType getSchemeTypeFromCAPI(OpenSubdiv_SchemeType type)
Definition: type_convert.cc:31
OpenSubdiv::Sdc::Options::FVarLinearInterpolation getFVarLinearInterpolationFromCAPI(OpenSubdiv_FVarLinearInterpolation linear_interpolation)
Definition: type_convert.cc:45
OpenSubdiv_FVarLinearInterpolation
@ OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY
@ OSD_FVAR_LINEAR_INTERPOLATION_ALL
@ OSD_FVAR_LINEAR_INTERPOLATION_NONE
@ OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS1
@ OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES
@ OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_PLUS2
OpenSubdiv_VtxBoundaryInterpolation
@ OSD_VTX_BOUNDARY_NONE
@ OSD_VTX_BOUNDARY_EDGE_AND_CORNER
@ OSD_VTX_BOUNDARY_EDGE_ONLY
OpenSubdiv_SchemeType
@ OSD_SCHEME_CATMARK
@ OSD_SCHEME_BILINEAR
@ OSD_SCHEME_LOOP