using std::cout;\r
using std::endl;\r
\r
-/*----------------------------------------------------------------------*\\r
- |* Declaration *|\r
- \*---------------------------------------------------------------------*/\r
+__global__ void fractalMandelbrot(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n);\r
+__global__ void fractalJulia(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float c_r, float c_i);\r
+__device__ void fractal(uchar4* ptrDevPixels, int w, int h, const DomaineMath& domaineMath, int n, const FractalMath& fractalMath);\r
\r
-/*--------------------------------------*\\r
- |* Imported *|\r
- \*-------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |* Public *|\r
- \*-------------------------------------*/\r
-\r
-__global__ void fractal(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float t);\r
-\r
-/*--------------------------------------*\\r
- |* Private *|\r
- \*-------------------------------------*/\r
-\r
-/*----------------------------------------------------------------------*\\r
- |* Implementation *|\r
- \*---------------------------------------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |* Public *|\r
- \*-------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |* Private *|\r
- \*-------------------------------------*/\r
+__global__ void fractalMandelbrot(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n)\r
+ {\r
+ FractalMandelbrotMath fractalMath(n);\r
+ fractal(ptrDevPixels, w, h, domaineMath, n, fractalMath);\r
+ }\r
\r
-__global__ void fractal(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float t)\r
+__global__ void fractalJulia(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float c_r, float c_i)\r
{\r
- FractalMath fractalMath(n);\r
+ FractalJuliaMath fractalMath(n, c_r, c_i);\r
+ fractal(ptrDevPixels, w, h, domaineMath, n, fractalMath);\r
+ }\r
\r
+__device__ void fractal(uchar4* ptrDevPixels, int w, int h, const DomaineMath& domaineMath, int n, const FractalMath& fractalMath)\r
+ {\r
const int TID = Indice2D::tid();\r
const int NB_THREAD = Indice2D::nbThread();\r
const int WH = w * h;\r
\r
int s = TID;\r
while (s < WH)\r
- {\r
- IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)\r
+ {\r
+ IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)\r
\r
- // (i,j) domaine ecran\r
- // (x,y) domaine math\r
- domaineMath.toXY(pixelI, pixelJ, &x, &y); // (i,j) -> (x,y)\r
+ // (i,j) domaine écran\r
+ // (x,y) domaine math\r
+ domaineMath.toXY(pixelI, pixelJ, &x, &y); // (i,j) -> (x,y)\r
\r
- fractalMath.colorXY(&color,x, y, t); // update color\r
+ fractalMath.colorXY(&color, x, y);\r
\r
- ptrDevPixels[s] = color;\r
+ ptrDevPixels[s] = color;\r
\r
- s += NB_THREAD;\r
- }\r
+ s += NB_THREAD;\r
+ }\r
}\r
-\r
-/*----------------------------------------------------------------------*\\r
- |* End *|\r
- \*---------------------------------------------------------------------*/\r
-\r