X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F00_Rippling_warmup%2F01_imageAPI%2FRippling0Image.cpp;fp=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F00_Rippling_warmup%2F01_imageAPI%2FRippling0Image.cpp;h=dc9e211dc980a9ceef9c93793b086cd1417beb76;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/00_Rippling_warmup/01_imageAPI/Rippling0Image.cpp b/WCudaMSE/Student_Cuda_Image/src/cpp/core/00_Rippling_warmup/01_imageAPI/Rippling0Image.cpp new file mode 100755 index 0000000..dc9e211 --- /dev/null +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/00_Rippling_warmup/01_imageAPI/Rippling0Image.cpp @@ -0,0 +1,108 @@ +#include +#include +#include + +#include "MathTools.h" +#include "StringTools.h" + +#include "Rippling0Image.h" + +using std::cout; +using std::endl; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +extern void launchKernelRippling0(uchar4* ptrDevPixels, int w, int h, float t); + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +Rippling0Image::Rippling0Image(unsigned int w, unsigned int h, float dt) : + ImageMOOs_A(w, h) + { + assert(getW() == getH()); // image carrer + + // Input + this->dt = dt; + + // Tools + this->t = 0; + } + +Rippling0Image::~Rippling0Image(void) + { + // rien + } + +/*--------------------------------------*\ + |* Redefinition *| + \*-------------------------------------*/ + +/** + * Call automaticly by the api + */ +void Rippling0Image::animationStep(bool& isNeedUpdateView) // Override + { + this->t += dt; + isNeedUpdateView = true; // true par default + } + +/** + * Call automaticly by the api + */ +void Rippling0Image::fillImageGL(uchar4* ptrDevImageGL, int w, int h) // Override + { + launchKernelRippling0(ptrDevImageGL, w, h, t); + } + +/** + * Call automaticly by the api + */ +void Rippling0Image::paintPrimitives(Graphic2Ds& graphic2D) // Override + { + const Font_A* ptrFont = graphic2D.getFont(TIMES_ROMAN_24); + + float r = 1; + float g = 0; + float b = 0; + + graphic2D.setColorRGB(r, g, b); + + // top + { + string message = "t = " + StringTools::toString(t); + graphic2D.drawTitleTop(message, ptrFont); + } + + // bottom + { + graphic2D.drawTitleBottom("Rippling warmup CUDA", ptrFont); + } + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/