예제 #1
0
 /// <summary>
 /// Analogue of SetTargets( depthStencil.Surface, renderTarget.Surface )
 /// </summary>
 /// <param name="depthStencil"></param>
 /// <param name="renderTarget"></param>
 public void SetTargets(DepthStencil2D depthStencil, RenderTarget2D renderTarget)
 {
     SetTargets(depthStencil == null?null:depthStencil.Surface, renderTarget == null?null:renderTarget.Surface);
 }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        void CreateShadowMaps()
        {
            SafeDispose( ref csmColor );
            SafeDispose( ref csmDepth );

            SafeDispose( ref spotColor );
            SafeDispose( ref spotDepth );

            csmColor	=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.R32F,  Config.CSMSize * 4, Config.CSMSize );
            csmDepth	=	new DepthStencil2D( Game.GraphicsDevice, DepthFormat.D24S8, Config.CSMSize * 4, Config.CSMSize );

            spotColor	=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.R32F,  Config.SpotShadowSize * 4, Config.SpotShadowSize * 4 );
            spotDepth	=	new DepthStencil2D( Game.GraphicsDevice, DepthFormat.D24S8, Config.SpotShadowSize * 4, Config.SpotShadowSize * 4 );
        }
예제 #3
0
 /// <summary>
 /// Analogue of SetTargets( depthStencil.Surface, renderTarget.Surface )
 /// </summary>
 /// <param name="depthStencil"></param>
 /// <param name="renderTarget"></param>
 public void SetTargets( DepthStencil2D depthStencil, RenderTarget2D renderTarget )
 {
     SetTargets( depthStencil==null?null:depthStencil.Surface, renderTarget==null?null:renderTarget.Surface );
 }
예제 #4
0
        /// <summary>
        /// Creates GBuffer
        /// </summary>
        void CreateGBuffer()
        {
            SafeDispose( ref depthBuffer	 );
            SafeDispose( ref diffuseBuffer	 );
            SafeDispose( ref specularBuffer	 );
            SafeDispose( ref normalMapBuffer );
            SafeDispose( ref lightAccumBuffer );

            var vp		=	Game.GraphicsDevice.DisplayBounds;

            depthBuffer			=	new DepthStencil2D( Game.GraphicsDevice, DepthFormat.D24S8,		vp.Width, vp.Height );
            diffuseBuffer		=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.Rgba8,		vp.Width, vp.Height );
            specularBuffer		=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.Rgba8,		vp.Width, vp.Height );
            normalMapBuffer		=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.Rgb10A2,	vp.Width, vp.Height );
            lightAccumBuffer	=	new RenderTarget2D( Game.GraphicsDevice, ColorFormat.Rgba16F,	vp.Width, vp.Height, true );
        }
예제 #5
0
        /// <summary>
        /// Load stuff here
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            LoadContent();

            rt			=	new RenderTarget2D( GraphicsDevice, ColorFormat.Rgba8, 256,256, 1 );
            rtMS		=	new RenderTarget2D( GraphicsDevice, ColorFormat.Rgba8, 256,256, 4 );
            dsMS		=	new DepthStencil2D( GraphicsDevice, DepthFormat.D24S8, 256,256, 4 );

            dynamicTexture	=	new Texture2D( GraphicsDevice, 64,64, ColorFormat.Rgba8, false );

            Reloading += (s,e) => LoadContent();

            InputDevice.KeyDown += InputDevice_KeyDown;
        }