-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
75 lines (60 loc) · 1.4 KB
/
main.c
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <stdlib.h>
#include <sys/time.h>
#include "toucan.h"
#include "spock.h"
#include "nets.h"
#include "graphics.h"
#include "layout.h"
#include "link.h"
static void die(struct vulkanrt *r, struct network *n);
int main(void)
{
Network net = dcomp();
//Network net = barbell();
struct timeval start, finish;
gettimeofday(&start, NULL);
printf("building tree\n");
Ptree *ptr = ptree(&net, 1);
printf("DONE\n");
for(int i=0; i<50; i++) {
layout(&net, ptr);
//if(i%1 == 0) {
//ptr = ptree(&net, 0);
balance(ptr);
//}
}
gettimeofday(&finish, NULL);
size_t d =
(finish.tv_sec*1e6 + finish.tv_usec) -
(start.tv_sec*1e6 + start.tv_usec);
printf("time: %f\n", d/1e3);
//return 0;
tesselate_links(&net);
printf("tesselation size %u (%d MB)\n",
net.t, (int)ceil((net.t * sizeof(Point2))/1e6));
struct vulkanrt r = new_vulkanrt();
if(init_vulkan(&r))
die(&r, &net);
if(init_glfw(&r))
die(&r, &net);
printf("configuring vulkan\n");
if(configure_vulkan(&r, &net))
die(&r, &net);
printf("done\n");
printf("initial draw\n");
draw(&r);
printf("done\n");
while(!glfwWindowShouldClose(r.win)) {
// the toucan is flying
glfwPollEvents();
//draw(&r);
}
free_vulkanrt(&r);
free_network(&net);
return 0;
}
static void die(struct vulkanrt *r, struct network *n) {
free_vulkanrt(r);
free_network(n);
exit(1);
}