//**************************************************************************/ // Copyright 2014 Autodesk, Inc. // All rights reserved. // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. //**************************************************************************/ #include "Common.ogsfh" // The source texture uniform texture2D gSourceTex : SourceTexture < string UIName = "Source Texture"; >; // Sampler of source texture uniform sampler2D gSourceSamp = sampler_state { Texture = ; }; // The 2nd source texture uniform texture2D gSourceTex2 : SourceTexture2 < string UIName = "Source Texture 2"; >; // Sampler of 2nd source texture uniform sampler2D gSourceSamp2 = sampler_state { Texture = ; }; uniform vec4 gUVTransform : RelativeViewportDimensions; uniform vec2 gBasePos = { 0.0f, 0.0f }; GLSLShader PS_Interlace { void main() { float screenPosY = (1.0f - VSUV[1]) * gScreenSize[1]; int ypos = int(trunc( screenPosY )) + int(trunc(gBasePos[1])); vec4 result; if ( ypos % 2 != 0 ) { result = texture2D(gSourceSamp, VSUV * gUVTransform.zw + gUVTransform.xy); } else { result = texture2D(gSourceSamp2, VSUV * gUVTransform.zw + gUVTransform.xy); } colorOut = result; } } technique Main { pass p0 { VertexShader (in VS_INPUT_ScreenQuad, out VS_TO_PS_ScreenQuad) = VS_ScreenQuad; PixelShader (in VS_TO_PS_ScreenQuad, out pixelOut) = PS_Interlace; } }