Is it better to use hierarchical serialization when serializing objects that contain other objects or just to create a function that acceses variables from the object. for example if i were to serialize a face object that stored a certain amount of vertex objects and a texture would i be better off with:
#include <stdio.h>
void Face::serialize(FILE * file) {
for(int a = 0; a < number of vertices; a++) {
vertex[a].serialize(file);
}
texture.serialize(file);
}
or with a function like:
#include <stdio.h>
void Face::serialize(FILE * file) {
for(int a = 0; a < number of vertices; a++) {
fputc(vertex[a].x, file);
fputc(vertex[a].y, file);
fputc(vertex[a].z, file);
}
// however you would serialize a texture
}
this is just an example, you probaly wouldn't use one byte for each vertex's x, y and z, but you get the idea.