Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="geom"></param>
        /// <param name="bounds"></param>
        public TreeLoader2D(PagedGeometry geom, TBounds bounds)
        {
            //Calculate grid size
            mGeom = geom;
            mPageSize = mGeom.PageSize;

            //Reset height function
            mHeightFunction = null;
            mHeightFunctionUserData = null;

            //Make sure the bounds are aligned with PagedGeometry's grid, so the TreeLoader's grid tiles will have a 1:1 relationship
            mActualBounds = bounds;
            mGridBounds = bounds;

            mGridBounds.Left = (float)(mPageSize * System.Math.Floor((mGridBounds.Left - mGeom.Bounds.Left) / mPageSize) + mGeom.Bounds.Left);
            mGridBounds.Top = (float)(mPageSize * System.Math.Floor((mGridBounds.Top - mGeom.Bounds.Top) / mPageSize) + mGeom.Bounds.Top);
            mGridBounds.Right = (float)(mPageSize * System.Math.Ceiling((mGridBounds.Right - mGeom.Bounds.Left) / mPageSize) + mGeom.Bounds.Left);
            mGridBounds.Bottom = (float)(mPageSize * System.Math.Ceiling((mGridBounds.Bottom - mGeom.Bounds.Top) / mPageSize) + mGeom.Bounds.Top);

            //Calculate page grid size
            mPageGridX = (int)(System.Math.Ceiling(mGridBounds.Width / mPageSize) + 1);
            mPageGridZ = (int)(System.Math.Ceiling(mGridBounds.Height / mPageSize) + 1);

            //Reset color map
            mColorMap = null;
            mColorMapFilter = MapFilter.None;

            //Default scale range
            mMaximumScale = 2.0f;
            mMinimumScale = 0.0f;
        }
Пример #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="map"></param>
 /// <param name="channel"></param>
 public void SetMapColor(Texture map, MapChannel channel)
 {
     if (mColorMap != null)
     {
         mColorMap.Unload();
         mColorMap = null;
     }
     if (map != null)
     {
         mColorMap = ColorMap.Load(map, channel);
         mColorMap.MapBounds = mActualBounds;
         mColorMap.Filter = mColorMapFilter;
     }
 }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geom"></param>
 /// <param name="ldr"></param>
 internal GrassLayer(PagedGeometry geom, GrassLoader ldr)
 {
     mGeom = geom;
     mParent = ldr;
     mDensity = 1.0f;
     mMinWidth = 1.0f;
     mMinHeight = 1.0f;
     mMaxWidth = 1.0f;
     mMaxHeight = 1.0f;
     mRenderTechnique = GrassTechnique.Quad;
     mFadeTechnique = FadeTechnique.Alpha;
     mAnimMag = 1.0f;
     mAnimSpeed = 1.0f;
     mAnimFreq = 1.0f;
     mWaveCount = 0.0f;
     mAnimate = false;
     mShaderNeedsUpdate = true;
     mDensityMap = null;
     mDensityMapFilter = MapFilter.Bilinear;
     mColorMap = null;
     mColorMapFilter = MapFilter.Bilinear;
 }
Пример #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="mapFile"></param>
 /// <param name="channel"></param>
 public void SetMapColor(string mapFile, MapChannel channel)
 {
     if (mColorMap != null)
     {
         mColorMap.Unload();
         mColorMap = null;
     }
     if (mapFile != "")
     {
         mColorMap = ColorMap.Load(mapFile, channel);
         mColorMap.MapBounds = mActualBounds;
         mColorMap.Filter = mColorMapFilter;
     }
 }
Пример #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="texture"></param>
 /// <param name="channel"></param>
 /// <returns></returns>
 public static ColorMap Load(Texture texture, MapChannel channel)
 {
     string key = texture.Name + (int)channel;
     ColorMap m = null;
     if (!mSelfList.TryGetValue(key, out m))
     {
         m = new ColorMap(texture, channel);
     }
     ++(m.mRefCount);
     return m;
 }