X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F00_Vague_warmup%2F01_imageAPI%2FVague0Image.cpp;fp=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F00_Vague_warmup%2F01_imageAPI%2FVague0Image.cpp;h=c91d361fbeffad001cb2afa4284e9650a1e34214;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/00_Vague_warmup/01_imageAPI/Vague0Image.cpp b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/00_Vague_warmup/01_imageAPI/Vague0Image.cpp new file mode 100755 index 0000000..c91d361 --- /dev/null +++ b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/00_Vague_warmup/01_imageAPI/Vague0Image.cpp @@ -0,0 +1,110 @@ +#include +#include +#include + +#include "MathTools.h" +#include "Vague0Image.h" +#include "StringTools.h" + +using std::cout; +using std::endl; + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +extern void launchKernelVague0(uchar4* ptrDevPixels, int w, int h, float t); + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +Vague0Image::Vague0Image(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; + } + +Vague0Image::~Vague0Image(void) + { + // rien + } + +/*--------------------------------------*\ + |* Override *| + \*-------------------------------------*/ + +/** + * Override + * Call automaticly by the api + */ +void Vague0Image::animationStep(bool& isNeedUpdateView) + { + this->t += dt; + isNeedUpdateView = true; // true par default + } + +/** + * Override + * Call automaticly by the api + */ +void Vague0Image::fillImageGL(uchar4* ptrDevImageGL, int w, int h) + { + launchKernelVague0(ptrDevImageGL, w, h, t); + } + +/** + * Override + * Call automaticly by the api + */ +void Vague0Image::paintPrimitives(Graphic2Ds& graphic2D) + { + 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("[API Image Cuda] : VagueImage warmup CUDA", ptrFont); + } + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/