抗锯齿,说明文档中写得比较少,只提到了multisampling和centroid sampling。
准确来说,这一次主要看FX文件,CPP文件只是在渲染一些能够突出抗锯齿效果的物体而已,并没有新代码。
texture g_tDiffuse;
sampler PointSampler =
sampler_state
{
Texture = <g_tDiffuse>;
MinFilter = Point;
MagFilter = Point;
};
sampler LinearSampler =
sampler_state
{
Texture = <g_tDiffuse>;
MinFilter = Linear;
MagFilter = Linear;
};
sampler AnisotropicSampler =
sampler_state
{
Texture = <g_tDiffuse>;
MinFilter = Anisotropic;
MagFilter = Linear;
MaxAnisotropy = 4;
};
这是什么?不用说了吧。
//--------------------------------------------------------------------------------------
// Texture - Point sampled (centroid)
//--------------------------------------------------------------------------------------
float4 TexturePointCentroidPS( float4 TexCoord : TEXCOORD0_centroid ) : COLOR0
{
return tex2D( PointSampler, TexCoord );
}
注意centroid关键字。