/// <summary> /// Loads the resource. /// </summary> /// <param name="device">The device.</param> /// <param name="resources">Parent ResourceDictionary.</param> protected override void LoadResourceInternal(EngineDevice device, ResourceDictionary resources) { base.LoadResourceInternal(device, resources); // Load graphics resources m_pixelShaderBlur = resources.GetResourceAndEnsureLoaded( RES_KEY_PIXEL_SHADER_BLUR, () => GraphicsHelper.GetPixelShaderResource(device, "Postprocessing", "PostprocessBlur")); m_singleForcedColor = resources.GetResourceAndEnsureLoaded <SingleForcedColorMaterialResource>( KEY_MATERIAL, () => new SingleForcedColorMaterialResource() { FadeIntensity = m_fadeIntensity }); m_renderTarget = resources.GetResourceAndEnsureLoaded <RenderTargetTextureResource>( KEY_RENDER_TARGET, () => new RenderTargetTextureResource(RenderTargetCreationMode.Color)); m_defaultResources = resources.DefaultResources; // Load constant buffers m_cbFirstPass = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >( KEY_CB_PASS_01, () => new TypeSafeConstantBufferResource <CBPerObject>(new CBPerObject() { BlurIntensity = 0.0f, BlurOpacity = 0.1f })); m_cbSecondPass = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >( KEY_CB_PASS_02, () => new TypeSafeConstantBufferResource <CBPerObject>(new CBPerObject() { BlurIntensity = 0.8f, BlurOpacity = 0.5f })); }
/// <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); m_pixelShaderBlur = null; m_singleForcedColor = null; m_renderTarget = null; m_defaultResources = null; m_cbFirstPass = null; m_cbSecondPass = null; }