void Models::SaveToCSV() { // Save next to exe char finalpath[MAX_PATH]; sprintf(finalpath,"%s\\%s",Globals::exepath,"Models.csv"); // Save grand total too unsigned int totalvertices = 0; unsigned int totalfaces = 0; unsigned int totalbytes = 0; FILE* file = fopen(finalpath,"wb"); if(file) { fprintf(file,"Full path;Vertices;Faces;Size (bytes)\r\n"); for(ModelIterator i = models.begin();i != models.end();i++) { Model* model = *i; fprintf(file,"%s;%u;%u;%llu\r\n", model->fullpath, model->numvertices, model->numfaces, model->GetSize()); totalvertices += model->numvertices; totalfaces += model->numfaces; totalbytes += model->GetSize(); } // TODO: create function if(totalbytes > 1024*1024*1024) { // 1 GiB fprintf(file,";%u;%u;%u (%.2f GiB)\r\n",totalvertices,totalfaces,totalbytes,totalbytes/1024.0f/1024.0f/1024.0f); } else if(totalbytes > 1024*1024) { // 1 MiB fprintf(file,";%u;%u;%u (%.2f MiB)\r\n",totalvertices,totalfaces,totalbytes,totalbytes/1024.0f/1024.0f); } else if(totalbytes > 1024) { // 1 KiB fprintf(file,";%u;%u;%u (%.2f KiB)\r\n",totalvertices,totalfaces,totalbytes,totalbytes/1024.0f); } else { fprintf(file,";%u;%u;%u bytes\r\n",totalvertices,totalfaces,totalbytes); } fclose(file); } }