Subversion Repositories gelsvn

Rev

Rev 443 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 443 Rev 595
-
 
1
/**
-
 
2
 * @file rply.h
-
 
3
 * @brief RPly library, read/write PLY files by Diego Nehab, Princeton University
-
 
4
 */
1
#ifndef __GEOMETRY_PLY_H
5
#ifndef __GEOMETRY_PLY_H
2
#define __GEOMETRY_PLY_H
6
#define __GEOMETRY_PLY_H
3
/* ----------------------------------------------------------------------
7
/* ----------------------------------------------------------------------
4
 * RPly library, read/write PLY files
8
 * RPly library, read/write PLY files
5
 * Diego Nehab, Princeton University
9
 * Diego Nehab, Princeton University
6
 * http://www.cs.princeton.edu/~diego/professional/rply
10
 * http://www.cs.princeton.edu/~diego/professional/rply
7
 *
11
 *
8
 * This library is distributed under the MIT License. See notice
12
 * This library is distributed under the MIT License. See notice
9
 * at the end of this file.
13
 * at the end of this file.
10
 * ---------------------------------------------------------------------- */
14
 * ---------------------------------------------------------------------- */
11
 
15
 
12
#ifdef __cplusplus
16
#ifdef __cplusplus
13
extern "C" {
17
extern "C" {
14
#endif
18
#endif
15
 
19
 
16
#define RPLY_VERSION   "RPly 1.01"
20
#define RPLY_VERSION   "RPly 1.01"
17
#define RPLY_COPYRIGHT "Copyright (C) 2003-2005 Diego Nehab"
21
#define RPLY_COPYRIGHT "Copyright (C) 2003-2005 Diego Nehab"
18
#define RPLY_AUTHORS   "Diego Nehab"
22
#define RPLY_AUTHORS   "Diego Nehab"
19
 
23
 
20
/* ----------------------------------------------------------------------
24
/* ----------------------------------------------------------------------
21
 * Types
25
 * Types
22
 * ---------------------------------------------------------------------- */
26
 * ---------------------------------------------------------------------- */
23
/* structures are opaque */
27
/* structures are opaque */
24
typedef struct t_ply_ *p_ply;
28
typedef struct t_ply_ *p_ply;
25
typedef struct t_ply_element_ *p_ply_element;
29
typedef struct t_ply_element_ *p_ply_element;
26
typedef struct t_ply_property_ *p_ply_property;
30
typedef struct t_ply_property_ *p_ply_property;
27
typedef struct t_ply_argument_ *p_ply_argument;
31
typedef struct t_ply_argument_ *p_ply_argument;
28
 
32
 
29
/* ply format mode type */
33
/* ply format mode type */
30
typedef enum e_ply_storage_mode_ {
34
typedef enum e_ply_storage_mode_ {
31
    PLY_BIG_ENDIAN,
35
    PLY_BIG_ENDIAN,
32
    PLY_LITTLE_ENDIAN,
36
    PLY_LITTLE_ENDIAN,
33
    PLY_ASCII,   
37
    PLY_ASCII,   
34
    PLY_DEFAULT      /* has to be the last in enum */
38
    PLY_DEFAULT      /* has to be the last in enum */
35
} e_ply_storage_mode; /* order matches ply_storage_mode_list */
39
} e_ply_storage_mode; /* order matches ply_storage_mode_list */
36
 
40
 
37
/* ply data type */
41
/* ply data type */
38
typedef enum e_ply_type {
42
typedef enum e_ply_type {
39
    PLY_INT8, PLY_UINT8, PLY_INT16, PLY_UINT16, 
43
    PLY_INT8, PLY_UINT8, PLY_INT16, PLY_UINT16, 
40
    PLY_INT32, PLY_UIN32, PLY_FLOAT32, PLY_FLOAT64,
44
    PLY_INT32, PLY_UIN32, PLY_FLOAT32, PLY_FLOAT64,
41
    PLY_CHAR, PLY_UCHAR, PLY_SHORT, PLY_USHORT,
45
    PLY_CHAR, PLY_UCHAR, PLY_SHORT, PLY_USHORT,
42
    PLY_INT, PLY_UINT, PLY_FLOAT, PLY_DOUBLE,
46
    PLY_INT, PLY_UINT, PLY_FLOAT, PLY_DOUBLE,
43
    PLY_LIST    /* has to be the last in enum */
47
    PLY_LIST    /* has to be the last in enum */
44
} e_ply_type;   /* order matches ply_type_list */
48
} e_ply_type;   /* order matches ply_type_list */
45
 
49
 
46
/* ----------------------------------------------------------------------
50
/* ----------------------------------------------------------------------
47
 * Property reading callback prototype
51
 * Property reading callback prototype
48
 *
52
 *
49
 * message: error message
53
 * message: error message
50
 * ---------------------------------------------------------------------- */
54
 * ---------------------------------------------------------------------- */
51
typedef void (*p_ply_error_cb)(const char *message);
55
typedef void (*p_ply_error_cb)(const char *message);
52
 
56
 
53
/* ----------------------------------------------------------------------
57
/* ----------------------------------------------------------------------
54
 * Opens a ply file for reading (fails if file is not a ply file)
58
 * Opens a ply file for reading (fails if file is not a ply file)
55
 *
59
 *
56
 * error_cb: error callback function
60
 * error_cb: error callback function
57
 * name: file name
61
 * name: file name
58
 *
62
 *
59
 * Returns 1 if successful, 0 otherwise
63
 * Returns 1 if successful, 0 otherwise
60
 * ---------------------------------------------------------------------- */
64
 * ---------------------------------------------------------------------- */
61
p_ply ply_open(const char *name, p_ply_error_cb error_cb);
65
p_ply ply_open(const char *name, p_ply_error_cb error_cb);
62
 
66
 
63
/* ----------------------------------------------------------------------
67
/* ----------------------------------------------------------------------
64
 * Reads and parses the header of a ply file returned by ply_open
68
 * Reads and parses the header of a ply file returned by ply_open
65
 *
69
 *
66
 * ply: handle returned by ply_open
70
 * ply: handle returned by ply_open
67
 *
71
 *
68
 * Returns 1 if successfull, 0 otherwise
72
 * Returns 1 if successfull, 0 otherwise
69
 * ---------------------------------------------------------------------- */
73
 * ---------------------------------------------------------------------- */
70
int ply_read_header(p_ply ply);
74
int ply_read_header(p_ply ply);
71
 
75
 
72
/* ----------------------------------------------------------------------
76
/* ----------------------------------------------------------------------
73
 * Property reading callback prototype
77
 * Property reading callback prototype
74
 *
78
 *
75
 * argument: parameters for property being processed when callback is called
79
 * argument: parameters for property being processed when callback is called
76
 *
80
 *
77
 * Returns 1 if should continue processing file, 0 if should abort.
81
 * Returns 1 if should continue processing file, 0 if should abort.
78
 * ---------------------------------------------------------------------- */
82
 * ---------------------------------------------------------------------- */
79
typedef int (*p_ply_read_cb)(p_ply_argument argument);
83
typedef int (*p_ply_read_cb)(p_ply_argument argument);
80
 
84
 
81
/* ----------------------------------------------------------------------
85
/* ----------------------------------------------------------------------
82
 * Sets up callbacks for property reading after header was parsed
86
 * Sets up callbacks for property reading after header was parsed
83
 *
87
 *
84
 * ply: handle returned by ply_open
88
 * ply: handle returned by ply_open
85
 * element_name: element where property is
89
 * element_name: element where property is
86
 * property_name: property to associate element with
90
 * property_name: property to associate element with
87
 * read_cb: function to be called for each property value
91
 * read_cb: function to be called for each property value
88
 * pdata/idata: user data that will be passed to callback
92
 * pdata/idata: user data that will be passed to callback
89
 *
93
 *
90
 * Returns 0 if no element or no property in element, returns the
94
 * Returns 0 if no element or no property in element, returns the
91
 * number of element instances otherwise. 
95
 * number of element instances otherwise. 
92
 * ---------------------------------------------------------------------- */
96
 * ---------------------------------------------------------------------- */
93
long ply_set_read_cb(p_ply ply, const char *element_name, 
97
int ply_set_read_cb(p_ply ply, const char *element_name, 
94
        const char *property_name, p_ply_read_cb read_cb, 
98
        const char *property_name, p_ply_read_cb read_cb, 
95
        void *pdata, long idata);
99
        void *pdata, int idata);
96
 
100
 
97
/* ----------------------------------------------------------------------
101
/* ----------------------------------------------------------------------
98
 * Returns information about the element originating a callback
102
 * Returns information about the element originating a callback
99
 *
103
 *
100
 * argument: handle to argument 
104
 * argument: handle to argument 
101
 * element: receives a the element handle (if non-null)
105
 * element: receives a the element handle (if non-null)
102
 * instance_index: receives the index of the current element instance 
106
 * instance_index: receives the index of the current element instance 
103
 *     (if non-null)
107
 *     (if non-null)
104
 *
108
 *
105
 * Returns 1 if successfull, 0 otherwise
109
 * Returns 1 if successfull, 0 otherwise
106
 * ---------------------------------------------------------------------- */
110
 * ---------------------------------------------------------------------- */
107
int ply_get_argument_element(p_ply_argument argument, 
111
int ply_get_argument_element(p_ply_argument argument, 
108
        p_ply_element *element, long *instance_index);
112
        p_ply_element *element, int *instance_index);
109
 
113
 
110
/* ----------------------------------------------------------------------
114
/* ----------------------------------------------------------------------
111
 * Returns information about the property originating a callback
115
 * Returns information about the property originating a callback
112
 *
116
 *
113
 * argument: handle to argument 
117
 * argument: handle to argument 
114
 * property: receives the property handle (if non-null)
118
 * property: receives the property handle (if non-null)
115
 * length: receives the number of values in this property (if non-null)
119
 * length: receives the number of values in this property (if non-null)
116
 * value_index: receives the index of current property value (if non-null)
120
 * value_index: receives the index of current property value (if non-null)
117
 *
121
 *
118
 * Returns 1 if successfull, 0 otherwise
122
 * Returns 1 if successfull, 0 otherwise
119
 * ---------------------------------------------------------------------- */
123
 * ---------------------------------------------------------------------- */
120
int ply_get_argument_property(p_ply_argument argument, 
124
int ply_get_argument_property(p_ply_argument argument, 
121
        p_ply_property *property, long *length, long *value_index);
125
        p_ply_property *property, int *length, int *value_index);
122
 
126
 
123
/* ----------------------------------------------------------------------
127
/* ----------------------------------------------------------------------
124
 * Returns user data associated with callback 
128
 * Returns user data associated with callback 
125
 *
129
 *
126
 * pdata: receives a copy of user custom data pointer (if non-null)
130
 * pdata: receives a copy of user custom data pointer (if non-null)
127
 * idata: receives a copy of user custom data integer (if non-null)
131
 * idata: receives a copy of user custom data integer (if non-null)
128
 *
132
 *
129
 * Returns 1 if successfull, 0 otherwise
133
 * Returns 1 if successfull, 0 otherwise
130
 * ---------------------------------------------------------------------- */
134
 * ---------------------------------------------------------------------- */
131
int ply_get_argument_user_data(p_ply_argument argument, void **pdata, 
135
int ply_get_argument_user_data(p_ply_argument argument, void **pdata, 
132
        long *idata);
136
        int *idata);
133
 
137
 
134
/* ----------------------------------------------------------------------
138
/* ----------------------------------------------------------------------
135
 * Returns the value associated with a callback
139
 * Returns the value associated with a callback
136
 *
140
 *
137
 * argument: handle to argument 
141
 * argument: handle to argument 
138
 *
142
 *
139
 * Returns the current data item
143
 * Returns the current data item
140
 * ---------------------------------------------------------------------- */
144
 * ---------------------------------------------------------------------- */
141
double ply_get_argument_value(p_ply_argument argument); 
145
double ply_get_argument_value(p_ply_argument argument); 
142
 
146
 
143
/* ----------------------------------------------------------------------
147
/* ----------------------------------------------------------------------
144
 * Reads all elements and properties calling the callbacks defined with
148
 * Reads all elements and properties calling the callbacks defined with
145
 * calls to ply_set_read_cb
149
 * calls to ply_set_read_cb
146
 *
150
 *
147
 * ply: handle returned by ply_open
151
 * ply: handle returned by ply_open
148
 *
152
 *
149
 * Returns 1 if successfull, 0 otherwise
153
 * Returns 1 if successfull, 0 otherwise
150
 * ---------------------------------------------------------------------- */
154
 * ---------------------------------------------------------------------- */
151
int ply_read(p_ply ply);
155
int ply_read(p_ply ply);
152
 
156
 
153
/* ----------------------------------------------------------------------
157
/* ----------------------------------------------------------------------
154
 * Iterates over all elements by returning the next element.
158
 * Iterates over all elements by returning the next element.
155
 * Call with NULL to return handle to first element.
159
 * Call with NULL to return handle to first element.
156
 *
160
 *
157
 * ply: handle returned by ply_open
161
 * ply: handle returned by ply_open
158
 * last: handle of last element returned (NULL for first element)
162
 * last: handle of last element returned (NULL for first element)
159
 *
163
 *
160
 * Returns element if successfull or NULL if no more elements
164
 * Returns element if successfull or NULL if no more elements
161
 * ---------------------------------------------------------------------- */
165
 * ---------------------------------------------------------------------- */
162
p_ply_element ply_get_next_element(p_ply ply, p_ply_element last);
166
p_ply_element ply_get_next_element(p_ply ply, p_ply_element last);
163
 
167
 
164
/* ----------------------------------------------------------------------
168
/* ----------------------------------------------------------------------
165
 * Iterates over all comments by returning the next comment.
169
 * Iterates over all comments by returning the next comment.
166
 * Call with NULL to return pointer to first comment.
170
 * Call with NULL to return pointer to first comment.
167
 *
171
 *
168
 * ply: handle returned by ply_open
172
 * ply: handle returned by ply_open
169
 * last: pointer to last comment returned (NULL for first comment)
173
 * last: pointer to last comment returned (NULL for first comment)
170
 *
174
 *
171
 * Returns comment if successfull or NULL if no more comments
175
 * Returns comment if successfull or NULL if no more comments
172
 * ---------------------------------------------------------------------- */
176
 * ---------------------------------------------------------------------- */
173
const char *ply_get_next_comment(p_ply ply, const char *last);
177
const char *ply_get_next_comment(p_ply ply, const char *last);
174
 
178
 
175
/* ----------------------------------------------------------------------
179
/* ----------------------------------------------------------------------
176
 * Iterates over all obj_infos by returning the next obj_info.
180
 * Iterates over all obj_infos by returning the next obj_info.
177
 * Call with NULL to return pointer to first obj_info.
181
 * Call with NULL to return pointer to first obj_info.
178
 *
182
 *
179
 * ply: handle returned by ply_open
183
 * ply: handle returned by ply_open
180
 * last: pointer to last obj_info returned (NULL for first obj_info)
184
 * last: pointer to last obj_info returned (NULL for first obj_info)
181
 *
185
 *
182
 * Returns obj_info if successfull or NULL if no more obj_infos
186
 * Returns obj_info if successfull or NULL if no more obj_infos
183
 * ---------------------------------------------------------------------- */
187
 * ---------------------------------------------------------------------- */
184
const char *ply_get_next_obj_info(p_ply ply, const char *last);
188
const char *ply_get_next_obj_info(p_ply ply, const char *last);
185
 
189
 
186
/* ----------------------------------------------------------------------
190
/* ----------------------------------------------------------------------
187
 * Returns information about an element
191
 * Returns information about an element
188
 *
192
 *
189
 * element: element of interest
193
 * element: element of interest
190
 * name: receives a pointer to internal copy of element name (if non-null)
194
 * name: receives a pointer to internal copy of element name (if non-null)
191
 * ninstances: receives the number of instances of this element (if non-null)
195
 * ninstances: receives the number of instances of this element (if non-null)
192
 *
196
 *
193
 * Returns 1 if successfull or 0 otherwise
197
 * Returns 1 if successfull or 0 otherwise
194
 * ---------------------------------------------------------------------- */
198
 * ---------------------------------------------------------------------- */
195
int ply_get_element_info(p_ply_element element, const char** name,
199
int ply_get_element_info(p_ply_element element, const char** name,
196
        long *ninstances);
200
        int *ninstances);
197
 
201
 
198
/* ----------------------------------------------------------------------
202
/* ----------------------------------------------------------------------
199
 * Iterates over all properties by returning the next property.
203
 * Iterates over all properties by returning the next property.
200
 * Call with NULL to return handle to first property.
204
 * Call with NULL to return handle to first property.
201
 *
205
 *
202
 * element: handle of element with the properties of interest
206
 * element: handle of element with the properties of interest
203
 * last: handle of last property returned (NULL for first property)
207
 * last: handle of last property returned (NULL for first property)
204
 *
208
 *
205
 * Returns element if successfull or NULL if no more properties
209
 * Returns element if successfull or NULL if no more properties
206
 * ---------------------------------------------------------------------- */
210
 * ---------------------------------------------------------------------- */
207
p_ply_property ply_get_next_property(p_ply_element element, 
211
p_ply_property ply_get_next_property(p_ply_element element, 
208
        p_ply_property last);
212
        p_ply_property last);
209
 
213
 
210
/* ----------------------------------------------------------------------
214
/* ----------------------------------------------------------------------
211
 * Returns information about a property
215
 * Returns information about a property
212
 *
216
 *
213
 * property: handle to property of interest
217
 * property: handle to property of interest
214
 * name: receives a pointer to internal copy of property name (if non-null)
218
 * name: receives a pointer to internal copy of property name (if non-null)
215
 * type: receives the property type (if non-null)
219
 * type: receives the property type (if non-null)
216
 * length_type: for list properties, receives the scalar type of
220
 * length_type: for list properties, receives the scalar type of
217
 *     the length field (if non-null)
221
 *     the length field (if non-null)
218
 * value_type: for list properties, receives the scalar type of the value 
222
 * value_type: for list properties, receives the scalar type of the value 
219
 *     fields  (if non-null)
223
 *     fields  (if non-null)
220
 *
224
 *
221
 * Returns 1 if successfull or 0 otherwise
225
 * Returns 1 if successfull or 0 otherwise
222
 * ---------------------------------------------------------------------- */
226
 * ---------------------------------------------------------------------- */
223
int ply_get_property_info(p_ply_property property, const char** name,
227
int ply_get_property_info(p_ply_property property, const char** name,
224
        e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type);
228
        e_ply_type *type, e_ply_type *length_type, e_ply_type *value_type);
225
 
229
 
226
/* ----------------------------------------------------------------------
230
/* ----------------------------------------------------------------------
227
 * Creates new ply file
231
 * Creates new ply file
228
 *
232
 *
229
 * name: file name
233
 * name: file name
230
 * storage_mode: file format mode
234
 * storage_mode: file format mode
231
 *
235
 *
232
 * Returns handle to ply file if successfull, NULL otherwise
236
 * Returns handle to ply file if successfull, NULL otherwise
233
 * ---------------------------------------------------------------------- */
237
 * ---------------------------------------------------------------------- */
234
p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, 
238
p_ply ply_create(const char *name, e_ply_storage_mode storage_mode, 
235
        p_ply_error_cb error_cb);
239
        p_ply_error_cb error_cb);
236
 
240
 
237
/* ----------------------------------------------------------------------
241
/* ----------------------------------------------------------------------
238
 * Adds a new element to the ply file created by ply_create
242
 * Adds a new element to the ply file created by ply_create
239
 *
243
 *
240
 * ply: handle returned by ply_create
244
 * ply: handle returned by ply_create
241
 * name: name of new element
245
 * name: name of new element
242
 * ninstances: number of element of this time in file
246
 * ninstances: number of element of this time in file
243
 *
247
 *
244
 * Returns 1 if successfull, 0 otherwise
248
 * Returns 1 if successfull, 0 otherwise
245
 * ---------------------------------------------------------------------- */
249
 * ---------------------------------------------------------------------- */
246
int ply_add_element(p_ply ply, const char *name, long ninstances);
250
int ply_add_element(p_ply ply, const char *name, int ninstances);
247
 
251
 
248
/* ----------------------------------------------------------------------
252
/* ----------------------------------------------------------------------
249
 * Adds a new property to the last element added by ply_add_element
253
 * Adds a new property to the last element added by ply_add_element
250
 *
254
 *
251
 * ply: handle returned by ply_create
255
 * ply: handle returned by ply_create
252
 * name: name of new property
256
 * name: name of new property
253
 * type: property type
257
 * type: property type
254
 * length_type: scalar type of length field of a list property 
258
 * length_type: scalar type of length field of a list property 
255
 * value_type: scalar type of value fields of a list property
259
 * value_type: scalar type of value fields of a list property
256
 *
260
 *
257
 * Returns 1 if successfull, 0 otherwise
261
 * Returns 1 if successfull, 0 otherwise
258
 * ---------------------------------------------------------------------- */
262
 * ---------------------------------------------------------------------- */
259
int ply_add_property(p_ply ply, const char *name, e_ply_type type,
263
int ply_add_property(p_ply ply, const char *name, e_ply_type type,
260
        e_ply_type length_type, e_ply_type value_type);
264
        e_ply_type length_type, e_ply_type value_type);
261
 
265
 
262
/* ----------------------------------------------------------------------
266
/* ----------------------------------------------------------------------
263
 * Adds a new list property to the last element added by ply_add_element
267
 * Adds a new list property to the last element added by ply_add_element
264
 *
268
 *
265
 * ply: handle returned by ply_create
269
 * ply: handle returned by ply_create
266
 * name: name of new property
270
 * name: name of new property
267
 * length_type: scalar type of length field of a list property 
271
 * length_type: scalar type of length field of a list property 
268
 * value_type: scalar type of value fields of a list property
272
 * value_type: scalar type of value fields of a list property
269
 *
273
 *
270
 * Returns 1 if successfull, 0 otherwise
274
 * Returns 1 if successfull, 0 otherwise
271
 * ---------------------------------------------------------------------- */
275
 * ---------------------------------------------------------------------- */
272
int ply_add_list_property(p_ply ply, const char *name, 
276
int ply_add_list_property(p_ply ply, const char *name, 
273
        e_ply_type length_type, e_ply_type value_type);
277
        e_ply_type length_type, e_ply_type value_type);
274
 
278
 
275
/* ----------------------------------------------------------------------
279
/* ----------------------------------------------------------------------
276
 * Adds a new property to the last element added by ply_add_element
280
 * Adds a new property to the last element added by ply_add_element
277
 *
281
 *
278
 * ply: handle returned by ply_create
282
 * ply: handle returned by ply_create
279
 * name: name of new property
283
 * name: name of new property
280
 * type: property type
284
 * type: property type
281
 *
285
 *
282
 * Returns 1 if successfull, 0 otherwise
286
 * Returns 1 if successfull, 0 otherwise
283
 * ---------------------------------------------------------------------- */
287
 * ---------------------------------------------------------------------- */
284
int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type);
288
int ply_add_scalar_property(p_ply ply, const char *name, e_ply_type type);
285
 
