#include <iostream>\r
\r
#include "Indice2D.h"\r
+#include "IndiceTools.h"\r
#include "cudaTools.h"\r
#include "Device.h"\r
\r
\r
__global__ void rippling(uchar4* ptrDevPixels, int w, int h, float t)\r
{\r
- RipplingMath ripplingMath = RipplingMath(w, h);\r
+ RipplingMath ripplingMath(w, h);\r
\r
- // TODO pattern entrelacement\r
+ const int TID = Indice2D::tid();\r
+ const int NB_THREAD = Indice2D::nbThread();\r
+\r
+ const int WH = w * h;\r
+\r
+ uchar4 color;\r
+ color.z = 255;\r
+\r
+ int pixelI;\r
+ int pixelJ;\r
+\r
+ int s = TID;\r
+ while (s < WH)\r
+ {\r
+ IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ)\r
+\r
+ ripplingMath.color(pixelI, pixelJ, t, color); // update color\r
+ ptrDevPixels[s] = color;\r
+\r
+ s += NB_THREAD;\r
+ }\r
}\r
\r
/*----------------------------------------------------------------------*\\r