public void Init(DataVolume dataVolume, int yLevel, int themeIndex, TileThemePalette themePalette, float3 cellSize = default, Settings settings = null) { var theme = themePalette.Get(themeIndex); int fillValue = themePalette.GetFillValue(themeIndex); Init(dataVolume, yLevel, fillValue, theme, themePalette, cellSize, settings); }
override public void Dispose() { base.Dispose(); SafeDispose(ref tiles); Theme?.Release(); Theme = null; ThemePalette = null; }
public void Init(DataVolume dataVolume, int yLevel, int fillValue, TileTheme theme, TileThemePalette themePalette, float3 cellSize = default, Settings settings = null) { Dispose(); this.cellSize = cellSize; if (cellSize.x == 0 && cellSize.y == 0 && cellSize.z == 0) { this.cellSize = new float3(1, 1, 1); } theme.Init(); if (theme.Configs.Length < TileTheme.Type2DConfigCount) { Debug.LogError("TileMesher theme has less than the required number of configurations! " + theme.ThemeName); return; } Data = dataVolume; ThemePalette = themePalette; FillValue = fillValue; MesherSettings = settings ?? DefaultSettings; Theme = theme; YLevel = Mathf.Clamp(yLevel, 0, dataVolume.YLength - 1); if (YLevel != yLevel) { Debug.LogError("TileMesher2D yLevel is out of bounds:" + yLevel + " it is clamped!"); } int x = Data.XLength; int y = Data.YLength; int z = Data.ZLength; dataExtents = new Extents(x, y, z); tileExtents = new Extents(x + 1, 1, z + 1); generationType = GenerationType.FromDataUncached; Inited(); }