public virtual void UpdateCompositeMap(Terrain terrain, Rectangle rect)
{
// convert point-space rect into image space
int compSize = terrain.CompositeMap.Width;
Rectangle imgRect = new Rectangle();
Vector3 inVec = Vector3.Zero, outVec = Vector3.Zero;
inVec.x = rect.Left;
inVec.y = rect.Bottom - 1; // this is 'top' in image space, also make inclusive
terrain.ConvertPosition(Space.PointSpace, inVec, Space.TerrainSpace, ref outVec);
float left = (outVec.x * compSize);
float top = ((1.0f - outVec.y) * compSize); ;
imgRect.Left = (long)left;
imgRect.Top = (long)top;
inVec.x = rect.Right - 1;
inVec.y = rect.Top;// this is 'bottom' in image space
terrain.ConvertPosition(Space.PointSpace, inVec, Space.TerrainSpace, ref outVec);
float right = (outVec.x * (float)compSize + 1);
imgRect.Right = (long)right;
float bottom = ((1.0f - outVec.y) * compSize + 1);
imgRect.Bottom = (long)bottom;
imgRect.Left = System.Math.Max(0L, imgRect.Left);
imgRect.Top = System.Math.Max(0L, imgRect.Top);
imgRect.Right = System.Math.Min((long)compSize, imgRect.Right);
imgRect.Bottom = System.Math.Min((long)compSize, imgRect.Bottom);
#warning enable rendercompositemap
#if false
mParent.RenderCompositeMap(compSize, imgRect,
terrain.CompositeMapMaterial,
terrain.CompositeMap);
#endif
update = true;
}
static bool update = false;