289
 
286
/* ----------------------------------------------------------------------
290
/* ----------------------------------------------------------------------
287
 * Adds a new comment item 
291
 * Adds a new comment item 
288
 *
292
 *
289
 * ply: handle returned by ply_create
293
 * ply: handle returned by ply_create
290
 * comment: pointer to string with comment text
294
 * comment: pointer to string with comment text
291
 *
295
 *
292
 * Returns 1 if successfull, 0 otherwise
296
 * Returns 1 if successfull, 0 otherwise
293
 * ---------------------------------------------------------------------- */
297
 * ---------------------------------------------------------------------- */
294
int ply_add_comment(p_ply ply, const char *comment);
298
int ply_add_comment(p_ply ply, const char *comment);
295
 
299
 
296
/* ----------------------------------------------------------------------
300
/* ----------------------------------------------------------------------
297
 * Adds a new obj_info item 
301
 * Adds a new obj_info item 
298
 *
302
 *
299
 * ply: handle returned by ply_create
303
 * ply: handle returned by ply_create
300
 * comment: pointer to string with obj_info data
304
 * comment: pointer to string with obj_info data
301
 *
305
 *
302
 * Returns 1 if successfull, 0 otherwise
306
 * Returns 1 if successfull, 0 otherwise
303
 * ---------------------------------------------------------------------- */
