/*! * Free a Lib3dsFile object and all of its resources. * * \param file The Lib3dsFile object to be freed. * * \ingroup file */ void lib3ds_file_free(Lib3dsFile* file) { ASSERT(file); lib3ds_viewport_set_views(&file->viewport,0); lib3ds_viewport_set_views(&file->viewport_keyf,0); { Lib3dsMaterial *p,*q; for (p=file->materials; p; p=q) { q=p->next; lib3ds_material_free(p); } file->materials=0; } { Lib3dsCamera *p,*q; for (p=file->cameras; p; p=q) { q=p->next; lib3ds_camera_free(p); } file->cameras=0; } { Lib3dsLight *p,*q; for (p=file->lights; p; p=q) { q=p->next; lib3ds_light_free(p); } file->lights=0; } { Lib3dsMesh *p,*q; for (p=file->meshes; p; p=q) { q=p->next; lib3ds_mesh_free(p); } file->meshes=0; } { Lib3dsNode *p,*q; for (p=file->nodes; p; p=q) { q=p->next; lib3ds_node_free(p); } } free(file); }
void lib3ds_io_cleanup(Lib3dsIo *io) { Lib3dsIoImpl *impl; assert(io); impl = (Lib3dsIoImpl*)io->impl; if (impl->tmp_mem) { free(impl->tmp_mem); impl->tmp_mem = NULL; } if (impl->tmp_node) { lib3ds_node_free(impl->tmp_node); impl->tmp_node = NULL; } free(impl); }
/*! * Free a Lib3dsFile object and all of its resources. * * \param file The Lib3dsFile object to be freed. */ void lib3ds_file_free(Lib3dsFile* file) { assert(file); lib3ds_file_reserve_materials(file, 0, TRUE); lib3ds_file_reserve_cameras(file, 0, TRUE); lib3ds_file_reserve_lights(file, 0, TRUE); lib3ds_file_reserve_meshes(file, 0, TRUE); { Lib3dsNode *p, *q; for (p = file->nodes; p; p = q) { q = p->next; lib3ds_node_free(p); } } free(file); }