//**************************************************************************/ // Copyright (c) 2011 Autodesk, Inc. // All rights reserved. // // These coded instructions, statements, and computer programs contain // unpublished proprietary information written by Autodesk, Inc., and are // protected by Federal copyright law. They may not be disclosed to third // parties or copied or duplicated in any form, in whole or in part, without // the prior written consent of Autodesk, Inc. #include "Common.cgh" // The source texture texture gSourceTex : SourceTexture < string UIName = "Source Texture"; >; // Sampler of source texture sampler2D gSourceSamp = sampler_state { Texture = ; }; // The 2nd source texture texture gSourceTex2 : SourceTexture2 < string UIName = "Source Texture 2"; >; // Sampler of 2nd source texture sampler2D gSourceSamp2 = sampler_state { Texture = ; }; float4 gUVTransform : RelativeViewportDimensions; float2 gBasePos = { 0.0f, 0.0f }; float4 PS_CheckerBoard(VS_TO_PS_ScreenQuad In) : COLOR0 { float1 screenPosX = (In.UV[0])*gScreenSize[0]; float1 screenPosY = (1.0 - In.UV[1]) * gScreenSize[1]; int xpos = int(trunc( screenPosX )) + int(trunc(gBasePos[0])); int ypos = int(trunc( screenPosY )) + int(trunc(gBasePos[1])); float4 result; if ( ypos % 2 != 0 ) { if ( xpos % 2 == 0 ) { result = tex2D(gSourceSamp, In.UV * gUVTransform.zw + gUVTransform.xy); } else { result = tex2D(gSourceSamp2, In.UV * gUVTransform.zw + gUVTransform.xy); } } else { if ( xpos % 2 == 0 ) { result = tex2D(gSourceSamp2, In.UV * gUVTransform.zw + gUVTransform.xy); } else { result = tex2D(gSourceSamp, In.UV * gUVTransform.zw + gUVTransform.xy); } } return result; } technique Main { pass p0 { VertexShader = compile glslv VS_ScreenQuad(); PixelShader = compile glslf PS_CheckerBoard(); } }