internal Touch(NewRenderer renderer) { this.renderer = renderer; objectStates = new List <ObjectState>(); touchFaces = new List <FaceState>(); try { pickingShader = new Shader("default", "picking", true); pickingShader.Activate(); pickingShader.Deactivate(); } catch { Interface.AddMessage(MessageType.Error, false, "Initialising the touch shader failed- Falling back to legacy openGL."); Interface.CurrentOptions.IsUseNewRenderer = false; } fbo = new FrameBufferObject(); fbo.Bind(); fbo.SetTextureBuffer(FrameBufferObject.TargetBuffer.Color, PixelInternalFormat.R32f, PixelFormat.Red, PixelType.Float, renderer.Screen.Width, renderer.Screen.Height); fbo.DrawBuffers(new[] { DrawBuffersEnum.ColorAttachment0 }); fbo.UnBind(); }
internal Touch(NewRenderer renderer) { this.renderer = renderer; touchableObject = new List <ObjectState>(); if (!renderer.ForceLegacyOpenGL) { fbo = new FrameBufferObject(); fbo.Bind(); fbo.SetTextureBuffer(FrameBufferObject.TargetBuffer.Color, PixelInternalFormat.R32f, PixelFormat.Red, PixelType.Float, renderer.Screen.Width, renderer.Screen.Height); fbo.DrawBuffers(new[] { DrawBuffersEnum.ColorAttachment0 }); fbo.UnBind(); } }
private static void Main() { ReactivePropertyScheduler.SetDefault(ImmediateScheduler.Instance); CurrentHost = new Host(); try { FileSystem = FileSystem.FromCommandLineArgs(new string[0], null); FileSystem.CreateFileSystem(); } catch (Exception ex) { MessageBox.Show(Translations.GetInterfaceString("errors_filesystem_invalid") + Environment.NewLine + Environment.NewLine + ex.Message, Translations.GetInterfaceString("program_title"), MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } Interface.LoadOptions(); Renderer = new NewRenderer(CurrentHost, Interface.CurrentOptions, FileSystem); SoundApi = new SoundApi(); SoundApi.Initialize(CurrentHost, SoundRange.Medium); string error; if (!CurrentHost.LoadPlugins(FileSystem, Interface.CurrentOptions, out error, null, Renderer)) { SoundApi.Deinitialize(); MessageBox.Show(error, @"OpenBVE", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TrainManager = new Simulation.TrainManager.TrainManager(CurrentHost, null, null, FileSystem); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormEditor()); CurrentHost.UnloadPlugins(out error); SoundApi.Deinitialize(); Interface.SaveOptions(); }
internal Overlays(NewRenderer renderer) { this.renderer = renderer; }
internal static void Main(string[] args) { CurrentHost = new Host(); // file system FileSystem = FileSystem.FromCommandLineArgs(args, CurrentHost); FileSystem.CreateFileSystem(); CurrentRoute = new CurrentRoute(CurrentHost, Renderer); Options.LoadOptions(); Renderer = new NewRenderer(CurrentHost, Interface.CurrentOptions, FileSystem); Renderer.CameraTrackFollower = new TrackFollower(CurrentHost); TrainManager = new TrainManager(CurrentHost, Renderer, Interface.CurrentOptions, FileSystem); if (Renderer.Screen.Width == 0 || Renderer.Screen.Height == 0) { Renderer.Screen.Width = 960; Renderer.Screen.Height = 600; } string error; if (!CurrentHost.LoadPlugins(FileSystem, Interface.CurrentOptions, out error, TrainManager, Renderer)) { MessageBox.Show(error, @"OpenBVE", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // 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; } } var options = new ToolkitOptions { Backend = PlatformBackend.PreferX11 }; Toolkit.Init(options); // 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(); formTrain.WaitTaskFinish(); }
public RenderedToolStrip() { Renderer = new NewRenderer(); }