/// <summary> /// Use to apply parameters /// </summary> public void UpdateParameters() { if (_material == null) { _material = new Material(Shader.Find(ShaderName)); } int MAX_ACT_COEEFS = 4; int sizeX = Mathf.Min(_leiaDisplay.GetDisplayConfig().ActCoefficients.x.Count, MAX_ACT_COEEFS); int sizeY = Mathf.Min(_leiaDisplay.GetDisplayConfig().ActCoefficients.y.Count, MAX_ACT_COEEFS); Vector4 x = Vector4.zero; Vector4 y = Vector4.zero; for (int i = 0; i < sizeX; ++i) { x[i] = _leiaDisplay.GetDisplayConfig().ActCoefficients.x[i]; } for (int i = 0; i < sizeY; ++i) { y[i] = _leiaDisplay.GetDisplayConfig().ActCoefficients.y[i]; } _material.SetInt("sharpening_x_size", sizeX); _material.SetInt("sharpening_y_size", sizeY); _material.SetVector("sharpening_x", x); _material.SetVector("sharpening_y", y); _lastOrientation = Screen.orientation; }
#pragma warning disable CS0618 // Type or member is obsolete private void ShowRenderModeControl() { List <string> leiaModes = _controller.GetDisplayConfig().RenderModes; var list = leiaModes.ToList().Beautify(); var previousIndex = list.IndexOf(_controller.DesiredLeiaStateID, ignoreCase: true); if (previousIndex < 0) { LogUtil.Log(LogLevel.Error, "Did not recognize renderMode {0}", _controller.DesiredLeiaStateID); list.Add(_controller.DesiredLeiaStateID); previousIndex = list.Count - 1; } EditorGUI.BeginDisabledGroup(true); UndoableInputFieldUtils.PopupLabeled(index => { if (list[index] == LeiaDisplay.TWO_D) { _controller.DesiredLightfieldMode = LeiaDisplay.LightfieldMode.Off; } else if (list[index] == LeiaDisplay.THREE_D || list[index] == LeiaDisplay.HPO) { _controller.DesiredLightfieldMode = LeiaDisplay.LightfieldMode.On; } else { LogUtil.Log(LogLevel.Error, "Could not match RenderMode {0} at index {1} to LightfieldMode", list[index], index); } } , RenderModeLabel, previousIndex, list.ToArray(), _controller.Settings); EditorGUI.EndDisabledGroup(); if (_controller.DesiredLeiaStateID == LeiaDisplay.TWO_D && _controller.IsLightfieldModeDesiredOn() || _controller.DesiredLeiaStateID == LeiaDisplay.HPO && !_controller.IsLightfieldModeDesiredOn()) { Debug.LogErrorFormat("On GameObject {0}: state mismatch between legacy RenderMode DesiredLeiaStateID {1} and LightfieldMode {2}\n" + "Please update the {0}'s LightfieldMode", _controller.gameObject.name, _controller.DesiredLeiaStateID, _controller.DesiredLightfieldMode); } }