《Focus On 3D Terrain Programming》中一段代码的注释一

时间:2023-03-08 15:35:54
《Focus On 3D Terrain Programming》中一段代码的注释一
取自《Focus On 3D Terrain Programming》中的一段:
//--------------------------------------------------------------
// Name: CTERRAIN::FilterHeightBand - private
// Description: Apply the erosion filter to an individual
// band of height values
// Arguments: -fpBand: the band to be filtered
// -iStride: how far to advance per pass
// -iCount: Number of passes to make
// -fFilter: the filter strength
// Return Value: None
//--------------------------------------------------------------
void CTERRAIN::FilterHeightBand(float* fpBand, int iStride, int iCount, float fFilter )
{
float v= fpBand[];
int j = iStride;
int i; //go through(遍历) the height band and apply the erosion filter
for( i=; i<iCount-; i++ )
{
fpBand[j]= fFilter*v + ( -fFilter )*fpBand[j]; v = fpBand[j];
j+= iStride;
}
}
滤波的一段代码,其中iStride就是步长,fFilter就是系数,为此,可以把函数参数名改为以下名称似乎更能说明函数功能:
void FilterHeightBand(float* fpBand,int iStep,int iCount,float fFilterFactor)