1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2015 Blender Foundation.
* All rights reserved.
*/
#ifndef __OPENSUBDIV_CONVERTER_CAPI_H__
#define __OPENSUBDIV_CONVERTER_CAPI_H__
#ifdef __cplusplus
extern "C" {
#endif
struct OpenSubdiv_TopologyRefinerDescr;
typedef struct OpenSubdiv_TopologyRefinerDescr OpenSubdiv_TopologyRefinerDescr;
typedef struct OpenSubdiv_Converter OpenSubdiv_Converter;
typedef enum OpenSubdiv_SchemeType {
OSD_SCHEME_BILINEAR,
OSD_SCHEME_CATMARK,
OSD_SCHEME_LOOP,
} OpenSubdiv_SchemeType;
typedef enum OpenSubdiv_FVarLinearInterpolation {
OSD_FVAR_LINEAR_INTERPOLATION_NONE,
OSD_FVAR_LINEAR_INTERPOLATION_CORNERS_ONLY,
OSD_FVAR_LINEAR_INTERPOLATION_BOUNDARIES,
OSD_FVAR_LINEAR_INTERPOLATION_ALL,
} OpenSubdiv_FVarLinearInterpolation;
typedef struct OpenSubdiv_Converter {
/* TODO(sergey): Needs to be implemented. */
/* OpenSubdiv::Sdc::Options get_options() const; */
OpenSubdiv_SchemeType (*get_scheme_type)(
const OpenSubdiv_Converter *converter);
OpenSubdiv_FVarLinearInterpolation (*get_fvar_linear_interpolation)(
const OpenSubdiv_Converter *converter);
int (*get_num_faces)(const OpenSubdiv_Converter *converter);
int (*get_num_edges)(const OpenSubdiv_Converter *converter);
int (*get_num_verts)(const OpenSubdiv_Converter *converter);
/* Face relationships. */
int (*get_num_face_verts)(const OpenSubdiv_Converter *converter,
int face);
void (*get_face_verts)(const OpenSubdiv_Converter *converter,
int face,
int *face_verts);
void (*get_face_edges)(const OpenSubdiv_Converter *converter,
int face,
int *face_edges);
/* Edge relationships. */
void (*get_edge_verts)(const OpenSubdiv_Converter *converter,
int edge,
int *edge_verts);
int (*get_num_edge_faces)(const OpenSubdiv_Converter *converter,
int edge);
void (*get_edge_faces)(const OpenSubdiv_Converter *converter,
int edge,
int *edge_faces);
float (*get_edge_sharpness)(const OpenSubdiv_Converter *converter,
int edge);
/* Vertex relationships. */
int (*get_num_vert_edges)(const OpenSubdiv_Converter *converter, int vert);
void (*get_vert_edges)(const OpenSubdiv_Converter *converter,
int vert,
int *vert_edges);
int (*get_num_vert_faces)(const OpenSubdiv_Converter *converter, int vert);
void (*get_vert_faces)(const OpenSubdiv_Converter *converter,
int vert,
int *vert_faces);
/* Face-varying data. */
int (*get_num_uv_layers)(const OpenSubdiv_Converter *converter);
void (*precalc_uv_layer)(const OpenSubdiv_Converter *converter, int layer);
void (*finish_uv_layer)(const OpenSubdiv_Converter *converter);
int (*get_num_uvs)(const OpenSubdiv_Converter *converter);
void (*get_uvs)(const OpenSubdiv_Converter *converter, float *uvs);
int (*get_face_corner_uv_index)(const OpenSubdiv_Converter *converter,
int face,
int corner);
/* User data associated with this converter. */
void (*free_user_data)(const OpenSubdiv_Converter *converter);
void *user_data;
} OpenSubdiv_Converter;
OpenSubdiv_TopologyRefinerDescr *openSubdiv_createTopologyRefinerDescr(
OpenSubdiv_Converter *converter);
void openSubdiv_deleteTopologyRefinerDescr(
OpenSubdiv_TopologyRefinerDescr *topology_refiner);
/* TODO(sergey): Those calls are not strictly related to conversion.
* needs some dedicated file perhaps.
*/
int openSubdiv_topologyRefinerGetSubdivLevel(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
int openSubdiv_topologyRefinerGetNumVerts(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
int openSubdiv_topologyRefinerGetNumEdges(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
int openSubdiv_topologyRefinerGetNumFaces(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner);
int openSubdiv_topologyRefinerGetNumFaceVerts(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
int face);
int openSubdiv_topologyRefnerCompareConverter(
const OpenSubdiv_TopologyRefinerDescr *topology_refiner,
OpenSubdiv_Converter *converter);
#ifdef __cplusplus
}
#endif
#endif /* __OPENSUBDIV_CONVERTER_CAPI_H__ */
|