UpdateViewport() static private méthode

static private UpdateViewport ( ) : void
Résultat void
Exemple #1
0
        protected override void OnLoad(EventArgs e)
        {
            KeyDown += Program.keyDownEvent;
            KeyUp   += Program.keyUpEvent;
            Program.ResetCamera();
            World.BackgroundImageDistance = 600.0;
            World.ForwardViewingDistance  = 600.0;
            World.BackwardViewingDistance = 0.0;
            World.ExtraViewingDistance    = 50.0;

            Renderer.Initialize();
            Renderer.InitializeLighting();
            SoundManager.Initialize();
            Fonts.Initialize();
            Program.UpdateViewport();
            if (Program.processCommandLineArgs)
            {
                Program.processCommandLineArgs = false;
                for (int i = 0; i < Program.commandLineArguments.Length; i++)
                {
                    if (!Program.SkipArgs[i] && System.IO.File.Exists(Program.commandLineArguments[i]))
                    {
                        currentlyLoading     = true;
                        Program.CurrentRoute = Program.commandLineArguments[i];
                        Program.LoadRoute();
                        Program.UpdateCaption();
                        break;
                    }
                }
            }
        }
Exemple #2
0
 private static void ApplyZoom()
 {
     World.VerticalViewingAngle = World.OriginalVerticalViewingAngle * Math.Exp(World.CameraCurrentAlignment.Zoom);
     if (World.VerticalViewingAngle < 0.001)
     {
         World.VerticalViewingAngle = 0.001;
     }
     if (World.VerticalViewingAngle > 1.5)
     {
         World.VerticalViewingAngle = 1.5;
     }
     Program.UpdateViewport();
 }
Exemple #3
0
 protected override void OnLoad(EventArgs e)
 {
     KeyDown    += Program.KeyDown;
     KeyUp      += Program.KeyUp;
     MouseDown  += Program.MouseEvent;
     MouseUp    += Program.MouseEvent;
     MouseWheel += Program.MouseWheelEvent;
     FileDrop   += Program.DragFile;
     Program.ResetCamera();
     Renderer.Initialize();
     Renderer.InitializeLighting();
     //SwapBuffers();
     Fonts.Initialize();
     Program.UpdateViewport();
     // command line arguments
     // if (commandLineArgs != null)
     // {
     //     for (int i = 0; i < commandLineArgs.Length; i++)
     //     {
     //         if (!Program.SkipArgs[i] && System.IO.File.Exists(commandLineArgs[i]))
     //         {
     //             try
     //             {
     //                 ObjectManager.UnifiedObject o = ObjectManager.LoadObject(commandLineArgs[i],
     //                     System.Text.Encoding.UTF8, ObjectManager.ObjectLoadMode.Normal, false, false, false,0,0,0);
     //                 ObjectManager.CreateObject(o, new Vector3(0.0, 0.0, 0.0),
     //                     new World.Transformation(0.0, 0.0, 0.0), new World.Transformation(0.0, 0.0, 0.0), true,
     //                     0.0, 0.0, 25.0, 0.0);
     //             }
     //             catch (Exception ex)
     //             {
     //                 Interface.AddMessage(Interface.MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + commandLineArgs[i] + ".");
     //             }
     //             Array.Resize<string>(ref Program.Files, Program.Files.Length + 1);
     //             Program.Files[Program.Files.Length - 1] = commandLineArgs[i];
     //         }
     //     }
     // }
     ObjectManager.InitializeVisibility();
     ObjectManager.FinishCreatingObjects();
     ObjectManager.UpdateVisibility(0.0, true);
     ObjectManager.UpdateAnimatedWorldObjects(0.01, true);
     Program.UpdateCaption();
 }
