Ejemplo n.º 1
0
        internal static void Main(string[] args)
        {
            CurrentlyRunOnMono = Type.GetType("Mono.Runtime") != null;
            CurrentHost        = new Host();

            // file system
            FileSystem = FileSystem.FromCommandLineArgs(args);
            FileSystem.CreateFileSystem();
            Plugins.LoadPlugins();
            // command line arguments
            SkipArgs = new bool[args.Length];
            if (args.Length != 0)
            {
                string File = System.IO.Path.Combine(Application.StartupPath, "RouteViewer.exe");
                if (System.IO.File.Exists(File))
                {
                    int Skips = 0;
                    System.Text.StringBuilder NewArgs = new System.Text.StringBuilder();
                    for (int i = 0; i < args.Length; i++)
                    {
                        if (args[i] != null && System.IO.File.Exists(args[i]))
                        {
                            if (System.IO.Path.GetExtension(args[i]).Equals(".csv", StringComparison.OrdinalIgnoreCase))
                            {
                                string Text = System.IO.File.ReadAllText(args[i], System.Text.Encoding.UTF8);
                                if (Text.Length != -1 &&
                                    Text.IndexOf("CreateMeshBuilder", StringComparison.OrdinalIgnoreCase) == -1)
                                {
                                    if (NewArgs.Length != 0)
                                    {
                                        NewArgs.Append(" ");
                                    }

                                    NewArgs.Append("\"" + args[i] + "\"");
                                    SkipArgs[i] = true;
                                    Skips++;
                                }
                            }
                        }
                        else
                        {
                            SkipArgs[i] = true;
                            Skips++;
                        }
                    }
                    if (NewArgs.Length != 0)
                    {
                        System.Diagnostics.Process.Start(File, NewArgs.ToString());
                    }
                    if (Skips == args.Length)
                    {
                        return;
                    }
                }
            }
            Options.LoadOptions();
            Interface.CurrentOptions.ObjectOptimizationBasicThreshold = 1000;
            Interface.CurrentOptions.ObjectOptimizationFullThreshold  = 250;
            Interface.CurrentOptions.AntialiasingLevel         = 16;
            Interface.CurrentOptions.AnisotropicFilteringLevel = 16;
            // initialize camera

            currentGraphicsMode       = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntialiasingLevel);
            currentGameWindow         = new ObjectViewer(Renderer.ScreenWidth, Renderer.ScreenHeight, currentGraphicsMode, "Object Viewer", GameWindowFlags.Default);
            currentGameWindow.Visible = true;
            currentGameWindow.TargetUpdateFrequency = 0;
            currentGameWindow.TargetRenderFrequency = 0;
            currentGameWindow.Title = "Object Viewer";
            currentGameWindow.Run();
            // quit
            Textures.UnloadAllTextures();
        }
Ejemplo n.º 2
0
        internal static void Main(string[] args)
        {
            CurrentHost = new Host();
            // file system
            FileSystem = FileSystem.FromCommandLineArgs(args, CurrentHost);
            FileSystem.CreateFileSystem();
            Renderer     = new NewRenderer();
            CurrentRoute = new CurrentRoute(Renderer);
            Renderer.CameraTrackFollower = new TrackFollower(CurrentHost);
            Options.LoadOptions();
            if (Renderer.Screen.Width == 0 || Renderer.Screen.Height == 0)
            {
                Renderer.Screen.Width  = 960;
                Renderer.Screen.Height = 600;
            }
            Plugins.LoadPlugins();
            // command line arguments
            List <string> filesToLoad = new List <string>();

            if (args.Length != 0)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i] != null)
                    {
                        if (System.IO.File.Exists(args[i]))
                        {
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Route != null && CurrentHost.Plugins[j].Route.CanLoadRoute(args[i]))
                                {
                                    string File = System.IO.Path.Combine(Application.StartupPath, "RouteViewer.exe");
                                    if (System.IO.File.Exists(File))
                                    {
                                        System.Diagnostics.Process.Start(File, args[i]);
                                    }
                                    continue;
                                }

                                if (CurrentHost.Plugins[j].Object != null && CurrentHost.Plugins[j].Object.CanLoadObject(args[i]))
                                {
                                    filesToLoad.Add(args[i]);
                                }
                            }
                        }
                        else if (args[i].ToLowerInvariant() == "/enablehacks")
                        {
                            //Deliberately undocumented option for debugging use
                            Interface.CurrentOptions.EnableBveTsHacks = true;
                            for (int j = 0; j < CurrentHost.Plugins.Length; j++)
                            {
                                if (CurrentHost.Plugins[j].Object != null)
                                {
                                    CompatabilityHacks enabledHacks = new CompatabilityHacks
                                    {
                                        BveTsHacks        = true,
                                        CylinderHack      = false,
                                        BlackTransparency = true
                                    };
                                    CurrentHost.Plugins[j].Object.SetCompatibilityHacks(enabledHacks);
                                }
                            }
                        }
                    }
                }

                if (filesToLoad.Count != 0)
                {
                    Files = filesToLoad.ToArray();
                }
            }

            var options = new ToolkitOptions
            {
                Backend = PlatformBackend.PreferX11
            };

            Toolkit.Init(options);
            Interface.CurrentOptions.ObjectOptimizationBasicThreshold = 1000;
            Interface.CurrentOptions.ObjectOptimizationFullThreshold  = 250;
            Interface.CurrentOptions.AntiAliasingLevel         = 16;
            Interface.CurrentOptions.AnisotropicFilteringLevel = 16;
            // initialize camera

            currentGraphicsMode = new GraphicsMode(new ColorFormat(8, 8, 8, 8), 24, 8, Interface.CurrentOptions.AntiAliasingLevel);
            currentGameWindow   = new ObjectViewer(Renderer.Screen.Width, Renderer.Screen.Height, currentGraphicsMode, "Object Viewer", GameWindowFlags.Default)
            {
                Visible = true,
                TargetUpdateFrequency = 0,
                TargetRenderFrequency = 0,
                Title = "Object Viewer"
            };
            currentGameWindow.Run();
            // quit
            Renderer.TextureManager.UnloadAllTextures();
        }