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