Cleanage.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / mainGL.cpp
index 44ee751..fe29a86 100755 (executable)
@@ -1,6 +1,7 @@
 #include <iostream>\r
 #include <stdlib.h>\r
 #include <string.h>\r
+using namespace std;\r
 \r
 #include "GLUTImageViewers.h"\r
 \r
 \r
 #include "Rippling0Provider.h"\r
 #include "RipplingProvider.h"\r
+#include "FractalProvider.h"\r
+#include "NewtonProvider.h"\r
+#include "HeatTransfertProvider.h"\r
+#include "RayTracingProvider.h"\r
 \r
-using std::cout;\r
-using std::endl;\r
-using std::string;\r
-\r
-/*----------------------------------------------------------------------*\\r
- |*                    Declaration                                     *|\r
- \*---------------------------------------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |*            Imported                *|\r
- \*-------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |*            Public                  *|\r
- \*-------------------------------------*/\r
-\r
-int mainGL(void);\r
-\r
-/*--------------------------------------*\\r
- |*            Private                 *|\r
- \*-------------------------------------*/\r
-\r
-/*----------------------------------------------------------------------*\\r
- |*                    Implementation                                  *|\r
- \*---------------------------------------------------------------------*/\r
-\r
-/*--------------------------------------*\\r
- |*            Public                  *|\r
- \*-------------------------------------*/\r
+template <class TOutput, class TProvider>\r
+class Viewer\r
+    {\r
+    private:\r
+        TOutput* ptrProvider;\r
+        GLUTImageViewers viewer;\r
+\r
+    public:\r
+        Viewer(bool isAnimation, bool isSelection, int pxFrame, int pyFrame):\r
+            ptrProvider(TProvider::createGL()),\r
+            viewer(ptrProvider, isAnimation, isSelection, pxFrame, pyFrame)\r
+            {\r
+            }\r
+\r
+        ~Viewer()\r
+            {\r
+            delete this->ptrProvider;\r
+            }\r
+    };\r
 \r
 int mainGL(void)\r
     {\r
-    Rippling0Image* ptrRippling0 = Rippling0Provider::createGL();\r
-    Image* ptrRippling = RipplingProvider::createGL();\r
-    // TODO : Insert  autres Images ...\r
-\r
-    bool isAnimation = true;\r
-    bool isSelection = true;\r
-\r
-    GLUTImageViewers rippling0Viewer(ptrRippling0, isAnimation, isSelection, 0, 0);\r
-    GLUTImageViewers ripplingViewer(ptrRippling, isAnimation, isSelection, 10, 10);\r
-    // TODO : Insert here autres ImageViewers ...\r
+    // Viewer<Rippling0Image, Rippling0Provider> rippling0(true, true, 10, 10);\r
+    // Viewer<Image, RipplingProvider> rippling0(true, true, 10, 10);\r
+    Viewer<ImageFonctionel, MandelbrotProvider> fractalMandelbrot(true, true, 20, 20);\r
+    // Viewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 30, 30);\r
+    // Viewer<ImageFonctionel, NewtonProvider> newtown(true, true, 20, 20);\r
+    // Viewer<Image, HeatTransfertProvider> heatTransfert(true, false, 20, 20);\r
+    // Viewer<ImageFonctionel, RayTracingProvider> rayTracing(true, true, 20, 20);\r
 \r
     GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte\r
 \r
-    // destruction\r
-       {\r
-       delete ptrRippling0;\r
-       delete ptrRippling;\r
-\r
-       ptrRippling0 = NULL;\r
-       ptrRippling = NULL;\r
-       }\r
-\r
     return EXIT_SUCCESS;\r
     }\r
-\r
-/*--------------------------------------*\\r
- |*            Private                 *|\r
- \*-------------------------------------*/\r
-\r
-/*----------------------------------------------------------------------*\\r
- |*                    End                                             *|\r
- \*---------------------------------------------------------------------*/\r
-\r