public ScreenManager(Game game, GraphicsDeviceManager graphics) { this.content = new ContentManager(game.Services, "Content"); this.GraphicsDevice = graphics.GraphicsDevice; this.graphicsDeviceService = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService)); if (this.graphicsDeviceService == null) { throw new InvalidOperationException("No graphics device service."); } this.lightingSystemManager = new LightingSystemManager(game.Services); this.sceneState = new SceneState(); this.inter = new SceneInterface(graphics); this.inter.CreateDefaultManagers(false, false, true); this.editor = new LightingSystemEditor(game.Services, graphics, game) { UserHandledView = true }; this.inter.AddManager(this.editor); }
/// <summary> /// /// </summary> protected Game_cl() : base() { mGraphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Required for lighting system. Components.Add(new SplashScreenGameComponent(this, mGraphics)); // Create the lighting system. mLightingSystemManager = new LightingSystemManager(Services, Content); mSceneState = new SceneState(); mEnvironment = new SceneEnvironment(); mSceneInterface = new SceneInterface(mGraphics); mSceneInterface.CreateDefaultManagers(false); mSceneInterface.AddManager(new ObjectManager_cl()); // Create the sprite manager used to create and organize sprite containers for 2D rendering. mSpriteManager = new SpriteManager(mGraphics); mSceneInterface.AddManager(mSpriteManager); mFrameBuffers = new FrameBuffers(mGraphics, DetailPreference.Low, DetailPreference.Low); mSceneInterface.ResourceManager.AssignOwnership(mFrameBuffers); mStaticSceneEffects = new List<SceneEffect>(); //mView = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward, Vector3.Up); //mProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, GraphicsDevice.Viewport.AspectRatio, 0.1f, 1000f); mCameraEntity = new Entity_cl(); #if WORLD_EDITOR mWorldEditor = new WorldEditor_cl(); #endif mManagers = new List<BaseManager_cl>(); mRandom = new Random(); mTimer = new FNA.Core.Timer_cl(); mBaseInstance = this; mIsPlayingGame = true; }
public Engine() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content-" + LightingSystemManager.Edition; // Minimum requirement. graphics.MinimumPixelShaderProfile = ShaderProfile.PS_3_0; graphics.MinimumVertexShaderProfile = ShaderProfile.VS_3_0; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; graphics.IsFullScreen = true; graphics.SynchronizeWithVerticalRetrace = true; graphics.PreparingDeviceSettings += PrepareDeviceSettings; // Used for advanced edge cleanup. graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; // Required for lighting system. splashScreenGameComponent = new SplashScreenGameComponent(this, graphics); Components.Add(splashScreenGameComponent); // Create the lighting system. lightingSystemManager = new LightingSystemManager(Services); sceneState = new SceneState(); // Create the scene interface. Acts as a service provider containing all scene managers // and returning them by type (including custom managers). Also acts as a component // container where calls to manager methods on the SceneInterface (such as BeginFrameRendering, // Unload, ...) are automatically called on all contained managers. // // This design allows managers to be plugged-in like modular components and for managers // to easily be added, removed, or replaced with custom implementations. // sceneInterface = new SceneInterface(graphics); sceneInterface.CreateDefaultManagers(false, false, false); // The skybox handles the back buffer clear. if (sceneInterface.RenderManager is BaseRenderManager) (sceneInterface.RenderManager as BaseRenderManager).ClearBackBufferEnabled = true; // Create a custom statistic, which is rendered to the screen with SunBurn's statistics. totalObjectCountStat = LightingSystemStatistics.GetStatistic("Instancing_TotalObjectCount", LightingSystemStatisticCategory.Rendering); // Load the user preferences (example - not required). preferences = new LightingSystemPreferences(); if (File.Exists(userPreferencesFile)) preferences.LoadFromFile(userPreferencesFile); else { preferences.EffectDetail = DetailPreference.High; preferences.MaxAnisotropy = 4; preferences.PostProcessingDetail = DetailPreference.High; preferences.ShadowDetail = DetailPreference.High; preferences.ShadowQuality = 1.0f; preferences.TextureQuality = DetailPreference.High; preferences.TextureSampling = SamplingPreference.Anisotropic; } view = GetViewMatrix(); }