public void generateNoise() { NoiseTexture = new Texture2D(Constants.ChunkWidth, Constants.ChunkHeight); Pixels = new Color[Constants.ChunkWidth * Constants.ChunkHeight]; NoiseGenerator = new FlatGenNoise(seed, new Vector2Int(0, 0), Persistance, Lacunarity, NumOctaves, ScaleFactor); // NoiseGenerator = new FlatGenNoise(); LoadMapIntoPixels(); NoiseTexture.SetPixels(Pixels); NoiseTexture.Apply(); textureRenderer.sharedMaterial.mainTexture = NoiseTexture; textureRenderer.transform.localScale = new Vector3(Constants.ChunkWidth, 1, Constants.ChunkHeight); }
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(); }