Implémentation du raytracing pour Global Memory/Shared Memory/Constant Memory
[GPU.git] / WCudaMSE / BilatTools_CPP / src / core / tools / cpp / namespace_cpu / IndiceTools_CPU.cpp
1 #include "IndiceTools_CPU.h"
2
3 /*----------------------------------------------------------------------*\
4 |* Implementation *|
5 \*---------------------------------------------------------------------*/
6
7 /*--------------------------------------*\
8 |* Public *|
9 \*-------------------------------------*/
10
11 namespace cpu
12 {
13
14 /**
15 * s[0,W*H[ --> i[0,H[ j[0,W[
16 */
17 void IndiceTools::toIJ( int s, int w, int* ptrI, int* ptrJ)
18 {
19 *ptrI = s / w;
20 *ptrJ = s - w * (*ptrI);
21 }
22
23 float2 IndiceTools::toPixelFloat(int s, int w)
24 {
25 const float y = (float)s / (float)w;
26 const float x = (float)s - (float)w * y;
27 return { x, y };
28 }
29
30 /**
31 * i[0,H[ j[0,W[ --> s[0,W*H[
32 */
33 int IndiceTools::toS(int w, int i, int j)
34 {
35 return (i * w) + j;
36 }
37
38 }
39 /*----------------------------------------------------------------------*\
40 |* End *|
41 \*---------------------------------------------------------------------*/
42