X-Git-Url: http://git.euphorik.ch/?p=GPU.git;a=blobdiff_plain;f=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F04_RayTracing%2Fmoo%2Fdevice%2FRayTracingDevice.cu;fp=WCudaMSE%2FStudent_Cuda_Image%2Fsrc%2Fcpp%2Fcore%2F04_RayTracing%2Fmoo%2Fdevice%2FRayTracingDevice.cu;h=368e469b38eb62b398fab0fe6668e54b7af2e35b;hp=0000000000000000000000000000000000000000;hb=ebdad7dc732d4742d09fd72d312175cb07d27a59;hpb=00dcb50daad8129676832b0b646e675770ee51a0 diff --git a/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/device/RayTracingDevice.cu b/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/device/RayTracingDevice.cu new file mode 100644 index 0000000..368e469 --- /dev/null +++ b/WCudaMSE/Student_Cuda_Image/src/cpp/core/04_RayTracing/moo/device/RayTracingDevice.cu @@ -0,0 +1,43 @@ +#include +#include +using namespace std; + +#include "Indice2D.h" +#include "IndiceTools.h" +#include "cudaTools.h" +#include "Device.h" + +#include "RayTracingDevice.h" +#include "RayTracingMath.h" + +__global__ +void rayTracing(uchar4* ptrDevPixels, int w, int h, DomaineMath domaineMath, float t) + { + const int TID = Indice2D::tid(); + const int NB_THREAD = Indice2D::nbThread(); + const int WH = w * h; + + RayTracingMath rayTracing; // TODO: prendre + + uchar4 color; + color.w = 255; // Par défaut, l'image est opaque. + + double x, y; + int pixelI, pixelJ; + + int s = TID; + while (s < WH) + { + IndiceTools::toIJ(s, w, &pixelI, &pixelJ); // update (pixelI, pixelJ) + + // (i,j) domaine écran. + // (x,y) domaine math. + // domaineMath.toXY(pixelI, pixelJ, &x, &y); // (i,j) -> (x,y). + + // newtonMath.colorXY(&color, x, y); + + ptrDevPixels[s] = color; + + s += NB_THREAD; + } + }