/// <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", "PostprocessEdgeDetect")); m_renderTarget = resources.GetResourceAndEnsureLoaded <RenderTargetTextureResource>( KEY_RENDER_TARGET, () => new RenderTargetTextureResource(RenderTargetCreationMode.Color)); m_defaultResources = resources.DefaultResources; // Load constant buffer m_constantBufferData = new CBPerObject(); m_constantBuffer = resources.GetResourceAndEnsureLoaded <TypeSafeConstantBufferResource <CBPerObject> >( KEY_CONSTANT_BUFFER, () => new TypeSafeConstantBufferResource <CBPerObject>(m_constantBufferData)); }
/// <summary> /// Updates all parameters. /// </summary> /// <param name="renderState">The render state on which to apply.</param> /// <param name="cbPerObject">Constant buffer data.</param> internal void UpdateValues(RenderState renderState, CBPerObject cbPerObject) { m_cbPerObject.SetData(renderState.Device.DeviceImmediateContextD3D11, cbPerObject); }