Exemple #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Interpolation mode
            switch (InterpolationMode.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.NearestNeighbor;
                break;

            case 1:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.Bilinear;
                break;

            case 2:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.NearestNeighborMipmapped;
                break;

            case 3:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.BilinearMipmapped;
                break;

            case 4:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.TrilinearMipmapped;
                break;

            case 5:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.AnisotropicFiltering;
                break;
            }
            //Ansiotropic filtering level
            Interface.CurrentOptions.AnisotropicFilteringLevel = (int)AnsiotropicLevel.Value;
            //Antialiasing level
            Interface.CurrentOptions.AntialiasingLevel = (int)AntialiasingLevel.Value;
            if (Interface.CurrentOptions.AntialiasingLevel != previousAntialasingLevel)
            {
                Program.currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel);
                GraphicsModeChanged         = true;
            }
            //Transparency quality
            switch (TransparencyQuality.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.TransparencyMode = TransparencyMode.Performance;
                break;

            default:
                Interface.CurrentOptions.TransparencyMode = TransparencyMode.Quality;
                break;
            }
            //Set width and height
            if (LibRender.Screen.Width != width.Value || LibRender.Screen.Height != height.Value)
            {
                if (width.Value >= 300)
                {
                    LibRender.Screen.Width          = (int)width.Value;
                    Program.currentGameWindow.Width = (int)width.Value;
                }
                if (height.Value >= 300)
                {
                    LibRender.Screen.Height          = (int)height.Value;
                    Program.currentGameWindow.Height = (int)height.Value;
                }
                Program.UpdateViewport();
            }
            Renderer.TransparentColorDepthSorting       = Interface.CurrentOptions.TransparencyMode == TransparencyMode.Quality & Interface.CurrentOptions.Interpolation != OpenBveApi.Graphics.InterpolationMode.NearestNeighbor & Interface.CurrentOptions.Interpolation != OpenBveApi.Graphics.InterpolationMode.Bilinear;
            Interface.CurrentOptions.LoadingLogo        = checkBoxLogo.Checked;
            Interface.CurrentOptions.LoadingBackground  = checkBoxBackgrounds.Checked;
            Interface.CurrentOptions.LoadingProgressBar = checkBoxProgressBar.Checked;
            Options.SaveOptions();
            //Check if interpolation mode or ansiotropic filtering level has changed, and trigger a reload
            if (previousInterpolationMode != Interface.CurrentOptions.Interpolation || previousAnsiotropicLevel != Interface.CurrentOptions.AnisotropicFilteringLevel || PreviousSort != Renderer.TransparentColorDepthSorting || GraphicsModeChanged)
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.Abort;
            }
        }
