Newton, work in progress.
[GPU.git] / WCudaMSE / Student_Cuda_Image / src / cpp / core / mainGL.cpp
index 3d4d02f..d2b6adf 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
-\r
 #include "FractalProvider.h"\r
+#include "NewtonProvider.h"\r
 \r
-using std::cout;\r
-using std::endl;\r
-using std::string;\r
 \r
-class RipplingViewer\r
+template <class TOutput, class TProvider>\r
+class Viewer\r
     {\r
+    private:\r
+        TOutput* ptrProvider;\r
+        GLUTImageViewers viewer;\r
+\r
     public:\r
-        RipplingViewer()\r
-            : ptrRippling0(Rippling0Provider::createGL()), ptrRippling(RipplingProvider::createGL()),\r
-              rippling0Viewer(this->ptrRippling0, true, true, 0, 0),\r
-              ripplingViewer(this->ptrRippling, true, true, 20, 20)\r
-            {}\r
-        ~RipplingViewer()\r
+        Viewer(bool isAnimation, bool isSelection, int pxFrame, int pyFrame):\r
+            ptrProvider(TProvider::createGL()),\r
+            viewer(ptrProvider, isAnimation, isSelection, pxFrame, pyFrame)\r
             {\r
-                delete this->ptrRippling0;\r
-                delete this->ptrRippling;\r
             }\r
-    private:\r
-        Rippling0Image* ptrRippling0;\r
-        Image* ptrRippling;\r
-        GLUTImageViewers rippling0Viewer, ripplingViewer;\r
-    };\r
 \r
-class FractalViewer\r
-    {\r
-    public:\r
-        FractalViewer()\r
-            : ptrMandelbrot(FractalProvider::createMandelbrotGL()), ptrJulia(FractalProvider::createJuliaGL()),\r
-              mandelbrotViewer(this->ptrMandelbrot, true, true, 0, 0),\r
-              juliaViewer(this->ptrJulia, true, true, 20, 20)\r
-            {}\r
-        ~FractalViewer()\r
+        ~Viewer()\r
             {\r
-                delete this->ptrMandelbrot;\r
-                delete this->ptrJulia;\r
+            delete this->ptrProvider;\r
             }\r
-    private:\r
-        ImageFonctionel* ptrMandelbrot;\r
-        ImageFonctionel* ptrJulia;\r
-        GLUTImageViewers mandelbrotViewer, juliaViewer;\r
     };\r
 \r
 int mainGL(void)\r
     {\r
-    // RipplingViewer rippling;\r
-    // FractalViewer fractals;\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
+\r
+\r
+    Viewer<ImageFonctionel, NewtonProvider> newtown(true, true, 20, 20);\r
+\r
 \r
     GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte\r
 \r