3 #include "Indice2D.h"
\r
4 #include "IndiceTools.h"
\r
5 #include "DomaineMath.h"
\r
6 #include "cudaTools.h"
\r
9 #include "FractalMath.h"
\r
14 __global__ void fractalMandelbrot(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n);
\r
15 __global__ void fractalJulia(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float c_r, float c_i);
\r
16 __device__ void fractal(uchar4* ptrDevPixels, int w, int h, const DomaineMath& domaineMath, int n, const FractalMath& fractalMath);
\r
18 __global__ void fractalMandelbrot(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n)
\r
20 FractalMandelbrotMath fractalMath(n);
\r
21 fractal(ptrDevPixels, w, h, domaineMath, n, fractalMath);
\r
24 __global__ void fractalJulia(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float c_r, float c_i)
\r
26 FractalJuliaMath fractalMath(n, c_r, c_i);
\r
27 fractal(ptrDevPixels, w, h, domaineMath, n, fractalMath);
\r
30 __device__ void fractal(uchar4* ptrDevPixels, int w, int h, const DomaineMath& domaineMath, int n, const FractalMath& fractalMath)
\r
32 const int TID = Indice2D::tid();
\r
33 const int NB_THREAD = Indice2D::nbThread();
\r
34 const int WH = w * h;
\r
37 color.z = 255; // Par défaut, l'image est opaque.
\r
45 IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)
\r
47 // (i,j) domaine écran
\r
48 // (x,y) domaine math
\r
49 domaineMath.toXY(pixelI, pixelJ, &x, &y); // (i,j) -> (x,y)
\r
51 fractalMath.colorXY(&color, x, y);
\r
53 ptrDevPixels[s] = color;
\r