Ejemplo n.º 1
0
        static void OnKeyPress(GlfwWindowPtr window, Key KeyCode, int Scancode, KeyAction Action, KeyModifiers Mods)
        {
            if (KeyCode == Key.Escape)
            {
                Glfw.SetWindowShouldClose(window, true);
            }

            if ((Mods == KeyModifiers.Alt || Mods == KeyModifiers.AltGr) && KeyCode == Key.Enter && Action == KeyAction.Press)
            {
                if (Settings.Window.Fullscreen)
                {
                    Settings.Window.Fullscreen = false;
                }
                else
                {
                    Settings.Window.Fullscreen = true;
                }

                Settings.Window.NeedReinitWindow = true;
            }

            #region DrawMode
            if (KeyCode == Key.F1 && Action == KeyAction.Press)
            {
                String[] S = Enum.GetNames(typeof(DrawMode));
                if (Settings.Debug.DrawMode.ToString().GetHashCode() == S[0].GetHashCode())
                {
                    Settings.Debug.DrawMode = (DrawMode)Enum.Parse(typeof(DrawMode), S[S.Length - 1]);
                }
                else
                {
                    Settings.Debug.DrawMode = (DrawMode)((int)(Settings.Debug.DrawMode) - 1);
                }
            }

            if (KeyCode == Key.F2 && Action == KeyAction.Press)
            {
                String[] S = Enum.GetNames(typeof(DrawMode));
                if (Settings.Debug.DrawMode.ToString().GetHashCode() == S[S.Length - 1].GetHashCode())
                {
                    Settings.Debug.DrawMode = (DrawMode)0;
                }
                else
                {
                    Settings.Debug.DrawMode = (DrawMode)((int)(Settings.Debug.DrawMode) + 1);
                }
            }

            switch (Settings.Debug.DrawMode)
            {
            case DrawMode.Default:
                FBO.ShaderIndex_P1 = FBO.ShaderIndex_P1_Orig;
                break;

            case DrawMode.Depth:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Depth;
                break;

            case DrawMode.Diffuse:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Diffuse;
                break;

            case DrawMode.Light:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Light;
                break;

            case DrawMode.Normals:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Normals;
                break;

            case DrawMode.AmbientOclusion:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_AmbientOclusion;
                break;

            case DrawMode.Emissive:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Emissive;
                break;

            case DrawMode.Specular:
                FBO.ShaderIndex_P1 = FBO.DebugShaderIndex_Specular;
                break;
            }
            #endregion

            if (KeyCode == Key.F12 && Action == KeyAction.Press)
            {
                LightSettings lightSettings = new LightSettings();
                lightSettings.Show();
            }
        }