Esempio n. 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load a font object.
            m_font = Content.Load <SpriteFont>("Fonts/Verdana");

            // Create a screen-UI.
            m_screenUI = new SpriteBatch(GraphicsDevice);

            // Load scene objects from scene description.
            m_sceneRoot = SceneObject.CreateFromSceneDescription(Content, m_scene);

            // Set up camera.
            m_sceneCamera = new Camera();

            // Create renderer.
            m_renderer = new LightPrePassRenderer(m_graphics.GraphicsDevice, Content, m_sceneCamera);
            m_renderer.OutputRenderTargetWidth  = Window.ClientBounds.Width;
            m_renderer.OutputRenderTargetHeight = Window.ClientBounds.Height;
            Window.ClientSizeChanged           += new EventHandler <EventArgs>(OnWindowClientSizeChanged);

            // Set up camera controller.
            m_cameraController = new FlyCameraController(m_sceneCamera, Window);
            m_cameraController.MovementSpeed = 20.0f;
            m_cameraController.RotationSpeed = 0.1f;
            m_cameraController.SetCameraProjectionParameters(MathHelper.PiOver4, m_renderer.OutputRenderTargetAspectRatio, 0.1f, 1000);

            // Add scene objects.
            m_renderer.AddScene(m_sceneRoot);
        }