1/****************************************************************************** 2Copyright (c) W.J. van der Laan 3 4Permission is hereby granted, free of charge, to any person obtaining a copy of 5this software and associated documentation files (the "Software"), to deal in 6the Software without restriction, including without limitation the rights to use, 7copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the 8Software, and to permit persons to whom the Software is furnished to do so, subject 9to the following conditions: 10 11The above copyright notice and this permission notice shall be included in all copies 12or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 15INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 16PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 17HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 18OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE 19SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20******************************************************************************/ 21/** Deferred shading framework 22 // W.J. :wumpus: van der Laan 2005 // 23 24 Post shader: Generic fullscreen quad 25*/ 26void main( 27 float4 Pos: POSITION, 28 29 out float4 oPos: POSITION, 30 out float2 oTexCoord: TEXCOORD0, 31 32 out float3 oRay : TEXCOORD1, 33 34 uniform float3 farCorner, 35 uniform float flip 36 ) 37{ 38 // Clean up inaccuracies 39 Pos.xy = sign(Pos.xy); 40 41 oPos = float4(Pos.xy, 0, 1); 42 oPos.y *= flip; 43 44 // Image-space 45 oTexCoord.x = 0.5 * (1 + Pos.x); 46 oTexCoord.y = 0.5 * (1 - Pos.y); 47 48 // This ray will be interpolated and will be the ray from the camera 49 // to the far clip plane, per pixel 50 oRay = farCorner * float3(Pos.xy, 1); 51} 52 53 54 55