< Previous | Contents | Next >

A More Complex DCT LUT Example

The following code shows an example of creating a mirror effect, illustrating how you can access pixels spatially.

// Example of spatial access for mirror effect


  DEVICE  float3 transform(int p_Width, int p_Height, int p_X, int p_Y,   TEXTURE  p_TexR,   TEXTURE  p_TexG,   TEXTURE  p_TexB)

{

const bool isMirror = (p_X < (p_Width / 2));

const float r = (isMirror) ? _tex2D(p_TexR, p_X, p_Y) : _tex2D(p_TexR, p_ Width - 1 - p_X, p_Y);

const float g = (isMirror) ? _tex2D(p_TexG, p_X, p_Y) : _tex2D(p_TexG, p_ Width - 1 - p_X, p_Y);

const float b = (isMirror) ? _tex2D(p_TexB, p_X, p_Y) : _tex2D(p_TexB, p_ Width - 1 - p_X, p_Y);

return make_float3(r, g, b);

}