2024-01-11 12:09:54 -07:00
|
|
|
#ifndef PLY_H
|
|
|
|
#define PLY_H
|
|
|
|
|
2024-01-11 12:14:02 -07:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2024-01-11 12:09:54 -07:00
|
|
|
typedef enum {
|
|
|
|
PLY_FORMAT_INVALID = -1,
|
|
|
|
PLY_FORMAT_ASCII,
|
|
|
|
PLY_FORMAT_LE,
|
|
|
|
PLY_FORMAT_BE,
|
|
|
|
} PlyFormatType;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PLY_HEADER_INVALID = -1,
|
|
|
|
PLY_HEADER_COMMENT,
|
|
|
|
PLY_HEADER_END,
|
|
|
|
PLY_HEADER_ELEMENT,
|
|
|
|
PLY_HEADER_PROPERTY,
|
|
|
|
} PlyHeaderType;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
PLY_TYPE_INVALID = -1,
|
|
|
|
PLY_TYPE_CHAR,
|
|
|
|
PLY_TYPE_UCHAR,
|
|
|
|
PLY_TYPE_SHORT,
|
|
|
|
PLY_TYPE_USHORT,
|
|
|
|
PLY_TYPE_INT,
|
|
|
|
PLY_TYPE_UINT,
|
|
|
|
PLY_TYPE_FLOAT,
|
|
|
|
PLY_TYPE_DOUBLE,
|
|
|
|
} PlyPropertyType;
|
|
|
|
|
|
|
|
typedef struct PlyPropertyStruct {
|
|
|
|
char* name;
|
|
|
|
PlyPropertyType count;
|
|
|
|
PlyPropertyType element;
|
|
|
|
|
|
|
|
void* elements;
|
|
|
|
void* counts;
|
|
|
|
struct PlyPropertyStruct* next;
|
|
|
|
} PlyProperty;
|
|
|
|
|
|
|
|
typedef struct PlyElementStruct {
|
|
|
|
char* name;
|
|
|
|
int count;
|
|
|
|
PlyProperty* properties;
|
|
|
|
|
|
|
|
struct PlyElementStruct* next;
|
|
|
|
} PlyElement;
|
|
|
|
|
2024-01-11 12:14:02 -07:00
|
|
|
|
|
|
|
char* ply_formats[] = {
|
|
|
|
"ascii",
|
|
|
|
"binary_little_endian",
|
|
|
|
"binary_big_endian"
|
|
|
|
};
|
|
|
|
|
|
|
|
char* ply_header_items[] = {
|
|
|
|
"comment",
|
|
|
|
"end_header",
|
|
|
|
"element",
|
|
|
|
"property",
|
|
|
|
};
|
|
|
|
|
|
|
|
char* ply_type_strings[] = {
|
|
|
|
"char",
|
|
|
|
"uchar",
|
|
|
|
"short",
|
|
|
|
"ushort",
|
|
|
|
"int",
|
|
|
|
"uint",
|
|
|
|
"float",
|
|
|
|
"double",
|
|
|
|
};
|
|
|
|
|
|
|
|
size_t ply_type_sizes[] = {
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
2,
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
4,
|
|
|
|
8,
|
|
|
|
};
|
|
|
|
|
2024-01-11 12:09:54 -07:00
|
|
|
PlyElement* ply_load_mesh(char* filename);
|
|
|
|
void ply_free_mesh(PlyElement* elements_head);
|
|
|
|
|
|
|
|
#endif
|