Exemple #5
0
 protected override void OnResize(EventArgs e)
 {
     Renderer.ScreenWidth  = Width;
     Renderer.ScreenHeight = Height;
     Program.UpdateViewport();
 }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            TextureManager.InterpolationMode previousInterpolationMode = Interface.CurrentOptions.Interpolation;
            int previousAntialasingLevel = Interface.CurrentOptions.AntialiasingLevel;
            int previousAnsiotropicLevel = Interface.CurrentOptions.AnisotropicFilteringLevel;

            //Interpolation mode
            switch (InterpolationMode.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.NearestNeighbor;
                break;

            case 1:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.Bilinear;
                break;

            case 2:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.NearestNeighborMipmapped;
                break;

            case 3:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.BilinearMipmapped;
                break;

            case 4:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.TrilinearMipmapped;
                break;

            case 5:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.AnisotropicFiltering;
                break;
            }
            //Ansiotropic filtering level
            Interface.CurrentOptions.AnisotropicFilteringLevel = (int)AnsiotropicLevel.Value;
            //Antialiasing level
            Interface.CurrentOptions.AntialiasingLevel = (int)AntialiasingLevel.Value;
            if (Interface.CurrentOptions.AntialiasingLevel != previousAntialasingLevel)
            {
                Program.currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel);
            }
            //Transparency quality
            switch (TransparencyQuality.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.TransparencyMode = Renderer.TransparencyMode.Sharp;
                break;

            default:
                Interface.CurrentOptions.TransparencyMode = Renderer.TransparencyMode.Smooth;
                break;
            }
            //Set width and height
            if (Renderer.ScreenWidth != width.Value || Renderer.ScreenHeight != height.Value)
            {
                Renderer.ScreenWidth             = (int)width.Value;
                Renderer.ScreenHeight            = (int)height.Value;
                Program.currentGameWindow.Width  = (int)width.Value;
                Program.currentGameWindow.Height = (int)height.Value;
                Program.UpdateViewport();
            }
            //Check if interpolation mode or ansiotropic filtering level has changed, and trigger a reload
            if (previousInterpolationMode != Interface.CurrentOptions.Interpolation || previousAnsiotropicLevel != Interface.CurrentOptions.AnisotropicFilteringLevel)
            {
                Program.ReducedMode      = false;
                Program.LightingRelative = -1.0;
                Game.Reset();
                TextureManager.UnuseAllTextures();
                Fonts.Initialize();
                Interface.ClearMessages();
                for (int i = 0; i < Program.Files.Length; i++)
                {
#if !DEBUG
                    try {
#endif
                    ObjectManager.UnifiedObject o = ObjectManager.LoadObject(Program.Files[i], System.Text.Encoding.UTF8,
                                                                             ObjectManager.ObjectLoadMode.Normal, false, false, false, 0, 0, 0);
                    ObjectManager.CreateObject(o, new World.Vector3D(0.0, 0.0, 0.0),
                                               new World.Transformation(0.0, 0.0, 0.0), new World.Transformation(0.0, 0.0, 0.0), true, 0.0,
                                               0.0, 25.0, 0.0);
#if !DEBUG
                }
                catch (Exception ex) {
                    Interface.AddMessage(Interface.MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + Program.Files[i] + ".");
                }
#endif
                }
                ObjectManager.InitializeVisibility();
                ObjectManager.UpdateVisibility(0.0, true);
                ObjectManager.UpdateAnimatedWorldObjects(0.01, true);
            }
            Renderer.TransparentColorDepthSorting = Interface.CurrentOptions.TransparencyMode == Renderer.TransparencyMode.Smooth & Interface.CurrentOptions.Interpolation != TextureManager.InterpolationMode.NearestNeighbor & Interface.CurrentOptions.Interpolation != TextureManager.InterpolationMode.Bilinear;
            Options.SaveOptions();
            this.Close();
        }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            InterpolationMode previousInterpolationMode = Interface.CurrentOptions.Interpolation;
            int previousAntialasingLevel = Interface.CurrentOptions.AntialiasingLevel;
            int previousAnsiotropicLevel = Interface.CurrentOptions.AnisotropicFilteringLevel;

            //Interpolation mode
            switch (InterpolationMode.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.NearestNeighbor;
                break;

            case 1:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.Bilinear;
                break;

            case 2:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.NearestNeighborMipmapped;
                break;

            case 3:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.BilinearMipmapped;
                break;

            case 4:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.TrilinearMipmapped;
                break;

            case 5:
                Interface.CurrentOptions.Interpolation = OpenBveApi.Graphics.InterpolationMode.AnisotropicFiltering;
                break;
            }
            //Ansiotropic filtering level
            Interface.CurrentOptions.AnisotropicFilteringLevel = (int)AnsiotropicLevel.Value;
            //Antialiasing level
            Interface.CurrentOptions.AntialiasingLevel = (int)AntialiasingLevel.Value;
            if (Interface.CurrentOptions.AntialiasingLevel != previousAntialasingLevel)
            {
                Program.currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel);
            }
            //Transparency quality
            switch (TransparencyQuality.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.TransparencyMode = TransparencyMode.Performance;
                break;

            default:
                Interface.CurrentOptions.TransparencyMode = TransparencyMode.Quality;
                break;
            }
            //Set width and height
            if (Screen.Width != width.Value || Screen.Height != height.Value)
            {
                if (width.Value >= 300)
                {
                    Screen.Width = (int)width.Value;
                    Program.currentGameWindow.Width = (int)width.Value;
                }
                if (height.Value >= 300)
                {
                    Screen.Height = (int)height.Value;
                    Program.currentGameWindow.Height = (int)height.Value;
                }
                Program.UpdateViewport();
            }
            //Check if interpolation mode or ansiotropic filtering level has changed, and trigger a reload
            if (previousInterpolationMode != Interface.CurrentOptions.Interpolation || previousAnsiotropicLevel != Interface.CurrentOptions.AnisotropicFilteringLevel)
            {
                Program.ReducedMode      = false;
                Program.LightingRelative = -1.0;
                Game.Reset();
                LibRender.TextureManager.UnloadAllTextures();
                Interface.ClearMessages();
                for (int i = 0; i < Program.Files.Length; i++)
                {
#if !DEBUG
                    try {
#endif
                    UnifiedObject o = ObjectManager.LoadObject(Program.Files[i], System.Text.Encoding.UTF8, false, false, false);
                    ObjectManager.CreateObject(o, Vector3.Zero,
                                               new Transformation(0.0, 0.0, 0.0), new Transformation(0.0, 0.0, 0.0), true, 0.0,
                                               0.0, 25.0, 0.0);
#if !DEBUG
                }
                catch (Exception ex) {
                    Interface.AddMessage(MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + Program.Files[i] + ".");
                }
#endif
                }
                ObjectManager.InitializeVisibility();
                ObjectManager.UpdateVisibility(0.0, true);
                ObjectManager.UpdateAnimatedWorldObjects(0.01, true);
            }
            Renderer.TransparentColorDepthSorting     = Interface.CurrentOptions.TransparencyMode == TransparencyMode.Quality & Interface.CurrentOptions.Interpolation != OpenBveApi.Graphics.InterpolationMode.NearestNeighbor & Interface.CurrentOptions.Interpolation != OpenBveApi.Graphics.InterpolationMode.Bilinear;
            Interface.CurrentOptions.CurrentXParser   = (XParsers)comboBoxNewXParser.SelectedIndex;
            Interface.CurrentOptions.CurrentObjParser = (ObjParsers)comboBoxNewObjParser.SelectedIndex;
            for (int i = 0; i < Plugins.LoadedPlugins.Length; i++)
            {
                if (Plugins.LoadedPlugins[i].Object != null)
                {
                    Plugins.LoadedPlugins[i].Object.SetObjectParser(Interface.CurrentOptions.CurrentXParser);
                    Plugins.LoadedPlugins[i].Object.SetObjectParser(Interface.CurrentOptions.CurrentObjParser);
                }
            }
            Options.SaveOptions();
            this.Close();
        }
