public override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            #region Effect の初期化

            effectManager = new EffectManager(GraphicsDevice, Content);
            normalMapEffect = effectManager.Load<FluidSurfaceNormalMapEffect>();
            normalMapEffect.SampleOffset = new Vector2(1.0f / (float) TextureSize, 1.0f / (float) TextureSize);

            #endregion

            #region 内部で使用する RenderTarget の初期化

            backBufferManager = new BackBufferManager(GraphicsDevice);

            prevWaveMapBackBuffer = backBufferManager.Load("FluidSurfacePrevWaveMap");
            prevWaveMapBackBuffer.Width = TextureSize;
            prevWaveMapBackBuffer.Height = TextureSize;
            prevWaveMapBackBuffer.MipMap = true;
            prevWaveMapBackBuffer.SurfaceFormat = SurfaceFormat.Vector2;
            prevWaveMapBackBuffer.DepthFormat = DepthFormat.None;
            prevWaveMapBackBuffer.MultiSampleCount = 0;
            prevWaveMapBackBuffer.Enabled = true;

            waveMapBackBuffer = backBufferManager.Load("FluidSurfaceWaveMap");
            waveMapBackBuffer.Width = TextureSize;
            waveMapBackBuffer.Height = TextureSize;
            waveMapBackBuffer.MipMap = true;
            waveMapBackBuffer.SurfaceFormat = SurfaceFormat.Vector2;
            waveMapBackBuffer.DepthFormat = DepthFormat.None;
            waveMapBackBuffer.MultiSampleCount = 0;
            waveMapBackBuffer.Enabled = true;

            normalMapBackBuffer = backBufferManager.Load("FluidSurfaceNormalMap");
            normalMapBackBuffer.Width = TextureSize;
            normalMapBackBuffer.Height = TextureSize;
            normalMapBackBuffer.MipMap = true;
            normalMapBackBuffer.SurfaceFormat = SurfaceFormat.Vector2;
            normalMapBackBuffer.DepthFormat = DepthFormat.None;
            normalMapBackBuffer.MultiSampleCount = 0;
            normalMapBackBuffer.Enabled = true;

            prevWaveMapBackBuffer.Begin();
            {
                GraphicsDevice.Clear(Color.Black);
            }
            prevWaveMapBackBuffer.End();

            #endregion

            base.LoadContent();
        }
Ejemplo n.º 2
0
        public virtual void Initialize()
        {
            effectManager = new EffectManager(GraphicsDevice, Content);
            backBufferManager = new BackBufferManager(GraphicsDevice);

            LoadContent();
        }
Ejemplo n.º 3
0
        public void LoadContent()
        {
            if (contentLoaded) return;

            effectManager = new EffectManager(renderContext.GraphicsDevice, renderContext.Content);

            effect = effectManager.Load<GaussianBlurEffect>();
            effect.Configure(widthHint, heightHint, radius, amount);

            backBufferManager = new BackBufferManager(renderContext.GraphicsDevice);

            backBuffer = backBufferManager.Load("GaussianBlur");
            backBuffer.MipMap = false;
            backBuffer.MultiSampleCount = 0;
            backBuffer.DepthFormat = DepthFormat.None;

            AdjustContent(widthHint, heightHint, formatHint);

            contentLoaded = true;
        }