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

📄 firstpass.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,
		   out float4 realoutput : COLOR0, out float4 imagoutput : COLOR1)
{
  float4 alpha_0 = float4(1,-1, 1, -1);


  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.xxyy + real11.xxyy * alpha_0;
  imagoutput = imag01.xxyy + imag11.xxyy * alpha_0;
  
}

⌨️ 快捷键说明

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