public float GetTerrainHeightAtXYZ(Vector3 pos)
{
float tX = pos.X;
float tY = pos.Y;
// You'd be surprized at the number of times this routine is called
// with the same parameters as last time.
if (!m_terrainModified && (lastHeightTX == tX) && (lastHeightTY == tY))
{
return(lastHeight);
}
m_terrainModified = false;
lastHeightTX = tX;
lastHeightTY = tY;
return(lastHeight = m_terrain.GetTerrainHeightAtXYZ(pos));
}