| 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 | #ifndef __PLY_H__ |
|---|
| 34 | #define __PLY_H__ |
|---|
| 35 | |
|---|
| 36 | #ifdef __cplusplus |
|---|
| 37 | extern "C" { |
|---|
| 38 | #endif |
|---|
| 39 | |
|---|
| 40 | #include <stdio.h> |
|---|
| 41 | #include <stddef.h> |
|---|
| 42 | |
|---|
| 43 | #define PLY_ASCII 1 |
|---|
| 44 | #define PLY_BINARY_BE 2 |
|---|
| 45 | #define PLY_BINARY_LE 3 |
|---|
| 46 | |
|---|
| 47 | #define PLY_OKAY 0 |
|---|
| 48 | #define PLY_ERROR -1 |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | #define PLY_START_TYPE 0 |
|---|
| 53 | #define PLY_CHAR 1 |
|---|
| 54 | #define PLY_SHORT 2 |
|---|
| 55 | #define PLY_INT 3 |
|---|
| 56 | #define PLY_UCHAR 4 |
|---|
| 57 | #define PLY_USHORT 5 |
|---|
| 58 | #define PLY_UINT 6 |
|---|
| 59 | #define PLY_FLOAT 7 |
|---|
| 60 | #define PLY_DOUBLE 8 |
|---|
| 61 | #define PLY_FLOAT32 9 |
|---|
| 62 | #define PLY_UINT8 10 |
|---|
| 63 | #define PLY_INT32 11 |
|---|
| 64 | #define PLY_END_TYPE 12 |
|---|
| 65 | |
|---|
| 66 | #define PLY_SCALAR 0 |
|---|
| 67 | #define PLY_LIST 1 |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | typedef struct PlyProperty { |
|---|
| 71 | |
|---|
| 72 | const char *name; |
|---|
| 73 | int external_type; |
|---|
| 74 | int internal_type; |
|---|
| 75 | int offset; |
|---|
| 76 | |
|---|
| 77 | int is_list; |
|---|
| 78 | int count_external; |
|---|
| 79 | int count_internal; |
|---|
| 80 | int count_offset; |
|---|
| 81 | |
|---|
| 82 | } PlyProperty; |
|---|
| 83 | |
|---|
| 84 | typedef struct PlyElement { |
|---|
| 85 | char *name; |
|---|
| 86 | int num; |
|---|
| 87 | int size; |
|---|
| 88 | int nprops; |
|---|
| 89 | PlyProperty **props; |
|---|
| 90 | char *store_prop; |
|---|
| 91 | int other_offset; |
|---|
| 92 | int other_size; |
|---|
| 93 | } PlyElement; |
|---|
| 94 | |
|---|
| 95 | typedef struct PlyOtherProp { |
|---|
| 96 | char *name; |
|---|
| 97 | int size; |
|---|
| 98 | int nprops; |
|---|
| 99 | PlyProperty **props; |
|---|
| 100 | } PlyOtherProp; |
|---|
| 101 | |
|---|
| 102 | typedef struct OtherData { |
|---|
| 103 | void *other_props; |
|---|
| 104 | } OtherData; |
|---|
| 105 | |
|---|
| 106 | typedef struct OtherElem { |
|---|
| 107 | char *elem_name; |
|---|
| 108 | int elem_count; |
|---|
| 109 | OtherData **other_data; |
|---|
| 110 | PlyOtherProp *other_props; |
|---|
| 111 | } OtherElem; |
|---|
| 112 | |
|---|
| 113 | typedef struct PlyOtherElems { |
|---|
| 114 | int num_elems; |
|---|
| 115 | OtherElem *other_list; |
|---|
| 116 | } PlyOtherElems; |
|---|
| 117 | |
|---|
| 118 | typedef struct PlyFile { |
|---|
| 119 | FILE *fp; |
|---|
| 120 | int file_type; |
|---|
| 121 | float version; |
|---|
| 122 | int nelems; |
|---|
| 123 | PlyElement **elems; |
|---|
| 124 | int num_comments; |
|---|
| 125 | char **comments; |
|---|
| 126 | int num_obj_info; |
|---|
| 127 | char **obj_info; |
|---|
| 128 | PlyElement *which_elem; |
|---|
| 129 | PlyOtherElems *other_elems; |
|---|
| 130 | } PlyFile; |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | extern char *my_alloc(); |
|---|
| 134 | #define myalloc(mem_size) my_alloc((mem_size), __LINE__, __FILE__) |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | extern PlyFile *ply_write(FILE *, int, char **, int); |
|---|
| 140 | extern PlyFile *ply_open_for_writing(char *, int, char **, int, float *); |
|---|
| 141 | extern void ply_describe_element(PlyFile *, char *, int, int, PlyProperty *); |
|---|
| 142 | extern void ply_describe_property(PlyFile *, char *, PlyProperty *); |
|---|
| 143 | extern void ply_element_count(PlyFile *, const char *, int); |
|---|
| 144 | extern void ply_header_complete(PlyFile *); |
|---|
| 145 | extern void ply_put_element_setup(PlyFile *, const char *); |
|---|
| 146 | extern void ply_put_element(PlyFile *, void *); |
|---|
| 147 | extern void ply_put_comment(PlyFile *, const char *); |
|---|
| 148 | extern void ply_put_obj_info(PlyFile *, const char *); |
|---|
| 149 | extern PlyFile *ply_read(FILE *, int *, char ***); |
|---|
| 150 | extern PlyFile *ply_open_for_reading( char *, int *, char ***, int *, float *); |
|---|
| 151 | extern PlyProperty **ply_get_element_description(PlyFile *, char *, int*, int*); |
|---|
| 152 | extern void ply_get_element_setup( PlyFile *, char *, int, PlyProperty *); |
|---|
| 153 | extern void ply_get_property(PlyFile *, const char *, PlyProperty *); |
|---|
| 154 | extern PlyOtherProp *ply_get_other_properties(PlyFile *, char *, int); |
|---|
| 155 | extern void ply_get_element(PlyFile *, void *); |
|---|
| 156 | extern char **ply_get_comments(PlyFile *, int *); |
|---|
| 157 | extern char **ply_get_obj_info(PlyFile *, int *); |
|---|
| 158 | extern void ply_close(PlyFile *); |
|---|
| 159 | extern void ply_get_info(PlyFile *, float *, int *); |
|---|
| 160 | extern PlyOtherElems *ply_get_other_element (PlyFile *, char *, int); |
|---|
| 161 | extern void ply_describe_other_elements ( PlyFile *, PlyOtherElems *); |
|---|
| 162 | extern void ply_put_other_elements (PlyFile *); |
|---|
| 163 | extern void ply_free_other_elements (PlyOtherElems *); |
|---|
| 164 | |
|---|
| 165 | extern int equal_strings(const char *, const char *); |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | #ifdef __cplusplus |
|---|
| 169 | } |
|---|
| 170 | #endif |
|---|
| 171 | #endif |
|---|