using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class DrawBlockMeshTexture : MonoBehaviour {
// Use this for initialization
void Start () {
int size = ;
Texture2D colorTxt = new Texture2D(* size, * size);
//colorTxt.filterMode = FilterMode.Point;
for (int i = ; i != colorTxt.height; i++)
{
int lat = i / size;
// 纬线圈lat上对应的方块个数
int blockNumAtLatitude = Mathf.CeilToInt( * Mathf.Cos((lat-) * Mathf.Deg2Rad));
if (blockNumAtLatitude == )
continue;
// 每一个小块对应的像素跨度
int pixPerBlock = colorTxt.width / blockNumAtLatitude;
for (int j = ; j != colorTxt.width; j++)
{
if (j % pixPerBlock == )
colorTxt.SetPixel(j, i, Color.green);
if (i % size == )
colorTxt.SetPixel(j, i, Color.red);
}
}
colorTxt.Apply();
byte[] bytes = colorTxt.EncodeToPNG();
File.WriteAllBytes(Application.dataPath + "/BlockMeshTexture.png", bytes);
}
// Update is called once per frame
void Update () {
}
}