Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / 00_Rippling_warmup / 01_imageAPI / Rippling0Image.cpp
diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/00_Rippling_warmup/01_imageAPI/Rippling0Image.cpp b/WCudaMSE/Student_Cuda_Image/src/cpp/core/00_Rippling_warmup/01_imageAPI/Rippling0Image.cpp
new file mode 100755 (executable)
index 0000000..dc9e211
--- /dev/null
@@ -0,0 +1,108 @@
+#include <iostream>\r
+#include <assert.h>\r
+#include <math.h>\r
+\r
+#include "MathTools.h"\r
+#include "StringTools.h"\r
+\r
+#include "Rippling0Image.h"\r
+\r
+using std::cout;\r
+using std::endl;\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Declaration                                     *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Imported                *|\r
+ \*-------------------------------------*/\r
+\r
+extern void launchKernelRippling0(uchar4* ptrDevPixels, int w, int h, float t);\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Implementation                                  *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+Rippling0Image::Rippling0Image(unsigned int w, unsigned int h, float dt) :\r
+       ImageMOOs_A(w, h)\r
+    {\r
+    assert(getW() == getH()); // image carrer\r
+\r
+           // Input\r
+    this->dt = dt;\r
+\r
+    // Tools\r
+    this->t = 0;\r
+    }\r
+\r
+Rippling0Image::~Rippling0Image(void)\r
+    {\r
+    // rien\r
+    }\r
+\r
+/*--------------------------------------*\\r
+ |*            Redefinition            *|\r
+ \*-------------------------------------*/\r
+\r
+/**\r
+ * Call automaticly by the api\r
+ */\r
+void Rippling0Image::animationStep(bool& isNeedUpdateView) // Override\r
+    {\r
+    this->t += dt;\r
+    isNeedUpdateView = true; // true par default\r
+    }\r
+\r
+/**\r
+ * Call automaticly by the api\r
+ */\r
+void Rippling0Image::fillImageGL(uchar4* ptrDevImageGL, int w, int h) // Override\r
+    {\r
+    launchKernelRippling0(ptrDevImageGL, w, h, t);\r
+    }\r
+\r
+/**\r
+ * Call automaticly by the api\r
+ */\r
+void Rippling0Image::paintPrimitives(Graphic2Ds& graphic2D) // Override\r
+    {\r
+    const Font_A* ptrFont = graphic2D.getFont(TIMES_ROMAN_24);\r
+\r
+    float r = 1;\r
+    float g = 0;\r
+    float b = 0;\r
+\r
+    graphic2D.setColorRGB(r, g, b);\r
+\r
+    // top\r
+       {\r
+       string message = "t = " + StringTools::toString(t);\r
+       graphic2D.drawTitleTop(message, ptrFont);\r
+       }\r
+\r
+    // bottom\r
+       {\r
+       graphic2D.drawTitleBottom("Rippling warmup CUDA", ptrFont);\r
+       }\r
+    }\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    End                                             *|\r
+ \*---------------------------------------------------------------------*/\r