-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
50 lines (40 loc) · 1.28 KB
/
test.cpp
File metadata and controls
50 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "fast_obj_loader.h"
#include <time.h>
#include <stdio.h>
#include "fastdynamic2.h"
int main(int argc, char* argv[])
{
int timestoload = 1;
if(argc == 1)
{
printf("usage testobjloader filename.obj 5\n");
return 0;
}
if(argc == 3)
{
sscanf(argv[2], "%20i", ×toload);
}
printf("starting to load %s %i times\n", argv[1], timestoload);
timespec start, stop;
clock_gettime(CLOCK_REALTIME, &start);
double calltime;
for(int i = 0; i < timestoload; i++)
{
obj* testmesh = loadObj(argv[1]);
for(int j=0;j<testmesh->numfaces;j++)
{
fprintf(stdout,"%i %i %i\n",testmesh->faces[j].verts[0],testmesh->faces[j].verts[1],testmesh->faces[j].verts[2]);
}
obj* testmesh2 = ObjMakeUniqueFullVerts(testmesh);
for(int j=0;j<testmesh2->numfaces;j++)
{
fprintf(stdout,"%i %i %i\n",testmesh2->faces[j].verts[0],testmesh2->faces[j].verts[1],testmesh2->faces[j].verts[2]);
}
delete testmesh;
delete testmesh2;
}
clock_gettime(CLOCK_REALTIME, &stop);
calltime = (stop.tv_sec - start.tv_sec) + (stop.tv_nsec - start.tv_nsec) / 1000000000.0;
printf("done loading file %lfseconds\n", calltime / timestoload);
return 0;
}