RenderCompositeMap() public method

Helper method to render a composite map.
public RenderCompositeMap ( int size, Rectangle rect, Material mat, Axiom.Core.Texture destCompositeMap ) : void
size int The requested composite map size
rect Axiom.Core.Rectangle The region of the composite map to update, in image space
mat Axiom.Graphics.Material The material to use to render the map
destCompositeMap Axiom.Core.Texture
return void
Example #1
0
            /// <summary>
            /// Update the composite map for a terrain
            /// </summary>
            /// <param name="terrain"></param>
            /// <param name="rect"></param>
            public virtual void UpdateCompositeMap(Terrain terrain, Rectangle rect)
            {
                // convert point-space rect into image space
                int     compSize = terrain.CompositeMap.Width;
                var     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;
            }