コード例 #1
0
        protected override void LoadContent()
        {
            m_input = new Input(Game);
            LoadKeyBindings();

            m_spriteBatch  = new SpriteBatch(Game.GraphicsDevice);
            m_physicsWorld = new World(new Vector2(0, 20));
            //m_camera2D = new Camera2D(GraphicsDevice);

            m_scene.InitializeScene(m_spriteBatch, m_physicsWorld, m_camera);
            m_sphere = Game.Content.Load <Model>(@"Models\sphere");

            int backBufferWidth  = GraphicsDevice.PresentationParameters.BackBufferWidth;
            int backBufferHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;

            m_colourRT = new RenderTarget2D(GraphicsDevice, backBufferWidth, backBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24);
            m_normalRT = new RenderTarget2D(GraphicsDevice, backBufferWidth, backBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);
            m_depthRT  = new RenderTarget2D(GraphicsDevice, backBufferWidth, backBufferHeight, false, SurfaceFormat.Single, DepthFormat.None);
            m_lightRT  = new RenderTarget2D(GraphicsDevice, backBufferWidth, backBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);

            m_clearBufferEffect      = Game.Content.Load <Effect>(@"Shaders/ClearGBuffer");
            m_directionalLightEffect = Game.Content.Load <Effect>(@"Shaders/DirectionalLight");
            m_combineFinalEffect     = Game.Content.Load <Effect>(@"Shaders/CombineFinal");
            m_pointLightEffect       = Game.Content.Load <Effect>(@"Shaders/PointLight");

            m_halfPixel.X = 0.5f / (float)GraphicsDevice.PresentationParameters.BackBufferWidth;
            m_halfPixel.Y = 0.5f / (float)GraphicsDevice.PresentationParameters.BackBufferHeight;

            base.LoadContent();
        }