#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
+#include "HeatTransfertProvider.h"\r
+#include "RayTracingProvider.h"\r
+#include "ConvolutionProvider.h"\r
\r
-using std::cout;\r
-using std::endl;\r
-using std::string;\r
-\r
-class RipplingViewer\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
- {\r
- delete this->ptrRippling0;\r
- delete this->ptrRippling;\r
- }\r
- private:\r
- Rippling0Image* ptrRippling0;\r
- Image* ptrRippling;\r
- GLUTImageViewers rippling0Viewer, ripplingViewer;\r
- };\r
+#include "Viewer.h"\r
\r
-class FractalViewer\r
+int mainGL(const vector<string>& args)\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
- {\r
- delete this->ptrMandelbrot;\r
- delete this->ptrJulia;\r
- }\r
- private:\r
- ImageFonctionel* ptrMandelbrot;\r
- ImageFonctionel* ptrJulia;\r
- GLUTImageViewers mandelbrotViewer, juliaViewer;\r
- };\r
+ const string defaultCommand = "raytracing";\r
+ const string command = args.size() > 0 ? args[0] : defaultCommand;\r
\r
-int mainGL(void)\r
- {\r
- // RipplingViewer rippling;\r
- // FractalViewer fractals;\r
+ // AutoViewer<Rippling0Image, Rippling0Provider> rippling0(true, true, 10, 10); // Warmup.\r
\r
- GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte\r
+ if (command == "rippling")\r
+ {\r
+ AutoViewer<Image, RipplingProvider> rippling(true, true, 10, 10);\r
+ }\r
+ else if (command == "mandelbrot")\r
+ {\r
+ const bool multiGPU = args.size() >= 2 && args[1] == "--mp";\r
+ Viewer<ImageFonctionel> fractalMandelbrot(MandelbrotProvider::createGL(multiGPU), true, true, 10, 10);\r
+ }\r
+ else if (command == "julia")\r
+ AutoViewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 10, 10);\r
+ else if (command == "newton")\r
+ AutoViewer<ImageFonctionel, NewtonProvider> newtown(true, true, 10, 10);\r
+ else if (command == "heat-transfert")\r
+ AutoViewer<Image, HeatTransfertProvider> heatTransfert(true, false, 10, 10);\r
+ else if (command == "raytracing")\r
+ AutoViewer<Image, RayTracingProvider> rayTracing(true, true, 20, 20);\r
+ else if (command == "convolution")\r
+ {\r
+ const string videoPath = args.size() >= 2 ? args[1] : "/media/Data/Video/nasaFHD_short.avi"; // Vidéo par défaut si pas donnée en paramètre.\r
+ Viewer<Image> convolution(ConvolutionProvider::createGL(videoPath), true, true, 10, 10);\r
+ }\r
+ else if (command == "demo")\r
+ {\r
+ Viewer<Image> convolution(ConvolutionProvider::createGL("/media/Data/Video/nasaFHD_short.avi"), true, true, 10, 10, false);\r
+ AutoViewer<Image, RipplingProvider> rippling(true, true, 60, 30, false);\r
+ Viewer<ImageFonctionel> fractalMandelbrot(MandelbrotProvider::createGL(false), true, true, 120, 60, false);\r
+ AutoViewer<ImageFonctionel, JuliaProvider> fractalJulia(true, true, 180, 80, false);\r
+ AutoViewer<ImageFonctionel, NewtonProvider> newtown(true, true, 260, 120, false);\r
+ AutoViewer<Image, HeatTransfertProvider> heatTransfert(true, false, 1200, 300, false);\r
+ GLUTImageViewers::runALL();\r
+ }\r
+ else\r
+ {\r
+ cout << "Command unknown: " << command << endl;\r
+ }\r
\r
return EXIT_SUCCESS;\r
}\r