www.pudn.com > GPU-KLT-1.0.zip > pyramid_with_derivative_pass2.cg


/*
Copyright (c) 2008 University of North Carolina at Chapel Hill

This file is part of GPU-KLT.

GPU-KLT is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

GPU-KLT is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
details.

You should have received a copy of the GNU Lesser General Public License along
with GPU-KLT. If not, see .
*/

void main(uniform sampler2D src_tex : TEXUNIT0,
                            float4 st0 : TEXCOORD0,
                            float4 st1 : TEXCOORD1,
                        out float3 color : COLOR)
{
   float3 val1 = tex2D(src_tex, st0.xy).xyz;
   float3 val2 = tex2D(src_tex, st0.zw).xyz;
   float3 val3 = tex2D(src_tex, st1.xy).xyz;
   float3 val4 = tex2D(src_tex, st1.zw).xyz;

   // This is the (even) binomial kernel [1 3 3 1]
   color = (val1 + 3*val2 + 3*val3 + val4) / 8.0f;
}