307
 * ---------------------------------------------------------------------- */
304
int ply_add_obj_info(p_ply ply, const char *obj_info);
308
int ply_add_obj_info(p_ply ply, const char *obj_info);
305
 
309
 
306
/* ----------------------------------------------------------------------
310
/* ----------------------------------------------------------------------
307
 * Writes the ply file header after all element and properties have been
311
 * Writes the ply file header after all element and properties have been
308
 * defined by calls to ply_add_element and ply_add_property
312
 * defined by calls to ply_add_element and ply_add_property
309
 *
313
 *
310
 * ply: handle returned by ply_create
314
 * ply: handle returned by ply_create
311
 *
315
 *
312
 * Returns 1 if successfull, 0 otherwise
316
 * Returns 1 if successfull, 0 otherwise
313
 * ---------------------------------------------------------------------- */
317
 * ---------------------------------------------------------------------- */
314
int ply_write_header(p_ply ply);
318
int ply_write_header(p_ply ply);
315
 
319
 
316
/* ----------------------------------------------------------------------
320
/* ----------------------------------------------------------------------
317
 * Writes one property value, in the order they should be written to the
321
 * Writes one property value, in the order they should be written to the
318
 * file. For each element type, write all elements of that type in order.
322
 * file. For each element type, write all elements of that type in order.
319
 * For each element, write all its properties in order. For scalar
323
 * For each element, write all its properties in order. For scalar
320
 * properties, just write the value. For list properties, write the length 
324
 * properties, just write the value. For list properties, write the length 
321
 * and then each of the values.
325
 * and then each of the values.
322
 *
326
 *
323
 * ply: handle returned by ply_create
327
 * ply: handle returned by ply_create
324
 *
328
 *
325
 * Returns 1 if successfull, 0 otherwise
329
 * Returns 1 if successfull, 0 otherwise
326
 * ---------------------------------------------------------------------- */
