public ColorMipmap(IColorFunction2D colorFunction, int baseLevelSize, int tileSize, int border, int channels, string tempFolder) : base(baseLevelSize, baseLevelSize, tileSize, channels, 200) { ColorFunction = colorFunction; this.BaseLevelSize = baseLevelSize; this.Size = tileSize; this.Border = Mathf.Max(0, border); this.MaxLevel = 0; this.TempFolder = tempFolder; var size = BaseLevelSize; while (size > this.Size) { MaxLevel += 1; size /= 2; } TileData = new byte[(this.Size + 2 * this.Border) * (this.Size + 2 * this.Border) * Channels]; ConstantTileIDs = new Dictionary <int, int>(); Left = null; Right = null; Bottom = null; Top = null; Debug.Log(string.Format("ColorMipmap.ctor: BaseLevelSize: {0}; TileSize: {1}; Border: {2}; MaxLevel: {3}; Channels: {4}", BaseLevelSize, this.Size, this.Border, MaxLevel, Channels)); }
public void SetCube(ColorMipmap hm1, ColorMipmap hm2, ColorMipmap hm3, ColorMipmap hm4, ColorMipmap hm5, ColorMipmap hm6) { // NOTE : Ffffffffrrrrrrraaaaaacccccttttaaalls! hm1.Left = hm5; hm1.Right = hm3; hm1.Bottom = hm2; hm1.Top = hm4; hm2.Left = hm5; hm2.Right = hm3; hm2.Bottom = hm6; hm2.Top = hm1; hm3.Left = hm2; hm3.Right = hm4; hm3.Bottom = hm6; hm3.Top = hm1; hm4.Left = hm3; hm4.Right = hm5; hm4.Bottom = hm6; hm4.Top = hm1; hm5.Left = hm4; hm5.Right = hm2; hm5.Bottom = hm6; hm5.Top = hm1; hm6.Left = hm5; hm6.Right = hm3; hm6.Bottom = hm4; hm6.Top = hm2; hm1.LeftR = 3; hm1.RightR = 1; hm1.BottomR = 0; hm1.TopR = 2; hm2.LeftR = 0; hm2.RightR = 0; hm2.BottomR = 0; hm2.TopR = 0; hm3.LeftR = 0; hm3.RightR = 0; hm3.BottomR = 1; hm3.TopR = 3; hm4.LeftR = 0; hm4.RightR = 0; hm4.BottomR = 2; hm4.TopR = 2; hm5.LeftR = 0; hm5.RightR = 0; hm5.BottomR = 3; hm5.TopR = 1; hm6.LeftR = 1; hm6.RightR = 3; hm6.BottomR = 2; hm6.TopR = 0; }
/// <summary> /// Preprocess a map into files that can be used with a <see cref="OrthoCPUProducer"/>. /// </summary> /// <param name="source">The map to be preprocessed.</param> /// <param name="tempFolder">Where temporary files must be saved.</param> /// <param name="destinationFolder">Where the precomputed file must be saved.</param> void PreprocessOrtho(InputMap source, string tempFolder, string destinationFolder) { var startTime = Time.realtimeSinceStartup; var destinationSize = DestinationTileSize << DestinationMaxLevel; IColorFunction2D function = new PlaneColorFunction(source, destinationSize); ColorMipmap mipmap = new ColorMipmap(function, destinationSize, DestinationTileSize, 2, DestinationChannels, tempFolder); mipmap.Compute(); mipmap.Generate(0, 0, 0, destinationFolder + "/" + FileName + ".proland"); Debug.Log(string.Format("PreProcessTerrain.PreprocessOrtho: Computation time: {0} s", (Time.realtimeSinceStartup - startTime))); }
public void SetCube(ColorMipmap hm1, ColorMipmap hm2, ColorMipmap hm3, ColorMipmap hm4, ColorMipmap hm5, ColorMipmap hm6) { hm1.Left = hm5; hm1.Right = hm3; hm1.Bottom = hm2; hm1.Top = hm4; hm2.Left = hm5; hm2.Right = hm3; hm2.Bottom = hm6; hm2.Top = hm1; hm3.Left = hm2; hm3.Right = hm4; hm3.Bottom = hm6; hm3.Top = hm1; hm4.Left = hm3; hm4.Right = hm5; hm4.Bottom = hm6; hm4.Top = hm1; hm5.Left = hm4; hm5.Right = hm2; hm5.Bottom = hm6; hm5.Top = hm1; hm6.Left = hm5; hm6.Right = hm3; hm6.Bottom = hm4; hm6.Top = hm2; hm1.LeftR = 3; hm1.RightR = 1; hm1.BottomR = 0; hm1.TopR = 2; hm2.LeftR = 0; hm2.RightR = 0; hm2.BottomR = 0; hm2.TopR = 0; hm3.LeftR = 0; hm3.RightR = 0; hm3.BottomR = 1; hm3.TopR = 3; hm4.LeftR = 0; hm4.RightR = 0; hm4.BottomR = 2; hm4.TopR = 2; hm5.LeftR = 0; hm5.RightR = 0; hm5.BottomR = 3; hm5.TopR = 1; hm6.LeftR = 1; hm6.RightR = 3; hm6.BottomR = 2; hm6.TopR = 0; }