00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __PLY_H__
00033 #define __PLY_H__
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00039 #include <stdio.h>
00040 #include <stddef.h>
00041
00042 #define PLY_ASCII 1
00043 #define PLY_BINARY_BE 2
00044 #define PLY_BINARY_LE 3
00045
00046 #define PLY_OKAY 0
00047 #define PLY_ERROR -1
00048
00049
00050
00051 #define StartType 0
00052 #define Int8 1
00053 #define Int16 2
00054 #define Int32 3
00055 #define Uint8 4
00056 #define Uint16 5
00057 #define Uint32 6
00058 #define Float32 7
00059 #define Float64 8
00060 #define EndType 9
00061
00062 #define PLY_SCALAR 0
00063 #define PLY_LIST 1
00064 #define PLY_STRING 2
00065
00066
00067 typedef struct PlyProperty {
00068
00069 const char *name;
00070 int external_type;
00071 int internal_type;
00072 int offset;
00073
00074 int is_list;
00075 int count_external;
00076 int count_internal;
00077 int count_offset;
00078
00079 } PlyProperty;
00080
00081 typedef struct PlyElement {
00082 char *name;
00083 int num;
00084 int size;
00085 int nprops;
00086 PlyProperty **props;
00087 char *store_prop;
00088 int other_offset;
00089 int other_size;
00090 } PlyElement;
00091
00092 typedef struct PlyOtherProp {
00093 char *name;
00094 int size;
00095 int nprops;
00096 PlyProperty **props;
00097 } PlyOtherProp;
00098
00099 typedef struct OtherData {
00100 void *other_props;
00101 } OtherData;
00102
00103 typedef struct OtherElem {
00104 char *elem_name;
00105 int elem_count;
00106 OtherData **other_data;
00107 PlyOtherProp *other_props;
00108 } OtherElem;
00109
00110 typedef struct PlyOtherElems {
00111 int num_elems;
00112 OtherElem *other_list;
00113 } PlyOtherElems;
00114
00115 #define AVERAGE_RULE 1
00116 #define MAJORITY_RULE 2
00117 #define MINIMUM_RULE 3
00118 #define MAXIMUM_RULE 4
00119 #define SAME_RULE 5
00120 #define RANDOM_RULE 6
00121
00122 typedef struct PlyPropRules {
00123 PlyElement *elem;
00124 int *rule_list;
00125 int nprops;
00126 int max_props;
00127 void **props;
00128 float *weights;
00129 } PlyPropRules;
00130
00131 typedef struct PlyRuleList {
00132 char *name;
00133 char *element;
00134 char *property;
00135 struct PlyRuleList *next;
00136 } PlyRuleList;
00137
00138 typedef struct PlyFile {
00139 FILE *fp;
00140 int file_type;
00141 float version;
00142 int num_elem_types;
00143 PlyElement **elems;
00144 int num_comments;
00145 char **comments;
00146 int num_obj_info;
00147 char **obj_info;
00148 PlyElement *which_elem;
00149 PlyOtherElems *other_elems;
00150 PlyPropRules *current_rules;
00151 PlyRuleList *rule_list;
00152 } PlyFile;
00153
00154
00155
00156
00157
00158 #define myalloc(mem_size) my_alloc((mem_size), __LINE__, __FILE__)
00159
00160
00161
00162
00163 #if 0
00164 extern PlyFile *ply_write(FILE *, int, char **, int);
00165 extern PlyFile *ply_read(FILE *, int *, char ***);
00166 extern PlyFile *ply_open_for_reading( char *, int *, char ***, int *, float *);
00167 extern void ply_close(PlyFile *);
00168 extern PlyOtherProp *ply_get_other_properties(PlyFile *, char *, int);
00169 #endif
00170
00171 extern void ply_describe_property(PlyFile *, char *, PlyProperty *);
00172 extern void ply_get_property(PlyFile *, char *, PlyProperty *);
00173 extern void ply_get_element(PlyFile *, void *);
00174
00175
00176
00177
00178 PlyOtherElems *get_other_element_ply (PlyFile *);
00179
00180 PlyFile *read_ply(FILE *);
00181 PlyFile *write_ply(FILE *, int, char **, int);
00182 extern PlyFile *open_for_writing_ply(char *, int, char **, int);
00183 void close_ply(PlyFile *);
00184 void free_ply(PlyFile *);
00185
00186 void get_info_ply(PlyFile *, float *, int *);
00187 void free_other_elements_ply (PlyOtherElems *);
00188
00189 void append_comment_ply(PlyFile *, char *);
00190 void append_obj_info_ply(PlyFile *, char *);
00191 void copy_comments_ply(PlyFile *, PlyFile *);
00192 void copy_obj_info_ply(PlyFile *, PlyFile *);
00193 char **get_comments_ply(PlyFile *, int *);
00194 char **get_obj_info_ply(PlyFile *, int *);
00195
00196 char **get_element_list_ply(PlyFile *, int *);
00197 void setup_property_ply(PlyFile *, PlyProperty *);
00198 void get_element_ply (PlyFile *, void *);
00199 char *setup_element_read_ply (PlyFile *, int, int *);
00200 PlyOtherProp *get_other_properties_ply(PlyFile *, int);
00201
00202 void element_count_ply(PlyFile *, char *, int);
00203 void describe_element_ply(PlyFile *, char *, int);
00204 void describe_property_ply(PlyFile *, PlyProperty *);
00205 void describe_other_properties_ply(PlyFile *, PlyOtherProp *, int);
00206 void describe_other_elements_ply ( PlyFile *, PlyOtherElems *);
00207 void get_element_setup_ply(PlyFile *, char *, int, PlyProperty *);
00208 PlyProperty **get_element_description_ply(PlyFile *, char *, int*, int*);
00209 void element_layout_ply(PlyFile *, char *, int, int, PlyProperty *);
00210
00211 void header_complete_ply(PlyFile *);
00212 void put_element_setup_ply(PlyFile *, char *);
00213 void put_element_ply(PlyFile *, void *);
00214 void put_other_elements_ply(PlyFile *);
00215
00216 PlyPropRules *init_rule_ply (PlyFile *, char *);
00217 void modify_rule_ply (PlyPropRules *, char *, int);
00218 void start_props_ply (PlyFile *, PlyPropRules *);
00219 void weight_props_ply (PlyFile *, float, void *);
00220 void *get_new_props_ply(PlyFile *);
00221 void set_prop_rules_ply (PlyFile *, PlyRuleList *);
00222 PlyRuleList *append_prop_rule (PlyRuleList *, char *, char *);
00223 int matches_rule_name (char *);
00224
00225 int equal_strings(const char *, const char *);
00226 char *recreate_command_line (int, char *argv[]);
00227
00228
00229 #ifdef __cplusplus
00230 }
00231 #endif
00232 #endif
00233