void Start() { //if we are a foreground mesh, create a background mesh if (foreground) { bgPVM = Instantiate (this, transform.position + Vector3.forward * 2, Quaternion.identity) as PerlinVoxelMesh; bgPVM.foreground = false; bgPVM.transform.parent = transform; } mesh = GetComponent<MeshFilter> ().mesh; col = GetComponent<MeshCollider> (); if(!foreground){ //darken if in background renderer.material.SetColor("_EmisColor",new Color(0.7f,0.7f,0.7f,0.7f)); } xOffset = new float[Mathf.Max (scale.Length, caveScale.Length)]; yOffset = new float[Mathf.Max (scale.Length, caveScale.Length)]; //randomize offsets for (int i = 0; i< xOffset.Length; i++) { //true randomness left out for now.... xOffset[i] = Random.Range(-100,100) + GeneralOffset.x; //xOffset [i] = GeneralOffset.x; //yOffset [i] = GeneralOffset.y; yOffset[i] = Random.Range(-100,100) + GeneralOffset.y; } //image stuff //make new blank texture, and array of pixels noiseTex = new Texture2D(voxWidth, voxHeight); noiseTex.wrapMode = TextureWrapMode.Clamp; bumpMap = new Texture2D(voxWidth, voxHeight); bumpMap.wrapMode = TextureWrapMode.Clamp; pix = new Color[noiseTex.width * noiseTex.height]; bumpix = new Color[noiseTex.width * noiseTex.height]; //calculate! ReadTerrain(); //yield return null; //CalcNoise (); //GrassPass(); //SimpleTerrain(); //Debug.Log("Going to build mesh"); //StartCoroutine(BuildMesh ()); //Debug.Log ("after callin method..."); }
public void SetPVM(PerlinVoxelMesh q) { pvm = q; inTransit = false; }