public SystemRenderer(ICamera camera, GameDataManager data, ResourceManager rescache, Game game) { this.camera = camera; AsteroidFields = new List <AsteroidFieldRenderer>(); Nebulae = new List <NebulaRenderer>(); StarSphereModels = new IDrawable[0]; Polyline = new PolylineRender(commands); cache = rescache; rstate = cache.Game.RenderState; this.game = game; gconfig = game.GetService <GameConfig>(); billboards = game.GetService <Billboards>(); resman = game.GetService <ResourceManager>(); nebulae = game.GetService <NebulaVertices>(); dot = (Texture2D)rescache.FindTexture(ResourceManager.WhiteTextureName); DebugRenderer = new PhysicsDebugRenderer(); if (GLExtensions.Features430) { pointLightBuffer = new ShaderStorageBuffer(MAX_POINTS * (16 * sizeof(float))); if (pointLightCull == null) { pointLightCull = new ComputeShader(Resources.LoadString("LibreLancer.Shaders.lightingcull.glcompute")); } } }
protected override void Load() { Thread.CurrentThread.Name = "FreelancerGame UIThread"; //Move to stop _TSGetMainThread error on OSX MinimumWindowSize = new Point(640, 480); SetVSync(Config.VSync); new IdentityCamera(this); uithread = Thread.CurrentThread.ManagedThreadId; useintromovies = _cfg.IntroMovies; FLLog.Info("Platform", Platform.RunningOS.ToString() + (IntPtr.Size == 4 ? " 32-bit" : " 64-bit")); FLLog.Info("Available Threads", Environment.ProcessorCount.ToString()); //Cache ResourceManager = new GameResourceManager(this); //Init Audio FLLog.Info("Audio", "Initialising Audio"); Audio = new AudioManager(this); if (_cfg.MuteMusic) { Audio.Music.Volume = 0f; } //Load data FLLog.Info("Game", "Loading game data"); GameData = new GameDataManager(_cfg.FreelancerPath, ResourceManager); IntroMovies = GameData.GetIntroMovies(); MpvOverride = _cfg.MpvOverride; Thread GameDataLoaderThread = new Thread(() => { GameData.LoadData(); Sound = new SoundManager(GameData, Audio); FLLog.Info("Game", "Finished loading game data"); InitialLoadComplete = true; }); GameDataLoaderThread.Name = "GamedataLoader"; GameDataLoaderThread.Start(); // Renderer2D = new Renderer2D(RenderState); Fonts = new FontManager(this); Billboards = new Billboards(); Nebulae = new NebulaVertices(); ViewportManager = new ViewportManager(RenderState); ViewportManager.Push(0, 0, Width, Height); Screenshots = new ScreenshotManager(this); Services.Add(Billboards); Services.Add(Nebulae); Services.Add(ResourceManager); Services.Add(Renderer2D); Services.Add(Config); Services.Add(Fonts); if (useintromovies && IntroMovies.Count > 0) { ChangeState(new IntroMovie(this, 0)); } else { ChangeState(new LoadingDataState(this)); } }
public NebulaRenderer(Nebula n, ICamera c, Game g) { Nebula = n; camera = c; game = g; nverts = g.GetService<NebulaVertices>(); render2D = g.GetService<Renderer2D>(); resman = g.GetService<ResourceManager>(); billboards = g.GetService<Billboards>(); rand = new Random(); if (n.HasInteriorClouds) { puffsinterior = new InteriorPuff[n.InteriorCloudCount]; for (int i = 0; i < n.InteriorCloudCount; i++) puffsinterior[i].Spawned = false; } GenerateExteriorPuffs(); //Set Timers dynLightningTimer = Nebula.DynamicLightningGap; bckLightningTimer = Nebula.BackgroundLightningGap; }
protected override void Load() { Thread.CurrentThread.Name = "FreelancerGame UIThread"; //Move to stop _TSGetMainThread error on OSX MinimumWindowSize = new Point(640, 480); SetVSync(Config.Settings.VSync); Config.Settings.RenderContext = RenderContext; new IdentityCamera(this); uithread = Thread.CurrentThread.ManagedThreadId; useintromovies = _cfg.IntroMovies; FLLog.Info("Platform", Platform.RunningOS.ToString() + (IntPtr.Size == 4 ? " 32-bit" : " 64-bit")); FLLog.Info("Available Threads", Environment.ProcessorCount.ToString()); //Cache ResourceManager = new GameResourceManager(this); //Init Audio FLLog.Info("Audio", "Initialising Audio"); Audio = new AudioManager(this); Audio.WaitReady(); Audio.MasterVolume = _cfg.Settings.MasterVolume; Audio.Music.Volume = _cfg.Settings.MusicVolume; //Load data FLLog.Info("Game", "Loading game data"); GameData = new GameDataManager(_cfg.FreelancerPath, ResourceManager); IntroMovies = GameData.GetIntroMovies(); MpvOverride = _cfg.MpvOverride; Saves = new SaveGameFolder(); var saveLoadTask = Task.Run(() => Saves.Load(GetSaveFolder())); Thread GameDataLoaderThread = new Thread(() => { GameData.LoadData(this, () => { Sound = new SoundManager(GameData, Audio, this); Services.Add(Sound); InisLoaded = true; }); FLLog.Info("Game", "Finished loading game data"); saveLoadTask.Wait(); Saves.Infocards = GameData.Ini.Infocards; InitialLoadComplete = true; }); GameDataLoaderThread.Name = "GamedataLoader"; GameDataLoaderThread.Start(); // Fonts = new FontManager(); Billboards = new Billboards(); Nebulae = new NebulaVertices(); RenderContext.PushViewport(0, 0, Width, Height); Screenshots = new ScreenshotManager(this); Typewriter = new Typewriter(this); Services.Add(Billboards); Services.Add(Nebulae); Services.Add(ResourceManager); Services.Add(Config); Services.Add(Fonts); Services.Add(GameData); Services.Add(Sound); Services.Add(Typewriter); Debug = new DebugView(this); if (useintromovies && IntroMovies.Count > 0) { ChangeState(new IntroMovie(this, 0)); } else { ChangeState(new LoadingDataState(this)); } }