void LoadMapIntoPixels() { float[] map = NoiseGenerator.CalcNoise(); for (int i = 0; i < Constants.ChunkHeight * Constants.ChunkWidth; i += 1) { Pixels[i] = Color.Lerp(Color.black, Color.white, map[i]); //Pixels[(int) height * Constants.ChunkWidth + (int) width] = new Color(value/255, value/255, value/255, 1); } }
void Start() { gameObject.AddComponent <MeshFilter>(); gameObject.AddComponent <MeshRenderer>(); mesh = new Mesh(); GetComponent <MeshFilter>().mesh = mesh; _noise = new FlatGenNoise(); y = _noise.CalcNoise(); // _flatTexturing = new FlatTexturing(y); // Texture2D tex = new Texture2D(Constants.ChunkWidth, Constants.ChunkHeight); // Color[] colors = _flatTexturing.makeColor(); // tex.SetPixels(colors); // tex.Apply(); // // textureRenderer.sharedMaterial.mainTexture = tex; // textureRenderer.transform.localScale = new Vector3(Constants.ChunkWidth,1, Constants.ChunkHeight); CreateShape(); UpdateMesh(); }