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(); }
public StarterGame() { // Default XNA setup. graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Required for lighting system. graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; // Required for lighting system. splashScreenGameComponent = new SplashScreenGameComponent(this); Components.Add(splashScreenGameComponent); // Create the lighting system. sunBurnCoreSystem = new SunBurnCoreSystem(Services, Content); 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(); SceneInterface.CreateDefaultManagers(RenderingSystemType.Forward, CollisionSystemType.Physics, true); SpriteManager = new SpriteManager(SceneInterface); SceneInterface.AddManager(SpriteManager); // Create the frame buffers used for rendering (sized to the backbuffer) and // assign them to the ResourceManager so we don't have to worry about cleanup. frameBuffers = new FrameBuffers(DetailPreference.High, DetailPreference.Medium); SceneInterface.ResourceManager.AssignOwnership(frameBuffers); physicsManager.RegisterPhysicsBody(Character); collisionManager.RegisterCollisionBody(Character); // Post console messages letting the user know how to open the SunBurn Editor. SceneInterface.ShowConsole = true; SystemConsole.AddMessage("Welcome to the SunBurn Engine.", 4); SystemConsole.AddMessage("Use an Xbox controller or the W, A, S, D keys to navigate the scene.", 8); SystemConsole.AddMessage("Press F11 to open the SunBurn Editor.", 12); }