Exemplo n.º 1
0
        /// <inheritdoc />
        protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            base.LoadResourceInternal(device, resources);

            // Load graphics resources
            _pixelShaderBlur = resources.GetResourceAndEnsureLoaded(
                s_resKeyPixelShaderBlur,
                () => GraphicsHelper.Internals.GetPixelShaderResource(device, "Postprocessing", "PostprocessBlur"));
            _singleForcedColor = resources.GetResourceAndEnsureLoaded(
                s_keyMaterial,
                () => new SingleForcedColorMaterialResource {
                FadeIntensity = _fadeIntensity
            });
            _renderTarget = resources.GetResourceAndEnsureLoaded(
                s_keyRenderTarget,
                () => new RenderTargetTextureResource(RenderTargetCreationMode.Color));
            _defaultResources = resources.DefaultResources;

            // Load constant buffers
            _cbFirstPass = resources.GetResourceAndEnsureLoaded(
                _keyCbPass01,
                () => new TypeSafeConstantBufferResource <CbPerObject>(new CbPerObject
            {
                BlurIntensity = 0.0f,
                BlurOpacity   = 0.1f
            }));
            _cbSecondPass = resources.GetResourceAndEnsureLoaded(
                _keyCbPass02,
                () => new TypeSafeConstantBufferResource <CbPerObject>(new CbPerObject
            {
                BlurIntensity = 0.8f,
                BlurOpacity   = 0.5f
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Unloads the resource.
        /// </summary>
        /// <param name="device">The device.</param>
        /// <param name="resources">Parent ResourceDictionary.</param>
        /// <exception cref="System.NotImplementedException"></exception>
        protected override void UnloadResourceInternal(EngineDevice device, ResourceDictionary resources)
        {
            base.UnloadResourceInternal(device, resources);

            _pixelShaderBlur   = null;
            _singleForcedColor = null;
            _renderTarget      = null;
            _defaultResources  = null;
            _cbFirstPass       = null;
            _cbSecondPass      = null;
        }