⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 secondpass.cg

📁 基于GPU进行快速科学计算
💻 CG
字号:
void mins( varying float2 elem2d : WPOS,
                   uniform samplerRECT reals : texunit2,
		   uniform samplerRECT imags : texunit3,
		   float2 coords0 : TEXCOORD0, float2 coords1 : TEXCOORD1, float2 coords2: TEXCOORD2, 
		   float2 real_cos: TEXCOORD3, float2 real_sin: TEXCOORD4,
		   out float4 realoutput : COLOR0, out float4 imagoutput : COLOR1)
{
 // float4 alpha_0 = float4(1,cos(2*22.0/(1024*7.0)), -1, -cos(2*22.0/(1024*7.0)));
 // float4 alpha_1 = float4(0,sin(2*22.0/(1024*7.0)), 0, -sin(2*22.0/(1024*7.0)));
  float4 temp= -float4(1,1,-1,-1);
  float4 alpha_0 = real_cos.xyxy*temp;
  float4 alpha_1 = real_sin.xyxy*temp;

  float cmp = frac(coords0.x) >0.5 ? -1 : 1; //-1 is ba and 1 is rg
  float cmp1 = frac(coords0.y) > 0.5 ? -1:1;
  coords0 = cmp1 < 0  ? coords0+coords2: coords0;
  coords1 = cmp1 < 0 ? coords1+coords2: coords1;  
  
  float4 real0 = f4texRECT(reals, coords0);
  float4 real1 = f4texRECT(reals, coords1);

  float4 imag0 = f4texRECT(imags, coords0);
  float4 imag1 = f4texRECT(imags, coords1);

  float2 real01 = cmp > 0 ? real0.rg : real0.ba; 
  float2 real11 = cmp > 0 ? real1.rg : real1.ba;

  float2 imag01 = cmp > 0 ? imag0.rg : imag0.ba; 
  float2 imag11 = cmp > 0 ? imag1.rg : imag1.ba;

  realoutput = real01.xyxy + real11.xyxy * alpha_0 - imag11.xyxy*alpha_1;
  imagoutput = imag01.xyxy + imag11.xyxy * alpha_0 + real11.xyxy*alpha_1;
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -