本文整理汇总了C++中Model::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetSize方法的具体用法?C++ Model::GetSize怎么用?C++ Model::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::GetSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToCSV
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);
}
}