|
|
@ -90,7 +90,25 @@ void ply_free_elements(PlyElement* elements_head) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlyMesh ply_load_mesh(char* filename) {
|
|
|
|
PlyMappings default_ply_mappings = {
|
|
|
|
|
|
|
|
.vertex_element = "vertex",
|
|
|
|
|
|
|
|
.x = "x",
|
|
|
|
|
|
|
|
.y = "y",
|
|
|
|
|
|
|
|
.z = "z",
|
|
|
|
|
|
|
|
.nx = "nx",
|
|
|
|
|
|
|
|
.ny = "ny",
|
|
|
|
|
|
|
|
.nz = "nz",
|
|
|
|
|
|
|
|
.r = "red",
|
|
|
|
|
|
|
|
.g = "green",
|
|
|
|
|
|
|
|
.b = "blue",
|
|
|
|
|
|
|
|
.a = "alpha",
|
|
|
|
|
|
|
|
.u = "s",
|
|
|
|
|
|
|
|
.v = "t",
|
|
|
|
|
|
|
|
.face_element = "face",
|
|
|
|
|
|
|
|
.index = "vetex_indices",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlyMesh ply_load_mesh(char* filename, PlyMappings mappings) {
|
|
|
|
PlyMesh mesh = {
|
|
|
|
PlyMesh mesh = {
|
|
|
|
.vertex_count = 0,
|
|
|
|
.vertex_count = 0,
|
|
|
|
.position = NULL,
|
|
|
|
.position = NULL,
|
|
|
@ -245,6 +263,12 @@ PlyMesh ply_load_mesh(char* filename) {
|
|
|
|
|
|
|
|
|
|
|
|
PlyElement* elem = elements_head;
|
|
|
|
PlyElement* elem = elements_head;
|
|
|
|
while(elem != NULL) {
|
|
|
|
while(elem != NULL) {
|
|
|
|
|
|
|
|
if(strcmp(elem->name, mappings.vertex_element) == 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(elem->name, mappings.face_element) == 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlyProperty* prop = elem->properties;
|
|
|
|
PlyProperty* prop = elem->properties;
|
|
|
|
while(prop != NULL) {
|
|
|
|
while(prop != NULL) {
|
|
|
|
if(prop->count == PLY_TYPE_INVALID) {
|
|
|
|
if(prop->count == PLY_TYPE_INVALID) {
|
|
|
|