Cleanup: fix compiler warnings.
[blender.git] / intern / opensubdiv / opensubdiv_converter_capi.h
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) 2015 Blender Foundation.
17  * All rights reserved.
18  */
19
20 #ifndef __OPENSUBDIV_CONVERTER_CAPI_H__
21 #define __OPENSUBDIV_CONVERTER_CAPI_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 struct OpenSubdiv_TopologyRefinerDescr;
28 typedef struct OpenSubdiv_TopologyRefinerDescr OpenSubdiv_TopologyRefinerDescr;
29
30 typedef struct OpenSubdiv_Converter OpenSubdiv_Converter;
31
32 typedef enum OpenSubdiv_SchemeType {
33         OSD_SCHEME_BILINEAR,
34         OSD_SCHEME_CATMARK,
35         OSD_SCHEME_LOOP,
36 } OpenSubdiv_SchemeType;
37
38 typedef enum OpenSubdiv_FVarLinearInterpolation {
39         OSD_FVAR_LINEAR_INTERPOLATION_NONE,
40         OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY,
41         OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES,
42         OSD_FVAR_LINEAR_INTERPOLATION_ALL,
43 } OpenSubdiv_FVarLinearInterpolation;
44
45 typedef struct OpenSubdiv_Converter {
46         /* TODO(sergey): Needs to be implemented. */
47         /* OpenSubdiv::Sdc::Options get_options() const; */
48
49         OpenSubdiv_SchemeType (*get_scheme_type)(
50                 const OpenSubdiv_Converter *converter);
51
52         OpenSubdiv_FVarLinearInterpolation (*get_fvar_linear_interpolation)(
53                 const OpenSubdiv_Converter *converter);
54
55         int (*get_num_faces)(const OpenSubdiv_Converter *converter);
56         int (*get_num_edges)(const OpenSubdiv_Converter *converter);
57         int (*get_num_verts)(const OpenSubdiv_Converter *converter);
58
59         /* Face relationships. */
60         int (*get_num_face_verts)(const OpenSubdiv_Converter *converter,
61                                   int face);
62         void (*get_face_verts)(const OpenSubdiv_Converter *converter,
63                                int face,
64                                int *face_verts);
65         void (*get_face_edges)(const OpenSubdiv_Converter *converter,
66                                int face,
67                                int *face_edges);
68
69         /* Edge relationships. */
70         void (*get_edge_verts)(const OpenSubdiv_Converter *converter,
71                                int edge,
72                                int *edge_verts);
73         int (*get_num_edge_faces)(const OpenSubdiv_Converter *converter,
74                                   int edge);
75         void (*get_edge_faces)(const OpenSubdiv_Converter *converter,
76                                int edge,
77                                int *edge_faces);
78         float (*get_edge_sharpness)(const OpenSubdiv_Converter *converter,
79                                     int edge);
80
81         /* Vertex relationships. */
82         int (*get_num_vert_edges)(const OpenSubdiv_Converter *converter, int vert);
83         void (*get_vert_edges)(const OpenSubdiv_Converter *converter,
84                                int vert,
85                                int *vert_edges);
86         int (*get_num_vert_faces)(const OpenSubdiv_Converter *converter, int vert);
87         void (*get_vert_faces)(const OpenSubdiv_Converter *converter,
88                                int vert,
89                                int *vert_faces);
90
91         /* Face-varying data. */
92         int (*get_num_uv_layers)(const OpenSubdiv_Converter *converter);
93
94         void (*precalc_uv_layer)(const OpenSubdiv_Converter *converter, int layer);
95         void (*finish_uv_layer)(const OpenSubdiv_Converter *converter);
96
97         int (*get_num_uvs)(const OpenSubdiv_Converter *converter);
98         void (*get_uvs)(const OpenSubdiv_Converter *converter, float *uvs);
99
100         int (*get_face_corner_uv_index)(const OpenSubdiv_Converter *converter,
101                                         int face,
102                                         int corner);
103
104         /* User data associated with this converter. */
105         void (*free_user_data)(const OpenSubdiv_Converter *converter);
106         void *user_data;
107 } OpenSubdiv_Converter;
108
109 OpenSubdiv_TopologyRefinerDescr *openSubdiv_createTopologyRefinerDescr(
110         OpenSubdiv_Converter *converter);
111
112 void openSubdiv_deleteTopologyRefinerDescr(
113         OpenSubdiv_TopologyRefinerDescr *topology_refiner);
114
115 /* TODO(sergey): Those calls are not strictly related to conversion.
116  * needs some dedicated file perhaps.
117  */
118
119 int openSubdiv_topologyRefinerGetSubdivLevel(
120         const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
121
122 int openSubdiv_topologyRefinerGetNumVerts(
123         const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
124
125 int openSubdiv_topologyRefinerGetNumEdges(
126         const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
127
128 int openSubdiv_topologyRefinerGetNumFaces(
129         const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
130
131 int openSubdiv_topologyRefinerGetNumFaceVerts(
132         const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
133         int face);
134
135 int openSubdiv_topologyRefnerCompareConverter(
136         const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
137         OpenSubdiv_Converter *converter);
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif  /* __OPENSUBDIV_CONVERTER_CAPI_H__ */