X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F02_Damier_Zoomable%2Fmoo%2Fhost%2FDamier.cu;fp=WCudaMSE%2FTuto_Image_Cuda%2Fsrc%2Fcpp%2Fcore%2F02_Damier_Zoomable%2Fmoo%2Fhost%2FDamier.cu;h=52ba530ae543225005d1d1141309abc46d2d8c13;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/02_Damier_Zoomable/moo/host/Damier.cu b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/02_Damier_Zoomable/moo/host/Damier.cu new file mode 100755 index 0000000..52ba530 --- /dev/null +++ b/WCudaMSE/Tuto_Image_Cuda/src/cpp/core/02_Damier_Zoomable/moo/host/Damier.cu @@ -0,0 +1,136 @@ +#include + +#include "Damier.h" +#include "Device.h" +#include "MathTools.h" + +/*----------------------------------------------------------------------*\ + |* Declaration *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Imported *| + \*-------------------------------------*/ + +__global__ void damier(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, int n, float t); + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* Implementation *| + \*---------------------------------------------------------------------*/ + +/*--------------------------------------*\ + |* Public *| + \*-------------------------------------*/ + +/*-------------------------*\ + |* Constructeur *| + \*-------------------------*/ + +Damier::Damier(int w, int h, float dt, int n) : + variateurAnimation(IntervalF(0, 2 * PI), dt) + { + // Inputs + this->w = w; + this->h = h; + this->n = n; + + // Tools + this->dg = dim3(8, 8, 1); // disons a optimiser + this->db = dim3(16, 16, 1); // disons a optimiser + this->t = 0; + ptrDomaineMathInit=new DomaineMath(0,0,2*PI,2*PI); + + //Outputs + this->title = "[API Image Fonctionelle] : Damier zoomable CUDA"; + + // Check: + //print(dg, db); + Device::assertDim(dg, db); + assert(w == h); + } + +Damier::~Damier() + { + delete ptrDomaineMathInit; + } + +/*-------------------------*\ + |* Methode *| + \*-------------------------*/ + +/** + * Override + */ +void Damier::animationStep() + { + this->t = variateurAnimation.varierAndGet(); // in [0,2pi] + } + +/** + * Override + */ +void Damier::runGPU(uchar4* ptrDevPixels, const DomaineMath& domaineMath) + { + damier<<>>(ptrDevPixels,w,h,domaineMath,n,t); + } + +/*--------------*\ + |* get *| + \*--------------*/ + +/** + * Override + */ +DomaineMath* Damier::getDomaineMathInit(void) + { + return ptrDomaineMathInit; + } + +/** + * Override + */ +float Damier::getT(void) + { + return t; + } + +/** + * Override + */ +int Damier::getW(void) + { + return w; + } + +/** + * Override + */ +int Damier::getH(void) + { + return h; + } + +/** + * Override + */ +string Damier::getTitle(void) + { + return title; + } + +/*--------------------------------------*\ + |* Private *| + \*-------------------------------------*/ + +/*----------------------------------------------------------------------*\ + |* End *| + \*---------------------------------------------------------------------*/ +