X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2FmainGL.cpp;h=13dd2db46dca34f24451d37a80e33509214bfedd;hb=f8259dce248a4411c3bc64cecb9fc268c4fd81d6;hp=b15ca7b3423f9972d57c41cabc8dc25668f2daf9;hpb=fd0031be0a39a5d902750affaff6322fcd5229b1;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 b15ca7b..13dd2db 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp @@ -14,44 +14,53 @@ using namespace std; #include "NewtonProvider.h" #include "HeatTransfertProvider.h" #include "RayTracingProvider.h" +#include "ConvolutionProvider.h" -template -class Viewer - { - private: - TOutput* ptrOutput; - GLUTImageViewers viewer; - - public: - Viewer(bool isAnimation, bool isSelection, int pxFrame, int pyFrame): - ptrOutput(TProvider::createGL()), - viewer(ptrOutput, isAnimation, isSelection, pxFrame, pyFrame) - { - } - - Viewer(TOutput* output, bool isAnimation, bool isSelection, int pxFrame, int pyFrame): - ptrOutput(output), - viewer(ptrOutput, isAnimation, isSelection, pxFrame, pyFrame) - { - } - - ~Viewer() - { - delete this->ptrOutput; - } - }; - -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(MandelbrotProvider::createGL(true), true, true, 20, 20); - // Viewer fractalJulia(true, true, 30, 30); - // Viewer newtown(true, true, 20, 20); - // Viewer heatTransfert(true, false, 20, 20); - // Viewer rayTracing(true, true, 20, 20); - - GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte. + const string defaultCommand = "raytracing"; + 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); + GLUTImageViewers::runALL(); + } + else + { + cout << "Command unknown: " << command << endl; + } return EXIT_SUCCESS; }