| 32 | namespace Falcor |
| 33 | { |
| 34 | static void clampToEdge(float2& pix, uint32_t width, uint32_t height, uint32_t offset) |
| 35 | { |
| 36 | float2 posOffset = pix + float2(offset, offset); |
| 37 | float2 negOffset = pix - float2(offset, offset); |
| 38 | |
| 39 | // x |
| 40 | if (posOffset.x > width) |
| 41 | { |
| 42 | pix.x = pix.x - (posOffset.x - width); |
| 43 | } |
| 44 | else if (negOffset.x < 0) |
| 45 | { |
| 46 | pix.x = pix.x - negOffset.x; |
| 47 | } |
| 48 | |
| 49 | // y |
| 50 | if (posOffset.y > height) |
| 51 | { |
| 52 | pix.y = pix.y - (posOffset.y - height); |
| 53 | } |
| 54 | else if (negOffset.y < 0) |
| 55 | { |
| 56 | pix.y = pix.y - negOffset.y; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | PixelZoom::PixelZoom(ref<Device> pDevice, const Fbo* pBackbuffer) : mpDevice(pDevice) |
| 61 | { |