-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathOpenCLFractalRenderer.h
43 lines (35 loc) · 1.35 KB
/
OpenCLFractalRenderer.h
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
#ifndef OPENCL_FRACTAL_RENDERER_H
#define OPENCL_FRACTAL_RENDERER_H
#include <memory>
#include "FractalRenderer.h"
#include "ImageGenerater_OpenCL.h"
class OpenCLFractalRenderer : public IFractalRenderer
{
public:
OpenCLFractalRenderer(int width, int height)
: mMandelbrot(std::make_unique<ImageGenerater_OpenCL>("mandelbrot.cl", "main", width, height)),
mJulia(std::make_unique<ImageGenerater_OpenCL>("julia.cl", "main", width, height))
{
}
virtual void ResetBuffer(int width, int height)
{
mMandelbrot = std::make_unique<ImageGenerater_OpenCL>("mandelbrot.cl", "main", width, height);
mJulia = std::make_unique<ImageGenerater_OpenCL>("julia.cl", "main", width, height);
}
virtual void RenderMandelbrot(
int *buffer, int width, int height, int maxIteration,
TFloat minX, TFloat maxX, TFloat minY, TFloat maxY) override
{
mMandelbrot->Run(buffer, maxIteration, minX, maxX, minY, maxY);
}
virtual void RenderJuliaSet(
int *buffer, int width, int height, int maxIteration, TFloat cx, TFloat cy,
TFloat minX, TFloat maxX, TFloat minY, TFloat maxY) override
{
mJulia->Run(buffer, maxIteration, cx, cy, minX, maxX, minY, maxY);
}
private:
std::unique_ptr<ImageGenerater_OpenCL> mMandelbrot;
std::unique_ptr<ImageGenerater_OpenCL> mJulia;
};
#endif