private void Update() { if (Input.GetKey(KeyCode.UpArrow)) { _rootInstanceContainer.SetGlobalColor("_Color", new Color(a % 1.0f, (a + 0.5f) % 1.0f, (a + 0.3f) % 1.0f)); a += 0.1f; } if (Input.GetKey(KeyCode.Q)) { _rootInstanceContainer.SetGlobalUniform(GrassShaderUniformName._BendingStrength, windStrength); windStrength += 0.1f; windStrength = Mathf.Clamp01(windStrength); } if (Input.GetKey(KeyCode.W)) { _rootInstanceContainer.SetGlobalUniform(GrassShaderUniformName._BendingStrength, windStrength); windStrength -= 0.1f; windStrength = Mathf.Clamp01(windStrength); } if (Input.GetKey(KeyCode.T)) { grassSplat.Remove(); } //if (Time.frameCount%100 == 0) //{ // _manager.UpdateLod(new Vector3(0, 0, 0)); //} if (windStrength < 1) { //_manager.UpdateLod(new Vector3(0,0,0)); //windStrength = 2; } if (Time.frameCount % 100 == 0) { _grassLodManager.UpdateLod(CameraGameObject.transform.position); } _rootInstanceContainer.Draw(); }
private void Update() { //if (Input.GetKey(KeyCode.UpArrow)) //{ // _rootInstanceContainer.SetGlobalColor("_Color", new Color(a%1.0f, (a + 0.5f)%1.0f, (a + 0.3f)%1.0f)); // a += 0.1f; //} //if (Input.GetKey(KeyCode.Q)) //{ // _rootInstanceContainer.SetGlobalUniform(GrassShaderUniformName._BendingStrength, windStrength); // windStrength += 0.1f; // windStrength = Mathf.Clamp01(windStrength); //} //if (Input.GetKey(KeyCode.W)) //{ // _rootInstanceContainer.SetGlobalUniform(GrassShaderUniformName._BendingStrength, windStrength); // windStrength -= 0.1f; // windStrength = Mathf.Clamp01(windStrength); //} //if (Input.GetKey(KeyCode.T)) //{ // grassSplat.Remove(); //} ////if (Time.frameCount%100 == 0) ////{ //// _manager.UpdateLod(new Vector3(0, 0, 0)); ////} //if (windStrength < 1) //{ // //_manager.UpdateLod(new Vector3(0,0,0)); // //windStrength = 2; //} float move = 0.05f; if (Input.GetKey(KeyCode.L)) { CameraGameObject.transform.position += new Vector3(move, 0, 0); } if (Input.GetKey(KeyCode.I)) { CameraGameObject.transform.position += new Vector3(0, 0, move); } if (Input.GetKey(KeyCode.K)) { CameraGameObject.transform.position += new Vector3(0, 0, -move); } if (Input.GetKey(KeyCode.J)) { CameraGameObject.transform.position += new Vector3(-move, 0, 0); } if (Time.frameCount % 100 == 0) { _grassLodManager.UpdateLod(CameraGameObject.transform.position); } _grassLodManager.UpdateNewGroups(); _rootInstanceContainer.Draw(); }