public void UpdateLod(int newLod) { int entityLod = _entityLodResolver.GetEntityLod(newLod); if (_entityLodLevel != entityLod) { _entityLodLevel = entityLod; _splat.Remove(); _splat = _splatGenerator.GenerateSplat(_position, _entityLodLevel); } }
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(); }