ClangFormat: apply to source, most of intern
[blender.git] / intern / openvdb / openvdb_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 __OPENVDB_CAPI_H__
21 #define __OPENVDB_CAPI_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 struct OpenVDBReader;
28 struct OpenVDBWriter;
29 struct OpenVDBFloatGrid;
30 struct OpenVDBIntGrid;
31 struct OpenVDBVectorGrid;
32
33 int OpenVDB_getVersionHex(void);
34
35 enum {
36   VEC_INVARIANT = 0,
37   VEC_COVARIANT = 1,
38   VEC_COVARIANT_NORMALIZE = 2,
39   VEC_CONTRAVARIANT_RELATIVE = 3,
40   VEC_CONTRAVARIANT_ABSOLUTE = 4,
41 };
42
43 struct OpenVDBFloatGrid *OpenVDB_export_grid_fl(struct OpenVDBWriter *writer,
44                                                 const char *name,
45                                                 float *data,
46                                                 const int res[3],
47                                                 float matrix[4][4],
48                                                 const float clipping,
49                                                 struct OpenVDBFloatGrid *mask);
50
51 struct OpenVDBIntGrid *OpenVDB_export_grid_ch(struct OpenVDBWriter *writer,
52                                               const char *name,
53                                               unsigned char *data,
54                                               const int res[3],
55                                               float matrix[4][4],
56                                               const float clipping,
57                                               struct OpenVDBFloatGrid *mask);
58
59 struct OpenVDBVectorGrid *OpenVDB_export_grid_vec(struct OpenVDBWriter *writer,
60                                                   const char *name,
61                                                   const float *data_x,
62                                                   const float *data_y,
63                                                   const float *data_z,
64                                                   const int res[3],
65                                                   float matrix[4][4],
66                                                   short vec_type,
67                                                   const float clipping,
68                                                   const bool is_color,
69                                                   struct OpenVDBFloatGrid *mask);
70
71 void OpenVDB_import_grid_fl(struct OpenVDBReader *reader,
72                             const char *name,
73                             float **data,
74                             const int res[3]);
75
76 void OpenVDB_import_grid_ch(struct OpenVDBReader *reader,
77                             const char *name,
78                             unsigned char **data,
79                             const int res[3]);
80
81 void OpenVDB_import_grid_vec(struct OpenVDBReader *reader,
82                              const char *name,
83                              float **data_x,
84                              float **data_y,
85                              float **data_z,
86                              const int res[3]);
87
88 struct OpenVDBWriter *OpenVDBWriter_create(void);
89 void OpenVDBWriter_free(struct OpenVDBWriter *writer);
90 void OpenVDBWriter_set_flags(struct OpenVDBWriter *writer, const int flag, const bool half);
91 void OpenVDBWriter_add_meta_fl(struct OpenVDBWriter *writer, const char *name, const float value);
92 void OpenVDBWriter_add_meta_int(struct OpenVDBWriter *writer, const char *name, const int value);
93 void OpenVDBWriter_add_meta_v3(struct OpenVDBWriter *writer,
94                                const char *name,
95                                const float value[3]);
96 void OpenVDBWriter_add_meta_v3_int(struct OpenVDBWriter *writer,
97                                    const char *name,
98                                    const int value[3]);
99 void OpenVDBWriter_add_meta_mat4(struct OpenVDBWriter *writer,
100                                  const char *name,
101                                  float value[4][4]);
102 void OpenVDBWriter_write(struct OpenVDBWriter *writer, const char *filename);
103
104 struct OpenVDBReader *OpenVDBReader_create(void);
105 void OpenVDBReader_free(struct OpenVDBReader *reader);
106 void OpenVDBReader_open(struct OpenVDBReader *reader, const char *filename);
107 void OpenVDBReader_get_meta_fl(struct OpenVDBReader *reader, const char *name, float *value);
108 void OpenVDBReader_get_meta_int(struct OpenVDBReader *reader, const char *name, int *value);
109 void OpenVDBReader_get_meta_v3(struct OpenVDBReader *reader, const char *name, float value[3]);
110 void OpenVDBReader_get_meta_v3_int(struct OpenVDBReader *reader, const char *name, int value[3]);
111 void OpenVDBReader_get_meta_mat4(struct OpenVDBReader *reader,
112                                  const char *name,
113                                  float value[4][4]);
114
115 #ifdef __cplusplus
116 }
117 #endif
118
119 #endif /* __OPENVDB_CAPI_H__ */