ps_best.fx

来自「about the basic GA in the VC++ using GPU」· FX 代码 · 共 62 行

FX
62
字号


float4 PS_BestGene(float2 pos: TEXCOORD0) : COLOR
{ 
	float2 Tex = pos + float2(0.0019607843 , 0.0019607843);
	
	if(tex2D(ColorMapSamplerBestFit,Tex).r > tex2D(ColorMapSamplerBestFitSave,Tex).r)
	{
		float2 GenePos = tex2D(ColorMapSamplerBestFit,Tex).gb;
		return tex2D(ColorMapSamplerGene,GenePos);
	}
	else
	{
		return tex2D(ColorMapSamplerBestGene,Tex);
	}
 
}


technique TShader_BestGene
{
    pass P0
    {    
        Sampler[0] = (ColorMapSamplerGene);
        Sampler[1] = (ColorMapSamplerBestGene);
        Sampler[2] = (ColorMapSamplerBestFit);
        Sampler[3] = (ColorMapSamplerBestFitSave);	       
        PixelShader  = compile ps_3_0 PS_BestGene();        
    }
    
}


float4 PS_BestFit(float2 pos: TEXCOORD0) : COLOR
{ 
	float2 Tex = pos + float2(0.0019607843 , 0.0019607843);
	
	if(tex2D(ColorMapSamplerBestFit,Tex).r > tex2D(ColorMapSamplerBestFitSave,Tex).r)
	{
		
		return tex2D(ColorMapSamplerBestFit,Tex);
	}
	else
	{
		return tex2D(ColorMapSamplerBestFitSave,Tex);
	}
	
	//return float4(0,0,0,0);
 
}


technique TShader_BestFit
{
    pass P0
    {
		Sampler[0] = (ColorMapSamplerBestFit);
        Sampler[1] = (ColorMapSamplerBestFitSave);	       
        PixelShader  = compile ps_3_0 PS_BestFit();        
    }
    
}

⌨️ 快捷键说明

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