Exemple #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            TextureManager.InterpolationMode previousInterpolationMode = Interface.CurrentOptions.Interpolation;
            int previousAntialasingLevel = Interface.CurrentOptions.AntialiasingLevel;
            int previousAnsiotropicLevel = Interface.CurrentOptions.AnisotropicFilteringLevel;

            //Interpolation mode
            switch (InterpolationMode.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.NearestNeighbor;
                break;

            case 1:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.Bilinear;
                break;

            case 2:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.NearestNeighborMipmapped;
                break;

            case 3:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.BilinearMipmapped;
                break;

            case 4:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.TrilinearMipmapped;
                break;

            case 5:
                Interface.CurrentOptions.Interpolation = TextureManager.InterpolationMode.AnisotropicFiltering;
                break;
            }
            //Ansiotropic filtering level
            Interface.CurrentOptions.AnisotropicFilteringLevel = (int)AnsiotropicLevel.Value;
            //Antialiasing level
            Interface.CurrentOptions.AntialiasingLevel = (int)AntialiasingLevel.Value;
            if (Interface.CurrentOptions.AntialiasingLevel != previousAntialasingLevel)
            {
                Program.currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel);
            }
            //Transparency quality
            switch (TransparencyQuality.SelectedIndex)
            {
            case 0:
                Interface.CurrentOptions.TransparencyMode = Renderer.TransparencyMode.Sharp;
                break;

            default:
                Interface.CurrentOptions.TransparencyMode = Renderer.TransparencyMode.Smooth;
                break;
            }
            //Set width and height
            if (Renderer.ScreenWidth != width.Value || Renderer.ScreenHeight != height.Value)
            {
                Renderer.ScreenWidth             = (int)width.Value;
                Renderer.ScreenHeight            = (int)height.Value;
                Program.currentGameWindow.Width  = (int)width.Value;
                Program.currentGameWindow.Height = (int)height.Value;
                Program.UpdateViewport();
            }
            //Check if interpolation mode or ansiotropic filtering level has changed, and trigger a reload
            if (previousInterpolationMode != Interface.CurrentOptions.Interpolation || previousAnsiotropicLevel != Interface.CurrentOptions.AnisotropicFilteringLevel)
            {
                if (Program.CurrentRoute != null)
                {
                    Program.CurrentlyLoading = true;
                    Renderer.RenderScene(0.0);
                    Program.currentGameWindow.SwapBuffers();
                    World.CameraAlignment a = World.CameraCurrentAlignment;
                    if (Program.LoadRoute())
                    {
                        World.CameraCurrentAlignment = a;
                        TrackManager.UpdateTrackFollower(ref World.CameraTrackFollower, -1.0, true, false);
                        TrackManager.UpdateTrackFollower(ref World.CameraTrackFollower, a.TrackPosition, true, false);
                        World.CameraAlignmentDirection = new World.CameraAlignment();
                        World.CameraAlignmentSpeed     = new World.CameraAlignment();
                        ObjectManager.UpdateVisibility(a.TrackPosition, true);
                        ObjectManager.UpdateAnimatedWorldObjects(0.0, true);
                    }
                    Program.CurrentlyLoading = false;
                }
            }
            Renderer.TransparentColorDepthSorting = Interface.CurrentOptions.TransparencyMode == Renderer.TransparencyMode.Smooth & Interface.CurrentOptions.Interpolation != TextureManager.InterpolationMode.NearestNeighbor & Interface.CurrentOptions.Interpolation != TextureManager.InterpolationMode.Bilinear;
            Options.SaveOptions();
            this.Dispose();
        }
Exemple #9
0
 protected override void OnResize(EventArgs e)
 {
     Screen.Width  = Width;
     Screen.Height = Height;
     Program.UpdateViewport();
 }