Compare commits

..

2 Commits

Author SHA1 Message Date
noah metz c9f33ae930 Organized ply constants 2024-01-11 12:14:50 -07:00
noah metz d7c688e4b2 Organized ply constants 2024-01-11 12:14:02 -07:00
2 changed files with 38 additions and 35 deletions

@ -1,6 +1,8 @@
#ifndef PLY_H #ifndef PLY_H
#define PLY_H #define PLY_H
#include <stddef.h>
typedef enum { typedef enum {
PLY_FORMAT_INVALID = -1, PLY_FORMAT_INVALID = -1,
PLY_FORMAT_ASCII, PLY_FORMAT_ASCII,
@ -46,6 +48,42 @@ typedef struct PlyElementStruct {
struct PlyElementStruct* next; struct PlyElementStruct* next;
} PlyElement; } PlyElement;
const char* const ply_formats[] = {
"ascii",
"binary_little_endian",
"binary_big_endian"
};
const char* const ply_header_items[] = {
"comment",
"end_header",
"element",
"property",
};
const char* const ply_type_strings[] = {
"char",
"uchar",
"short",
"ushort",
"int",
"uint",
"float",
"double",
};
size_t ply_type_sizes[] = {
1,
1,
2,
2,
4,
4,
4,
8,
};
PlyElement* ply_load_mesh(char* filename); PlyElement* ply_load_mesh(char* filename);
void ply_free_mesh(PlyElement* elements_head); void ply_free_mesh(PlyElement* elements_head);

@ -3,41 +3,6 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
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,
};
PlyPropertyType ply_parse_type(const char* type_string) { PlyPropertyType ply_parse_type(const char* type_string) {
for(uint32_t i = 0; i < sizeof(ply_type_strings)/sizeof(char*); i++) { for(uint32_t i = 0; i < sizeof(ply_type_strings)/sizeof(char*); i++) {
if(strcmp(ply_type_strings[i], type_string) == 0) { if(strcmp(ply_type_strings[i], type_string) == 0) {