/// <summary> /// Loads graphics resources needed for the game. /// </summary> public override void LoadGraphicsContent(bool loadAllContent) { // Initialize the camera camera = new FirstPersonCamera(GameOptions.CameraAccelerationMagnitude, GameOptions.CameraRotationSpeed, GameOptions.CameraVelocityDecayRate); camera.AspectRatio = (float)ScreenManager.GraphicsDevice.Viewport.Width / (float)ScreenManager.GraphicsDevice.Viewport.Height; camera.Position = new Vector3(0, GameOptions.TerrainMaxHeight, 0); camera.Angles = new Vector3(-MathHelper.PiOver2, 0.0f, 0.0f); if (loadAllContent) { // Load the sky box skyBox = new SkyBox(ScreenManager.Game, ScreenManager.Content, camera); // Set up the terrain parameters TerrainQuadTreeParameters parameters = new TerrainQuadTreeParameters(); parameters.HeightMapName = "Content\\Textures\\Heightmap"; parameters.LayerMap0Name = "Content\\Textures\\grass01"; parameters.LayerMap1Name = "Content\\Textures\\rock01"; parameters.LayerMap2Name = "Content\\Textures\\snow01"; parameters.GrassTextureName = "Content\\Textures\\grass"; parameters.MaxHeight = GameOptions.TerrainMaxHeight; parameters.TerrainScale = GameOptions.TerrainScale; parameters.MaxScreenSpaceError = 0.075f; parameters.ScreenHeight = ScreenManager.Game.GraphicsDevice.Viewport.Height; parameters.FieldOfView = camera.FieldOfView; parameters.GrassChunkDimension = 30; parameters.GrassChunkStarSeparation = 266.6f; parameters.GrassStartFadingInDistance = 4000.0f; parameters.GrassStopFadingInDistance = 3900.0f; parameters.WindStrength = 100.0f; parameters.WindDirection = new Vector4(-1.0f, 0.0f, 0.0f, 0.0f); parameters.DoPreprocessing = true; parameters.ComputePerspectiveScalingFactor(); terrain = new TerrainQuadTree(ScreenManager.Game, ScreenManager.Content, parameters); // Iniialize the water manager waterManager = new WaterManager(ScreenManager.Game, GameOptions.WaterHeight); } }