330
 * ---------------------------------------------------------------------- */
327
int ply_write(p_ply ply, double value);
331
int ply_write(p_ply ply, double value);
328
 
332
 
329
/* ----------------------------------------------------------------------
333
/* ----------------------------------------------------------------------
330
 * Closes a ply file handle. Releases all memory used by handle
334
 * Closes a ply file handle. Releases all memory used by handle
331
 *
335
 *
332
 * ply: handle to be closed. 
336
 * ply: handle to be closed. 
333
 *
337
 *
334
 * Returns 1 if successfull, 0 otherwise
338
 * Returns 1 if successfull, 0 otherwise
335
 * ---------------------------------------------------------------------- */
339
 * ---------------------------------------------------------------------- */
336
int ply_close(p_ply ply);
340
int ply_close(p_ply ply);
337
 
341
 
338
#ifdef __cplusplus
342
#ifdef __cplusplus
339
}
343
}
340
#endif
344
#endif
341
 
345
 
342
#endif /* RPLY_H */
346
#endif /* RPLY_H */
343
 
347
 
344
/* ----------------------------------------------------------------------
348
/* ----------------------------------------------------------------------
345
 * Copyright (C) 2003-2005 Diego Nehab. All rights reserved.
349
 * Copyright (C) 2003-2005 Diego Nehab. All rights reserved.
346
 *
350
 *
347
 * Permission is hereby granted, free of charge, to any person obtaining
351
 * Permission is hereby granted, free of charge, to any person obtaining
348
 * a copy of this software and associated documentation files (the
352
 * a copy of this software and associated documentation files (the
349
 * "Software"), to deal in the Software without restriction, including
353
 * "Software"), to deal in the Software without restriction, including
350
 * without limitation the rights to use, copy, modify, merge, publish,
354
 * without limitation the rights to use, copy, modify, merge, publish,
351
 * distribute, sublicense, and/or sell copies of the Software, and to
355
 * distribute, sublicense, and/or sell copies of the Software, and to
352
 * permit persons to whom the Software is furnished to do so, subject to
356
 * permit persons to whom the Software is furnished to do so, subject to
353
 * the following conditions:
357
 * the following conditions:
354
 *
358
 *
355
 * The above copyright notice and this permission notice shall be
359
 * The above copyright notice and this permission notice shall be
356
 * included in all copies or substantial portions of the Software.
360
 * included in all copies or substantial portions of the Software.
357
 *
361
 *
358
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
362
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
359
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
363
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
360
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
364
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
361
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
365
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
362
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
366
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
363
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
367
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
364
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
368
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
365
 * ---------------------------------------------------------------------- */
369
 * ---------------------------------------------------------------------- */
366
 
370