1 #include "FractalDevice.h"
\r
5 #include "Indice2D.h"
\r
6 #include "IndiceTools.h"
\r
7 #include "cudaTools.h"
\r
10 #include "FractalMath.h"
\r
15 __device__ void fractal(uchar4* ptrDevPixels, int w, int hFrom, int hTo, const DomaineMath& domaineMath, int n, const FractalMath& fractalMath)
\r
17 const int TID = Indice2D::tid();
\r
18 const int NB_THREAD = Indice2D::nbThread();
\r
19 const int WH = w * (hTo - hFrom);
\r
22 color.z = 255; // Par défaut, l'image est opaque.
\r
30 IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)
\r
32 // (i,j) domaine écran
\r
33 // (x,y) domaine math
\r
34 domaineMath.toXY(pixelI + hFrom, pixelJ, &x, &y); // (i,j) -> (x,y)
\r
36 fractalMath.colorXY(&color, x, y);
\r
38 ptrDevPixels[s] = color;
\r
44 __global__ void fractalMandelbrot(uchar4* ptrDevPixels, int w, int hFrom, int hTo, DomaineMath domaineMath, int n)
\r
46 FractalMandelbrotMath fractalMath(n);
\r
47 fractal(ptrDevPixels, w, hFrom, hTo, domaineMath, n, fractalMath);
\r
50 __global__ void fractalJulia(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float c_r, float c_i)
\r
52 FractalJuliaMath fractalMath(n, c_r, c_i);
\r
53 fractal(ptrDevPixels, w, 0, h, domaineMath, n, fractalMath);
\r