示例#1
0
            // GetPixelHeightAlpha - Float
            public override HeightAlpha GetPixelHeightAlpha(float x, float y)
            {
                if (!IsLoaded)
                {
                    if (OnDemandStorage.onDemandLogOnMissing)
                    {
                        Debug.Log("[OD] ERROR: getting pixelHeightAlphaF with unloaded map " + name + " of path " + Path + ", autoload = " + AutoLoad);
                    }
                    if (AutoLoad)
                    {
                        Load();
                    }
                    else
                    {
                        return(new HeightAlpha(0f, 0f));
                    }
                }

                BilinearCoords coords = ConstructBilinearCoords(x, y);

                return(HeightAlpha.Lerp(
                           HeightAlpha.Lerp(
                               GetPixelHeightAlpha(coords.xFloor, coords.yFloor),
                               GetPixelHeightAlpha(coords.xCeiling, coords.yFloor),
                               coords.u),
                           HeightAlpha.Lerp(
                               GetPixelHeightAlpha(coords.xFloor, coords.yCeiling),
                               GetPixelHeightAlpha(coords.xFloor, coords.yCeiling),
                               coords.u),
                           coords.v));
            }
示例#2
0
            /// GetPixelHeightAlpha - Float
            public HeightAlpha GetPixelHeightAlpha(Single x, Single y)
            {
                BilinearCoords coords = ConstructBilinearCoords(x, y);

                return(HeightAlpha.Lerp(
                           HeightAlpha.Lerp(
                               GetPixelHeightAlpha(coords.xFloor, coords.yFloor),
                               GetPixelHeightAlpha(coords.xCeiling, coords.yFloor),
                               coords.u),
                           HeightAlpha.Lerp(
                               GetPixelHeightAlpha(coords.xFloor, coords.yCeiling),
                               GetPixelHeightAlpha(coords.xFloor, coords.yCeiling),
                               coords.u),
                           coords.v));
            }
示例#3
0
 /// <summary>
 /// Lerps two HeightAlphas
 /// </summary>
 /// <returns></returns>
 public static HeightAlpha Lerp(HeightAlpha a, HeightAlpha b, Single dt)
 {
     return(new HeightAlpha(a.height + (b.height - a.height) * dt, a.alpha + (b.alpha - a.alpha) * dt));
 }