Ejemplo n.º 1
0
    private void PickRawDefaults(string path)
    {
        FileStream fileStream = File.Open(path, FileMode.Open, FileAccess.Read);
        int        num        = (int)fileStream.Length;

        fileStream.Close();
        this.m_TerrainSize = base.terrainData.size;

        if (terrainData.heightmapWidth * terrainData.heightmapHeight == num)
        {
            this.m_Width  = base.terrainData.heightmapWidth;
            this.m_Height = base.terrainData.heightmapHeight;
            this.m_Depth  = ImportRawHeightmap.Depth.Bit8;
        }
        else if (terrainData.heightmapWidth * terrainData.heightmapHeight * 2 == num)
        {
            this.m_Width  = base.terrainData.heightmapWidth;
            this.m_Height = base.terrainData.heightmapHeight;
            this.m_Depth  = ImportRawHeightmap.Depth.Bit16;
        }
        else
        {
            this.m_Depth = ImportRawHeightmap.Depth.Bit8;
            int num2 = num / (int)this.m_Depth;
            int num3 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
            int num4 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
            if (num3 * num4 * (int)this.m_Depth == num)
            {
                this.m_Width  = num3;
                this.m_Height = num4;
            }
            else
            {
                this.m_Depth = ImportRawHeightmap.Depth.Bit8;
                num2         = num / (int)this.m_Depth;
                num3         = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
                num4         = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
                if (num3 * num4 * (int)this.m_Depth == num)
                {
                    this.m_Width  = num3;
                    this.m_Height = num4;
                }
                else
                {
                    this.m_Depth = ImportRawHeightmap.Depth.Bit8;
                }
            }
        }
    }
Ejemplo n.º 2
0
        private void PickRawDefaults(string path)
        {
            FileStream fileStream = File.Open(path, System.IO.FileMode.Open, FileAccess.Read);
            int        length     = (int)fileStream.Length;

            fileStream.Close();
            this.m_TerrainSize = this.terrainData.size;
            if (this.terrainData.heightmapWidth * this.terrainData.heightmapHeight == length)
            {
                this.m_Width  = this.terrainData.heightmapWidth;
                this.m_Height = this.terrainData.heightmapHeight;
                this.m_Depth  = ImportRawHeightmap.Depth.Bit8;
            }
            else if (this.terrainData.heightmapWidth * this.terrainData.heightmapHeight * 2 == length)
            {
                this.m_Width  = this.terrainData.heightmapWidth;
                this.m_Height = this.terrainData.heightmapHeight;
                this.m_Depth  = ImportRawHeightmap.Depth.Bit16;
            }
            else
            {
                this.m_Depth = ImportRawHeightmap.Depth.Bit16;
                int num1 = length / (int)this.m_Depth;
                int num2 = Mathf.RoundToInt(Mathf.Sqrt((float)num1));
                int num3 = Mathf.RoundToInt(Mathf.Sqrt((float)num1));
                if (num2 * num3 * (int)this.m_Depth == length)
                {
                    this.m_Width  = num2;
                    this.m_Height = num3;
                }
                else
                {
                    this.m_Depth = ImportRawHeightmap.Depth.Bit8;
                    int num4 = length / (int)this.m_Depth;
                    int num5 = Mathf.RoundToInt(Mathf.Sqrt((float)num4));
                    int num6 = Mathf.RoundToInt(Mathf.Sqrt((float)num4));
                    if (num5 * num6 * (int)this.m_Depth == length)
                    {
                        this.m_Width  = num5;
                        this.m_Height = num6;
                    }
                    else
                    {
                        this.m_Depth = ImportRawHeightmap.Depth.Bit16;
                    }
                }
            }
        }
		private void PickRawDefaults(string path)
		{
			FileStream fileStream = File.Open(path, FileMode.Open, FileAccess.Read);
			int num = (int)fileStream.Length;
			fileStream.Close();
			this.m_TerrainSize = base.terrainData.size;
			if (base.terrainData.heightmapWidth * base.terrainData.heightmapHeight == num)
			{
				this.m_Width = base.terrainData.heightmapWidth;
				this.m_Height = base.terrainData.heightmapHeight;
				this.m_Depth = ImportRawHeightmap.Depth.Bit8;
			}
			else
			{
				if (base.terrainData.heightmapWidth * base.terrainData.heightmapHeight * 2 == num)
				{
					this.m_Width = base.terrainData.heightmapWidth;
					this.m_Height = base.terrainData.heightmapHeight;
					this.m_Depth = ImportRawHeightmap.Depth.Bit16;
				}
				else
				{
					this.m_Depth = ImportRawHeightmap.Depth.Bit16;
					int num2 = num / (int)this.m_Depth;
					int num3 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
					int num4 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
					if (num3 * num4 * (int)this.m_Depth == num)
					{
						this.m_Width = num3;
						this.m_Height = num4;
						return;
					}
					this.m_Depth = ImportRawHeightmap.Depth.Bit8;
					num2 = num / (int)this.m_Depth;
					num3 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
					num4 = Mathf.RoundToInt(Mathf.Sqrt((float)num2));
					if (num3 * num4 * (int)this.m_Depth == num)
					{
						this.m_Width = num3;
						this.m_Height = num4;
						return;
					}
					this.m_Depth = ImportRawHeightmap.Depth.Bit16;
				}
			}
		}
 private void PickRawDefaults(string path)
 {
   FileStream fileStream = File.Open(path, System.IO.FileMode.Open, FileAccess.Read);
   int length = (int) fileStream.Length;
   fileStream.Close();
   this.m_TerrainSize = this.terrainData.size;
   if (this.terrainData.heightmapWidth * this.terrainData.heightmapHeight == length)
   {
     this.m_Width = this.terrainData.heightmapWidth;
     this.m_Height = this.terrainData.heightmapHeight;
     this.m_Depth = ImportRawHeightmap.Depth.Bit8;
   }
   else if (this.terrainData.heightmapWidth * this.terrainData.heightmapHeight * 2 == length)
   {
     this.m_Width = this.terrainData.heightmapWidth;
     this.m_Height = this.terrainData.heightmapHeight;
     this.m_Depth = ImportRawHeightmap.Depth.Bit16;
   }
   else
   {
     this.m_Depth = ImportRawHeightmap.Depth.Bit16;
     int num1 = length / (int) this.m_Depth;
     int num2 = Mathf.RoundToInt(Mathf.Sqrt((float) num1));
     int num3 = Mathf.RoundToInt(Mathf.Sqrt((float) num1));
     if (num2 * num3 * (int) this.m_Depth == length)
     {
       this.m_Width = num2;
       this.m_Height = num3;
     }
     else
     {
       this.m_Depth = ImportRawHeightmap.Depth.Bit8;
       int num4 = length / (int) this.m_Depth;
       int num5 = Mathf.RoundToInt(Mathf.Sqrt((float) num4));
       int num6 = Mathf.RoundToInt(Mathf.Sqrt((float) num4));
       if (num5 * num6 * (int) this.m_Depth == length)
       {
         this.m_Width = num5;
         this.m_Height = num6;
       }
       else
         this.m_Depth = ImportRawHeightmap.Depth.Bit16;
     }
   }
 }