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