X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2FmainGL.cpp;h=e353be7cffd4be4bdad716c5c4bb7b0fae7ac647;hb=1c4b2276e7157acde9a3014b68d5d1667a7d6a44;hp=9f1b84aba92cc297e68ab6c09c9f8f8d1f248db7;hpb=7753d7abc9c1cdf90793a2936221aa4951c574b3;p=GPU.git diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp b/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp index 9f1b84a..e353be7 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp @@ -13,37 +13,53 @@ using namespace std; #include "FractalProvider.h" #include "NewtonProvider.h" #include "HeatTransfertProvider.h" +#include "RayTracingProvider.h" +#include "ConvolutionProvider.h" -template -class Viewer - { - private: - TOutput* ptrProvider; - GLUTImageViewers viewer; - - public: - Viewer(bool isAnimation, bool isSelection, int pxFrame, int pyFrame): - ptrProvider(TProvider::createGL()), - viewer(ptrProvider, isAnimation, isSelection, pxFrame, pyFrame) - { - } - - ~Viewer() - { - delete this->ptrProvider; - } - }; - -int mainGL(void) +#include "Viewer.h" + +int mainGL(const vector& args) { - //Viewer rippling0(true, true, 10, 10); - //Viewer rippling0(true, true, 10, 10); - //Viewer fractalMandelbrot(true, true, 20, 20); - //Viewer fractalJulia(true, true, 30, 30); - Viewer newtown(true, true, 20, 20); - //Viewer heatTransfert(true, false, 20, 20); - - GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte + const string defaultCommand = "demo"; + const string command = args.size() > 0 ? args[0] : defaultCommand; + + // AutoViewer rippling0(true, true, 10, 10); // Warmup. + + if (command == "rippling") + AutoViewer rippling(true, true, 10, 10); + else if (command == "mandelbrot") + { + const bool multiGPU = args.size() >= 2 && args[1] == "--mp"; + Viewer fractalMandelbrot(MandelbrotProvider::createGL(multiGPU), true, true, 10, 10); + } + else if (command == "julia") + AutoViewer fractalJulia(true, true, 10, 10); + else if (command == "newton") + AutoViewer newtown(true, true, 10, 10); + else if (command == "heat-transfert") + AutoViewer heatTransfert(true, false, 10, 10); + else if (command == "raytracing") + AutoViewer rayTracing(true, true, 20, 20); + else if (command == "convolution") + { + 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. + Viewer convolution(ConvolutionProvider::createGL(videoPath), true, true, 10, 10); + } + else if (command == "demo") + { + Viewer convolution(ConvolutionProvider::createGL("/media/Data/Video/nasaFHD_short.avi"), true, true, 10, 10, false); + AutoViewer rippling(true, true, 60, 30, false); + Viewer fractalMandelbrot(MandelbrotProvider::createGL(false), true, true, 120, 60, false); + AutoViewer fractalJulia(true, true, 180, 80, false); + AutoViewer newtown(true, true, 260, 120, false); + AutoViewer heatTransfert(true, false, 1200, 300, false); + AutoViewer rayTracing(true, true, 200, 80); + GLUTImageViewers::runALL(); + } + else + { + cout << "Command unknown: " << command << endl; + } return EXIT_SUCCESS; }