-
Notifications
You must be signed in to change notification settings - Fork 0
/
FractalGenerator.hpp
50 lines (40 loc) · 1.06 KB
/
FractalGenerator.hpp
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
#ifndef FRACTALGENERATOR_HPP
#define FRACTALGENERATOR_HPP
#include <mutex>
#include <cmath>
#include <list>
#include <thread>
#include "mpreal.h"
#include "PixelBuffer.hpp"
#include "ColorGenerator.hpp"
using namespace mpfr;
typedef mpreal Float;
class FractalGenerator
{
public:
FractalGenerator(PixelBuffer *renderTarget, ColorGenerator const *colorGenerator);
~FractalGenerator();
void Render(size_t threads = 1);
void SetRenderTarget(PixelBuffer *renderTarget);
void SetPoint(Float c_real, Float c_imag);
void SetMagnitude(Float magnitude);
void SetIterations(uint64_t iterations);
Float GetReal() const;
Float GetImag() const;
Float GetMagnitude() const;
uint64_t GetIterations() const;
PixelBuffer const &GetPixelBuffer() const;
float GetProgress();
private:
PixelBuffer *renderTarget;
ColorGenerator *colorGenerator;
Float c_real;
Float c_imag;
Float magnitude;
uint64_t iterations;
float progress;
std::mutex mut;
void RenderPartially(uint32_t xmin, uint32_t xmax);
static Float map(Float f0, Float f1, Float t0, Float t1, Float x);
};
#endif