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=44ee7517441366796ea42cebcaf25bf6aadc6a16;hpb=8d08c12b29c2a14684f35c023ee39e694bb80d25;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 44ee751..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,69 +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; +#include "Viewer.h" -/*----------------------------------------------------------------------*\ - |* Declaration *| - \*---------------------------------------------------------------------*/ - -/*--------------------------------------*\ - |* Imported *| - \*-------------------------------------*/ - -/*--------------------------------------*\ - |* Public *| - \*-------------------------------------*/ - -int mainGL(void); - -/*--------------------------------------*\ - |* Private *| - \*-------------------------------------*/ - -/*----------------------------------------------------------------------*\ - |* Implementation *| - \*---------------------------------------------------------------------*/ - -/*--------------------------------------*\ - |* Public *| - \*-------------------------------------*/ - -int mainGL(void) +int mainGL(const vector& args) { - Rippling0Image* ptrRippling0 = Rippling0Provider::createGL(); - Image* ptrRippling = RipplingProvider::createGL(); - // TODO : Insert autres Images ... - - bool isAnimation = true; - bool isSelection = true; - - GLUTImageViewers rippling0Viewer(ptrRippling0, isAnimation, isSelection, 0, 0); - GLUTImageViewers ripplingViewer(ptrRippling, isAnimation, isSelection, 10, 10); - // TODO : Insert here autres ImageViewers ... - - GLUTImageViewers::runALL(); // Bloquant, Tant qu'une fenetre est ouverte - - // destruction - { - delete ptrRippling0; - delete ptrRippling; - - ptrRippling0 = NULL; - ptrRippling = NULL; - } + 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; } - -/*--------------------------------------*\ - |* Private *| - \*-------------------------------------*/ - -/*----------------------------------------------------------------------*\ - |* End *| - \*---------------------------------------------------------------------*/ -