fast_obj icon indicating copy to clipboard operation
fast_obj copied to clipboard

Maybe an option to not skip empty objects?

Open badVibes-- opened this issue 2 years ago • 0 comments

I used this library (thank you for sharing it!) with ttf2mesh and it exports spaces as empty objects. The names still hold data about the characters but your library skips them because they have no geometry. Maybe add an option to not do that :).

Hacked my way out of it like so:

void flush_object(fastObjData* data)
{
    /* Add object if not empty */
    if (data->object.face_count > 0)
        array_push(data->mesh->objects, data->object);
    else if(data->object.name != NULL)
    {
        data->object.face_count=0;
        data->object.face_offset=0;
        data->object.index_offset=0;
        array_push(data->mesh->objects, data->object);
    }
    else
        object_clean(&data->object);
    
    /* Reset for more data */
    data->object = object_default();
    data->object.face_offset  = array_size(data->mesh->face_vertices);
    data->object.index_offset = array_size(data->mesh->indices);
}


badVibes-- avatar Nov 10 '22 20:11 badVibes--