public void BiomeMap2DPreview(GUIContent prefix, BiomeData biomeData, bool update, bool settings = true, bool debug = true) { if (biomeData.biomeIds == null) { Debug.Log("biomeData does not contains biome map 2D"); return; } var map = biomeData.biomeIds; int texSize = biomeData.biomeIds.size; var fieldSettings = GetGUISettingData(() => { var state = new PWGUISettings(); state.filterMode = FilterMode.Point; state.debug = debug; update = true; return(state); }); if (fieldSettings.texture == null) { fieldSettings.texture = new Texture2D(texSize, texSize, TextureFormat.RGBA32, false); fieldSettings.texture.filterMode = FilterMode.Point; } if (texSize != fieldSettings.texture.width) { fieldSettings.texture.Resize(texSize, texSize, TextureFormat.RGBA32, false); } if (update || fieldSettings.update) { for (int x = 0; x < texSize; x++) { for (int y = 0; y < texSize; y++) { var blendInfo = map.GetBiomeBlendInfo(x, y); var biome = biomeData.biomeTree.GetBiome(blendInfo.firstBiomeId); if (biome == null) { continue; } Color firstBiomeColor = biome.previewColor; //TODO: second biome color: fieldSettings.texture.SetPixel(x, y, firstBiomeColor); } } fieldSettings.texture.Apply(); } TexturePreview(fieldSettings.texture, false, false, false); }
public void BiomeMap2DPreview(BiomeData map, bool update, bool settings = true, bool debug = true) { BiomeMap2DPreview(new GUIContent(), map, update, settings, debug); }