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=3d4d02f88f80e42573770ef4ebc869fb4aa487a7;hpb=7a1564c56b396cfeb1cbc246fe7b441304364465;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 3d4d02f..13dd2db 100755 --- a/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/mainGL.cpp @@ -1,6 +1,7 @@ #include #include #include +using namespace std; #include "GLUTImageViewers.h" @@ -9,57 +10,57 @@ #include "Rippling0Provider.h" #include "RipplingProvider.h" - #include "FractalProvider.h" +#include "NewtonProvider.h" +#include "HeatTransfertProvider.h" +#include "RayTracingProvider.h" +#include "ConvolutionProvider.h" -using std::cout; -using std::endl; -using std::string; - -class RipplingViewer - { - public: - RipplingViewer() - : ptrRippling0(Rippling0Provider::createGL()), ptrRippling(RipplingProvider::createGL()), - rippling0Viewer(this->ptrRippling0, true, true, 0, 0), - ripplingViewer(this->ptrRippling, true, true, 20, 20) - {} - ~RipplingViewer() - { - delete this->ptrRippling0; - delete this->ptrRippling; - } - private: - Rippling0Image* ptrRippling0; - Image* ptrRippling; - GLUTImageViewers rippling0Viewer, ripplingViewer; - }; +#include "Viewer.h" -class FractalViewer +int mainGL(const vector& args) { - public: - FractalViewer() - : ptrMandelbrot(FractalProvider::createMandelbrotGL()), ptrJulia(FractalProvider::createJuliaGL()), - mandelbrotViewer(this->ptrMandelbrot, true, true, 0, 0), - juliaViewer(this->ptrJulia, true, true, 20, 20) - {} - ~FractalViewer() - { - delete this->ptrMandelbrot; - delete this->ptrJulia; - } - private: - ImageFonctionel* ptrMandelbrot; - ImageFonctionel* ptrJulia; - GLUTImageViewers mandelbrotViewer, juliaViewer; - }; + const string defaultCommand = "raytracing"; + const string command = args.size() > 0 ? args[0] : defaultCommand; -int mainGL(void) - { - // RipplingViewer rippling; - // FractalViewer fractals; + // AutoViewer rippling0(true, true, 10, 10); // Warmup. - GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte + 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; }