summaryrefslogtreecommitdiff
path: root/src/mansdl-genf.cc
blob: 1596286036122ceaf58036b531043feae4e02a65 (plain) (blame)
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
/* Include libraries */
#include <chrono>
#include <iomanip>
#include <iostream>

/* Include header files */
#include "mansdl.hh"

/* To-do list: */
/* Banish Windows from this world */
/* Optimize the Mandelbrot^4 renderer */

void mansdl::genF(fractData* fd) {
	doGenerate = false;

	auto timer_start = std::chrono::high_resolution_clock::now();

	genf genf;

	switch(fd->fract) {
		case burningShip:
			genf.burningShip(renderer, fd);
			break;

		case julia:
			genf.julia(renderer, fd);
			break;

		case mandelbrot3:
			genf.mandelbrot3(renderer, fd);
			break;

		case mandelbrot4:
			genf.mandelbrot4(renderer, fd);
			break;

		case mandelbrot5:
			genf.mandelbrot5(renderer, fd);
			break;

		case tricorn:
			genf.tricorn(renderer, fd);
			break;

		default:
			genf.mandelbrot(renderer, fd);
			break;
	}

	auto timer_stop = std::chrono::high_resolution_clock::now();
	std::chrono::duration<double> duration = timer_stop - timer_start;

	if(duration > std::chrono::seconds(5))
		std::cout << "\a";

	std::cout << "\r" << "\033[033m" << "Done!" << "\033[000m" << " (Took " << std::setprecision(3) << std::fixed << duration.count() << " seconds)" << std::flush;
}